Abilities can now be activated from multiple contexts

This commit is contained in:
Sam 2023-04-19 19:36:16 -04:00
parent 95a38ff8f6
commit 9cedf854de
9 changed files with 77 additions and 71 deletions

View File

@ -144,7 +144,7 @@ impl ActiveAbilities {
skill_set: &SkillSet, skill_set: &SkillSet,
body: Option<&Body>, body: Option<&Body>,
char_state: Option<&CharacterState>, char_state: Option<&CharacterState>,
context: AbilityContext, contexts: &[AbilityContext],
// bool is from_offhand // bool is from_offhand
) -> Option<(CharacterAbility, bool)> { ) -> Option<(CharacterAbility, bool)> {
let ability = self.get_ability(input, inv, Some(skill_set)); let ability = self.get_ability(input, inv, Some(skill_set));
@ -168,14 +168,14 @@ impl ActiveAbilities {
Ability::ToolPrimary => ability_set(EquipSlot::ActiveMainhand) Ability::ToolPrimary => ability_set(EquipSlot::ActiveMainhand)
.and_then(|abilities| { .and_then(|abilities| {
abilities abilities
.primary(Some(skill_set), context) .primary(Some(skill_set), contexts)
.map(|a| a.ability.clone()) .map(|a| a.ability.clone())
}) })
.map(|ability| (scale_ability(ability, EquipSlot::ActiveMainhand), false)), .map(|ability| (scale_ability(ability, EquipSlot::ActiveMainhand), false)),
Ability::ToolSecondary => ability_set(EquipSlot::ActiveOffhand) Ability::ToolSecondary => ability_set(EquipSlot::ActiveOffhand)
.and_then(|abilities| { .and_then(|abilities| {
abilities abilities
.secondary(Some(skill_set), context) .secondary(Some(skill_set), contexts)
.map(|a| a.ability.clone()) .map(|a| a.ability.clone())
}) })
.map(|ability| (scale_ability(ability, EquipSlot::ActiveOffhand), true)) .map(|ability| (scale_ability(ability, EquipSlot::ActiveOffhand), true))
@ -183,7 +183,7 @@ impl ActiveAbilities {
ability_set(EquipSlot::ActiveMainhand) ability_set(EquipSlot::ActiveMainhand)
.and_then(|abilities| { .and_then(|abilities| {
abilities abilities
.secondary(Some(skill_set), context) .secondary(Some(skill_set), contexts)
.map(|a| a.ability.clone()) .map(|a| a.ability.clone())
}) })
.map(|ability| (scale_ability(ability, EquipSlot::ActiveMainhand), false)) .map(|ability| (scale_ability(ability, EquipSlot::ActiveMainhand), false))
@ -194,14 +194,14 @@ impl ActiveAbilities {
Ability::MainWeaponAux(index) => ability_set(EquipSlot::ActiveMainhand) Ability::MainWeaponAux(index) => ability_set(EquipSlot::ActiveMainhand)
.and_then(|abilities| { .and_then(|abilities| {
abilities abilities
.auxiliary(index, Some(skill_set), context) .auxiliary(index, Some(skill_set), contexts)
.map(|a| a.ability.clone()) .map(|a| a.ability.clone())
}) })
.map(|ability| (scale_ability(ability, EquipSlot::ActiveMainhand), false)), .map(|ability| (scale_ability(ability, EquipSlot::ActiveMainhand), false)),
Ability::OffWeaponAux(index) => ability_set(EquipSlot::ActiveOffhand) Ability::OffWeaponAux(index) => ability_set(EquipSlot::ActiveOffhand)
.and_then(|abilities| { .and_then(|abilities| {
abilities abilities
.auxiliary(index, Some(skill_set), context) .auxiliary(index, Some(skill_set), contexts)
.map(|a| a.ability.clone()) .map(|a| a.ability.clone())
}) })
.map(|ability| (scale_ability(ability, EquipSlot::ActiveOffhand), true)), .map(|ability| (scale_ability(ability, EquipSlot::ActiveOffhand), true)),
@ -226,8 +226,8 @@ impl ActiveAbilities {
pseudo_id: _, pseudo_id: _,
abilities, abilities,
} => abilities } => abilities
.values() .iter()
.any(|(skill, _)| { .any(|(_contexts, (skill, _))| {
skill.map_or(true, |s| skill_set.map_or(false, |ss| ss.has_skill(s))) skill.map_or(true, |s| skill_set.map_or(false, |ss| ss.has_skill(s)))
}) })
.then_some(i), .then_some(i),
@ -273,7 +273,7 @@ impl Ability {
self, self,
inv: Option<&'a Inventory>, inv: Option<&'a Inventory>,
skillset: Option<&'a SkillSet>, skillset: Option<&'a SkillSet>,
context: AbilityContext, contexts: &[AbilityContext],
) -> Option<&'a str> { ) -> Option<&'a str> {
let ability_set = |equip_slot| { let ability_set = |equip_slot| {
inv.and_then(|inv| inv.equipped(equip_slot)) inv.and_then(|inv| inv.equipped(equip_slot))
@ -295,21 +295,21 @@ impl Ability {
match self { match self {
Ability::ToolPrimary => ability_set(EquipSlot::ActiveMainhand).and_then(|abilities| { Ability::ToolPrimary => ability_set(EquipSlot::ActiveMainhand).and_then(|abilities| {
abilities abilities
.primary(skillset, context) .primary(skillset, contexts)
.map(|a| a.id.as_str()) .map(|a| a.id.as_str())
.or_else(|| contextual_id(Some(&abilities.primary))) .or_else(|| contextual_id(Some(&abilities.primary)))
}), }),
Ability::ToolSecondary => ability_set(EquipSlot::ActiveOffhand) Ability::ToolSecondary => ability_set(EquipSlot::ActiveOffhand)
.and_then(|abilities| { .and_then(|abilities| {
abilities abilities
.secondary(skillset, context) .secondary(skillset, contexts)
.map(|a| a.id.as_str()) .map(|a| a.id.as_str())
.or_else(|| contextual_id(Some(&abilities.secondary))) .or_else(|| contextual_id(Some(&abilities.secondary)))
}) })
.or_else(|| { .or_else(|| {
ability_set(EquipSlot::ActiveMainhand).and_then(|abilities| { ability_set(EquipSlot::ActiveMainhand).and_then(|abilities| {
abilities abilities
.secondary(skillset, context) .secondary(skillset, contexts)
.map(|a| a.id.as_str()) .map(|a| a.id.as_str())
.or_else(|| contextual_id(Some(&abilities.secondary))) .or_else(|| contextual_id(Some(&abilities.secondary)))
}) })
@ -318,7 +318,7 @@ impl Ability {
Ability::MainWeaponAux(index) => { Ability::MainWeaponAux(index) => {
ability_set(EquipSlot::ActiveMainhand).and_then(|abilities| { ability_set(EquipSlot::ActiveMainhand).and_then(|abilities| {
abilities abilities
.auxiliary(index, skillset, context) .auxiliary(index, skillset, contexts)
.map(|a| a.id.as_str()) .map(|a| a.id.as_str())
.or_else(|| contextual_id(abilities.abilities.get(index))) .or_else(|| contextual_id(abilities.abilities.get(index)))
}) })
@ -326,7 +326,7 @@ impl Ability {
Ability::OffWeaponAux(index) => { Ability::OffWeaponAux(index) => {
ability_set(EquipSlot::ActiveOffhand).and_then(|abilities| { ability_set(EquipSlot::ActiveOffhand).and_then(|abilities| {
abilities abilities
.auxiliary(index, skillset, context) .auxiliary(index, skillset, contexts)
.map(|a| a.id.as_str()) .map(|a| a.id.as_str())
.or_else(|| contextual_id(abilities.abilities.get(index))) .or_else(|| contextual_id(abilities.abilities.get(index)))
}) })

View File

@ -297,7 +297,7 @@ pub enum AbilityKind<T> {
Simple(Option<Skill>, T), Simple(Option<Skill>, T),
Contextualized { Contextualized {
pseudo_id: String, pseudo_id: String,
abilities: HashMap<AbilityContext, (Option<Skill>, T)>, abilities: Vec<(Vec<AbilityContext>, (Option<Skill>, T))>,
}, },
} }
@ -328,13 +328,13 @@ impl<T> AbilityKind<T> {
pseudo_id: pseudo_id.clone(), pseudo_id: pseudo_id.clone(),
abilities: abilities abilities: abilities
.into_iter() .into_iter()
.map(|(c, (s, x))| (*c, (*s, f(x)))) .map(|(c, (s, x))| (c.clone(), (*s, f(x))))
.collect(), .collect(),
}, },
} }
} }
pub fn ability(&self, skillset: Option<&SkillSet>, context: AbilityContext) -> Option<&T> { pub fn ability(&self, skillset: Option<&SkillSet>, contexts: &[AbilityContext]) -> Option<&T> {
let unlocked = |s: Option<Skill>, a| { let unlocked = |s: Option<Skill>, a| {
// If there is a skill requirement and the skillset does not contain the // If there is a skill requirement and the skillset does not contain the
// required skill, return None // required skill, return None
@ -352,13 +352,14 @@ impl<T> AbilityKind<T> {
// the required skill, try falling back to the ability from this input that does // the required skill, try falling back to the ability from this input that does
// not require a context // not require a context
abilities abilities
.get(&context) .iter()
.and_then(|(s, a)| unlocked(*s, a)) .find_map(|(req_contexts, (s, a))| {
.or_else(|| { req_contexts
abilities .iter()
.get(&AbilityContext::None) .all(|req| contexts.contains(req))
.and_then(|(s, a)| unlocked(*s, a)) .then_some((s, a))
}) })
.and_then(|(s, a)| unlocked(*s, a))
}, },
} }
} }
@ -371,16 +372,17 @@ pub enum AbilityContext {
/// `AbilityContext::Stance(Stance::None)` in the ability map config /// `AbilityContext::Stance(Stance::None)` in the ability map config
/// files(s). /// files(s).
Stance(Stance), Stance(Stance),
None,
} }
impl AbilityContext { impl AbilityContext {
pub fn from(stance: Option<&Stance>) -> Self { pub fn from(stance: Option<&Stance>) -> Vec<Self> {
let mut contexts = Vec::new();
match stance { match stance {
Some(Stance::None) => AbilityContext::None, Some(Stance::None) => {},
Some(stance) => AbilityContext::Stance(*stance), Some(stance) => contexts.push(AbilityContext::Stance(*stance)),
None => AbilityContext::None, None => {},
} }
contexts
} }
} }
@ -417,23 +419,27 @@ impl<T> AbilitySet<T> {
} }
} }
pub fn primary(&self, skillset: Option<&SkillSet>, context: AbilityContext) -> Option<&T> { pub fn primary(&self, skillset: Option<&SkillSet>, contexts: &[AbilityContext]) -> Option<&T> {
self.primary.ability(skillset, context) self.primary.ability(skillset, contexts)
} }
pub fn secondary(&self, skillset: Option<&SkillSet>, context: AbilityContext) -> Option<&T> { pub fn secondary(
self.secondary.ability(skillset, context) &self,
skillset: Option<&SkillSet>,
contexts: &[AbilityContext],
) -> Option<&T> {
self.secondary.ability(skillset, contexts)
} }
pub fn auxiliary( pub fn auxiliary(
&self, &self,
index: usize, index: usize,
skillset: Option<&SkillSet>, skillset: Option<&SkillSet>,
context: AbilityContext, contexts: &[AbilityContext],
) -> Option<&T> { ) -> Option<&T> {
self.abilities self.abilities
.get(index) .get(index)
.and_then(|a| a.ability(skillset, context)) .and_then(|a| a.ability(skillset, contexts))
} }
} }

View File

@ -1107,7 +1107,7 @@ fn handle_ability(
output_events: &mut OutputEvents, output_events: &mut OutputEvents,
input: InputKind, input: InputKind,
) -> bool { ) -> bool {
let context = AbilityContext::from(data.stance); let contexts = AbilityContext::from(data.stance);
if let Some(ability_input) = input.into() { if let Some(ability_input) = input.into() {
if let Some((ability, from_offhand)) = data if let Some((ability, from_offhand)) = data
.active_abilities .active_abilities
@ -1118,7 +1118,7 @@ fn handle_ability(
data.skill_set, data.skill_set,
Some(data.body), Some(data.body),
Some(data.character), Some(data.character),
context, &contexts,
) )
}) })
.filter(|(ability, _)| ability.requirements_paid(data, update)) .filter(|(ability, _)| ability.requirements_paid(data, update))

View File

@ -757,7 +757,7 @@ impl<'a> AgentData<'a> {
); );
let attack_failed = if attempt_attack { let attack_failed = if attempt_attack {
let context = AbilityContext::from(self.stance); let contexts = AbilityContext::from(self.stance);
let extract_ability = |input: AbilityInput| { let extract_ability = |input: AbilityInput| {
AbilityData::from_ability( AbilityData::from_ability(
&self &self
@ -768,7 +768,7 @@ impl<'a> AgentData<'a> {
self.skill_set, self.skill_set,
self.body, self.body,
Some(self.char_state), Some(self.char_state),
context, &contexts,
) )
.unwrap_or_default() .unwrap_or_default()
.0, .0,
@ -1437,7 +1437,7 @@ impl<'a> AgentData<'a> {
enum ActionStateConditions { enum ActionStateConditions {
ConditionStaffCanShockwave = 0, ConditionStaffCanShockwave = 0,
} }
let context = AbilityContext::from(self.stance); let contexts = AbilityContext::from(self.stance);
let extract_ability = |input: AbilityInput| { let extract_ability = |input: AbilityInput| {
self.active_abilities self.active_abilities
.activate_ability( .activate_ability(
@ -1446,7 +1446,7 @@ impl<'a> AgentData<'a> {
self.skill_set, self.skill_set,
self.body, self.body,
Some(self.char_state), Some(self.char_state),
context, &contexts,
) )
.unwrap_or_default() .unwrap_or_default()
.0 .0

View File

@ -241,7 +241,7 @@ pub struct Diary<'a> {
tooltip_manager: &'a mut TooltipManager, tooltip_manager: &'a mut TooltipManager,
slot_manager: &'a mut SlotManager, slot_manager: &'a mut SlotManager,
pulse: f32, pulse: f32,
context: AbilityContext, contexts: &'a [AbilityContext],
#[conrod(common_builder)] #[conrod(common_builder)]
common: widget::CommonBuilder, common: widget::CommonBuilder,
@ -287,7 +287,7 @@ impl<'a> Diary<'a> {
tooltip_manager: &'a mut TooltipManager, tooltip_manager: &'a mut TooltipManager,
slot_manager: &'a mut SlotManager, slot_manager: &'a mut SlotManager,
pulse: f32, pulse: f32,
context: AbilityContext, contexts: &'a [AbilityContext],
) -> Self { ) -> Self {
Self { Self {
show, show,
@ -309,7 +309,7 @@ impl<'a> Diary<'a> {
tooltip_manager, tooltip_manager,
slot_manager, slot_manager,
pulse, pulse,
context, contexts,
common: widget::CommonBuilder::default(), common: widget::CommonBuilder::default(),
created_btns_top_l: 0, created_btns_top_l: 0,
created_btns_top_r: 0, created_btns_top_r: 0,
@ -853,7 +853,7 @@ impl<'a> Widget for Diary<'a> {
self.active_abilities, self.active_abilities,
self.inventory, self.inventory,
self.skill_set, self.skill_set,
self.context, self.contexts,
), ),
image_source: self.imgs, image_source: self.imgs,
slot_manager: Some(self.slot_manager), slot_manager: Some(self.slot_manager),
@ -868,7 +868,7 @@ impl<'a> Widget for Diary<'a> {
Some(self.inventory), Some(self.inventory),
Some(self.skill_set), Some(self.skill_set),
) )
.ability_id(Some(self.inventory), Some(self.skill_set), self.context); .ability_id(Some(self.inventory), Some(self.skill_set), self.contexts);
let (ability_title, ability_desc) = if let Some(ability_id) = ability_id { let (ability_title, ability_desc) = if let Some(ability_id) = ability_id {
util::ability_description(ability_id, self.localized_strings) util::ability_description(ability_id, self.localized_strings)
} else { } else {
@ -953,7 +953,7 @@ impl<'a> Widget for Diary<'a> {
Ability::from(a).ability_id( Ability::from(a).ability_id(
Some(self.inventory), Some(self.inventory),
Some(self.skill_set), Some(self.skill_set),
self.context, self.contexts,
), ),
a, a,
) )
@ -969,7 +969,7 @@ impl<'a> Widget for Diary<'a> {
Ability::from(a).ability_id( Ability::from(a).ability_id(
Some(self.inventory), Some(self.inventory),
Some(self.skill_set), Some(self.skill_set),
self.context, self.contexts,
), ),
a, a,
) )
@ -1080,7 +1080,7 @@ impl<'a> Widget for Diary<'a> {
self.active_abilities, self.active_abilities,
self.inventory, self.inventory,
self.skill_set, self.skill_set,
self.context, self.contexts,
), ),
image_source: self.imgs, image_source: self.imgs,
slot_manager: Some(self.slot_manager), slot_manager: Some(self.slot_manager),

View File

@ -3018,7 +3018,7 @@ impl Hud {
bodies.get(entity), bodies.get(entity),
) { ) {
let stance = stances.get(entity); let stance = stances.get(entity);
let context = AbilityContext::from(stance); let contexts = AbilityContext::from(stance);
match Skillbar::new( match Skillbar::new(
client, client,
&info, &info,
@ -3044,7 +3044,7 @@ impl Hud {
i18n, i18n,
&msm, &msm,
self.floaters.combo_floater, self.floaters.combo_floater,
context, &contexts,
combos.get(entity), combos.get(entity),
char_states.get(entity), char_states.get(entity),
stance, stance,
@ -3522,7 +3522,7 @@ impl Hud {
bodies.get(entity), bodies.get(entity),
poises.get(entity), poises.get(entity),
) { ) {
let context = AbilityContext::from(stances.get(entity)); let contexts = AbilityContext::from(stances.get(entity));
for event in Diary::new( for event in Diary::new(
&self.show, &self.show,
client, client,
@ -3543,7 +3543,7 @@ impl Hud {
tooltip_manager, tooltip_manager,
&mut self.slot_manager, &mut self.slot_manager,
self.pulse, self.pulse,
context, &contexts,
) )
.set(self.ids.diary, ui_widgets) .set(self.ids.diary, ui_widgets)
{ {

View File

@ -313,7 +313,7 @@ pub struct Skillbar<'a> {
common: widget::CommonBuilder, common: widget::CommonBuilder,
msm: &'a MaterialStatManifest, msm: &'a MaterialStatManifest,
combo_floater: Option<ComboFloater>, combo_floater: Option<ComboFloater>,
context: AbilityContext, contexts: &'a [AbilityContext],
combo: Option<&'a Combo>, combo: Option<&'a Combo>,
char_state: Option<&'a CharacterState>, char_state: Option<&'a CharacterState>,
stance: Option<&'a Stance>, stance: Option<&'a Stance>,
@ -346,7 +346,7 @@ impl<'a> Skillbar<'a> {
localized_strings: &'a Localization, localized_strings: &'a Localization,
msm: &'a MaterialStatManifest, msm: &'a MaterialStatManifest,
combo_floater: Option<ComboFloater>, combo_floater: Option<ComboFloater>,
context: AbilityContext, contexts: &'a [AbilityContext],
combo: Option<&'a Combo>, combo: Option<&'a Combo>,
char_state: Option<&'a CharacterState>, char_state: Option<&'a CharacterState>,
stance: Option<&'a Stance>, stance: Option<&'a Stance>,
@ -377,7 +377,7 @@ impl<'a> Skillbar<'a> {
localized_strings, localized_strings,
msm, msm,
combo_floater, combo_floater,
context, contexts,
combo, combo,
char_state, char_state,
stance, stance,
@ -940,7 +940,7 @@ impl<'a> Skillbar<'a> {
self.skillset, self.skillset,
self.active_abilities, self.active_abilities,
self.body, self.body,
self.context, self.contexts,
self.combo, self.combo,
self.char_state, self.char_state,
self.stance, self.stance,
@ -1025,7 +1025,7 @@ impl<'a> Skillbar<'a> {
// Helper // Helper
let tooltip_text = |slot| { let tooltip_text = |slot| {
let (hotbar, inventory, _, skill_set, active_abilities, _, context, _, _, _) = let (hotbar, inventory, _, skill_set, active_abilities, _, contexts, _, _, _) =
content_source; content_source;
hotbar.get(slot).and_then(|content| match content { hotbar.get(slot).and_then(|content| match content {
hotbar::SlotContents::Inventory(i, _) => inventory hotbar::SlotContents::Inventory(i, _) => inventory
@ -1039,7 +1039,7 @@ impl<'a> Skillbar<'a> {
Ability::from(*a).ability_id( Ability::from(*a).ability_id(
Some(inventory), Some(inventory),
Some(skill_set), Some(skill_set),
context, contexts,
) )
}) })
}) })
@ -1114,7 +1114,7 @@ impl<'a> Skillbar<'a> {
Ability::from(a.primary).ability_id( Ability::from(a.primary).ability_id(
Some(self.inventory), Some(self.inventory),
Some(self.skillset), Some(self.skillset),
self.context, self.contexts,
) )
}); });
@ -1144,7 +1144,7 @@ impl<'a> Skillbar<'a> {
Ability::from(a.secondary).ability_id( Ability::from(a.secondary).ability_id(
Some(self.inventory), Some(self.inventory),
Some(self.skillset), Some(self.skillset),
self.context, self.contexts,
) )
}); });
@ -1166,7 +1166,7 @@ impl<'a> Skillbar<'a> {
self.skillset, self.skillset,
Some(self.body), Some(self.body),
self.char_state, self.char_state,
self.context, self.contexts,
) )
}) })
.map_or(false, |(a, _)| { .map_or(false, |(a, _)| {

View File

@ -129,7 +129,7 @@ type HotbarSource<'a> = (
&'a SkillSet, &'a SkillSet,
Option<&'a ActiveAbilities>, Option<&'a ActiveAbilities>,
&'a Body, &'a Body,
AbilityContext, &'a [AbilityContext],
Option<&'a Combo>, Option<&'a Combo>,
Option<&'a CharacterState>, Option<&'a CharacterState>,
Option<&'a Stance>, Option<&'a Stance>,
@ -148,7 +148,7 @@ impl<'a> SlotKey<HotbarSource<'a>, HotbarImageSource<'a>> for HotbarSlot {
skillset, skillset,
active_abilities, active_abilities,
body, body,
context, contexts,
combo, combo,
char_state, char_state,
stance, stance,
@ -168,7 +168,7 @@ impl<'a> SlotKey<HotbarSource<'a>, HotbarImageSource<'a>> for HotbarSlot {
a.auxiliary_set(Some(inventory), Some(skillset)) a.auxiliary_set(Some(inventory), Some(skillset))
.get(i) .get(i)
.and_then(|a| { .and_then(|a| {
Ability::from(*a).ability_id(Some(inventory), Some(skillset), *context) Ability::from(*a).ability_id(Some(inventory), Some(skillset), contexts)
}) })
}); });
@ -183,7 +183,7 @@ impl<'a> SlotKey<HotbarSource<'a>, HotbarImageSource<'a>> for HotbarSlot {
skillset, skillset,
Some(body), Some(body),
*char_state, *char_state,
*context, contexts,
) )
}) })
.map(|(ability, _)| { .map(|(ability, _)| {
@ -240,7 +240,7 @@ type AbilitiesSource<'a> = (
&'a ActiveAbilities, &'a ActiveAbilities,
&'a Inventory, &'a Inventory,
&'a SkillSet, &'a SkillSet,
AbilityContext, &'a [AbilityContext],
); );
impl<'a> SlotKey<AbilitiesSource<'a>, img_ids::Imgs> for AbilitySlot { impl<'a> SlotKey<AbilitiesSource<'a>, img_ids::Imgs> for AbilitySlot {
@ -248,7 +248,7 @@ impl<'a> SlotKey<AbilitiesSource<'a>, img_ids::Imgs> for AbilitySlot {
fn image_key( fn image_key(
&self, &self,
(active_abilities, inventory, skillset, context): &AbilitiesSource<'a>, (active_abilities, inventory, skillset, contexts): &AbilitiesSource<'a>,
) -> Option<(Self::ImageKey, Option<Color>)> { ) -> Option<(Self::ImageKey, Option<Color>)> {
let ability_id = match self { let ability_id = match self {
Self::Slot(index) => active_abilities Self::Slot(index) => active_abilities
@ -257,9 +257,9 @@ impl<'a> SlotKey<AbilitiesSource<'a>, img_ids::Imgs> for AbilitySlot {
Some(inventory), Some(inventory),
Some(skillset), Some(skillset),
) )
.ability_id(Some(inventory), Some(skillset), *context), .ability_id(Some(inventory), Some(skillset), contexts),
Self::Ability(ability) => { Self::Ability(ability) => {
Ability::from(*ability).ability_id(Some(inventory), Some(skillset), *context) Ability::from(*ability).ability_id(Some(inventory), Some(skillset), contexts)
}, },
}; };

View File

@ -931,12 +931,12 @@ impl FigureMgr {
let second_tool_spec = second_tool_spec.as_deref(); let second_tool_spec = second_tool_spec.as_deref();
let hands = (active_tool_hand, second_tool_hand); let hands = (active_tool_hand, second_tool_hand);
let context = AbilityContext::from(stance); let contexts = AbilityContext::from(stance);
let ability_id = character.and_then(|c| { let ability_id = character.and_then(|c| {
c.ability_info() c.ability_info()
.and_then(|a| a.ability) .and_then(|a| a.ability)
.and_then(|a| a.ability_id(inventory, skillset, context)) .and_then(|a| a.ability_id(inventory, skillset, &contexts))
}); });
let move_dir = { let move_dir = {