Addressed review comments

This commit is contained in:
Sam 2023-07-23 21:23:26 -04:00
parent 9f86cafc5c
commit e3ad16ef47
10 changed files with 166 additions and 167 deletions

View File

@ -13,99 +13,99 @@
primary: Contextualized( primary: Contextualized(
pseudo_id: "veloren.core.pseudo_abilities.sword.double_slash", pseudo_id: "veloren.core.pseudo_abilities.sword.double_slash",
abilities: [ abilities: [
([Stance(Sword(Heavy))], (None, "common.abilities.sword.heavy_double_slash")), ((stance: Sword(Heavy)), (None, "common.abilities.sword.heavy_double_slash")),
([Stance(Sword(Agile))], (None, "common.abilities.sword.agile_double_slash")), ((stance: Sword(Agile)), (None, "common.abilities.sword.agile_double_slash")),
([Stance(Sword(Defensive))], (None, "common.abilities.sword.defensive_double_slash")), ((stance: Sword(Defensive)), (None, "common.abilities.sword.defensive_double_slash")),
([Stance(Sword(Crippling))], (None, "common.abilities.sword.crippling_double_slash")), ((stance: Sword(Crippling)), (None, "common.abilities.sword.crippling_double_slash")),
([Stance(Sword(Cleaving))], (None, "common.abilities.sword.cleaving_double_slash")), ((stance: Sword(Cleaving)), (None, "common.abilities.sword.cleaving_double_slash")),
([], (None, "common.abilities.sword.basic_double_slash")), ((), (None, "common.abilities.sword.basic_double_slash")),
], ],
), ),
secondary: Contextualized( secondary: Contextualized(
pseudo_id: "veloren.core.pseudo_abilities.sword.secondary_ability", pseudo_id: "veloren.core.pseudo_abilities.sword.secondary_ability",
abilities: [ abilities: [
([Stance(Sword(Heavy))], (None, "common.abilities.sword.heavy_slam")), ((stance: Sword(Heavy)), (None, "common.abilities.sword.heavy_slam")),
([Stance(Sword(Agile)), DualWieldingSameKind], (None, "common.abilities.sword.agile_dual_perforate")), ((stance: Sword(Agile), dual_wielding_same_kind: true), (None, "common.abilities.sword.agile_dual_perforate")),
([Stance(Sword(Agile))], (None, "common.abilities.sword.agile_perforate")), ((stance: Sword(Agile)), (None, "common.abilities.sword.agile_perforate")),
([Stance(Sword(Defensive))], (None, "common.abilities.sword.defensive_vital_jab")), ((stance: Sword(Defensive)), (None, "common.abilities.sword.defensive_vital_jab")),
([Stance(Sword(Crippling))], (None, "common.abilities.sword.crippling_deep_rend")), ((stance: Sword(Crippling)), (None, "common.abilities.sword.crippling_deep_rend")),
([Stance(Sword(Cleaving)), DualWieldingSameKind], (None, "common.abilities.sword.cleaving_dual_spiral_slash")), ((stance: Sword(Cleaving), dual_wielding_same_kind: true), (None, "common.abilities.sword.cleaving_dual_spiral_slash")),
([Stance(Sword(Cleaving))], (None, "common.abilities.sword.cleaving_spiral_slash")), ((stance: Sword(Cleaving)), (None, "common.abilities.sword.cleaving_spiral_slash")),
([], (None, "common.abilities.sword.basic_thrust")), ((), (None, "common.abilities.sword.basic_thrust")),
], ],
), ),
abilities: [ abilities: [
Contextualized( Contextualized(
pseudo_id: "veloren.core.pseudo_abilities.sword.crescent_slash", pseudo_id: "veloren.core.pseudo_abilities.sword.crescent_slash",
abilities: [ abilities: [
([Stance(Sword(Heavy))], (Sword(CrescentSlash), "common.abilities.sword.heavy_crescent_slash")), ((stance: Sword(Heavy)), (Sword(CrescentSlash), "common.abilities.sword.heavy_crescent_slash")),
([Stance(Sword(Agile))], (Sword(CrescentSlash), "common.abilities.sword.agile_crescent_slash")), ((stance: Sword(Agile)), (Sword(CrescentSlash), "common.abilities.sword.agile_crescent_slash")),
([Stance(Sword(Defensive))], (Sword(CrescentSlash), "common.abilities.sword.defensive_crescent_slash")), ((stance: Sword(Defensive)), (Sword(CrescentSlash), "common.abilities.sword.defensive_crescent_slash")),
([Stance(Sword(Crippling))], (Sword(CrescentSlash), "common.abilities.sword.crippling_crescent_slash")), ((stance: Sword(Crippling)), (Sword(CrescentSlash), "common.abilities.sword.crippling_crescent_slash")),
([Stance(Sword(Cleaving))], (Sword(CrescentSlash), "common.abilities.sword.cleaving_crescent_slash")), ((stance: Sword(Cleaving)), (Sword(CrescentSlash), "common.abilities.sword.cleaving_crescent_slash")),
([], (Sword(CrescentSlash), "common.abilities.sword.basic_crescent_slash")), ((), (Sword(CrescentSlash), "common.abilities.sword.basic_crescent_slash")),
], ],
), ),
Contextualized( Contextualized(
pseudo_id: "veloren.core.pseudo_abilities.sword.fell_strike", pseudo_id: "veloren.core.pseudo_abilities.sword.fell_strike",
abilities: [ abilities: [
([Stance(Sword(Heavy))], (Sword(FellStrike), "common.abilities.sword.heavy_fell_strike")), ((stance: Sword(Heavy)), (Sword(FellStrike), "common.abilities.sword.heavy_fell_strike")),
([Stance(Sword(Agile))], (Sword(FellStrike), "common.abilities.sword.agile_fell_strike")), ((stance: Sword(Agile)), (Sword(FellStrike), "common.abilities.sword.agile_fell_strike")),
([Stance(Sword(Defensive))], (Sword(FellStrike), "common.abilities.sword.defensive_fell_strike")), ((stance: Sword(Defensive)), (Sword(FellStrike), "common.abilities.sword.defensive_fell_strike")),
([Stance(Sword(Crippling))], (Sword(FellStrike), "common.abilities.sword.crippling_fell_strike")), ((stance: Sword(Crippling)), (Sword(FellStrike), "common.abilities.sword.crippling_fell_strike")),
([Stance(Sword(Cleaving))], (Sword(FellStrike), "common.abilities.sword.cleaving_fell_strike")), ((stance: Sword(Cleaving)), (Sword(FellStrike), "common.abilities.sword.cleaving_fell_strike")),
([], (Sword(FellStrike), "common.abilities.sword.basic_fell_strike")), ((), (Sword(FellStrike), "common.abilities.sword.basic_fell_strike")),
], ],
), ),
Contextualized( Contextualized(
pseudo_id: "veloren.core.pseudo_abilities.sword.skewer", pseudo_id: "veloren.core.pseudo_abilities.sword.skewer",
abilities: [ abilities: [
([Stance(Sword(Heavy))], (Sword(Skewer), "common.abilities.sword.heavy_skewer")), ((stance: Sword(Heavy)), (Sword(Skewer), "common.abilities.sword.heavy_skewer")),
([Stance(Sword(Agile))], (Sword(Skewer), "common.abilities.sword.agile_skewer")), ((stance: Sword(Agile)), (Sword(Skewer), "common.abilities.sword.agile_skewer")),
([Stance(Sword(Defensive))], (Sword(Skewer), "common.abilities.sword.defensive_skewer")), ((stance: Sword(Defensive)), (Sword(Skewer), "common.abilities.sword.defensive_skewer")),
([Stance(Sword(Crippling))], (Sword(Skewer), "common.abilities.sword.crippling_skewer")), ((stance: Sword(Crippling)), (Sword(Skewer), "common.abilities.sword.crippling_skewer")),
([Stance(Sword(Cleaving))], (Sword(Skewer), "common.abilities.sword.cleaving_skewer")), ((stance: Sword(Cleaving)), (Sword(Skewer), "common.abilities.sword.cleaving_skewer")),
([], (Sword(Skewer), "common.abilities.sword.basic_skewer")), ((), (Sword(Skewer), "common.abilities.sword.basic_skewer")),
], ],
), ),
Contextualized( Contextualized(
pseudo_id: "veloren.core.pseudo_abilities.sword.cascade", pseudo_id: "veloren.core.pseudo_abilities.sword.cascade",
abilities: [ abilities: [
([Stance(Sword(Heavy))], (Sword(Cascade), "common.abilities.sword.heavy_cascade")), ((stance: Sword(Heavy)), (Sword(Cascade), "common.abilities.sword.heavy_cascade")),
([Stance(Sword(Agile))], (Sword(Cascade), "common.abilities.sword.agile_cascade")), ((stance: Sword(Agile)), (Sword(Cascade), "common.abilities.sword.agile_cascade")),
([Stance(Sword(Defensive))], (Sword(Cascade), "common.abilities.sword.defensive_cascade")), ((stance: Sword(Defensive)), (Sword(Cascade), "common.abilities.sword.defensive_cascade")),
([Stance(Sword(Crippling))], (Sword(Cascade), "common.abilities.sword.crippling_cascade")), ((stance: Sword(Crippling)), (Sword(Cascade), "common.abilities.sword.crippling_cascade")),
([Stance(Sword(Cleaving))], (Sword(Cascade), "common.abilities.sword.cleaving_cascade")), ((stance: Sword(Cleaving)), (Sword(Cascade), "common.abilities.sword.cleaving_cascade")),
([], (Sword(Cascade), "common.abilities.sword.basic_cascade")), ((), (Sword(Cascade), "common.abilities.sword.basic_cascade")),
], ],
), ),
Contextualized( Contextualized(
pseudo_id: "veloren.core.pseudo_abilities.sword.cross_cut", pseudo_id: "veloren.core.pseudo_abilities.sword.cross_cut",
abilities: [ abilities: [
([Stance(Sword(Heavy)), DualWieldingSameKind], (Sword(CrossCut), "common.abilities.sword.heavy_dual_cross_cut")), ((stance: Sword(Heavy), dual_wielding_same_kind: true), (Sword(CrossCut), "common.abilities.sword.heavy_dual_cross_cut")),
([Stance(Sword(Agile)), DualWieldingSameKind], (Sword(CrossCut), "common.abilities.sword.agile_dual_cross_cut")), ((stance: Sword(Agile), dual_wielding_same_kind: true), (Sword(CrossCut), "common.abilities.sword.agile_dual_cross_cut")),
([Stance(Sword(Defensive)), DualWieldingSameKind], (Sword(CrossCut), "common.abilities.sword.defensive_dual_cross_cut")), ((stance: Sword(Defensive), dual_wielding_same_kind: true), (Sword(CrossCut), "common.abilities.sword.defensive_dual_cross_cut")),
([Stance(Sword(Crippling)), DualWieldingSameKind], (Sword(CrossCut), "common.abilities.sword.crippling_dual_cross_cut")), ((stance: Sword(Crippling), dual_wielding_same_kind: true), (Sword(CrossCut), "common.abilities.sword.crippling_dual_cross_cut")),
([Stance(Sword(Cleaving)), DualWieldingSameKind], (Sword(CrossCut), "common.abilities.sword.cleaving_dual_cross_cut")), ((stance: Sword(Cleaving), dual_wielding_same_kind: true), (Sword(CrossCut), "common.abilities.sword.cleaving_dual_cross_cut")),
([DualWieldingSameKind], (Sword(CrossCut), "common.abilities.sword.basic_dual_cross_cut")), ((dual_wielding_same_kind: true), (Sword(CrossCut), "common.abilities.sword.basic_dual_cross_cut")),
([Stance(Sword(Heavy))], (Sword(CrossCut), "common.abilities.sword.heavy_cross_cut")), ((stance: Sword(Heavy)), (Sword(CrossCut), "common.abilities.sword.heavy_cross_cut")),
([Stance(Sword(Agile))], (Sword(CrossCut), "common.abilities.sword.agile_cross_cut")), ((stance: Sword(Agile)), (Sword(CrossCut), "common.abilities.sword.agile_cross_cut")),
([Stance(Sword(Defensive))], (Sword(CrossCut), "common.abilities.sword.defensive_cross_cut")), ((stance: Sword(Defensive)), (Sword(CrossCut), "common.abilities.sword.defensive_cross_cut")),
([Stance(Sword(Crippling))], (Sword(CrossCut), "common.abilities.sword.crippling_cross_cut")), ((stance: Sword(Crippling)), (Sword(CrossCut), "common.abilities.sword.crippling_cross_cut")),
([Stance(Sword(Cleaving))], (Sword(CrossCut), "common.abilities.sword.cleaving_cross_cut")), ((stance: Sword(Cleaving)), (Sword(CrossCut), "common.abilities.sword.cleaving_cross_cut")),
([], (Sword(CrossCut), "common.abilities.sword.basic_cross_cut")), ((), (Sword(CrossCut), "common.abilities.sword.basic_cross_cut")),
], ],
), ),
Contextualized( Contextualized(
pseudo_id: "veloren.core.pseudo_abilities.sword.finisher", pseudo_id: "veloren.core.pseudo_abilities.sword.finisher",
abilities: [ abilities: [
([Stance(Sword(Heavy))], (Sword(Finisher), "common.abilities.sword.heavy_guillotine")), ((stance: Sword(Heavy)), (Sword(Finisher), "common.abilities.sword.heavy_guillotine")),
([Stance(Sword(Agile))], (Sword(Finisher), "common.abilities.sword.agile_hundred_cuts")), ((stance: Sword(Agile)), (Sword(Finisher), "common.abilities.sword.agile_hundred_cuts")),
([Stance(Sword(Defensive))], (Sword(Finisher), "common.abilities.sword.defensive_counter")), ((stance: Sword(Defensive)), (Sword(Finisher), "common.abilities.sword.defensive_counter")),
([Stance(Sword(Crippling))], (Sword(Finisher), "common.abilities.sword.crippling_mutilate")), ((stance: Sword(Crippling)), (Sword(Finisher), "common.abilities.sword.crippling_mutilate")),
([Stance(Sword(Cleaving)), DualWieldingSameKind], (Sword(Finisher), "common.abilities.sword.cleaving_dual_bladestorm")), ((stance: Sword(Cleaving), dual_wielding_same_kind: true), (Sword(Finisher), "common.abilities.sword.cleaving_dual_bladestorm")),
([Stance(Sword(Cleaving))], (Sword(Finisher), "common.abilities.sword.cleaving_bladestorm")), ((stance: Sword(Cleaving)), (Sword(Finisher), "common.abilities.sword.cleaving_bladestorm")),
([], (Sword(Finisher), "common.abilities.sword.basic_mighty_strike")), ((), (Sword(Finisher), "common.abilities.sword.basic_mighty_strike")),
], ],
), ),
Simple(Sword(HeavySweep), "common.abilities.sword.heavy_sweep"), Simple(Sword(HeavySweep), "common.abilities.sword.heavy_sweep"),
@ -119,8 +119,8 @@
Contextualized( Contextualized(
pseudo_id: "common.abilities.sword.cleaving_whirlwind_slice", pseudo_id: "common.abilities.sword.cleaving_whirlwind_slice",
abilities: [ abilities: [
([DualWieldingSameKind], (Sword(CleavingWhirlwindSlice), "common.abilities.sword.cleaving_dual_whirlwind_slice")), ((dual_wielding_same_kind: true), (Sword(CleavingWhirlwindSlice), "common.abilities.sword.cleaving_dual_whirlwind_slice")),
([], (Sword(CleavingWhirlwindSlice), "common.abilities.sword.cleaving_whirlwind_slice")), ((), (Sword(CleavingWhirlwindSlice), "common.abilities.sword.cleaving_whirlwind_slice")),
], ],
), ),
Simple(Sword(CleavingEarthSplitter), "common.abilities.sword.cleaving_earth_splitter"), Simple(Sword(CleavingEarthSplitter), "common.abilities.sword.cleaving_earth_splitter"),
@ -130,8 +130,8 @@
Contextualized( Contextualized(
pseudo_id: "common.abilities.sword.agile_flurry", pseudo_id: "common.abilities.sword.agile_flurry",
abilities: [ abilities: [
([Stance(Sword(Agile)), DualWieldingSameKind], (Sword(AgileFlurry), "common.abilities.sword.agile_dual_flurry")), ((stance: Sword(Agile), dual_wielding_same_kind: true), (Sword(AgileFlurry), "common.abilities.sword.agile_dual_flurry")),
([Stance(Sword(Agile))], (Sword(AgileFlurry), "common.abilities.sword.agile_flurry")), ((stance: Sword(Agile)), (Sword(AgileFlurry), "common.abilities.sword.agile_flurry")),
], ],
), ),
Simple(Sword(DefensiveStalwartSword), "common.abilities.sword.defensive_stalwart_sword"), Simple(Sword(DefensiveStalwartSword), "common.abilities.sword.defensive_stalwart_sword"),
@ -155,8 +155,8 @@
Contextualized( Contextualized(
pseudo_id: "common.abilities.axe.execute", pseudo_id: "common.abilities.axe.execute",
abilities: [ abilities: [
([Combo(50)], (Axe(Maelstrom), "common.abilities.axe.maelstrom")), ((combo: Some(50)), (Axe(Maelstrom), "common.abilities.axe.maelstrom")),
([], (Axe(Execute), "common.abilities.axe.execute")), ((), (Axe(Execute), "common.abilities.axe.execute")),
], ],
), ),
Simple(Axe(Rake), "common.abilities.axe.rake"), Simple(Axe(Rake), "common.abilities.axe.rake"),
@ -164,8 +164,8 @@
Contextualized( Contextualized(
pseudo_id: "common.abilities.axe.fierce_raze", pseudo_id: "common.abilities.axe.fierce_raze",
abilities: [ abilities: [
([DualWieldingSameKind], (Axe(FierceRaze), "common.abilities.axe.dual_fierce_raze")), ((dual_wielding_same_kind: true), (Axe(FierceRaze), "common.abilities.axe.dual_fierce_raze")),
([], (Axe(FierceRaze), "common.abilities.axe.fierce_raze")), ((), (Axe(FierceRaze), "common.abilities.axe.fierce_raze")),
], ],
), ),
Simple(Axe(Furor), "common.abilities.axe.furor"), Simple(Axe(Furor), "common.abilities.axe.furor"),
@ -173,8 +173,8 @@
Contextualized( Contextualized(
pseudo_id: "common.abilities.axe.lacerate", pseudo_id: "common.abilities.axe.lacerate",
abilities: [ abilities: [
([Combo(50)], (Axe(Riptide), "common.abilities.axe.riptide")), ((combo: Some(50)), (Axe(Riptide), "common.abilities.axe.riptide")),
([], (Axe(Lacerate), "common.abilities.axe.lacerate")), ((), (Axe(Lacerate), "common.abilities.axe.lacerate")),
], ],
), ),
Simple(Axe(SkullBash), "common.abilities.axe.skull_bash"), Simple(Axe(SkullBash), "common.abilities.axe.skull_bash"),
@ -185,8 +185,8 @@
Contextualized( Contextualized(
pseudo_id: "common.abilities.axe.bulkhead", pseudo_id: "common.abilities.axe.bulkhead",
abilities: [ abilities: [
([Combo(50)], (Axe(Capsize), "common.abilities.axe.capsize")), ((combo: Some(50)), (Axe(Capsize), "common.abilities.axe.capsize")),
([], (Axe(Bulkhead), "common.abilities.axe.bulkhead")), ((), (Axe(Bulkhead), "common.abilities.axe.bulkhead")),
], ],
), ),
], ],

