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
This commit is contained in:
Sam 2021-03-06 16:29:00 -05:00
parent d711c77468
commit c13e84aff5
16 changed files with 63 additions and 96 deletions

View File

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

View File

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

View File

@ -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(_)
)
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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