From c7cc287e89226ca2d89bfd83fae7179844c23b37 Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Wed, 20 Mar 2024 16:01:11 +0200 Subject: [PATCH] Respond to review - Add changelog - Remove unused code --- CHANGELOG.md | 4 +++- assets/server/manifests/presets.ron | 4 ---- common/src/comp/ability.rs | 5 +---- common/src/comp/energy.rs | 18 +++--------------- common/src/comp/health.rs | 21 +++------------------ common/src/comp/skillset/skills.rs | 8 -------- common/src/consts.rs | 4 ---- common/src/states/basic_summon.rs | 2 +- common/systems/tests/character_state.rs | 2 +- common/systems/tests/phys/utils.rs | 4 ++-- server/src/cmd.rs | 4 ++-- server/src/state_ext.rs | 10 +++++----- server/src/sys/terrain.rs | 2 +- 13 files changed, 22 insertions(+), 66 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e94e6c8c6c..1a6017d271 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -95,11 +95,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Plugin interface based on WASI 0.2 WIT, wasmtime executes these components. - Balance changes; Smoother entity progression consisting of larger variety in (effective) health pools, DPS, entity flee_health alterations, and minor weight distribution changes for entity spawns. - Made power of weapon tiers scale non-linearly. -- Sword Changes; Pommel Strike has been nerfed -> increased energy cost, increased _durations, and decreased poise damage. Heavy Sweep has been nerfed -> decreased poise damage and stun vulnerability damage. Pillar Thrust has been altered -> decreased maximum base damage with an increase in stun vulnerability damage. +- Sword Changes; Pommel Strike has been nerfed -> increased energy cost, increased durations, and decreased poise damage. Heavy Sweep has been nerfed -> decreased poise damage and stun vulnerability damage. Pillar Thrust has been altered -> decreased maximum base damage with an increase in stun vulnerability damage. - Weapons block are based on poise. - Wooden Shield recipe. - Overhauled the visuals of several cave biomes. - Dropped items now merge dynamically (including non-stackables). +- You no longer need to unlock health, energy and roll skills to get to max. +- Rolls now don't skip recovery, and instead have increased buildup during ability interrupts. ### Removed diff --git a/assets/server/manifests/presets.ron b/assets/server/manifests/presets.ron index 2a6eb63f6a..3788c7d7da 100644 --- a/assets/server/manifests/presets.ron +++ b/assets/server/manifests/presets.ron @@ -140,8 +140,6 @@ ], // Just copypasta from max with random reductions "middle": [ - // General skills - // Sword (UnlockGroup(Weapon(Sword)), 1), @@ -225,8 +223,6 @@ ], // Basic skill preset to unlock all abilities "basic": [ - // General skills - // Sword (UnlockGroup(Weapon(Sword)), 1), diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs index 2c0d7a7e2a..54eae6dd46 100644 --- a/common/src/comp/ability.rs +++ b/common/src/comp/ability.rs @@ -1917,8 +1917,7 @@ impl CharacterAbility { Some(ToolKind::Staff) => self.adjusted_by_staff_skills(skillset), Some(ToolKind::Sceptre) => self.adjusted_by_sceptre_skills(skillset), Some(ToolKind::Pick) => self.adjusted_by_mining_skills(skillset), - None => self.adjusted_by_general_skills(skillset), - Some(_) => {}, + None | Some(_) => {}, } self } @@ -1944,8 +1943,6 @@ impl CharacterAbility { } } - fn adjusted_by_general_skills(&mut self, _skillset: &SkillSet) {} - fn adjusted_by_hammer_skills(&mut self, skillset: &SkillSet) { #![allow(clippy::enum_glob_use)] use skills::{HammerSkill::*, Skill::Hammer}; diff --git a/common/src/comp/energy.rs b/common/src/comp/energy.rs index 2d7751cdb4..17e075c9a5 100644 --- a/common/src/comp/energy.rs +++ b/common/src/comp/energy.rs @@ -1,4 +1,4 @@ -use crate::{comp, consts::ENERGY_PER_LEVEL}; +use crate::comp; use serde::{Deserialize, Serialize}; use specs::{Component, DerefFlaggedStorage}; use std::ops::Mul; @@ -82,11 +82,8 @@ impl Energy { self.current = self.current.min(self.maximum); } - pub fn new(body: comp::Body, level: u16) -> Self { - let energy = u32::from( - body.base_energy() - .saturating_add(ENERGY_PER_LEVEL.saturating_mul(level)), - ) * Self::SCALING_FACTOR_INT; + pub fn new(body: comp::Body) -> Self { + let energy = u32::from(body.base_energy()) * Self::SCALING_FACTOR_INT; Energy { current: energy, base_max: energy, @@ -130,15 +127,6 @@ impl Energy { } } - pub fn update_max_energy(&mut self, body: comp::Body, level: u16) { - let old_max = self.base_max; - self.base_max = u32::from( - body.base_energy() - .saturating_add(ENERGY_PER_LEVEL.saturating_mul(level)), - ) * Self::SCALING_FACTOR_INT; - self.current = (self.current + self.base_max - old_max).min(self.maximum); - } - pub fn refresh(&mut self) { self.current = self.maximum; } } diff --git a/common/src/comp/health.rs b/common/src/comp/health.rs index 3837166bb2..a59f29b37c 100644 --- a/common/src/comp/health.rs +++ b/common/src/comp/health.rs @@ -1,6 +1,4 @@ -use crate::{ - combat::DamageContributor, comp, consts::HP_PER_LEVEL, resources::Time, uid::Uid, DamageSource, -}; +use crate::{combat::DamageContributor, comp, resources::Time, uid::Uid, DamageSource}; use hashbrown::HashMap; use serde::{Deserialize, Serialize}; use specs::{Component, DerefFlaggedStorage}; @@ -117,11 +115,8 @@ impl Health { self.current = self.current.min(self.maximum); } - pub fn new(body: comp::Body, level: u16) -> Self { - let health = u32::from( - body.base_health() - .saturating_add(HP_PER_LEVEL.saturating_mul(level)), - ) * Self::SCALING_FACTOR_INT; + pub fn new(body: comp::Body) -> Self { + let health = u32::from(body.base_health()) * Self::SCALING_FACTOR_INT; Health { current: health, base_max: health, @@ -139,16 +134,6 @@ impl Health { } } - // TODO: Delete this once stat points will be a thing - pub fn update_max_hp(&mut self, body: comp::Body, level: u16) { - let old_max = self.base_max; - self.base_max = u32::from( - body.base_health() - .saturating_add(HP_PER_LEVEL.saturating_mul(level)), - ) * Self::SCALING_FACTOR_INT; - self.current = (self.current + self.base_max - old_max).min(self.maximum); - } - /// Returns a boolean if the delta was not zero. pub fn change_by(&mut self, change: HealthChange) -> bool { let prev_health = i64::from(self.current); diff --git a/common/src/comp/skillset/skills.rs b/common/src/comp/skillset/skills.rs index 18c0754631..6179cb25de 100644 --- a/common/src/comp/skillset/skills.rs +++ b/common/src/comp/skillset/skills.rs @@ -11,14 +11,12 @@ use serde::{Deserialize, Serialize}; // SkillTree Modifiers below. #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Serialize, Deserialize, Ord, PartialOrd)] pub enum Skill { - General(GeneralSkill), Sword(SwordSkill), Axe(AxeSkill), Hammer(HammerSkill), Bow(BowSkill), Staff(StaffSkill), Sceptre(SceptreSkill), - Roll(RollSkill), Climb(ClimbSkill), Swim(SwimSkill), Pick(MiningSkill), @@ -162,12 +160,6 @@ pub enum SceptreSkill { ACost, } -#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Serialize, Deserialize, Ord, PartialOrd)] -pub enum GeneralSkill {} - -#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Serialize, Deserialize, Ord, PartialOrd)] -pub enum RollSkill {} - #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Serialize, Deserialize, Ord, PartialOrd)] pub enum ClimbSkill { Cost, diff --git a/common/src/consts.rs b/common/src/consts.rs index c03aa987f3..77e2e0d346 100644 --- a/common/src/consts.rs +++ b/common/src/consts.rs @@ -31,10 +31,6 @@ pub const MIN_RECOMMENDED_TOKIO_THREADS: usize = 2; pub const SOUND_TRAVEL_DIST_PER_VOLUME: f32 = 3.0; -// Stat increase per level (multiplied by 10 compared to what you'll see in UI) -pub const ENERGY_PER_LEVEL: u16 = 5; -pub const HP_PER_LEVEL: u16 = 5; - pub const TELEPORTER_RADIUS: f32 = 3.; // Map settings diff --git a/common/src/states/basic_summon.rs b/common/src/states/basic_summon.rs index ff5aea216e..17fa0ffb7f 100644 --- a/common/src/states/basic_summon.rs +++ b/common/src/states/basic_summon.rs @@ -134,7 +134,7 @@ impl CharacterBehavior for Data { .static_data .summon_info .has_health - .then(|| comp::Health::new(body, 0)); + .then(|| comp::Health::new(body)); // Ray cast to check where summon should happen let summon_frac = diff --git a/common/systems/tests/character_state.rs b/common/systems/tests/character_state.rs index 0099c57f05..a6805e044c 100644 --- a/common/systems/tests/character_state.rs +++ b/common/systems/tests/character_state.rs @@ -64,7 +64,7 @@ mod tests { .with(body.mass()) .with(body.density()) .with(body) - .with(Energy::new(body, 0)) + .with(Energy::new(body)) .with(Controller::default()) .with(Poise::new(body)) .with(skill_set) diff --git a/common/systems/tests/phys/utils.rs b/common/systems/tests/phys/utils.rs index cac5788f25..396dcef410 100644 --- a/common/systems/tests/phys/utils.rs +++ b/common/systems/tests/phys/utils.rs @@ -128,8 +128,8 @@ pub fn create_player(state: &mut State) -> Entity { .with(Buffs::default()) .with(Combo::default()) .with(Auras::default()) - .with(Energy::new(body, 0)) - .with(Health::new(body, body.base_health())) + .with(Energy::new(body)) + .with(Health::new(body)) .with(skill_set) .with(Stats::empty(body)) .build() diff --git a/server/src/cmd.rs b/server/src/cmd.rs index 7ae44ff56c..3cf5d6851b 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -1689,7 +1689,7 @@ fn handle_spawn( comp::Ori::default(), comp::Stats::new(get_npc_name(id, npc::BodyType::from_body(body)), body), comp::SkillSet::default(), - Some(comp::Health::new(body, 0)), + Some(comp::Health::new(body)), comp::Poise::new(body), inventory, body, @@ -1778,7 +1778,7 @@ fn handle_spawn_training_dummy( let stats = comp::Stats::new("Training Dummy".to_string(), body); let skill_set = comp::SkillSet::default(); - let health = comp::Health::new(body, 0); + let health = comp::Health::new(body); let poise = comp::Poise::new(body); server diff --git a/server/src/state_ext.rs b/server/src/state_ext.rs index e0d99c9d31..04fbddb020 100644 --- a/server/src/state_ext.rs +++ b/server/src/state_ext.rs @@ -297,7 +297,7 @@ impl StateExt for State { .with(body.collider()) .with(comp::Controller::default()) .with(body) - .with(comp::Energy::new(body, 0)) + .with(comp::Energy::new(body)) .with(stats) .with(if body.is_humanoid() { comp::ActiveAbilities::default_limited(BASE_ABILITY_LIMIT) @@ -428,7 +428,7 @@ impl StateExt for State { .with(comp::CharacterActivity::default()) // TODO: some of these are required in order for the character_behavior system to // recognize a possesed airship; that system should be refactored to use `.maybe()` - .with(comp::Energy::new(ship.into(), 0)) + .with(comp::Energy::new(ship.into())) .with(comp::Stats::new("Airship".to_string(), body)) .with(comp::SkillSet::default()) .with(comp::ActiveAbilities::default()) @@ -727,8 +727,8 @@ impl StateExt for State { self.write_component_ignore_entity_dead(entity, body); self.write_component_ignore_entity_dead(entity, body.mass()); self.write_component_ignore_entity_dead(entity, body.density()); - self.write_component_ignore_entity_dead(entity, comp::Health::new(body, 0)); - self.write_component_ignore_entity_dead(entity, comp::Energy::new(body, 0)); + self.write_component_ignore_entity_dead(entity, comp::Health::new(body)); + self.write_component_ignore_entity_dead(entity, comp::Energy::new(body)); self.write_component_ignore_entity_dead(entity, Poise::new(body)); self.write_component_ignore_entity_dead(entity, stats); self.write_component_ignore_entity_dead(entity, active_abilities); @@ -773,7 +773,7 @@ impl StateExt for State { ori, stats, comp::SkillSet::default(), - Some(comp::Health::new(body, 0)), + Some(comp::Health::new(body)), Poise::new(body), Inventory::with_loadout( LoadoutBuilder::from_default(&body).build(), diff --git a/server/src/sys/terrain.rs b/server/src/sys/terrain.rs index 3516d1799d..f0547bd446 100644 --- a/server/src/sys/terrain.rs +++ b/server/src/sys/terrain.rs @@ -498,7 +498,7 @@ impl SpawnEntityData { inventory }; - let health = Some(comp::Health::new(body, 0)); + let health = Some(comp::Health::new(body)); let poise = comp::Poise::new(body); // Allow Humanoid, BirdMedium, and Parrot to speak