View File

@ -149,7 +149,7 @@ impl ActiveAbilities {
skill_set: &SkillSet, skill_set: &SkillSet,
body: Option<&Body>, body: Option<&Body>,
char_state: Option<&CharacterState>, char_state: Option<&CharacterState>,
contexts: &[AbilityContext], context: &AbilityContext,
// bool is from_offhand // bool is from_offhand
) -> Option<(CharacterAbility, bool, SpecifiedAbility)> { ) -> Option<(CharacterAbility, bool, SpecifiedAbility)> {
let ability = self.get_ability(input, inv, Some(skill_set)); let ability = self.get_ability(input, inv, Some(skill_set));
@ -206,7 +206,7 @@ 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), contexts) .primary(Some(skill_set), context)
.map(|(a, i)| (a.ability.clone(), i)) .map(|(a, i)| (a.ability.clone(), i))
}) })
.map(|(ability, i)| { .map(|(ability, i)| {
@ -219,7 +219,7 @@ impl ActiveAbilities {
Ability::ToolSecondary => ability_set(EquipSlot::ActiveOffhand) Ability::ToolSecondary => ability_set(EquipSlot::ActiveOffhand)
.and_then(|abilities| { .and_then(|abilities| {
abilities abilities
.secondary(Some(skill_set), contexts) .secondary(Some(skill_set), context)
.map(|(a, i)| (a.ability.clone(), i)) .map(|(a, i)| (a.ability.clone(), i))
}) })
.map(|(ability, i)| { .map(|(ability, i)| {
@ -233,7 +233,7 @@ impl ActiveAbilities {
ability_set(EquipSlot::ActiveMainhand) ability_set(EquipSlot::ActiveMainhand)
.and_then(|abilities| { .and_then(|abilities| {
abilities abilities
.secondary(Some(skill_set), contexts) .secondary(Some(skill_set), context)
.map(|(a, i)| (a.ability.clone(), i)) .map(|(a, i)| (a.ability.clone(), i))
}) })
.map(|(ability, i)| { .map(|(ability, i)| {
@ -256,7 +256,7 @@ 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), contexts) .auxiliary(index, Some(skill_set), context)
.map(|(a, i)| (a.ability.clone(), i)) .map(|(a, i)| (a.ability.clone(), i))
}) })
.map(|(ability, i)| { .map(|(ability, i)| {
@ -269,7 +269,7 @@ impl ActiveAbilities {
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), contexts) .auxiliary(index, Some(skill_set), context)
.map(|(a, i)| (a.ability.clone(), i)) .map(|(a, i)| (a.ability.clone(), i))
}) })
.map(|(ability, i)| { .map(|(ability, i)| {
@ -349,7 +349,7 @@ impl Ability {
self, self,
inv: Option<&'a Inventory>, inv: Option<&'a Inventory>,
skillset: Option<&'a SkillSet>, skillset: Option<&'a SkillSet>,
contexts: &[AbilityContext], context: &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))
@ -396,21 +396,21 @@ impl Ability {
}), }),
Ability::ToolPrimary => ability_set(EquipSlot::ActiveMainhand).and_then(|abilities| { Ability::ToolPrimary => ability_set(EquipSlot::ActiveMainhand).and_then(|abilities| {
abilities abilities
.primary(skillset, contexts) .primary(skillset, context)
.map(|a| a.0.id.as_str()) .map(|a| a.0.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, contexts) .secondary(skillset, context)
.map(|a| a.0.id.as_str()) .map(|a| a.0.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, contexts) .secondary(skillset, context)
.map(|a| a.0.id.as_str()) .map(|a| a.0.id.as_str())
.or_else(|| contextual_id(Some(&abilities.secondary))) .or_else(|| contextual_id(Some(&abilities.secondary)))
}) })
@ -419,7 +419,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, contexts) .auxiliary(index, skillset, context)
.map(|a| a.0.id.as_str()) .map(|a| a.0.id.as_str())
.or_else(|| contextual_id(abilities.abilities.get(index))) .or_else(|| contextual_id(abilities.abilities.get(index)))
}) })
@ -427,7 +427,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, contexts) .auxiliary(index, skillset, context)
.map(|a| a.0.id.as_str()) .map(|a| a.0.id.as_str())
.or_else(|| contextual_id(abilities.abilities.get(index))) .or_else(|| contextual_id(abilities.abilities.get(index)))
}) })

