From 5d1993009fb4884b7dd2d5c120284218450a67df Mon Sep 17 00:00:00 2001 From: jshipsey Date: Wed, 13 Jan 2021 03:11:31 -0500 Subject: [PATCH] keyframed axe spin Fixed error in converting FK to entity_id from character_id. Giant match statements in persistence. Tweaked roll. Changed how skills and skill groups were assigned in the skillset builder so it's format more closely followed loadout builder. --- assets/common/abilities/axe/spin.ron | 6 +- .../skill_trees/skill_prerequisites.ron | 26 +- .../skills_skill-groups_manifest.ron | 6 +- common/src/comp/ability.rs | 6 +- common/src/comp/skills.rs | 21 +- common/src/skillset_builder.rs | 818 +++++++++--------- common/src/states/utils.rs | 6 +- common/sys/src/agent.rs | 8 +- .../2020-12-13-172324_skills/up.sql | 2 +- server/src/persistence/character.rs | 10 +- .../src/persistence/character/conversions.rs | 33 +- server/src/persistence/json_models.rs | 268 ++++++ server/src/persistence/models.rs | 8 +- server/src/persistence/schema.rs | 8 +- voxygen/anim/src/character/spinmelee.rs | 141 ++- voxygen/anim/src/dyn_lib.rs | 3 +- voxygen/src/hud/diary.rs | 6 +- voxygen/src/hud/hotbar.rs | 6 +- voxygen/src/hud/mod.rs | 2 +- voxygen/src/scene/figure/mod.rs | 2 +- 20 files changed, 820 insertions(+), 566 deletions(-) diff --git a/assets/common/abilities/axe/spin.ron b/assets/common/abilities/axe/spin.ron index 20b77caa8a..e9660d27d4 100644 --- a/assets/common/abilities/axe/spin.ron +++ b/assets/common/abilities/axe/spin.ron @@ -1,7 +1,7 @@ SpinMelee( - buildup_duration: 100, - swing_duration: 300, - recover_duration: 100, + buildup_duration: 200, + swing_duration: 400, + recover_duration: 200, base_damage: 60, knockback: 0.0, range: 3.5, diff --git a/assets/common/skill_trees/skill_prerequisites.ron b/assets/common/skill_trees/skill_prerequisites.ron index c4b33bb162..44c84cf49c 100644 --- a/assets/common/skill_trees/skill_prerequisites.ron +++ b/assets/common/skill_trees/skill_prerequisites.ron @@ -10,10 +10,10 @@ Sword(DSpeed): {Sword(DDamage): Some(1)}, Sword(DInfinite): {Sword(DDamage): Some(1)}, Sword(DScaling): {Sword(DDamage): Some(1)}, - Sword(SDamage): {Sword(SUnlockSpin): None}, - Sword(SSpeed): {Sword(SUnlockSpin): None}, - Sword(SCost): {Sword(SUnlockSpin): None}, - Sword(SSpins): {Sword(SUnlockSpin): None}, + Sword(SDamage): {Sword(UnlockSpin): None}, + Sword(SSpeed): {Sword(UnlockSpin): None}, + Sword(SCost): {Sword(UnlockSpin): None}, + Sword(SSpins): {Sword(UnlockSpin): None}, Axe(DsDamage): {Axe(DsCombo): None}, Axe(DsSpeed): {Axe(DsCombo): None}, Axe(DsRegen): {Axe(DsCombo): None}, @@ -21,21 +21,21 @@ Axe(SDamage): {Axe(SInfinite): None}, Axe(SSpeed): {Axe(SInfinite): None}, Axe(SCost): {Axe(SInfinite): None}, - Axe(LDamage): {Axe(LUnlockLeap): None}, - Axe(LKnockback): {Axe(LUnlockLeap): None}, - Axe(LCost): {Axe(LUnlockLeap): None}, - Axe(LDistance): {Axe(LUnlockLeap): None}, + Axe(LDamage): {Axe(UnlockLeap): None}, + Axe(LKnockback): {Axe(UnlockLeap): None}, + Axe(LCost): {Axe(UnlockLeap): None}, + Axe(LDistance): {Axe(UnlockLeap): None}, Hammer(SsDamage): {Hammer(SsKnockback): Some(1)}, Hammer(SsRegen): {Hammer(SsKnockback): Some(1)}, Hammer(SsSpeed): {Hammer(SsKnockback): Some(1)}, Hammer(CDamage): {Hammer(CKnockback): Some(1)}, Hammer(CDrain): {Hammer(CKnockback): Some(1)}, Hammer(CSpeed): {Hammer(CKnockback): Some(1)}, - Hammer(LDamage): {Hammer(LUnlockLeap): None}, - Hammer(LCost): {Hammer(LUnlockLeap): None}, - Hammer(LDistance): {Hammer(LUnlockLeap): None}, - Hammer(LKnockback): {Hammer(LUnlockLeap): None}, - Hammer(LRange): {Hammer(LUnlockLeap): None}, + Hammer(LDamage): {Hammer(UnlockLeap): None}, + Hammer(LCost): {Hammer(UnlockLeap): None}, + Hammer(LDistance): {Hammer(UnlockLeap): None}, + Hammer(LKnockback): {Hammer(UnlockLeap): None}, + Hammer(LRange): {Hammer(UnlockLeap): None}, Bow(BRegen): {Bow(BDamage): Some(1)}, Bow(CKnockback): {Bow(CDamage): Some(1)}, Bow(CProjSpeed): {Bow(CDamage): Some(1)}, diff --git a/assets/common/skill_trees/skills_skill-groups_manifest.ron b/assets/common/skill_trees/skills_skill-groups_manifest.ron index dc2fa0b0ba..6735642c82 100644 --- a/assets/common/skill_trees/skills_skill-groups_manifest.ron +++ b/assets/common/skill_trees/skills_skill-groups_manifest.ron @@ -25,7 +25,7 @@ Sword(DScaling), Sword(DSpeed), Sword(DInfinite), - Sword(SUnlockSpin), + Sword(UnlockSpin), Sword(SDamage), Sword(SSpeed), Sword(SCost), @@ -41,7 +41,7 @@ Axe(SDamage), Axe(SSpeed), Axe(SCost), - Axe(LUnlockLeap), + Axe(UnlockLeap), Axe(LDamage), Axe(LKnockback), Axe(LCost), @@ -56,7 +56,7 @@ Hammer(CKnockback), Hammer(CDrain), Hammer(CSpeed), - Hammer(LUnlockLeap), + Hammer(UnlockLeap), Hammer(LDamage), Hammer(LCost), Hammer(LDistance), diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs index 5e80eea5ab..f691e8df9c 100644 --- a/common/src/comp/ability.rs +++ b/common/src/comp/ability.rs @@ -307,9 +307,9 @@ impl CharacterAbility { CharacterAbility::Roll { energy_cost: 150, buildup_duration: 100, - movement_duration: 250, + movement_duration: 180, recover_duration: 150, - roll_strength: 2.5, + roll_strength: 1.8, immune_melee: false, } } @@ -1035,7 +1035,7 @@ impl CharacterAbility { *energy_cost = (*energy_cost as f32 * 0.8_f32.powi(level.into())) as u32; } if let Some(level) = skills.get(&Skill::Roll(Strength)).copied().flatten() { - *roll_strength *= 1.3_f32.powi(level.into()); + *roll_strength *= 1.2_f32.powi(level.into()); } if let Some(level) = skills.get(&Skill::Roll(Duration)).copied().flatten() { *movement_duration = diff --git a/common/src/comp/skills.rs b/common/src/comp/skills.rs index 83bf045f0d..e3729d96f8 100644 --- a/common/src/comp/skills.rs +++ b/common/src/comp/skills.rs @@ -92,7 +92,7 @@ pub enum SwordSkill { DSpeed, DInfinite, // Spin upgrades - SUnlockSpin, + UnlockSpin, SDamage, SSpeed, SCost, @@ -113,7 +113,7 @@ pub enum AxeSkill { SSpeed, SCost, // Leap upgrades - LUnlockLeap, + UnlockLeap, LDamage, LKnockback, LCost, @@ -133,7 +133,7 @@ pub enum HammerSkill { CDrain, CSpeed, // Leap upgrades - LUnlockLeap, + UnlockLeap, LDamage, LCost, LDistance, @@ -635,24 +635,21 @@ mod tests { let mut skillset = SkillSet::default(); skillset.unlock_skill_group(SkillGroupType::Weapon(ToolKind::Axe)); skillset.add_skill_points(SkillGroupType::Weapon(ToolKind::Axe), 1); - skillset.unlock_skill(Skill::Axe(AxeSkill::LUnlockLeap)); + skillset.unlock_skill(Skill::Axe(AxeSkill::UnlockLeap)); assert_eq!(skillset.skill_groups[1].available_sp, 0); assert_eq!(skillset.skills.len(), 1); assert_eq!( skillset .skills - .contains_key(&Skill::Axe(AxeSkill::LUnlockLeap)), + .contains_key(&Skill::Axe(AxeSkill::UnlockLeap)), true ); - skillset.refund_skill(Skill::Axe(AxeSkill::LUnlockLeap)); + skillset.refund_skill(Skill::Axe(AxeSkill::UnlockLeap)); assert_eq!(skillset.skill_groups[1].available_sp, 1); - assert_eq!( - skillset.skills.get(&Skill::Axe(AxeSkill::LUnlockLeap)), - None - ); + assert_eq!(skillset.skills.get(&Skill::Axe(AxeSkill::UnlockLeap)), None); } #[test] @@ -678,14 +675,14 @@ mod tests { assert_eq!(skillset.skills.len(), 0); // Try unlocking a skill with enough skill points - skillset.unlock_skill(Skill::Axe(AxeSkill::LUnlockLeap)); + skillset.unlock_skill(Skill::Axe(AxeSkill::UnlockLeap)); assert_eq!(skillset.skill_groups[1].available_sp, 0); assert_eq!(skillset.skills.len(), 1); assert_eq!( skillset .skills - .contains_key(&Skill::Axe(AxeSkill::LUnlockLeap)), + .contains_key(&Skill::Axe(AxeSkill::UnlockLeap)), true ); diff --git a/common/src/skillset_builder.rs b/common/src/skillset_builder.rs index c47e87d067..456eb87f50 100644 --- a/common/src/skillset_builder.rs +++ b/common/src/skillset_builder.rs @@ -27,7 +27,6 @@ impl Default for SkillSetBuilder { impl SkillSetBuilder { pub fn build_skillset(main_tool: &Option, config: Option) -> Self { - let mut skillset = Self::default(); let active_item = main_tool.as_ref().and_then(|ic| { if let ItemKind::Tool(tool) = &ic.kind() { Some(tool.kind) @@ -41,543 +40,558 @@ impl SkillSetBuilder { Some(Guard) => { if let Some(ToolKind::Sword) = active_item { // Sword - skillset = skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsCombo)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsRegen)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsSpeed)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DCost)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DDrain)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DScaling)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DSpeed)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DInfinite)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SUnlockSpin)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SSpeed)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SSpins)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SCost)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)) + .with_skill(Skill::Sword(SwordSkill::TsCombo)) + .with_skill(Skill::Sword(SwordSkill::TsDamage)) + .with_skill(Skill::Sword(SwordSkill::TsRegen)) + .with_skill(Skill::Sword(SwordSkill::TsSpeed)) + .with_skill(Skill::Sword(SwordSkill::DDamage)) + .with_skill(Skill::Sword(SwordSkill::DCost)) + .with_skill(Skill::Sword(SwordSkill::DDrain)) + .with_skill(Skill::Sword(SwordSkill::DScaling)) + .with_skill(Skill::Sword(SwordSkill::DSpeed)) + .with_skill(Skill::Sword(SwordSkill::DInfinite)) + .with_skill(Skill::Sword(SwordSkill::UnlockSpin)) + .with_skill(Skill::Sword(SwordSkill::SDamage)) + .with_skill(Skill::Sword(SwordSkill::SSpeed)) + .with_skill(Skill::Sword(SwordSkill::SSpins)) + .with_skill(Skill::Sword(SwordSkill::SCost)) + } else { + Self::default() } }, Some(Outcast) => { match active_item { Some(ToolKind::Sword) => { // Sword - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsCombo)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DCost)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)) + .with_skill(Skill::Sword(SwordSkill::TsCombo)) + .with_skill(Skill::Sword(SwordSkill::DDamage)) + .with_skill(Skill::Sword(SwordSkill::DCost)) }, Some(ToolKind::Axe) => { // Axe - skillset = skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Axe)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsCombo)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SInfinite)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SSpeed)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SCost)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Axe)) + .with_skill(Skill::Axe(AxeSkill::DsCombo)) + .with_skill(Skill::Axe(AxeSkill::SInfinite)) + .with_skill(Skill::Axe(AxeSkill::SSpeed)) + .with_skill(Skill::Axe(AxeSkill::SCost)) }, Some(ToolKind::Hammer) => { // Hammer - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Hammer)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsSpeed)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CSpeed)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Hammer)) + .with_skill(Skill::Hammer(HammerSkill::SsKnockback)) + .with_skill(Skill::Hammer(HammerSkill::SsSpeed)) + .with_skill(Skill::Hammer(HammerSkill::CKnockback)) + .with_skill(Skill::Hammer(HammerSkill::CSpeed)) }, Some(ToolKind::Bow) => { // Bow - skillset = skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Bow)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::BDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::ProjSpeed)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CKnockback)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CProjSpeed)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Bow)) + .with_skill(Skill::Bow(BowSkill::BDamage)) + .with_skill(Skill::Bow(BowSkill::ProjSpeed)) + .with_skill(Skill::Bow(BowSkill::CDamage)) + .with_skill(Skill::Bow(BowSkill::CKnockback)) + .with_skill(Skill::Bow(BowSkill::CProjSpeed)) }, Some(ToolKind::Staff) => { // Staff - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Staff)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FDrain)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FVelocity)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Staff)) + .with_skill(Skill::Staff(StaffSkill::FDamage)) + .with_skill(Skill::Staff(StaffSkill::FDrain)) + .with_skill(Skill::Staff(StaffSkill::FVelocity)) }, - _ => {}, + _ => Self::default(), } }, Some(Highwayman) => { match active_item { Some(ToolKind::Sword) => { // Sword - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsCombo)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SUnlockSpin)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SSpins)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SCost)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)) + .with_skill(Skill::Sword(SwordSkill::TsCombo)) + .with_skill(Skill::Sword(SwordSkill::TsDamage)) + .with_skill(Skill::Sword(SwordSkill::DDamage)) + .with_skill(Skill::Sword(SwordSkill::UnlockSpin)) + .with_skill(Skill::Sword(SwordSkill::SSpins)) + .with_skill(Skill::Sword(SwordSkill::SCost)) }, Some(ToolKind::Axe) => { // Axe - skillset = skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Axe)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsCombo)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsDamage)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SInfinite)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SDamage)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SSpeed)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SCost)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LUnlockLeap)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Axe)) + .with_skill(Skill::Axe(AxeSkill::DsCombo)) + .with_skill(Skill::Axe(AxeSkill::DsDamage)) + .with_skill(Skill::Axe(AxeSkill::SInfinite)) + .with_skill(Skill::Axe(AxeSkill::SDamage)) + .with_skill(Skill::Axe(AxeSkill::SSpeed)) + .with_skill(Skill::Axe(AxeSkill::SCost)) + .with_skill(Skill::Axe(AxeSkill::UnlockLeap)) }, Some(ToolKind::Hammer) => { // Hammer - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Hammer)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsDamage)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsSpeed)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LUnlockLeap)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LRange)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Hammer)) + .with_skill(Skill::Hammer(HammerSkill::SsKnockback)) + .with_skill(Skill::Hammer(HammerSkill::SsDamage)) + .with_skill(Skill::Hammer(HammerSkill::SsSpeed)) + .with_skill(Skill::Hammer(HammerSkill::CKnockback)) + .with_skill(Skill::Hammer(HammerSkill::UnlockLeap)) + .with_skill(Skill::Hammer(HammerSkill::LKnockback)) + .with_skill(Skill::Hammer(HammerSkill::LRange)) }, Some(ToolKind::Bow) => { // Bow - skillset = skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Bow)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::BDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CKnockback)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CSpeed)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CMove)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::UnlockRepeater)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RArrows)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Bow)) + .with_skill(Skill::Bow(BowSkill::BDamage)) + .with_skill(Skill::Bow(BowSkill::CDamage)) + .with_skill(Skill::Bow(BowSkill::CKnockback)) + .with_skill(Skill::Bow(BowSkill::CSpeed)) + .with_skill(Skill::Bow(BowSkill::CMove)) + .with_skill(Skill::Bow(BowSkill::UnlockRepeater)) + .with_skill(Skill::Bow(BowSkill::RArrows)) }, Some(ToolKind::Staff) => { // Staff - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Staff)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BExplosion)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BRegen)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BRadius)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FRange)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FVelocity)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::UnlockShockwave)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Staff)) + .with_skill(Skill::Staff(StaffSkill::BExplosion)) + .with_skill(Skill::Staff(StaffSkill::BRegen)) + .with_skill(Skill::Staff(StaffSkill::BRadius)) + .with_skill(Skill::Staff(StaffSkill::FDamage)) + .with_skill(Skill::Staff(StaffSkill::FRange)) + .with_skill(Skill::Staff(StaffSkill::FVelocity)) + .with_skill(Skill::Staff(StaffSkill::UnlockShockwave)) }, - _ => {}, + _ => Self::default(), } }, Some(Bandit) => { match active_item { Some(ToolKind::Sword) => { // Sword - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsCombo)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DCost)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SUnlockSpin)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SSpins)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SCost)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)) + .with_skill(Skill::Sword(SwordSkill::TsCombo)) + .with_skill(Skill::Sword(SwordSkill::TsDamage)) + .with_skill(Skill::Sword(SwordSkill::DDamage)) + .with_skill(Skill::Sword(SwordSkill::DCost)) + .with_skill(Skill::Sword(SwordSkill::UnlockSpin)) + .with_skill(Skill::Sword(SwordSkill::SDamage)) + .with_skill(Skill::Sword(SwordSkill::SSpins)) + .with_skill(Skill::Sword(SwordSkill::SCost)) }, Some(ToolKind::Axe) => { // Axe - skillset = skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Axe)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsCombo)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsSpeed)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsRegen)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SInfinite)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SDamage)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LUnlockLeap)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LKnockback)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LCost)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LDistance)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Axe)) + .with_skill(Skill::Axe(AxeSkill::DsCombo)) + .with_skill(Skill::Axe(AxeSkill::DsSpeed)) + .with_skill(Skill::Axe(AxeSkill::DsRegen)) + .with_skill(Skill::Axe(AxeSkill::SInfinite)) + .with_skill(Skill::Axe(AxeSkill::SDamage)) + .with_skill(Skill::Axe(AxeSkill::UnlockLeap)) + .with_skill(Skill::Axe(AxeSkill::LKnockback)) + .with_skill(Skill::Axe(AxeSkill::LCost)) + .with_skill(Skill::Axe(AxeSkill::LDistance)) }, Some(ToolKind::Hammer) => { // Hammer - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Hammer)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsDamage)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsRegen)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CDamage)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LUnlockLeap)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LDamage)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LCost)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LDistance)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Hammer)) + .with_skill(Skill::Hammer(HammerSkill::SsKnockback)) + .with_skill(Skill::Hammer(HammerSkill::SsDamage)) + .with_skill(Skill::Hammer(HammerSkill::SsRegen)) + .with_skill(Skill::Hammer(HammerSkill::CKnockback)) + .with_skill(Skill::Hammer(HammerSkill::CDamage)) + .with_skill(Skill::Hammer(HammerSkill::UnlockLeap)) + .with_skill(Skill::Hammer(HammerSkill::LDamage)) + .with_skill(Skill::Hammer(HammerSkill::LCost)) + .with_skill(Skill::Hammer(HammerSkill::LDistance)) }, Some(ToolKind::Bow) => { // Bow - skillset = skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Bow)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::BDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::ProjSpeed)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::BRegen)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CDrain)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CSpeed)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::UnlockRepeater)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RGlide)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RCost)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Bow)) + .with_skill(Skill::Bow(BowSkill::BDamage)) + .with_skill(Skill::Bow(BowSkill::ProjSpeed)) + .with_skill(Skill::Bow(BowSkill::BRegen)) + .with_skill(Skill::Bow(BowSkill::CDamage)) + .with_skill(Skill::Bow(BowSkill::CDrain)) + .with_skill(Skill::Bow(BowSkill::CSpeed)) + .with_skill(Skill::Bow(BowSkill::UnlockRepeater)) + .with_skill(Skill::Bow(BowSkill::RGlide)) + .with_skill(Skill::Bow(BowSkill::RCost)) }, Some(ToolKind::Staff) => { // Staff - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Staff)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BExplosion)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FRange)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FDrain)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::UnlockShockwave)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::SDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::SRange)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Staff)) + .with_skill(Skill::Staff(StaffSkill::BExplosion)) + .with_skill(Skill::Staff(StaffSkill::FDamage)) + .with_skill(Skill::Staff(StaffSkill::FRange)) + .with_skill(Skill::Staff(StaffSkill::FDrain)) + .with_skill(Skill::Staff(StaffSkill::UnlockShockwave)) + .with_skill(Skill::Staff(StaffSkill::SDamage)) + .with_skill(Skill::Staff(StaffSkill::SRange)) }, - _ => {}, + _ => Self::default(), } }, Some(CultistNovice) => { match active_item { Some(ToolKind::Sword) => { // Sword - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsCombo)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsRegen)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsSpeed)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DCost)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DDrain)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DScaling)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SUnlockSpin)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SSpeed)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SSpins)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SCost)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)) + .with_skill(Skill::Sword(SwordSkill::TsCombo)) + .with_skill(Skill::Sword(SwordSkill::TsRegen)) + .with_skill(Skill::Sword(SwordSkill::TsSpeed)) + .with_skill(Skill::Sword(SwordSkill::DDamage)) + .with_skill(Skill::Sword(SwordSkill::DCost)) + .with_skill(Skill::Sword(SwordSkill::DDrain)) + .with_skill(Skill::Sword(SwordSkill::DScaling)) + .with_skill(Skill::Sword(SwordSkill::UnlockSpin)) + .with_skill(Skill::Sword(SwordSkill::SSpeed)) + .with_skill(Skill::Sword(SwordSkill::SSpins)) + .with_skill(Skill::Sword(SwordSkill::SCost)) }, Some(ToolKind::Axe) => { // Axe - skillset = skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Axe)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsCombo)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SInfinite)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SHelicopter)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SDamage)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LUnlockLeap)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LKnockback)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LDistance)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Axe)) + .with_skill(Skill::Axe(AxeSkill::DsCombo)) + .with_skill(Skill::Axe(AxeSkill::SInfinite)) + .with_skill(Skill::Axe(AxeSkill::SHelicopter)) + .with_skill(Skill::Axe(AxeSkill::SDamage)) + .with_skill(Skill::Axe(AxeSkill::UnlockLeap)) + .with_skill(Skill::Axe(AxeSkill::LKnockback)) + .with_skill(Skill::Axe(AxeSkill::LDistance)) }, Some(ToolKind::Hammer) => { // Hammer - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Hammer)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsSpeed)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsRegen)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CDamage)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CDrain)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CSpeed)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LUnlockLeap)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LDamage)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LKnockback)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Hammer)) + .with_skill(Skill::Hammer(HammerSkill::SsKnockback)) + .with_skill(Skill::Hammer(HammerSkill::SsSpeed)) + .with_skill(Skill::Hammer(HammerSkill::SsRegen)) + .with_skill(Skill::Hammer(HammerSkill::CKnockback)) + .with_skill(Skill::Hammer(HammerSkill::CDamage)) + .with_skill(Skill::Hammer(HammerSkill::CDrain)) + .with_skill(Skill::Hammer(HammerSkill::CSpeed)) + .with_skill(Skill::Hammer(HammerSkill::UnlockLeap)) + .with_skill(Skill::Hammer(HammerSkill::LDamage)) + .with_skill(Skill::Hammer(HammerSkill::LKnockback)) }, Some(ToolKind::Bow) => { // Bow - skillset = skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Bow)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::BDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::ProjSpeed)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CKnockback)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CProjSpeed)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CDrain)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::UnlockRepeater)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RGlide)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RArrows)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Bow)) + .with_skill(Skill::Bow(BowSkill::BDamage)) + .with_skill(Skill::Bow(BowSkill::ProjSpeed)) + .with_skill(Skill::Bow(BowSkill::CDamage)) + .with_skill(Skill::Bow(BowSkill::CKnockback)) + .with_skill(Skill::Bow(BowSkill::CProjSpeed)) + .with_skill(Skill::Bow(BowSkill::CDrain)) + .with_skill(Skill::Bow(BowSkill::UnlockRepeater)) + .with_skill(Skill::Bow(BowSkill::RDamage)) + .with_skill(Skill::Bow(BowSkill::RGlide)) + .with_skill(Skill::Bow(BowSkill::RArrows)) }, Some(ToolKind::Staff) => { // Staff - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Staff)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BExplosion)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BRadius)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FRange)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FDrain)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FVelocity)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::UnlockShockwave)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::SDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::SRange)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Staff)) + .with_skill(Skill::Staff(StaffSkill::BExplosion)) + .with_skill(Skill::Staff(StaffSkill::BDamage)) + .with_skill(Skill::Staff(StaffSkill::BRadius)) + .with_skill(Skill::Staff(StaffSkill::FDamage)) + .with_skill(Skill::Staff(StaffSkill::FRange)) + .with_skill(Skill::Staff(StaffSkill::FDrain)) + .with_skill(Skill::Staff(StaffSkill::FVelocity)) + .with_skill(Skill::Staff(StaffSkill::UnlockShockwave)) + .with_skill(Skill::Staff(StaffSkill::SDamage)) + .with_skill(Skill::Staff(StaffSkill::SRange)) }, - _ => {}, + _ => Self::default(), } }, Some(CultistAcolyte) => { match active_item { Some(ToolKind::Sword) => { // Sword - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsCombo)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsSpeed)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DScaling)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SUnlockSpin)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SSpeed)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SSpins)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)) + .with_skill(Skill::Sword(SwordSkill::TsCombo)) + .with_skill(Skill::Sword(SwordSkill::TsDamage)) + .with_skill(Skill::Sword(SwordSkill::TsSpeed)) + .with_skill(Skill::Sword(SwordSkill::DDamage)) + .with_skill(Skill::Sword(SwordSkill::DScaling)) + .with_skill(Skill::Sword(SwordSkill::UnlockSpin)) + .with_skill(Skill::Sword(SwordSkill::SDamage)) + .with_skill(Skill::Sword(SwordSkill::SSpeed)) + .with_skill(Skill::Sword(SwordSkill::SSpins)) }, Some(ToolKind::Axe) => { // Axe - skillset = skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Axe)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsCombo)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsDamage)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SInfinite)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SDamage)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SCost)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LUnlockLeap)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LDamage)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LKnockback)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LCost)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LDistance)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Axe)) + .with_skill(Skill::Axe(AxeSkill::DsCombo)) + .with_skill(Skill::Axe(AxeSkill::DsDamage)) + .with_skill(Skill::Axe(AxeSkill::SInfinite)) + .with_skill(Skill::Axe(AxeSkill::SDamage)) + .with_skill(Skill::Axe(AxeSkill::SCost)) + .with_skill(Skill::Axe(AxeSkill::UnlockLeap)) + .with_skill(Skill::Axe(AxeSkill::LDamage)) + .with_skill(Skill::Axe(AxeSkill::LKnockback)) + .with_skill(Skill::Axe(AxeSkill::LCost)) + .with_skill(Skill::Axe(AxeSkill::LDistance)) }, Some(ToolKind::Hammer) => { // Hammer - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Hammer)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsDamage)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsRegen)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CDamage)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CDrain)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LUnlockLeap)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LDamage)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LRange)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Hammer)) + .with_skill(Skill::Hammer(HammerSkill::SsKnockback)) + .with_skill(Skill::Hammer(HammerSkill::SsDamage)) + .with_skill(Skill::Hammer(HammerSkill::SsRegen)) + .with_skill(Skill::Hammer(HammerSkill::CKnockback)) + .with_skill(Skill::Hammer(HammerSkill::CDamage)) + .with_skill(Skill::Hammer(HammerSkill::CDrain)) + .with_skill(Skill::Hammer(HammerSkill::UnlockLeap)) + .with_skill(Skill::Hammer(HammerSkill::LDamage)) + .with_skill(Skill::Hammer(HammerSkill::LRange)) }, Some(ToolKind::Bow) => { // Bow - skillset = skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Bow)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::BDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CKnockback)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CProjSpeed)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CDrain)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::UnlockRepeater)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RGlide)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RArrows)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RCost)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Bow)) + .with_skill(Skill::Bow(BowSkill::BDamage)) + .with_skill(Skill::Bow(BowSkill::CDamage)) + .with_skill(Skill::Bow(BowSkill::CKnockback)) + .with_skill(Skill::Bow(BowSkill::CProjSpeed)) + .with_skill(Skill::Bow(BowSkill::CDrain)) + .with_skill(Skill::Bow(BowSkill::UnlockRepeater)) + .with_skill(Skill::Bow(BowSkill::RDamage)) + .with_skill(Skill::Bow(BowSkill::RGlide)) + .with_skill(Skill::Bow(BowSkill::RArrows)) + .with_skill(Skill::Bow(BowSkill::RCost)) }, Some(ToolKind::Staff) => { // Staff - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Staff)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BExplosion)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BRadius)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FRange)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FVelocity)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::UnlockShockwave)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::SDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::SKnockback)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::SRange)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Staff)) + .with_skill(Skill::Staff(StaffSkill::BExplosion)) + .with_skill(Skill::Staff(StaffSkill::BDamage)) + .with_skill(Skill::Staff(StaffSkill::BRadius)) + .with_skill(Skill::Staff(StaffSkill::FDamage)) + .with_skill(Skill::Staff(StaffSkill::FRange)) + .with_skill(Skill::Staff(StaffSkill::FVelocity)) + .with_skill(Skill::Staff(StaffSkill::UnlockShockwave)) + .with_skill(Skill::Staff(StaffSkill::SDamage)) + .with_skill(Skill::Staff(StaffSkill::SKnockback)) + .with_skill(Skill::Staff(StaffSkill::SRange)) }, - _ => {}, + _ => Self::default(), } }, Some(Warlord) => { match active_item { Some(ToolKind::Sword) => { // Sword - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsCombo)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsRegen)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DCost)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DDrain)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SUnlockSpin)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SSpins)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SSpins)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SCost)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)) + .with_skill(Skill::Sword(SwordSkill::TsCombo)) + .with_skill(Skill::Sword(SwordSkill::TsDamage)) + .with_skill(Skill::Sword(SwordSkill::TsRegen)) + .with_skill(Skill::Sword(SwordSkill::DDamage)) + .with_skill(Skill::Sword(SwordSkill::DCost)) + .with_skill(Skill::Sword(SwordSkill::DDrain)) + .with_skill(Skill::Sword(SwordSkill::UnlockSpin)) + .with_skill(Skill::Sword(SwordSkill::SDamage)) + .with_skill(Skill::Sword(SwordSkill::SSpins)) + .with_skill(Skill::Sword(SwordSkill::SSpins)) + .with_skill(Skill::Sword(SwordSkill::SCost)) }, Some(ToolKind::Axe) => { // Axe - skillset = skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Axe)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsCombo)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsDamage)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsSpeed)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsRegen)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SInfinite)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SHelicopter)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SDamage)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SSpeed)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LUnlockLeap)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LDamage)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LKnockback)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LDistance)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Axe)) + .with_skill(Skill::Axe(AxeSkill::DsCombo)) + .with_skill(Skill::Axe(AxeSkill::DsDamage)) + .with_skill(Skill::Axe(AxeSkill::DsSpeed)) + .with_skill(Skill::Axe(AxeSkill::DsRegen)) + .with_skill(Skill::Axe(AxeSkill::SInfinite)) + .with_skill(Skill::Axe(AxeSkill::SHelicopter)) + .with_skill(Skill::Axe(AxeSkill::SDamage)) + .with_skill(Skill::Axe(AxeSkill::SSpeed)) + .with_skill(Skill::Axe(AxeSkill::UnlockLeap)) + .with_skill(Skill::Axe(AxeSkill::LDamage)) + .with_skill(Skill::Axe(AxeSkill::LKnockback)) + .with_skill(Skill::Axe(AxeSkill::LDistance)) }, Some(ToolKind::Hammer) => { // Hammer - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Hammer)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsDamage)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsSpeed)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsRegen)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CDamage)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CDrain)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LUnlockLeap)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LDamage)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LDistance)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LRange)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Hammer)) + .with_skill(Skill::Hammer(HammerSkill::SsKnockback)) + .with_skill(Skill::Hammer(HammerSkill::SsDamage)) + .with_skill(Skill::Hammer(HammerSkill::SsSpeed)) + .with_skill(Skill::Hammer(HammerSkill::SsRegen)) + .with_skill(Skill::Hammer(HammerSkill::CKnockback)) + .with_skill(Skill::Hammer(HammerSkill::CDamage)) + .with_skill(Skill::Hammer(HammerSkill::CDrain)) + .with_skill(Skill::Hammer(HammerSkill::UnlockLeap)) + .with_skill(Skill::Hammer(HammerSkill::LDamage)) + .with_skill(Skill::Hammer(HammerSkill::LDistance)) + .with_skill(Skill::Hammer(HammerSkill::LKnockback)) + .with_skill(Skill::Hammer(HammerSkill::LRange)) }, Some(ToolKind::Bow) => { // Bow - skillset = skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Bow)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::BDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::BRegen)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CKnockback)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CProjSpeed)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CSpeed)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CMove)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::UnlockRepeater)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RGlide)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RArrows)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RCost)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Bow)) + .with_skill(Skill::Bow(BowSkill::BDamage)) + .with_skill(Skill::Bow(BowSkill::BRegen)) + .with_skill(Skill::Bow(BowSkill::CDamage)) + .with_skill(Skill::Bow(BowSkill::CKnockback)) + .with_skill(Skill::Bow(BowSkill::CProjSpeed)) + .with_skill(Skill::Bow(BowSkill::CSpeed)) + .with_skill(Skill::Bow(BowSkill::CMove)) + .with_skill(Skill::Bow(BowSkill::UnlockRepeater)) + .with_skill(Skill::Bow(BowSkill::RDamage)) + .with_skill(Skill::Bow(BowSkill::RGlide)) + .with_skill(Skill::Bow(BowSkill::RArrows)) + .with_skill(Skill::Bow(BowSkill::RCost)) }, Some(ToolKind::Staff) => { // Staff - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Staff)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BExplosion)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BRegen)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BRadius)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FDrain)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FVelocity)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::UnlockShockwave)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::SDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::SKnockback)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::SCost)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Staff)) + .with_skill(Skill::Staff(StaffSkill::BExplosion)) + .with_skill(Skill::Staff(StaffSkill::BDamage)) + .with_skill(Skill::Staff(StaffSkill::BRegen)) + .with_skill(Skill::Staff(StaffSkill::BRadius)) + .with_skill(Skill::Staff(StaffSkill::FDamage)) + .with_skill(Skill::Staff(StaffSkill::FDrain)) + .with_skill(Skill::Staff(StaffSkill::FVelocity)) + .with_skill(Skill::Staff(StaffSkill::UnlockShockwave)) + .with_skill(Skill::Staff(StaffSkill::SDamage)) + .with_skill(Skill::Staff(StaffSkill::SKnockback)) + .with_skill(Skill::Staff(StaffSkill::SCost)) }, - _ => {}, + _ => Self::default(), } }, Some(Warlock) => { match active_item { Some(ToolKind::Sword) => { // Sword - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsCombo)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsRegen)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::TsSpeed)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DCost)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DDrain)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::DScaling)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SUnlockSpin)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SDamage)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SSpeed)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SSpins)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SSpins)); - skillset = skillset.with_skill(Skill::Sword(SwordSkill::SCost)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Sword)) + .with_skill(Skill::Sword(SwordSkill::TsCombo)) + .with_skill(Skill::Sword(SwordSkill::TsDamage)) + .with_skill(Skill::Sword(SwordSkill::TsRegen)) + .with_skill(Skill::Sword(SwordSkill::TsSpeed)) + .with_skill(Skill::Sword(SwordSkill::DDamage)) + .with_skill(Skill::Sword(SwordSkill::DDamage)) + .with_skill(Skill::Sword(SwordSkill::DCost)) + .with_skill(Skill::Sword(SwordSkill::DDrain)) + .with_skill(Skill::Sword(SwordSkill::DScaling)) + .with_skill(Skill::Sword(SwordSkill::UnlockSpin)) + .with_skill(Skill::Sword(SwordSkill::SDamage)) + .with_skill(Skill::Sword(SwordSkill::SSpeed)) + .with_skill(Skill::Sword(SwordSkill::SSpins)) + .with_skill(Skill::Sword(SwordSkill::SSpins)) + .with_skill(Skill::Sword(SwordSkill::SCost)) }, Some(ToolKind::Axe) => { // Axe - skillset = skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Axe)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsCombo)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsDamage)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsSpeed)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::DsRegen)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SInfinite)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SHelicopter)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SDamage)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SSpeed)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::SCost)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LUnlockLeap)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LDamage)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LKnockback)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LCost)); - skillset = skillset.with_skill(Skill::Axe(AxeSkill::LDistance)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Axe)) + .with_skill(Skill::Axe(AxeSkill::DsCombo)) + .with_skill(Skill::Axe(AxeSkill::DsDamage)) + .with_skill(Skill::Axe(AxeSkill::DsSpeed)) + .with_skill(Skill::Axe(AxeSkill::DsRegen)) + .with_skill(Skill::Axe(AxeSkill::SInfinite)) + .with_skill(Skill::Axe(AxeSkill::SHelicopter)) + .with_skill(Skill::Axe(AxeSkill::SDamage)) + .with_skill(Skill::Axe(AxeSkill::SSpeed)) + .with_skill(Skill::Axe(AxeSkill::SCost)) + .with_skill(Skill::Axe(AxeSkill::UnlockLeap)) + .with_skill(Skill::Axe(AxeSkill::LDamage)) + .with_skill(Skill::Axe(AxeSkill::LKnockback)) + .with_skill(Skill::Axe(AxeSkill::LCost)) + .with_skill(Skill::Axe(AxeSkill::LDistance)) }, Some(ToolKind::Hammer) => { // Hammer - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Hammer)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsDamage)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsSpeed)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::SsRegen)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CDamage)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CDrain)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::CSpeed)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LUnlockLeap)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LDamage)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LCost)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LDistance)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LKnockback)); - skillset = skillset.with_skill(Skill::Hammer(HammerSkill::LRange)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Hammer)) + .with_skill(Skill::Hammer(HammerSkill::SsKnockback)) + .with_skill(Skill::Hammer(HammerSkill::SsDamage)) + .with_skill(Skill::Hammer(HammerSkill::SsSpeed)) + .with_skill(Skill::Hammer(HammerSkill::SsRegen)) + .with_skill(Skill::Hammer(HammerSkill::CKnockback)) + .with_skill(Skill::Hammer(HammerSkill::CDamage)) + .with_skill(Skill::Hammer(HammerSkill::CDrain)) + .with_skill(Skill::Hammer(HammerSkill::CSpeed)) + .with_skill(Skill::Hammer(HammerSkill::UnlockLeap)) + .with_skill(Skill::Hammer(HammerSkill::LDamage)) + .with_skill(Skill::Hammer(HammerSkill::LCost)) + .with_skill(Skill::Hammer(HammerSkill::LDistance)) + .with_skill(Skill::Hammer(HammerSkill::LKnockback)) + .with_skill(Skill::Hammer(HammerSkill::LRange)) }, Some(ToolKind::Bow) => { // Bow - skillset = skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Bow)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::BDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::ProjSpeed)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::BRegen)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CKnockback)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CProjSpeed)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CDrain)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CSpeed)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::CMove)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::UnlockRepeater)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RDamage)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RGlide)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RArrows)); - skillset = skillset.with_skill(Skill::Bow(BowSkill::RCost)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Bow)) + .with_skill(Skill::Bow(BowSkill::BDamage)) + .with_skill(Skill::Bow(BowSkill::ProjSpeed)) + .with_skill(Skill::Bow(BowSkill::BRegen)) + .with_skill(Skill::Bow(BowSkill::CDamage)) + .with_skill(Skill::Bow(BowSkill::CKnockback)) + .with_skill(Skill::Bow(BowSkill::CProjSpeed)) + .with_skill(Skill::Bow(BowSkill::CDrain)) + .with_skill(Skill::Bow(BowSkill::CSpeed)) + .with_skill(Skill::Bow(BowSkill::CMove)) + .with_skill(Skill::Bow(BowSkill::UnlockRepeater)) + .with_skill(Skill::Bow(BowSkill::RDamage)) + .with_skill(Skill::Bow(BowSkill::RGlide)) + .with_skill(Skill::Bow(BowSkill::RArrows)) + .with_skill(Skill::Bow(BowSkill::RCost)) }, Some(ToolKind::Staff) => { // Staff - skillset = - skillset.with_skill_group(SkillGroupType::Weapon(ToolKind::Staff)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BExplosion)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BRegen)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::BRadius)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FRange)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FDrain)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::FVelocity)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::UnlockShockwave)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::SDamage)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::SKnockback)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::SRange)); - skillset = skillset.with_skill(Skill::Staff(StaffSkill::SCost)); + Self::default() + .with_skill_group(SkillGroupType::Weapon(ToolKind::Staff)) + .with_skill(Skill::Staff(StaffSkill::BExplosion)) + .with_skill(Skill::Staff(StaffSkill::BDamage)) + .with_skill(Skill::Staff(StaffSkill::BRegen)) + .with_skill(Skill::Staff(StaffSkill::BRadius)) + .with_skill(Skill::Staff(StaffSkill::FDamage)) + .with_skill(Skill::Staff(StaffSkill::FRange)) + .with_skill(Skill::Staff(StaffSkill::FDrain)) + .with_skill(Skill::Staff(StaffSkill::FVelocity)) + .with_skill(Skill::Staff(StaffSkill::UnlockShockwave)) + .with_skill(Skill::Staff(StaffSkill::SDamage)) + .with_skill(Skill::Staff(StaffSkill::SKnockback)) + .with_skill(Skill::Staff(StaffSkill::SRange)) + .with_skill(Skill::Staff(StaffSkill::SCost)) }, - _ => {}, + _ => Self::default(), } }, - Some(Villager) | None => {}, + Some(Villager) | None => Self::default(), } - - skillset } pub fn with_skill(mut self, skill: Skill) -> Self { diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index 41b8273cd1..43c57c151c 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -491,7 +491,7 @@ pub fn handle_ability3_input(data: &JoinData, update: &mut StateUpdate) { .stats .skill_set .skills - .contains_key(&Skill::Sword(SwordSkill::SUnlockSpin)) => + .contains_key(&Skill::Sword(SwordSkill::UnlockSpin)) => { None }, @@ -500,7 +500,7 @@ pub fn handle_ability3_input(data: &JoinData, update: &mut StateUpdate) { .stats .skill_set .skills - .contains_key(&Skill::Axe(AxeSkill::LUnlockLeap)) => + .contains_key(&Skill::Axe(AxeSkill::UnlockLeap)) => { None }, @@ -509,7 +509,7 @@ pub fn handle_ability3_input(data: &JoinData, update: &mut StateUpdate) { .stats .skill_set .skills - .contains_key(&Skill::Hammer(HammerSkill::LUnlockLeap)) => + .contains_key(&Skill::Hammer(HammerSkill::UnlockLeap)) => { None }, diff --git a/common/sys/src/agent.rs b/common/sys/src/agent.rs index eff3157e7e..4eaf46eafd 100644 --- a/common/sys/src/agent.rs +++ b/common/sys/src/agent.rs @@ -583,7 +583,7 @@ impl<'a> System<'a> for Sys { } else if *powerup > 4.0 && energy.current() > 10 { inputs.secondary.set_state(true); *powerup += dt.0; - } else if stats.skill_set.skills.contains_key(&Skill::Axe(AxeSkill::LUnlockLeap)) && energy.current() > 800 && thread_rng().gen_bool(0.5) { + } else if stats.skill_set.skills.contains_key(&Skill::Axe(AxeSkill::UnlockLeap)) && energy.current() > 800 && thread_rng().gen_bool(0.5) { inputs.ability3.set_state(true); *powerup += dt.0; } else { @@ -632,7 +632,7 @@ impl<'a> System<'a> for Sys { } else if *powerup > 2.0 { inputs.secondary.set_state(true); *powerup += dt.0; - } else if stats.skill_set.skills.contains_key(&Skill::Hammer(HammerSkill::LUnlockLeap)) && energy.current() > 700 + } else if stats.skill_set.skills.contains_key(&Skill::Hammer(HammerSkill::UnlockLeap)) && energy.current() > 700 && thread_rng().gen_bool(0.9) { inputs.ability3.set_state(true); *powerup += dt.0; @@ -662,7 +662,7 @@ impl<'a> System<'a> for Sys { .try_normalized() .unwrap_or(Vec2::zero()) * speed; - if stats.skill_set.skills.contains_key(&Skill::Hammer(HammerSkill::LUnlockLeap)) && *powerup > 5.0 { + if stats.skill_set.skills.contains_key(&Skill::Hammer(HammerSkill::UnlockLeap)) && *powerup > 5.0 { inputs.ability3.set_state(true); *powerup = 0.0; } else { @@ -690,7 +690,7 @@ impl<'a> System<'a> for Sys { Tactic::Sword => { if dist_sqrd < (MIN_ATTACK_DIST * scale).powi(2) { inputs.move_dir = Vec2::zero(); - if stats.skill_set.skills.contains_key(&Skill::Sword(SwordSkill::SUnlockSpin)) && *powerup < 2.0 && energy.current() > 600 { + if stats.skill_set.skills.contains_key(&Skill::Sword(SwordSkill::UnlockSpin)) && *powerup < 2.0 && energy.current() > 600 { inputs.ability3.set_state(true); *powerup += dt.0; } else if *powerup > 2.0 { diff --git a/server/src/migrations/2020-12-13-172324_skills/up.sql b/server/src/migrations/2020-12-13-172324_skills/up.sql index 06e19294e0..507a6ee0d7 100644 --- a/server/src/migrations/2020-12-13-172324_skills/up.sql +++ b/server/src/migrations/2020-12-13-172324_skills/up.sql @@ -53,5 +53,5 @@ CREATE TABLE skill ( -- Inserts starting skill group for everyone INSERT INTO skill_group -SELECT c.character_id, '"General"', 0, 0, 0 +SELECT c.character_id, 'General', 0, 0, 0 FROM character c \ No newline at end of file diff --git a/server/src/persistence/character.rs b/server/src/persistence/character.rs index 543f1dad2a..be5b993dd3 100644 --- a/server/src/persistence/character.rs +++ b/server/src/persistence/character.rs @@ -99,11 +99,11 @@ pub fn load_character_data( }); let skill_data = schema::skill::dsl::skill - .filter(schema::skill::dsl::character_id.eq(char_id)) + .filter(schema::skill::dsl::entity_id.eq(char_id)) .load::(&*connection)?; let skill_group_data = skill_group - .filter(schema::skill_group::dsl::character_id.eq(char_id)) + .filter(schema::skill_group::dsl::entity_id.eq(char_id)) .load::(&*connection)?; Ok(( @@ -324,10 +324,10 @@ pub fn delete_character( .first::(&*connection)?; // Delete skills - diesel::delete(skill_group.filter(schema::skill_group::dsl::character_id.eq(char_id))) + diesel::delete(skill_group.filter(schema::skill_group::dsl::entity_id.eq(char_id))) .execute(&*connection)?; - diesel::delete(skill.filter(schema::skill::dsl::character_id.eq(char_id))) + diesel::delete(skill.filter(schema::skill::dsl::entity_id.eq(char_id))) .execute(&*connection)?; // Delete character @@ -606,7 +606,7 @@ pub fn update( let delete_count = diesel::delete( schema::skill::dsl::skill.filter( - schema::skill::dsl::character_id.eq(char_id).and( + schema::skill::dsl::entity_id.eq(char_id).and( schema::skill::dsl::skill_type.ne_all( db_skills .iter() diff --git a/server/src/persistence/character/conversions.rs b/server/src/persistence/character/conversions.rs index fc2d3af44f..e25fd16a74 100644 --- a/server/src/persistence/character/conversions.rs +++ b/server/src/persistence/character/conversions.rs @@ -5,7 +5,7 @@ use crate::persistence::{ use crate::persistence::{ error::Error, - json_models::{CharacterPosition, HumanoidBody}, + json_models::{self, CharacterPosition, HumanoidBody}, }; use common::{ character::CharacterId, @@ -367,15 +367,7 @@ fn get_item_from_asset(item_definition_id: &str) -> Result Vec { let mut new_skill_groups = Vec::new(); for skill_group in skill_groups.iter() { - let skill_group_type = - serde_json::de::from_str::(&skill_group.skill_group_type) - .map_err(|err| { - Error::ConversionError(format!( - "Error de-serializing skill group: {} err: {}", - skill_group.skill_group_type, err - )) - }) - .unwrap(); + let skill_group_type = json_models::db_string_to_skill_group(&skill_group.skill_group_type); let new_skill_group = skills::SkillGroup { skill_group_type, exp: skill_group.exp as u16, @@ -390,28 +382,21 @@ fn convert_skill_groups_from_database(skill_groups: &[SkillGroup]) -> Vec HashMap { let mut new_skills = HashMap::new(); for skill in skills.iter() { - let new_skill = serde_json::de::from_str::(&skill.skill_type) - .map_err(|err| { - Error::ConversionError(format!( - "Error de-serializing skill: {} err: {}", - skill.skill_type, err - )) - }) - .unwrap(); + let new_skill = json_models::db_string_to_skill(&skill.skill_type); new_skills.insert(new_skill, skill.level.map(|l| l as u16)); } new_skills } pub fn convert_skill_groups_to_database( - character_id: CharacterId, + entity_id: CharacterId, skill_groups: Vec, ) -> Vec { let db_skill_groups: Vec<_> = skill_groups .into_iter() .map(|sg| SkillGroup { - character_id, - skill_group_type: serde_json::to_string(&sg.skill_group_type).unwrap(), + entity_id, + skill_group_type: json_models::skill_group_to_db_string(sg.skill_group_type), exp: sg.exp as i32, available_sp: sg.available_sp as i32, earned_sp: sg.earned_sp as i32, @@ -421,14 +406,14 @@ pub fn convert_skill_groups_to_database( } pub fn convert_skills_to_database( - character_id: CharacterId, + entity_id: CharacterId, skills: HashMap, ) -> Vec { let db_skills: Vec<_> = skills .iter() .map(|(s, l)| Skill { - character_id, - skill_type: serde_json::to_string(&s).unwrap(), + entity_id, + skill_type: json_models::skill_to_db_string(*s), level: l.map(|l| l as i32), }) .collect(); diff --git a/server/src/persistence/json_models.rs b/server/src/persistence/json_models.rs index 83353ee296..4a09580b5a 100644 --- a/server/src/persistence/json_models.rs +++ b/server/src/persistence/json_models.rs @@ -35,3 +35,271 @@ impl From<&comp::humanoid::Body> for HumanoidBody { pub struct CharacterPosition { pub waypoint: Vec3, } + +pub fn skill_to_db_string(skill: comp::skills::Skill) -> String { + use comp::{ + item::tool::ToolKind, + skills::{ + AxeSkill, BowSkill, GeneralSkill, HammerSkill, RollSkill, SceptreSkill, Skill::*, + SkillGroupType, StaffSkill, SwordSkill, + }, + }; + let skill_string = match skill { + General(GeneralSkill::HealthIncrease) => "General HealthIncrease", + General(GeneralSkill::EnergyIncrease) => "General EnergyIncrease", + Sword(SwordSkill::InterruptingAttacks) => "Sword InterruptingAttacks", + Sword(SwordSkill::TsCombo) => "Sword TsCombo", + Sword(SwordSkill::TsDamage) => "Sword TsDamage", + Sword(SwordSkill::TsRegen) => "Sword TsRegen", + Sword(SwordSkill::TsSpeed) => "Sword TsSpeed", + Sword(SwordSkill::DCost) => "Sword DCost", + Sword(SwordSkill::DDrain) => "Sword DDrain", + Sword(SwordSkill::DDamage) => "Sword DDamage", + Sword(SwordSkill::DScaling) => "Sword DScaling", + Sword(SwordSkill::DSpeed) => "Sword DSpeed", + Sword(SwordSkill::DInfinite) => "Sword DInfinite", + Sword(SwordSkill::UnlockSpin) => "Sword UnlockSpin", + Sword(SwordSkill::SDamage) => "Sword SDamage", + Sword(SwordSkill::SSpeed) => "Sword SSpeed", + Sword(SwordSkill::SCost) => "Sword SCost", + Sword(SwordSkill::SSpins) => "Sword SSpins", + Axe(AxeSkill::DsCombo) => "Axe DsCombo", + Axe(AxeSkill::DsDamage) => "Axe DsDamage", + Axe(AxeSkill::DsSpeed) => "Axe DsSpeed", + Axe(AxeSkill::DsRegen) => "Axe DsRegen", + Axe(AxeSkill::SInfinite) => "Axe SInfinite", + Axe(AxeSkill::SHelicopter) => "Axe SHelicopter", + Axe(AxeSkill::SDamage) => "Axe SDamage", + Axe(AxeSkill::SSpeed) => "Axe SSpeed", + Axe(AxeSkill::SCost) => "Axe SCost", + Axe(AxeSkill::UnlockLeap) => "Axe UnlockLeap", + Axe(AxeSkill::LDamage) => "Axe LDamage", + Axe(AxeSkill::LKnockback) => "Axe LKnockback", + Axe(AxeSkill::LCost) => "Axe LCost", + Axe(AxeSkill::LDistance) => "Axe LDistance", + Hammer(HammerSkill::SsKnockback) => "Hammer SsKnockback", + Hammer(HammerSkill::SsDamage) => "Hammer SsDamage", + Hammer(HammerSkill::SsSpeed) => "Hammer SsSpeed", + Hammer(HammerSkill::SsRegen) => "Hammer SsRegen", + Hammer(HammerSkill::CDamage) => "Hammer CDamage", + Hammer(HammerSkill::CKnockback) => "Hammer CKnockback", + Hammer(HammerSkill::CDrain) => "Hammer CDrain", + Hammer(HammerSkill::CSpeed) => "Hammer CSpeed", + Hammer(HammerSkill::UnlockLeap) => "Hammer UnlockLeap", + Hammer(HammerSkill::LDamage) => "Hammer LDamage", + Hammer(HammerSkill::LCost) => "Hammer LCost", + Hammer(HammerSkill::LDistance) => "Hammer LDistance", + Hammer(HammerSkill::LKnockback) => "Hammer LKnockback", + Hammer(HammerSkill::LRange) => "Hammer LRange", + Bow(BowSkill::ProjSpeed) => "Bow ProjSpeed", + Bow(BowSkill::BDamage) => "Bow BDamage", + Bow(BowSkill::BRegen) => "Bow BRegen", + Bow(BowSkill::CDamage) => "Bow CDamage", + Bow(BowSkill::CKnockback) => "Bow CKnockback", + Bow(BowSkill::CProjSpeed) => "Bow CProjSpeed", + Bow(BowSkill::CDrain) => "Bow CDrain", + Bow(BowSkill::CSpeed) => "Bow CSpeed", + Bow(BowSkill::CMove) => "Bow CMove", + Bow(BowSkill::UnlockRepeater) => "Bow UnlockRepeater", + Bow(BowSkill::RDamage) => "Bow RDamage", + Bow(BowSkill::RGlide) => "Bow RGlide", + Bow(BowSkill::RArrows) => "Bow RArrows", + Bow(BowSkill::RCost) => "Bow RCost", + Staff(StaffSkill::BExplosion) => "Staff BExplosion", + Staff(StaffSkill::BDamage) => "Staff BDamage", + Staff(StaffSkill::BRegen) => "Staff BRegen", + Staff(StaffSkill::BRadius) => "Staff BRadius", + Staff(StaffSkill::FDamage) => "Staff FDamage", + Staff(StaffSkill::FRange) => "Staff FRange", + Staff(StaffSkill::FDrain) => "Staff FDrain", + Staff(StaffSkill::FVelocity) => "Staff FVelocity", + Staff(StaffSkill::UnlockShockwave) => "Staff UnlockShockwave", + Staff(StaffSkill::SDamage) => "Staff SDamage", + Staff(StaffSkill::SKnockback) => "Staff SKnockback", + Staff(StaffSkill::SRange) => "Staff SRange", + Staff(StaffSkill::SCost) => "Staff SCost", + Sceptre(SceptreSkill::BHeal) => "Sceptre BHeal", + Sceptre(SceptreSkill::BDamage) => "Sceptre BDamage", + Sceptre(SceptreSkill::BRange) => "Sceptre BRange", + Sceptre(SceptreSkill::BLifesteal) => "Sceptre BLifesteal", + Sceptre(SceptreSkill::BRegen) => "Sceptre BRegen", + Sceptre(SceptreSkill::BCost) => "Sceptre BCost", + Sceptre(SceptreSkill::PHeal) => "Sceptre PHeal", + Sceptre(SceptreSkill::PDamage) => "Sceptre PDamage", + Sceptre(SceptreSkill::PRadius) => "Sceptre PRadius", + Sceptre(SceptreSkill::PCost) => "Sceptre PCost", + Sceptre(SceptreSkill::PProjSpeed) => "Sceptre PProjSpeed", + Roll(RollSkill::ImmuneMelee) => "Roll ImmuneMelee", + Roll(RollSkill::Cost) => "Roll Cost", + Roll(RollSkill::Strength) => "Roll Strength", + Roll(RollSkill::Duration) => "Roll Duration", + UnlockGroup(SkillGroupType::Weapon(ToolKind::Sword)) => "Unlock Weapon Sword", + UnlockGroup(SkillGroupType::Weapon(ToolKind::Axe)) => "Unlock Weapon Axe", + UnlockGroup(SkillGroupType::Weapon(ToolKind::Hammer)) => "Unlock Weapon Hammer", + UnlockGroup(SkillGroupType::Weapon(ToolKind::Bow)) => "Unlock Weapon Bow", + UnlockGroup(SkillGroupType::Weapon(ToolKind::Staff)) => "Unlock Weapon Staff", + UnlockGroup(SkillGroupType::Weapon(ToolKind::Sceptre)) => "Unlock Weapon Sceptre", + UnlockGroup(SkillGroupType::Weapon(ToolKind::Dagger)) + | UnlockGroup(SkillGroupType::Weapon(ToolKind::Shield)) + | UnlockGroup(SkillGroupType::Weapon(ToolKind::Debug)) + | UnlockGroup(SkillGroupType::Weapon(ToolKind::Farming)) + | UnlockGroup(SkillGroupType::Weapon(ToolKind::Empty)) + | UnlockGroup(SkillGroupType::Weapon(ToolKind::Unique(_))) + | UnlockGroup(SkillGroupType::General) => { + panic!("Tried to add unsupported skill to database: {:?}", skill) + }, + }; + skill_string.to_string() +} + +pub fn db_string_to_skill(skill_string: &str) -> comp::skills::Skill { + use comp::{ + item::tool::ToolKind, + skills::{ + AxeSkill, BowSkill, GeneralSkill, HammerSkill, RollSkill, SceptreSkill, Skill::*, + SkillGroupType, StaffSkill, SwordSkill, + }, + }; + match skill_string { + "General HealthIncrease" => General(GeneralSkill::HealthIncrease), + "General EnergyIncrease" => General(GeneralSkill::EnergyIncrease), + "Sword InterruptingAttacks" => Sword(SwordSkill::InterruptingAttacks), + "Sword TsCombo" => Sword(SwordSkill::TsCombo), + "Sword TsDamage" => Sword(SwordSkill::TsDamage), + "Sword TsRegen" => Sword(SwordSkill::TsRegen), + "Sword TsSpeed" => Sword(SwordSkill::TsSpeed), + "Sword DCost" => Sword(SwordSkill::DCost), + "Sword DDrain" => Sword(SwordSkill::DDrain), + "Sword DDamage" => Sword(SwordSkill::DDamage), + "Sword DScaling" => Sword(SwordSkill::DScaling), + "Sword DSpeed" => Sword(SwordSkill::DSpeed), + "Sword DInfinite" => Sword(SwordSkill::DInfinite), + "Sword UnlockSpin" => Sword(SwordSkill::UnlockSpin), + "Sword SDamage" => Sword(SwordSkill::SDamage), + "Sword SSpeed" => Sword(SwordSkill::SSpeed), + "Sword SCost" => Sword(SwordSkill::SCost), + "Sword SSpins" => Sword(SwordSkill::SSpins), + "Axe DsCombo" => Axe(AxeSkill::DsCombo), + "Axe DsDamage" => Axe(AxeSkill::DsDamage), + "Axe DsSpeed" => Axe(AxeSkill::DsSpeed), + "Axe DsRegen" => Axe(AxeSkill::DsRegen), + "Axe SInfinite" => Axe(AxeSkill::SInfinite), + "Axe SHelicopter" => Axe(AxeSkill::SHelicopter), + "Axe SDamage" => Axe(AxeSkill::SDamage), + "Axe SSpeed" => Axe(AxeSkill::SSpeed), + "Axe SCost" => Axe(AxeSkill::SCost), + "Axe UnlockLeap" => Axe(AxeSkill::UnlockLeap), + "Axe LDamage" => Axe(AxeSkill::LDamage), + "Axe LKnockback" => Axe(AxeSkill::LKnockback), + "Axe LCost" => Axe(AxeSkill::LCost), + "Axe LDistance" => Axe(AxeSkill::LDistance), + "Hammer SsKnockback" => Hammer(HammerSkill::SsKnockback), + "Hammer SsDamage" => Hammer(HammerSkill::SsDamage), + "Hammer SsSpeed" => Hammer(HammerSkill::SsSpeed), + "Hammer SsRegen" => Hammer(HammerSkill::SsRegen), + "Hammer CDamage" => Hammer(HammerSkill::CDamage), + "Hammer CKnockback" => Hammer(HammerSkill::CKnockback), + "Hammer CDrain" => Hammer(HammerSkill::CDrain), + "Hammer CSpeed" => Hammer(HammerSkill::CSpeed), + "Hammer UnlockLeap" => Hammer(HammerSkill::UnlockLeap), + "Hammer LDamage" => Hammer(HammerSkill::LDamage), + "Hammer LCost" => Hammer(HammerSkill::LCost), + "Hammer LDistance" => Hammer(HammerSkill::LDistance), + "Hammer LKnockback" => Hammer(HammerSkill::LKnockback), + "Hammer LRange" => Hammer(HammerSkill::LRange), + "Bow ProjSpeed" => Bow(BowSkill::ProjSpeed), + "Bow BDamage" => Bow(BowSkill::BDamage), + "Bow BRegen" => Bow(BowSkill::BRegen), + "Bow CDamage" => Bow(BowSkill::CDamage), + "Bow CKnockback" => Bow(BowSkill::CKnockback), + "Bow CProjSpeed" => Bow(BowSkill::CProjSpeed), + "Bow CDrain" => Bow(BowSkill::CDrain), + "Bow CSpeed" => Bow(BowSkill::CSpeed), + "Bow CMove" => Bow(BowSkill::CMove), + "Bow UnlockRepeater" => Bow(BowSkill::UnlockRepeater), + "Bow RDamage" => Bow(BowSkill::RDamage), + "Bow RGlide" => Bow(BowSkill::RGlide), + "Bow RArrows" => Bow(BowSkill::RArrows), + "Bow RCost" => Bow(BowSkill::RCost), + "Staff BExplosion" => Staff(StaffSkill::BExplosion), + "Staff BDamage" => Staff(StaffSkill::BDamage), + "Staff BRegen" => Staff(StaffSkill::BRegen), + "Staff BRadius" => Staff(StaffSkill::BRadius), + "Staff FDamage" => Staff(StaffSkill::FDamage), + "Staff FRange" => Staff(StaffSkill::FRange), + "Staff FDrain" => Staff(StaffSkill::FDrain), + "Staff FVelocity" => Staff(StaffSkill::FVelocity), + "Staff UnlockShockwave" => Staff(StaffSkill::UnlockShockwave), + "Staff SDamage" => Staff(StaffSkill::SDamage), + "Staff SKnockback" => Staff(StaffSkill::SKnockback), + "Staff SRange" => Staff(StaffSkill::SRange), + "Staff SCost" => Staff(StaffSkill::SCost), + "Sceptre BHeal" => Sceptre(SceptreSkill::BHeal), + "Sceptre BDamage" => Sceptre(SceptreSkill::BDamage), + "Sceptre BRange" => Sceptre(SceptreSkill::BRange), + "Sceptre BLifesteal" => Sceptre(SceptreSkill::BLifesteal), + "Sceptre BRegen" => Sceptre(SceptreSkill::BRegen), + "Sceptre BCost" => Sceptre(SceptreSkill::BCost), + "Sceptre PHeal" => Sceptre(SceptreSkill::PHeal), + "Sceptre PDamage" => Sceptre(SceptreSkill::PDamage), + "Sceptre PRadius" => Sceptre(SceptreSkill::PRadius), + "Sceptre PCost" => Sceptre(SceptreSkill::PCost), + "Sceptre PProjSpeed" => Sceptre(SceptreSkill::PProjSpeed), + "Roll ImmuneMelee" => Roll(RollSkill::ImmuneMelee), + "Roll Cost" => Roll(RollSkill::Cost), + "Roll Strength" => Roll(RollSkill::Strength), + "Roll Duration" => Roll(RollSkill::Duration), + "Unlock Weapon Sword" => UnlockGroup(SkillGroupType::Weapon(ToolKind::Sword)), + "Unlock Weapon Axe" => UnlockGroup(SkillGroupType::Weapon(ToolKind::Axe)), + "Unlock Weapon Hammer" => UnlockGroup(SkillGroupType::Weapon(ToolKind::Hammer)), + "Unlock Weapon Bow" => UnlockGroup(SkillGroupType::Weapon(ToolKind::Bow)), + "Unlock Weapon Staff" => UnlockGroup(SkillGroupType::Weapon(ToolKind::Staff)), + "Unlock Weapon Sceptre" => UnlockGroup(SkillGroupType::Weapon(ToolKind::Sceptre)), + _ => { + panic!( + "Tried to convert an unsupported string from the database: {}", + skill_string + ) + }, + } +} + +pub fn skill_group_to_db_string(skill_group: comp::skills::SkillGroupType) -> String { + use comp::{item::tool::ToolKind, skills::SkillGroupType::*}; + let skill_group_string = match skill_group { + General => "General", + Weapon(ToolKind::Sword) => "Weapon Sword", + Weapon(ToolKind::Axe) => "Weapon Axe", + Weapon(ToolKind::Hammer) => "Weapon Hammer", + Weapon(ToolKind::Bow) => "Weapon Bow", + Weapon(ToolKind::Staff) => "Weapon Staff", + Weapon(ToolKind::Sceptre) => "Weapon Sceptre", + Weapon(ToolKind::Dagger) + | Weapon(ToolKind::Shield) + | Weapon(ToolKind::Debug) + | Weapon(ToolKind::Farming) + | Weapon(ToolKind::Empty) + | Weapon(ToolKind::Unique(_)) => panic!( + "Tried to add unsupported skill group to database: {:?}", + skill_group + ), + }; + skill_group_string.to_string() +} + +pub fn db_string_to_skill_group(skill_group_string: &str) -> comp::skills::SkillGroupType { + use comp::{item::tool::ToolKind, skills::SkillGroupType::*}; + match skill_group_string { + "General" => General, + "Weapon Sword" => Weapon(ToolKind::Sword), + "Weapon Axe" => Weapon(ToolKind::Axe), + "Weapon Hammer" => Weapon(ToolKind::Hammer), + "Weapon Bow" => Weapon(ToolKind::Bow), + "Weapon Staff" => Weapon(ToolKind::Staff), + "Weapon Sceptre" => Weapon(ToolKind::Sceptre), + _ => panic!( + "Tried to convert an unsupported string from the database: {}", + skill_group_string + ), + } +} diff --git a/server/src/persistence/models.rs b/server/src/persistence/models.rs index 3bebab4182..288da1492e 100644 --- a/server/src/persistence/models.rs +++ b/server/src/persistence/models.rs @@ -48,19 +48,19 @@ pub struct Body { } #[derive(Associations, Identifiable, Insertable, Queryable, Debug)] -#[primary_key(character_id, skill_type)] +#[primary_key(entity_id, skill_type)] #[table_name = "skill"] pub struct Skill { - pub character_id: i64, + pub entity_id: i64, pub skill_type: String, pub level: Option, } #[derive(Associations, Identifiable, Insertable, Queryable, Debug)] -#[primary_key(character_id, skill_group_type)] +#[primary_key(entity_id, skill_group_type)] #[table_name = "skill_group"] pub struct SkillGroup { - pub character_id: i64, + pub entity_id: i64, pub skill_group_type: String, pub exp: i32, pub available_sp: i32, diff --git a/server/src/persistence/schema.rs b/server/src/persistence/schema.rs index 90a048c8f7..5f14e3ac98 100644 --- a/server/src/persistence/schema.rs +++ b/server/src/persistence/schema.rs @@ -32,8 +32,8 @@ table! { } table! { - skill (character_id, skill_type) { - character_id -> BigInt, + skill (entity_id, skill_type) { + entity_id -> BigInt, #[sql_name = "skill"] skill_type -> Text, level -> Nullable, @@ -41,8 +41,8 @@ table! { } table! { - skill_group (character_id, skill_group_type) { - character_id -> BigInt, + skill_group (entity_id, skill_group_type) { + entity_id -> BigInt, skill_group_type -> Text, exp -> Integer, available_sp -> Integer, diff --git a/voxygen/anim/src/character/spinmelee.rs b/voxygen/anim/src/character/spinmelee.rs index 2a801bfe39..26b810d9ff 100644 --- a/voxygen/anim/src/character/spinmelee.rs +++ b/voxygen/anim/src/character/spinmelee.rs @@ -24,42 +24,19 @@ impl Animation for SpinMeleeAnimation { #[allow(clippy::approx_constant)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section): Self::Dependency, + (active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency, anim_time: f64, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { *rate = 1.0; - let lab = 1.0; let (movement1, movement2, movement3) = match stage_section { - Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0), + Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)), _ => (0.0, 0.0, 0.0), }; - let speed = Vec2::::from(velocity).magnitude(); let mut next = (*skeleton).clone(); - //torso movement - let xshift = if velocity.z.abs() < 0.1 { - ((anim_time as f32 - 1.1) * lab as f32 * 3.0).sin() - } else { - 0.0 - }; - let yshift = if velocity.z.abs() < 0.1 { - ((anim_time as f32 - 1.1) * lab as f32 * 3.0 + PI / 2.0).sin() - } else { - 0.0 - }; - - let spin = if anim_time < 1.1 && velocity.z.abs() < 0.1 { - 0.5 * ((anim_time as f32).powi(2)) - } else { - lab as f32 * anim_time as f32 * 0.9 - }; - - //feet - let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin(); - let quick = (anim_time as f32 * lab as f32 * 8.0).sin(); match active_tool_kind { Some(ToolKind::Sword) => { @@ -81,7 +58,11 @@ impl Animation for SpinMeleeAnimation { ); next.torso.orientation = Quaternion::rotation_z(movement2 * PI * 2.0); - next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + movement1 * -2.0); + next.chest.position = Vec3::new( + 0.0, + s_a.chest.0 + movement1 * -2.0, + s_a.chest.1 + movement1 * -3.0, + ); next.chest.orientation = Quaternion::rotation_x(movement1 * -0.3) * Quaternion::rotation_y(movement1 * 0.15 + movement3 * -0.15); next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); @@ -90,66 +71,76 @@ impl Animation for SpinMeleeAnimation { next.belt.orientation = Quaternion::rotation_x(0.1); next.shorts.orientation = Quaternion::rotation_x(0.2); }, + Some(ToolKind::Axe) => { - next.head.position = Vec3::new(0.0, s_a.head.0 + 1.0, s_a.head.1 + 1.0); - - next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0); - next.hand_l.orientation = - Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(PI); - next.hand_r.position = Vec3::new(0.5, 0.0, -2.5); - next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0); - next.main.position = Vec3::new(-0.0, -2.0, -1.0); + next.main.position = Vec3::new(0.0, 0.0, 0.0); next.main.orientation = Quaternion::rotation_x(0.0); + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - next.control.position = Vec3::new(0.0, 16.0, 3.0); + next.control.position = Vec3::new( + s_a.ac.0 + movement1 * 8.0, + s_a.ac.1, + s_a.ac.2 + movement1 * -4.0, + ); next.control.orientation = - Quaternion::rotation_x(-1.4) * Quaternion::rotation_z(1.4); + Quaternion::rotation_x(s_a.ac.3 + movement1 * -0.8 * (1.0 - movement3)) + * Quaternion::rotation_y(s_a.ac.4 + movement1 * -PI * (1.0 - movement3)) + * Quaternion::rotation_z(s_a.ac.5 + movement1 * 1.2 * (1.0 - movement3)); next.head.orientation = - Quaternion::rotation_x(-0.15) * Quaternion::rotation_y(0.08); - next.chest.position = Vec3::new(0.0, s_a.chest.0 - 3.0, s_a.chest.1 - 2.0); - next.chest.orientation = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(-0.1) - * Quaternion::rotation_y(0.3); + Quaternion::rotation_x(movement1 * -0.2 * (1.0 - movement3)) + * Quaternion::rotation_z(movement1 * 0.4 * (1.0 - movement3)); + next.head.position = Vec3::new(0.0, s_a.head.0 + movement1 * 2.0, s_a.head.1); - next.belt.position = Vec3::new(0.0, 1.0, -1.0); - next.belt.orientation = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(0.4) - * Quaternion::rotation_y(0.0); - next.shorts.position = Vec3::new(0.0, 3.0, -2.5); - next.shorts.orientation = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(0.7) - * Quaternion::rotation_y(0.0); - next.torso.position = Vec3::new( - -xshift * (anim_time as f32).min(0.6), - -yshift * (anim_time as f32).min(0.6), + next.chest.position = Vec3::new( 0.0, - ) * s_a.scaler; - next.torso.orientation = Quaternion::rotation_z(spin * -16.0) - * Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(0.0); - if velocity.z.abs() > 0.1 { - next.foot_l.position = Vec3::new(-s_a.foot.0, 8.0, s_a.foot.2 + 2.0); - next.foot_l.orientation = - Quaternion::rotation_x(1.0) * Quaternion::rotation_z(0.0); + s_a.chest.0, + s_a.chest.1 + movement1 * -1.0 * (1.0 - movement3), + ); + next.chest.orientation = + Quaternion::rotation_x(movement1 * 0.3 * (1.0 - movement3)) + * Quaternion::rotation_y(movement1 * 0.3 * (1.0 - movement3)); - next.foot_r.position = Vec3::new(s_a.foot.0, 8.0, s_a.foot.2 + 2.0); - next.foot_r.orientation = Quaternion::rotation_x(1.0); - } else if speed < 0.5 { - next.foot_l.position = Vec3::new(-s_a.foot.0, 2.0 + quick * -6.0, s_a.foot.2); - next.foot_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2); + next.belt.position = Vec3::new( + 0.0, + 1.0 + s_a.belt.0, + s_a.belt.1 + movement1 * 0.5 * (1.0 - movement3), + ); + next.belt.orientation = Quaternion::rotation_x(0.15); + next.shorts.position = Vec3::new( + 0.0, + 1.0 + s_a.shorts.0 + movement1 * 1.0 * (1.0 - movement3), + s_a.shorts.1 + movement1 * 1.0 * (1.0 - movement3), + ); + next.shorts.orientation = + Quaternion::rotation_x(0.15 + 0.15 * movement1 * (1.0 - movement3)); - next.foot_r.position = Vec3::new(s_a.foot.0, 4.0, s_a.foot.2); - next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2) - * Quaternion::rotation_y(-0.4); - } else { - next.foot_l.position = Vec3::new(-s_a.foot.0, 2.0 + quick * -6.0, s_a.foot.2); - next.foot_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2); + next.torso.orientation = Quaternion::rotation_z( + movement1 * 1.0 * (1.0 - movement3) + movement2 * -2.0 * PI, + ); - next.foot_r.position = Vec3::new(s_a.foot.0, 2.0 + quick * 6.0, s_a.foot.2); - next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2); - }; + next.foot_l.position = Vec3::new( + -s_a.foot.0, + s_a.foot.1 + movement1 * 7.0 * (1.0 - movement3), + s_a.foot.2, + ); + next.foot_l.orientation = + Quaternion::rotation_x(movement1 * 0.8 * (1.0 - movement3)); + + next.foot_r.position = Vec3::new( + s_a.foot.0, + s_a.foot.1 + movement1 * -3.0 * (1.0 - movement3), + s_a.foot.2, + ); + next.foot_r.orientation = + Quaternion::rotation_x(movement1 * -0.5 * (1.0 - movement3)); }, + _ => {}, } diff --git a/voxygen/anim/src/dyn_lib.rs b/voxygen/anim/src/dyn_lib.rs index 71c12e90aa..7f817f625f 100644 --- a/voxygen/anim/src/dyn_lib.rs +++ b/voxygen/anim/src/dyn_lib.rs @@ -1,4 +1,3 @@ -use hashbrown::HashSet; use lazy_static::lazy_static; use libloading::Library; use notify::{immediate_watcher, EventKind, RecursiveMode, Watcher}; @@ -148,7 +147,7 @@ pub fn init() { // "Debounces" events since I can't find the option to do this in the latest // `notify` thread::spawn(move || { - let mut modified_paths = HashSet::new(); + let mut modified_paths = std::collections::HashSet::new(); while let Ok(path) = reload_recv.recv() { modified_paths.insert(path); diff --git a/voxygen/src/hud/diary.rs b/voxygen/src/hud/diary.rs index 669a49848f..10de56df51 100644 --- a/voxygen/src/hud/diary.rs +++ b/voxygen/src/hud/diary.rs @@ -1275,7 +1275,7 @@ impl<'a> Widget for Diary<'a> { events.push(Event::UnlockSkill(skill)); }; // Bottom left skills - let skill = Skill::Sword(SUnlockSpin); + let skill = Skill::Sword(UnlockSpin); if create_skill_button( self.imgs.sword_whirlwind, state.skills_bot_l[0], @@ -1708,7 +1708,7 @@ impl<'a> Widget for Diary<'a> { events.push(Event::UnlockSkill(skill)); }; // Bottom left skills - let skill = Skill::Axe(LUnlockLeap); + let skill = Skill::Axe(UnlockLeap); if create_skill_button( self.imgs.axespin, state.skills_bot_l[0], @@ -2102,7 +2102,7 @@ impl<'a> Widget for Diary<'a> { events.push(Event::UnlockSkill(skill)); }; // Bottom left skills - let skill = Skill::Hammer(LUnlockLeap); + let skill = Skill::Hammer(UnlockLeap); if create_skill_button( self.imgs.hammergolf, state.skills_bot_l[0], diff --git a/voxygen/src/hud/hotbar.rs b/voxygen/src/hud/hotbar.rs index 9f3f61a2ca..72edd68bea 100644 --- a/voxygen/src/hud/hotbar.rs +++ b/voxygen/src/hud/hotbar.rs @@ -90,15 +90,15 @@ impl State { ToolKind::Sword => stat .skill_set .skills - .contains_key(&Skill::Sword(skills::SwordSkill::SUnlockSpin)), + .contains_key(&Skill::Sword(skills::SwordSkill::UnlockSpin)), ToolKind::Axe => stat .skill_set .skills - .contains_key(&Skill::Axe(skills::AxeSkill::LUnlockLeap)), + .contains_key(&Skill::Axe(skills::AxeSkill::UnlockLeap)), ToolKind::Hammer => stat .skill_set .skills - .contains_key(&Skill::Hammer(skills::HammerSkill::LUnlockLeap)), + .contains_key(&Skill::Hammer(skills::HammerSkill::UnlockLeap)), ToolKind::Bow => stat .skill_set .skills diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 1dda1ab9a4..12567b7bdb 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -1152,7 +1152,7 @@ impl Hud { 300.0 - (display.timer as f64 - tweak!(2.0)) * tweak!(-300.0) } else { 300.0 - }; + }; Image::new(self.imgs.level_up) .w_h(328.0, 126.0) .mid_top_with_margin_on(ui_widgets.window, offset) diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 4edd0c761e..3f518b51ee 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -1073,7 +1073,7 @@ impl FigureMgr { }, CharacterState::SpinMelee(s) => { let stage_progress = match active_tool_kind { - Some(ToolKind::Sword) => { + Some(ToolKind::Axe | ToolKind::Sword) => { let stage_time = s.timer.as_secs_f64(); match s.stage_section { StageSection::Buildup => {