Removed health sclaing from summon character state.

This commit is contained in:
Sam 2022-01-16 18:18:23 -05:00
parent f306e01433
commit 31a894601f
6 changed files with 32 additions and 14 deletions

View File

@ -7,7 +7,7 @@ BasicSummon(
summon_info: (
body: Object(Tornado),
scale: None,
health_scaling: None,
has_health: false,
loadout_config: None,
skillset_config: None,
),

View File

@ -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,
)

View File

@ -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,
),

View File

@ -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 {

View File

@ -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<SkillNode>);
@ -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

View File

@ -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<comp::Scale>,
health_scaling: Option<u16>,
has_health: bool,
// TODO: use assets for specifying skills and loadout?
loadout_config: Option<loadout_builder::Preset>,
skillset_config: Option<skillset_builder::Preset>,