View File

@ -305,10 +305,13 @@ pub enum AbilityKind<T> {
Simple(Option<Skill>, T), Simple(Option<Skill>, T),
Contextualized { Contextualized {
pseudo_id: String, pseudo_id: String,
abilities: Vec<(Vec<AbilityContext>, (Option<Skill>, T))>, abilities: Vec<(AbilityContext, (Option<Skill>, T))>,
}, },
} }
/// The contextual index indicates which entry in a contextual ability was used.
/// This should only be necessary for the frontend to distinguish between the
/// options when a contextual ability is used.
#[derive(Clone, Debug, Serialize, Deserialize, Copy, Eq, PartialEq)] #[derive(Clone, Debug, Serialize, Deserialize, Copy, Eq, PartialEq)]
pub struct ContextualIndex(pub usize); pub struct ContextualIndex(pub usize);
@ -339,7 +342,7 @@ impl<T> AbilityKind<T> {
pseudo_id: pseudo_id.clone(), pseudo_id: pseudo_id.clone(),
abilities: abilities abilities: abilities
.iter() .iter()
.map(|(c, (s, x))| (c.clone(), (*s, f(x)))) .map(|(c, (s, x))| (*c, (*s, f(x))))
.collect(), .collect(),
}, },
} }
@ -348,7 +351,7 @@ impl<T> AbilityKind<T> {
pub fn ability( pub fn ability(
&self, &self,
skillset: Option<&SkillSet>, skillset: Option<&SkillSet>,
contexts: &[AbilityContext], context: &AbilityContext,
) -> Option<(&T, Option<ContextualIndex>)> { ) -> Option<(&T, Option<ContextualIndex>)> {
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
@ -368,40 +371,34 @@ impl<T> AbilityKind<T> {
.filter_map(|(i, (req_contexts, (s, a)))| { .filter_map(|(i, (req_contexts, (s, a)))| {
unlocked(*s, a).map(|a| (i, (req_contexts, a))) unlocked(*s, a).map(|a| (i, (req_contexts, a)))
}) })
.find_map(|(i, (req_contexts, a))| { .find_map(|(i, (req_context, a))| {
req_contexts req_context
.iter() .fulfilled_by(context)
.all(|req| req.fulfilled_by(contexts))
.then_some((a, Some(ContextualIndex(i)))) .then_some((a, Some(ContextualIndex(i))))
}), }),
} }
} }
} }
#[derive(Clone, Debug, Serialize, Deserialize, Copy, Eq, PartialEq, Hash)] #[derive(Clone, Debug, Serialize, Deserialize, Copy, Eq, PartialEq, Hash, Default)]
pub enum AbilityContext { pub struct AbilityContext {
/// Note, in this context `Stance::None` isn't intended to be used. e.g. /// Note, in this context `Stance::None` isn't intended to be used. e.g. the
/// `AbilityContext::None` should always be used instead of /// stance field should be `None` instead of `Some(Stance::None)` in the
/// `AbilityContext::Stance(Stance::None)` in the ability map config /// ability map config files(s).
/// files(s). pub stance: Option<Stance>,
Stance(Stance), #[serde(default)]
DualWieldingSameKind, pub dual_wielding_same_kind: bool,
Combo(u32), pub combo: Option<u32>,
} }
impl AbilityContext { impl AbilityContext {
pub fn from( pub fn from(stance: Option<&Stance>, inv: Option<&Inventory>, combo: Option<&Combo>) -> Self {
stance: Option<&Stance>, let stance = match stance {
inv: Option<&Inventory>, Some(Stance::None) => None,
combo: Option<&Combo>, Some(stance) => Some(*stance),
) -> Vec<Self> { None => None,
let mut contexts = Vec::new(); };
match stance { let dual_wielding_same_kind = if let Some(inv) = inv {
Some(Stance::None) => {},
Some(stance) => contexts.push(AbilityContext::Stance(*stance)),
None => {},
}
if let Some(inv) = inv {
let tool_kind = |slot| { let tool_kind = |slot| {
inv.equipped(slot).and_then(|i| { inv.equipped(slot).and_then(|i| {
if let ItemKind::Tool(tool) = &*i.kind() { if let ItemKind::Tool(tool) = &*i.kind() {
@ -411,30 +408,33 @@ impl AbilityContext {
} }
}) })
}; };
if tool_kind(EquipSlot::ActiveMainhand) == tool_kind(EquipSlot::ActiveOffhand) { tool_kind(EquipSlot::ActiveMainhand) == tool_kind(EquipSlot::ActiveOffhand)
contexts.push(AbilityContext::DualWieldingSameKind) } else {
} false
};
let combo = combo.map(|c| c.counter());
AbilityContext {
stance,
dual_wielding_same_kind,
combo,
} }
if let Some(combo) = combo {
contexts.push(AbilityContext::Combo(combo.counter()));
}
contexts
} }
fn fulfilled_by(&self, contexts: &[AbilityContext]) -> bool { fn fulfilled_by(&self, context: &AbilityContext) -> bool {
match self { let AbilityContext {
Self::Stance(_) | Self::DualWieldingSameKind => contexts.contains(self), stance,
Self::Combo(required) => contexts dual_wielding_same_kind,
.iter() combo,
.filter_map(|context| { } = self;
if let Self::Combo(combo) = context { // Either stance not required or context is in the same stance
Some(combo) let stance_check = stance.map_or(true, |s| context.stance.map_or(false, |c_s| c_s == s));
} else { // Either dual wield not required or context is dual wielding
None let dual_wield_check = !dual_wielding_same_kind || context.dual_wielding_same_kind;
} // Either no minimum combo needed or context has sufficient combo
}) let combo_check = combo.map_or(true, |c| context.combo.map_or(false, |c_c| c_c >= c));
.any(|combo| combo >= required),
} stance_check && dual_wield_check && combo_check
} }
} }
@ -486,28 +486,28 @@ impl<T> AbilitySet<T> {
pub fn primary( pub fn primary(
&self, &self,
skillset: Option<&SkillSet>, skillset: Option<&SkillSet>,
contexts: &[AbilityContext], context: &AbilityContext,
) -> Option<(&T, Option<ContextualIndex>)> { ) -> Option<(&T, Option<ContextualIndex>)> {
self.primary.ability(skillset, contexts) self.primary.ability(skillset, context)
} }
pub fn secondary( pub fn secondary(
&self, &self,
skillset: Option<&SkillSet>, skillset: Option<&SkillSet>,
contexts: &[AbilityContext], context: &AbilityContext,
) -> Option<(&T, Option<ContextualIndex>)> { ) -> Option<(&T, Option<ContextualIndex>)> {
self.secondary.ability(skillset, contexts) self.secondary.ability(skillset, context)
} }
pub fn auxiliary( pub fn auxiliary(
&self, &self,
index: usize, index: usize,
skillset: Option<&SkillSet>, skillset: Option<&SkillSet>,
contexts: &[AbilityContext], context: &AbilityContext,
) -> Option<(&T, Option<ContextualIndex>)> { ) -> Option<(&T, Option<ContextualIndex>)> {
self.abilities self.abilities
.get(index) .get(index)
.and_then(|a| a.ability(skillset, contexts)) .and_then(|a| a.ability(skillset, context))
} }
} }

