From c13e84aff595fa8cc47cd545b06e33b115c8df01 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 6 Mar 2021 16:29:00 -0500 Subject: [PATCH] Aura duration separated from cast duration in aura state Healing beam now requires combo > 0 to enter character state Removed last vestiges of old sceptre abilities Combo extended to most other attacks Cast aura state renamed to basic aura --- .../common/abilities/sceptre/wardingaura.ron | 7 +- common/src/comp/ability.rs | 34 +++++----- common/src/comp/character_state.rs | 6 +- common/src/comp/projectile.rs | 65 +++---------------- .../states/{cast_aura.rs => basic_aura.rs} | 16 +++-- common/src/states/basic_melee.rs | 3 +- common/src/states/charged_melee.rs | 3 +- common/src/states/charged_ranged.rs | 3 +- common/src/states/dash_melee.rs | 3 +- common/src/states/leap_melee.rs | 3 +- common/src/states/mod.rs | 2 +- common/src/states/shockwave.rs | 3 +- common/src/states/spin_melee.rs | 3 +- common/sys/src/character_behavior.rs | 4 +- common/sys/src/stats.rs | 2 +- voxygen/src/scene/figure/mod.rs | 2 +- 16 files changed, 63 insertions(+), 96 deletions(-) rename common/src/states/{cast_aura.rs => basic_aura.rs} (89%) diff --git a/assets/common/abilities/sceptre/wardingaura.ron b/assets/common/abilities/sceptre/wardingaura.ron index e9d21c0c41..7872675f3d 100644 --- a/assets/common/abilities/sceptre/wardingaura.ron +++ b/assets/common/abilities/sceptre/wardingaura.ron @@ -1,6 +1,6 @@ -CastAura( +BasicAura( buildup_duration: 0.25, - cast_duration: 1.5, + cast_duration: 0.5, recover_duration: 0.25, targets: InGroup, aura: ( @@ -9,6 +9,7 @@ CastAura( duration: Some(10.0), category: Magical, ), + aura_duration: 1.0, range: 25.0, - energy_cost: 00, + energy_cost: 400, ) \ No newline at end of file diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs index 5c2441dc75..c55d668c32 100644 --- a/common/src/comp/ability.rs +++ b/common/src/comp/ability.rs @@ -226,12 +226,13 @@ pub enum CharacterAbility { orientation_behavior: basic_beam::MovementBehavior, specifier: beam::FrontendSpecifier, }, - CastAura { + BasicAura { buildup_duration: f32, cast_duration: f32, recover_duration: f32, targets: combat::GroupTarget, aura: aura::AuraBuffConstructor, + aura_duration: f32, range: f32, energy_cost: f32, }, @@ -290,7 +291,7 @@ impl CharacterAbility { | CharacterAbility::ChargedRanged { energy_cost, .. } | CharacterAbility::ChargedMelee { energy_cost, .. } | CharacterAbility::Shockwave { energy_cost, .. } - | CharacterAbility::CastAura { energy_cost, .. } => update + | CharacterAbility::BasicAura { energy_cost, .. } => update .energy .try_change_by(-(*energy_cost as i32), EnergySource::Ability) .is_ok(), @@ -310,6 +311,7 @@ impl CharacterAbility { .try_change_by(-(*energy_cost as i32), EnergySource::Ability) .is_ok() }, + CharacterAbility::HealingBeam { .. } => data.combo.counter() > 0, _ => true, } } @@ -350,7 +352,7 @@ impl CharacterAbility { } => { *buildup_duration /= speed; *recover_duration /= speed; - *projectile = projectile.modified_projectile(power, 1_f32, 1_f32, power); + *projectile = projectile.modified_projectile(power, 1_f32, 1_f32); }, RepeaterRanged { ref mut movement_duration, @@ -364,7 +366,7 @@ impl CharacterAbility { *buildup_duration /= speed; *shoot_duration /= speed; *recover_duration /= speed; - *projectile = projectile.modified_projectile(power, 1_f32, 1_f32, power); + *projectile = projectile.modified_projectile(power, 1_f32, 1_f32); }, Boost { ref mut movement_duration, @@ -499,14 +501,15 @@ impl CharacterAbility { *damage *= power; *tick_rate *= speed; }, - CastAura { + BasicAura { ref mut buildup_duration, + ref mut cast_duration, ref mut recover_duration, - // cast_duration explicitly not affected by speed ref mut aura, .. } => { *buildup_duration /= speed; + *cast_duration /= speed; *recover_duration /= speed; aura.strength *= power; }, @@ -540,7 +543,7 @@ impl CharacterAbility { | ChargedRanged { energy_cost, .. } | Shockwave { energy_cost, .. } | HealingBeam { energy_cost, .. } - | CastAura { energy_cost, .. } => *energy_cost as u32, + | BasicAura { energy_cost, .. } => *energy_cost as u32, BasicBeam { energy_drain, .. } => { if *energy_drain > f32::EPSILON { 1 @@ -857,7 +860,7 @@ impl CharacterAbility { .unwrap_or(0); let power = 1.20_f32.powi(damage_level.into()); let regen = 1.4_f32.powi(regen_level.into()); - *projectile = projectile.modified_projectile(power, regen, 1_f32, 1_f32); + *projectile = projectile.modified_projectile(power, regen, 1_f32); }, ChargedRanged { ref mut scaled_damage, @@ -904,8 +907,7 @@ impl CharacterAbility { } if let Ok(Some(level)) = skillset.skill_level(Bow(RDamage)) { let power = 1.4_f32.powi(level.into()); - *projectile = - projectile.modified_projectile(power, 1_f32, 1_f32, 1_f32); + *projectile = projectile.modified_projectile(power, 1_f32, 1_f32); } if !skillset.has_skill(Bow(RGlide)) { *buildup_duration = 0.001; @@ -944,7 +946,7 @@ impl CharacterAbility { let power = 1.2_f32.powi(damage_level.into()); let regen = 1.2_f32.powi(regen_level.into()); let range = 1.1_f32.powi(range_level.into()); - *projectile = projectile.modified_projectile(power, regen, range, 1_f32); + *projectile = projectile.modified_projectile(power, regen, range); }, BasicBeam { ref mut damage, @@ -1051,7 +1053,7 @@ impl CharacterAbility { let heal = 1.15_f32.powi(heal_level.into()); let power = 1.2_f32.powi(damage_level.into()); let range = 1.3_f32.powi(range_level.into()); - *projectile = projectile.modified_projectile(power, 1_f32, range, heal); + *projectile = projectile.modified_projectile(power, 1_f32, range); } if let Ok(Some(level)) = skillset.skill_level(Sceptre(PCost)) { *energy_cost *= 0.85_f32.powi(level.into()); @@ -1494,21 +1496,23 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState { timer: Duration::default(), stage_section: StageSection::Buildup, }), - CharacterAbility::CastAura { + CharacterAbility::BasicAura { buildup_duration, cast_duration, recover_duration, targets, aura, + aura_duration, range, energy_cost: _, - } => CharacterState::CastAura(cast_aura::Data { - static_data: cast_aura::StaticData { + } => CharacterState::BasicAura(basic_aura::Data { + static_data: basic_aura::StaticData { buildup_duration: Duration::from_secs_f32(*buildup_duration), cast_duration: Duration::from_secs_f32(*cast_duration), recover_duration: Duration::from_secs_f32(*recover_duration), targets: *targets, aura: *aura, + aura_duration: Duration::from_secs_f32(*aura_duration), range: *range, ability_info, }, diff --git a/common/src/comp/character_state.rs b/common/src/comp/character_state.rs index fe439922c6..c86b278d23 100644 --- a/common/src/comp/character_state.rs +++ b/common/src/comp/character_state.rs @@ -82,7 +82,7 @@ pub enum CharacterState { /// from the source BasicBeam(basic_beam::Data), /// Creates an aura that persists as long as you are actively casting - CastAura(cast_aura::Data), + BasicAura(basic_aura::Data), /// A directed beam that heals targets in range HealingBeam(healing_beam::Data), } @@ -104,7 +104,7 @@ impl CharacterState { | CharacterState::RepeaterRanged(_) | CharacterState::Shockwave(_) | CharacterState::BasicBeam(_) - | CharacterState::CastAura(_) + | CharacterState::BasicAura(_) | CharacterState::HealingBeam(_) ) } @@ -127,7 +127,7 @@ impl CharacterState { | CharacterState::RepeaterRanged(_) | CharacterState::Shockwave(_) | CharacterState::BasicBeam(_) - | CharacterState::CastAura(_) + | CharacterState::BasicAura(_) | CharacterState::HealingBeam(_) ) } diff --git a/common/src/comp/projectile.rs b/common/src/comp/projectile.rs index f370f87419..120791e5ab 100644 --- a/common/src/comp/projectile.rs +++ b/common/src/comp/projectile.rs @@ -58,11 +58,6 @@ pub enum ProjectileConstructor { damage: f32, energy_regen: f32, }, - Heal { - heal: f32, - damage: f32, - radius: f32, - }, Possess, } @@ -103,7 +98,8 @@ impl ProjectileConstructor { .with_damage(damage) .with_crit(crit_chance, crit_mult) .with_effect(energy) - .with_effect(knockback); + .with_effect(knockback) + .with_combo_increment(); Projectile { hit_solid: vec![Effect::Stick], @@ -130,7 +126,8 @@ impl ProjectileConstructor { let attack = Attack::default() .with_damage(damage) .with_crit(crit_chance, crit_mult) - .with_effect(energy); + .with_effect(energy) + .with_combo_increment(); let explosion = Explosion { effects: vec![ RadiusEffect::Attack(attack), @@ -157,7 +154,8 @@ impl ProjectileConstructor { ); let attack = Attack::default() .with_damage(damage) - .with_crit(crit_chance, crit_mult); + .with_crit(crit_chance, crit_mult) + .with_combo_increment(); let explosion = Explosion { effects: vec![RadiusEffect::Attack(attack)], radius, @@ -187,7 +185,8 @@ impl ProjectileConstructor { let attack = Attack::default() .with_damage(damage) .with_crit(crit_chance, crit_mult) - .with_effect(energy); + .with_effect(energy) + .with_combo_increment(); Projectile { hit_solid: vec![Effect::Vanish], @@ -197,36 +196,6 @@ impl ProjectileConstructor { ignore_group: true, } }, - Heal { - heal, - damage, - radius, - } => { - let damage = AttackDamage::new( - Damage { - source: DamageSource::Explosion, - value: damage, - }, - Some(GroupTarget::OutOfGroup), - ); - let heal = AttackEffect::new(Some(GroupTarget::InGroup), CombatEffect::Heal(heal)); - let attack = Attack::default() - .with_damage(damage) - .with_crit(crit_chance, crit_mult) - .with_effect(heal); - let explosion = Explosion { - effects: vec![RadiusEffect::Attack(attack)], - radius, - reagent: Some(Reagent::Green), - }; - Projectile { - hit_solid: vec![Effect::Explode(explosion.clone()), Effect::Vanish], - hit_entity: vec![Effect::Explode(explosion), Effect::Vanish], - time_left: Duration::from_secs(10), - owner, - ignore_group: false, - } - }, Possess => Projectile { hit_solid: vec![Effect::Stick], hit_entity: vec![Effect::Stick, Effect::Possess], @@ -237,13 +206,7 @@ impl ProjectileConstructor { } } - pub fn modified_projectile( - mut self, - power: f32, - regen: f32, - range: f32, - heal_power: f32, - ) -> Self { + pub fn modified_projectile(mut self, power: f32, regen: f32, range: f32) -> Self { use ProjectileConstructor::*; match self { Arrow { @@ -280,16 +243,6 @@ impl ProjectileConstructor { *damage *= power; *energy_regen *= regen; }, - Heal { - ref mut damage, - ref mut heal, - ref mut radius, - .. - } => { - *damage *= power; - *heal *= heal_power; - *radius *= range; - }, Possess => {}, } self diff --git a/common/src/states/cast_aura.rs b/common/src/states/basic_aura.rs similarity index 89% rename from common/src/states/cast_aura.rs rename to common/src/states/basic_aura.rs index 8f419e52fc..47f3268a19 100644 --- a/common/src/states/cast_aura.rs +++ b/common/src/states/basic_aura.rs @@ -26,6 +26,8 @@ pub struct StaticData { pub targets: GroupTarget, /// Has information used to construct the aura pub aura: AuraBuffConstructor, + /// How long aura lasts + pub aura_duration: Duration, /// Radius of aura pub range: f32, /// What key is used to press ability @@ -52,7 +54,7 @@ impl CharacterBehavior for Data { if !ability_key_is_pressed(data, self.static_data.ability_info.key) { handle_interrupt(data, &mut update, false); match update.character { - CharacterState::CastAura(_) => {}, + CharacterState::BasicAura(_) => {}, _ => { return update; }, @@ -63,7 +65,7 @@ impl CharacterBehavior for Data { StageSection::Buildup => { if self.timer < self.static_data.buildup_duration { // Build up - update.character = CharacterState::CastAura(Data { + update.character = CharacterState::BasicAura(Data { timer: self .timer .checked_add(Duration::from_secs_f32(data.dt.0)) @@ -77,7 +79,7 @@ impl CharacterBehavior for Data { let aura = self.static_data.aura.to_aura( data.uid, self.static_data.range, - Some(self.static_data.cast_duration), + Some(self.static_data.aura_duration), targets, ); update.server_events.push_front(ServerEvent::Aura { @@ -85,7 +87,7 @@ impl CharacterBehavior for Data { aura_change: AuraChange::Add(aura), }); // Build up - update.character = CharacterState::CastAura(Data { + update.character = CharacterState::BasicAura(Data { timer: Duration::default(), stage_section: StageSection::Cast, ..*self @@ -95,7 +97,7 @@ impl CharacterBehavior for Data { StageSection::Cast => { if self.timer < self.static_data.cast_duration { // Cast - update.character = CharacterState::CastAura(Data { + update.character = CharacterState::BasicAura(Data { timer: self .timer .checked_add(Duration::from_secs_f32(data.dt.0)) @@ -103,7 +105,7 @@ impl CharacterBehavior for Data { ..*self }); } else { - update.character = CharacterState::CastAura(Data { + update.character = CharacterState::BasicAura(Data { timer: Duration::default(), stage_section: StageSection::Recover, ..*self @@ -112,7 +114,7 @@ impl CharacterBehavior for Data { }, StageSection::Recover => { if self.timer < self.static_data.recover_duration { - update.character = CharacterState::CastAura(Data { + update.character = CharacterState::BasicAura(Data { timer: self .timer .checked_add(Duration::from_secs_f32(data.dt.0)) diff --git a/common/src/states/basic_melee.rs b/common/src/states/basic_melee.rs index 5e32889794..a4ce9a4d5a 100644 --- a/common/src/states/basic_melee.rs +++ b/common/src/states/basic_melee.rs @@ -121,7 +121,8 @@ impl CharacterBehavior for Data { .with_crit(crit_chance, crit_mult) .with_effect(energy) .with_effect(poise) - .with_effect(knockback); + .with_effect(knockback) + .with_combo_increment(); // Hit attempt data.updater.insert(data.entity, Melee { diff --git a/common/src/states/charged_melee.rs b/common/src/states/charged_melee.rs index 5ec42d92f6..f014913946 100644 --- a/common/src/states/charged_melee.rs +++ b/common/src/states/charged_melee.rs @@ -186,7 +186,8 @@ impl CharacterBehavior for Data { .with_damage(damage) .with_crit(crit_chance, crit_mult) .with_effect(poise) - .with_effect(knockback); + .with_effect(knockback) + .with_combo_increment(); // Hit attempt data.updater.insert(data.entity, Melee { diff --git a/common/src/states/charged_ranged.rs b/common/src/states/charged_ranged.rs index 4d65df8feb..f28fd350de 100644 --- a/common/src/states/charged_ranged.rs +++ b/common/src/states/charged_ranged.rs @@ -129,7 +129,8 @@ impl CharacterBehavior for Data { let attack = Attack::default() .with_damage(damage) .with_crit(crit_chance, crit_mult) - .with_effect(knockback); + .with_effect(knockback) + .with_combo_increment(); // Fire let projectile = Projectile { diff --git a/common/src/states/dash_melee.rs b/common/src/states/dash_melee.rs index 26d2abfc40..0922f0e7bf 100644 --- a/common/src/states/dash_melee.rs +++ b/common/src/states/dash_melee.rs @@ -166,7 +166,8 @@ impl CharacterBehavior for Data { .with_damage(damage) .with_crit(crit_chance, crit_mult) .with_effect(poise) - .with_effect(knockback); + .with_effect(knockback) + .with_combo_increment(); data.updater.insert(data.entity, Melee { attack, diff --git a/common/src/states/leap_melee.rs b/common/src/states/leap_melee.rs index c9be3dc4c3..31b7daff7f 100644 --- a/common/src/states/leap_melee.rs +++ b/common/src/states/leap_melee.rs @@ -176,7 +176,8 @@ impl CharacterBehavior for Data { .with_damage(damage) .with_crit(crit_chance, crit_mult) .with_effect(poise) - .with_effect(knockback); + .with_effect(knockback) + .with_combo_increment(); // Hit attempt, when animation plays data.updater.insert(data.entity, Melee { diff --git a/common/src/states/mod.rs b/common/src/states/mod.rs index 3984eb29b6..049f6a058c 100644 --- a/common/src/states/mod.rs +++ b/common/src/states/mod.rs @@ -1,10 +1,10 @@ +pub mod basic_aura; pub mod basic_beam; pub mod basic_block; pub mod basic_melee; pub mod basic_ranged; pub mod behavior; pub mod boost; -pub mod cast_aura; pub mod charged_melee; pub mod charged_ranged; pub mod climb; diff --git a/common/src/states/shockwave.rs b/common/src/states/shockwave.rs index bb233d8606..6d2647236a 100644 --- a/common/src/states/shockwave.rs +++ b/common/src/states/shockwave.rs @@ -106,7 +106,8 @@ impl CharacterBehavior for Data { .with_damage(damage) .with_crit(crit_chance, crit_mult) .with_effect(poise) - .with_effect(knockback); + .with_effect(knockback) + .with_combo_increment(); let properties = shockwave::Properties { angle: self.static_data.shockwave_angle, vertical_angle: self.static_data.shockwave_vertical_angle, diff --git a/common/src/states/spin_melee.rs b/common/src/states/spin_melee.rs index f91306d1d7..18548937b6 100644 --- a/common/src/states/spin_melee.rs +++ b/common/src/states/spin_melee.rs @@ -141,7 +141,8 @@ impl CharacterBehavior for Data { .with_damage(damage) .with_crit(crit_chance, crit_mult) .with_effect(poise) - .with_effect(knockback); + .with_effect(knockback) + .with_combo_increment(); // Hit attempt data.updater.insert(data.entity, Melee { diff --git a/common/sys/src/character_behavior.rs b/common/sys/src/character_behavior.rs index ab46d49b07..e68da90340 100644 --- a/common/sys/src/character_behavior.rs +++ b/common/sys/src/character_behavior.rs @@ -303,7 +303,7 @@ impl<'a> System<'a> for Sys { CharacterState::RepeaterRanged(data) => data.handle_event(&j, action), CharacterState::Shockwave(data) => data.handle_event(&j, action), CharacterState::BasicBeam(data) => data.handle_event(&j, action), - CharacterState::CastAura(data) => data.handle_event(&j, action), + CharacterState::BasicAura(data) => data.handle_event(&j, action), CharacterState::HealingBeam(data) => data.handle_event(&j, action), }; local_emitter.append(&mut state_update.local_events); @@ -344,7 +344,7 @@ impl<'a> System<'a> for Sys { CharacterState::RepeaterRanged(data) => data.behavior(&j), CharacterState::Shockwave(data) => data.behavior(&j), CharacterState::BasicBeam(data) => data.behavior(&j), - CharacterState::CastAura(data) => data.behavior(&j), + CharacterState::BasicAura(data) => data.behavior(&j), CharacterState::HealingBeam(data) => data.behavior(&j), }; diff --git a/common/sys/src/stats.rs b/common/sys/src/stats.rs index 374af1458e..b42c7af872 100644 --- a/common/sys/src/stats.rs +++ b/common/sys/src/stats.rs @@ -233,7 +233,7 @@ impl<'a> System<'a> for Sys { | CharacterState::RepeaterRanged { .. } | CharacterState::Shockwave { .. } | CharacterState::BasicBeam { .. } - | CharacterState::CastAura { .. } + | CharacterState::BasicAura { .. } | CharacterState::HealingBeam { .. } => { if energy.get_unchecked().regen_rate != 0.0 { energy.get_mut_unchecked().regen_rate = 0.0 diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 24ee90bd01..91e208200f 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -1099,7 +1099,7 @@ impl FigureMgr { skeleton_attr, ) }, - CharacterState::CastAura(s) => { + CharacterState::BasicAura(s) => { let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => {