From 31a894601f307e324a9a308c60e41610626e613b Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 16 Jan 2022 18:18:23 -0500 Subject: [PATCH 1/2] Removed health sclaing from summon character state. --- .../custom/birdlargebasic/summontornadoes.ron | 2 +- .../custom/mindflayer/summonminions.ron | 4 ++-- .../abilities/custom/tidalwarrior/totem.ron | 2 +- common/src/comp/body.rs | 2 +- common/src/skillset_builder.rs | 18 ++++++++++++++++-- common/src/states/basic_summon.rs | 18 +++++++++++------- 6 files changed, 32 insertions(+), 14 deletions(-) diff --git a/assets/common/abilities/custom/birdlargebasic/summontornadoes.ron b/assets/common/abilities/custom/birdlargebasic/summontornadoes.ron index 66240b64a6..3eb2a494d6 100644 --- a/assets/common/abilities/custom/birdlargebasic/summontornadoes.ron +++ b/assets/common/abilities/custom/birdlargebasic/summontornadoes.ron @@ -7,7 +7,7 @@ BasicSummon( summon_info: ( body: Object(Tornado), scale: None, - health_scaling: None, + has_health: false, loadout_config: None, skillset_config: None, ), diff --git a/assets/common/abilities/custom/mindflayer/summonminions.ron b/assets/common/abilities/custom/mindflayer/summonminions.ron index 1716608e3c..af48510a48 100644 --- a/assets/common/abilities/custom/mindflayer/summonminions.ron +++ b/assets/common/abilities/custom/mindflayer/summonminions.ron @@ -10,9 +10,9 @@ BasicSummon( body_type: Male, )), scale: None, - health_scaling: Some(80), + has_health: true, loadout_config: Some(HuskSummon), - skillset_config: None, + skillset_config: Some(Rank5), ), duration: None, ) diff --git a/assets/common/abilities/custom/tidalwarrior/totem.ron b/assets/common/abilities/custom/tidalwarrior/totem.ron index c997b8954c..0f6ffaac43 100644 --- a/assets/common/abilities/custom/tidalwarrior/totem.ron +++ b/assets/common/abilities/custom/tidalwarrior/totem.ron @@ -7,7 +7,7 @@ BasicSummon( summon_info: ( body: Object(SeaLantern), scale: None, - health_scaling: Some(0), + has_health: true, loadout_config: None, skillset_config: None, ), diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index dfb79752f9..8e1c6ad3c4 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -603,7 +603,7 @@ impl Body { biped_small::Species::Sahagin => 85, biped_small::Species::Haniwa => 100, biped_small::Species::Myrmidon => 100, - biped_small::Species::Husk => 20, + biped_small::Species::Husk => 50, _ => 60, }, Body::Object(object) => match object { diff --git a/common/src/skillset_builder.rs b/common/src/skillset_builder.rs index dec454c499..643571f638 100644 --- a/common/src/skillset_builder.rs +++ b/common/src/skillset_builder.rs @@ -10,7 +10,13 @@ use tracing::warn; /// When you're adding new enum variant, /// handle it in [`with_preset`](SkillSetBuilder::with_preset) method #[derive(Copy, Clone, PartialEq, Serialize, Deserialize, Debug)] -pub enum Preset {} +pub enum Preset { + Rank1, + Rank2, + Rank3, + Rank4, + Rank5, +} #[derive(Debug, Deserialize, Clone)] struct SkillSetTree(Vec); @@ -87,7 +93,15 @@ impl SkillSetBuilder { /// Applies preset #[must_use] - pub const fn with_preset(self, _preset: Preset) -> Self { self } + pub fn with_preset(self, preset: Preset) -> Self { + match preset { + Preset::Rank1 => self.with_asset_expect("common.skillset.preset.rank1.fullskill"), + Preset::Rank2 => self.with_asset_expect("common.skillset.preset.rank2.fullskill"), + Preset::Rank3 => self.with_asset_expect("common.skillset.preset.rank3.fullskill"), + Preset::Rank4 => self.with_asset_expect("common.skillset.preset.rank4.fullskill"), + Preset::Rank5 => self.with_asset_expect("common.skillset.preset.rank5.fullskill"), + } + } #[must_use] /// # Panics diff --git a/common/src/states/basic_summon.rs b/common/src/states/basic_summon.rs index 1a203ade97..6648473a6d 100644 --- a/common/src/states/basic_summon.rs +++ b/common/src/states/basic_summon.rs @@ -3,6 +3,7 @@ use crate::{ self, character_state::OutputEvents, inventory::loadout_builder::{self, LoadoutBuilder}, + skillset::skills, Behavior, BehaviorCapability, CharacterState, Projectile, StateUpdate, }, event::{LocalEvent, ServerEvent}, @@ -113,11 +114,14 @@ impl CharacterBehavior for Data { let stats = comp::Stats::new("Summon".to_string()); - let health_scaling = self - .static_data - .summon_info - .health_scaling - .map(|health_scaling| comp::Health::new(body, health_scaling)); + let health = self.static_data.summon_info.has_health.then_some({ + let health_level = skill_set + .skill_level(skills::Skill::General( + skills::GeneralSkill::HealthIncrease, + )) + .unwrap_or(0); + comp::Health::new(body, health_level) + }); // Ray cast to check where summon should happen let summon_frac = @@ -173,7 +177,7 @@ impl CharacterBehavior for Data { pos: comp::Pos(collision_vector - Vec3::unit_z() * obstacle_z), stats, skill_set, - health: health_scaling, + health, poise: comp::Poise::new(body), loadout, body, @@ -250,7 +254,7 @@ impl CharacterBehavior for Data { pub struct SummonInfo { body: comp::Body, scale: Option, - health_scaling: Option, + has_health: bool, // TODO: use assets for specifying skills and loadout? loadout_config: Option, skillset_config: Option, From bc402dd1b2f2ca48d2664d4aebaa46b8e6506b05 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 16 Jan 2022 18:36:46 -0500 Subject: [PATCH 2/2] Changed `then_some` to `then` --- common/src/states/basic_summon.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/states/basic_summon.rs b/common/src/states/basic_summon.rs index 6648473a6d..08c1e24575 100644 --- a/common/src/states/basic_summon.rs +++ b/common/src/states/basic_summon.rs @@ -114,7 +114,7 @@ impl CharacterBehavior for Data { let stats = comp::Stats::new("Summon".to_string()); - let health = self.static_data.summon_info.has_health.then_some({ + let health = self.static_data.summon_info.has_health.then(|| { let health_level = skill_set .skill_level(skills::Skill::General( skills::GeneralSkill::HealthIncrease,