View File

@ -65,9 +65,11 @@ pub struct Stats {
pub attack_damage_modifier: f32, pub attack_damage_modifier: f32,
pub crit_chance_modifier: StatsModifier, pub crit_chance_modifier: StatsModifier,
pub swim_speed_modifier: f32, pub swim_speed_modifier: f32,
// This adds effects to any attacks that the entity makes
pub effects_on_attack: Vec<AttackEffect>, pub effects_on_attack: Vec<AttackEffect>,
pub mitigations_penetration: f32, pub mitigations_penetration: f32,
pub energy_reward_modifier: f32, pub energy_reward_modifier: f32,
// This creates effects when the entity is damaged
pub effects_on_damaged: Vec<DamagedEffect>, pub effects_on_damaged: Vec<DamagedEffect>,
} }

View File

@ -1197,7 +1197,7 @@ fn handle_ability(
output_events: &mut OutputEvents, output_events: &mut OutputEvents,
input: InputKind, input: InputKind,
) -> bool { ) -> bool {
let contexts = AbilityContext::from(data.stance, data.inventory, data.combo); let context = AbilityContext::from(data.stance, data.inventory, data.combo);
if let Some(ability_input) = input.into() { if let Some(ability_input) = input.into() {
if let Some((ability, from_offhand, spec_ability)) = data if let Some((ability, from_offhand, spec_ability)) = data
.active_abilities .active_abilities
@ -1208,7 +1208,7 @@ fn handle_ability(
data.skill_set, data.skill_set,
Some(data.body), Some(data.body),
Some(data.character), Some(data.character),
&contexts, &context,
) )
}) })
.filter(|(ability, _, _)| ability.requirements_paid(data, update)) .filter(|(ability, _, _)| ability.requirements_paid(data, update))
@ -1609,8 +1609,9 @@ impl ScalingKind {
} }
} }
#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Default)]
pub enum ComboConsumption { pub enum ComboConsumption {
#[default]
All, All,
Half, Half,
} }
@ -1629,10 +1630,6 @@ impl ComboConsumption {
} }
} }
impl Default for ComboConsumption {
fn default() -> Self { Self::All }
}
fn loadout_change_hook(data: &JoinData<'_>, output_events: &mut OutputEvents, clear_combo: bool) { fn loadout_change_hook(data: &JoinData<'_>, output_events: &mut OutputEvents, clear_combo: bool) {
if clear_combo { if clear_combo {
// Reset combo to 0 // Reset combo to 0

View File

@ -1699,7 +1699,7 @@ impl<'a> AgentData<'a> {
enum ActionStateConditions { enum ActionStateConditions {
ConditionStaffCanShockwave = 0, ConditionStaffCanShockwave = 0,
} }
let contexts = AbilityContext::from(self.stance, Some(self.inventory), self.combo); let context = AbilityContext::from(self.stance, Some(self.inventory), self.combo);
let extract_ability = |input: AbilityInput| { let extract_ability = |input: AbilityInput| {
self.active_abilities self.active_abilities
.activate_ability( .activate_ability(
@ -1708,7 +1708,7 @@ impl<'a> AgentData<'a> {
self.skill_set, self.skill_set,
self.body, self.body,
Some(self.char_state), Some(self.char_state),
&contexts, &context,
) )
.map_or(Default::default(), |a| a.0) .map_or(Default::default(), |a| a.0)
}; };

View File

@ -225,7 +225,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,
contexts: &'a [AbilityContext], context: &'a AbilityContext,
#[conrod(common_builder)] #[conrod(common_builder)]
common: widget::CommonBuilder, common: widget::CommonBuilder,
@ -271,7 +271,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,
contexts: &'a [AbilityContext], context: &'a AbilityContext,
) -> Self { ) -> Self {
Self { Self {
show, show,
@ -293,7 +293,7 @@ impl<'a> Diary<'a> {
tooltip_manager, tooltip_manager,
slot_manager, slot_manager,
pulse, pulse,
contexts, context,
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,
@ -837,7 +837,7 @@ impl<'a> Widget for Diary<'a> {
self.active_abilities, self.active_abilities,
self.inventory, self.inventory,
self.skill_set, self.skill_set,
self.contexts, self.context,
), ),
image_source: self.imgs, image_source: self.imgs,
slot_manager: Some(self.slot_manager), slot_manager: Some(self.slot_manager),
@ -852,7 +852,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.contexts); .ability_id(Some(self.inventory), Some(self.skill_set), self.context);
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 {
@ -937,7 +937,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.contexts, self.context,
), ),
a, a,
) )
@ -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.contexts, self.context,
), ),
a, a,
) )
@ -1064,7 +1064,7 @@ impl<'a> Widget for Diary<'a> {
self.active_abilities, self.active_abilities,
self.inventory, self.inventory,
self.skill_set, self.skill_set,
self.contexts, self.context,
), ),
image_source: self.imgs, image_source: self.imgs,
slot_manager: Some(self.slot_manager), slot_manager: Some(self.slot_manager),

View File

@ -3074,7 +3074,7 @@ impl Hud {
bodies.get(entity), bodies.get(entity),
) { ) {
let stance = stances.get(entity); let stance = stances.get(entity);
let contexts = AbilityContext::from(stance, Some(inventory), combo); let context = AbilityContext::from(stance, Some(inventory), combo);
match Skillbar::new( match Skillbar::new(
client, client,
&info, &info,
@ -3100,7 +3100,7 @@ impl Hud {
i18n, i18n,
&msm, &msm,
self.floaters.combo_floater, self.floaters.combo_floater,
&contexts, &context,
combo, combo,
char_states.get(entity), char_states.get(entity),
stance, stance,
@ -3582,7 +3582,7 @@ impl Hud {
bodies.get(entity), bodies.get(entity),
poises.get(entity), poises.get(entity),
) { ) {
let contexts = AbilityContext::from(stances.get(entity), Some(inventory), combo); let context = AbilityContext::from(stances.get(entity), Some(inventory), combo);
for event in Diary::new( for event in Diary::new(
&self.show, &self.show,
client, client,
@ -3603,7 +3603,7 @@ impl Hud {
tooltip_manager, tooltip_manager,
&mut self.slot_manager, &mut self.slot_manager,
self.pulse, self.pulse,
&contexts, &context,
) )
.set(self.ids.diary, ui_widgets) .set(self.ids.diary, ui_widgets)
{ {
@ -5195,7 +5195,6 @@ pub fn get_buff_desc(buff: BuffKind, data: BuffData, localized_strings: &Localiz
BuffKind::Fortitude => localized_strings.get_msg("buff-desc-fortitude"), BuffKind::Fortitude => localized_strings.get_msg("buff-desc-fortitude"),
BuffKind::Reckless => localized_strings.get_msg("buff-desc-reckless"), BuffKind::Reckless => localized_strings.get_msg("buff-desc-reckless"),
// BuffKind::SalamanderAspect => localized_strings.get_msg("buff-desc-salamanderaspect"), // BuffKind::SalamanderAspect => localized_strings.get_msg("buff-desc-salamanderaspect"),
BuffKind::Polymorphed(_) => localized_strings.get_msg("buff-desc-polymorphed"),
BuffKind::Flame => localized_strings.get_msg("buff-desc-flame"), BuffKind::Flame => localized_strings.get_msg("buff-desc-flame"),
BuffKind::Frigid => localized_strings.get_msg("buff-desc-frigid"), BuffKind::Frigid => localized_strings.get_msg("buff-desc-frigid"),
BuffKind::Lifesteal => localized_strings.get_msg("buff-desc-lifesteal"), BuffKind::Lifesteal => localized_strings.get_msg("buff-desc-lifesteal"),
@ -5216,6 +5215,7 @@ pub fn get_buff_desc(buff: BuffKind, data: BuffData, localized_strings: &Localiz
BuffKind::Poisoned => localized_strings.get_msg("buff-desc-poisoned"), BuffKind::Poisoned => localized_strings.get_msg("buff-desc-poisoned"),
BuffKind::Parried => localized_strings.get_msg("buff-desc-parried"), BuffKind::Parried => localized_strings.get_msg("buff-desc-parried"),
BuffKind::PotionSickness => localized_strings.get_msg("buff-desc-potionsickness"), BuffKind::PotionSickness => localized_strings.get_msg("buff-desc-potionsickness"),
BuffKind::Polymorphed(_) => localized_strings.get_msg("buff-desc-polymorphed"),
} }
} }

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>,
contexts: &'a [AbilityContext], context: &'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>,
contexts: &'a [AbilityContext], context: &'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,
contexts, context,
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.contexts, self.context,
self.combo, self.combo,
self.char_state, self.char_state,
self.stance, self.stance,
@ -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.contexts, self.context,
) )
}); });
@ -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.contexts, self.context,
) )
}); });
@ -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.contexts, self.context,
) )
}) })
.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,
&'a [AbilityContext], &'a AbilityContext,
Option<&'a Combo>, Option<&'a Combo>,
Option<&'a CharacterState>, Option<&'a CharacterState>,
Option<&'a Stance>, Option<&'a Stance>,
@ -240,7 +240,7 @@ type AbilitiesSource<'a> = (
&'a ActiveAbilities, &'a ActiveAbilities,
&'a Inventory, &'a Inventory,
&'a SkillSet, &'a SkillSet,
&'a [AbilityContext], &'a AbilityContext,
); );
impl<'a> SlotKey<AbilitiesSource<'a>, img_ids::Imgs> for AbilitySlot { impl<'a> SlotKey<AbilitiesSource<'a>, img_ids::Imgs> for AbilitySlot {