veloren/common/src/comp/ability.rs

1547 lines
63 KiB
Rust
Raw Normal View History

use crate::{
assets::{self, Asset},
2021-03-01 20:44:29 +00:00
combat,
2020-03-24 19:31:54 +00:00
comp::{
aura, beam, inventory::item::tool::ToolKind, projectile::ProjectileConstructor, skills,
Body, CharacterState, EnergySource, Gravity, LightEmitter, StateUpdate,
2020-03-24 19:31:54 +00:00
},
states::{
behavior::JoinData,
utils::{AbilityInfo, StageSection},
*,
},
2020-10-18 18:21:58 +00:00
Knockback,
};
use serde::{Deserialize, Serialize};
2020-12-12 22:14:24 +00:00
use std::time::Duration;
2020-01-01 17:16:29 +00:00
#[derive(Copy, Clone, Hash, Eq, PartialEq, Debug, Serialize, Deserialize)]
pub enum CharacterAbilityType {
BasicMelee,
BasicRanged,
Boost,
2020-10-14 22:30:58 +00:00
ChargedMelee(StageSection),
2020-07-26 03:06:53 +00:00
ChargedRanged,
2020-10-14 22:30:58 +00:00
DashMelee(StageSection),
BasicBlock,
2020-09-13 01:33:46 +00:00
ComboMelee(StageSection, u32),
2020-10-14 22:30:58 +00:00
LeapMelee(StageSection),
SpinMelee(StageSection),
Shockwave,
BasicBeam,
RepeaterRanged,
}
impl From<&CharacterState> for CharacterAbilityType {
fn from(state: &CharacterState) -> Self {
match state {
CharacterState::BasicMelee(_) => Self::BasicMelee,
CharacterState::BasicRanged(_) => Self::BasicRanged,
CharacterState::Boost(_) => Self::Boost,
2020-10-14 22:30:58 +00:00
CharacterState::DashMelee(data) => Self::DashMelee(data.stage_section),
CharacterState::BasicBlock => Self::BasicBlock,
2020-10-14 22:30:58 +00:00
CharacterState::LeapMelee(data) => Self::LeapMelee(data.stage_section),
2020-09-13 01:33:46 +00:00
CharacterState::ComboMelee(data) => Self::ComboMelee(data.stage_section, data.stage),
2020-10-14 22:30:58 +00:00
CharacterState::SpinMelee(data) => Self::SpinMelee(data.stage_section),
CharacterState::ChargedMelee(data) => Self::ChargedMelee(data.stage_section),
2020-07-26 03:06:53 +00:00
CharacterState::ChargedRanged(_) => Self::ChargedRanged,
CharacterState::Shockwave(_) => Self::Shockwave,
CharacterState::BasicBeam(_) => Self::BasicBeam,
CharacterState::RepeaterRanged(_) => Self::RepeaterRanged,
_ => Self::BasicMelee,
}
}
}
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
2020-03-14 15:40:29 +00:00
pub enum CharacterAbility {
BasicMelee {
energy_cost: f32,
buildup_duration: f32,
swing_duration: f32,
recover_duration: f32,
base_damage: f32,
base_poise_damage: f32,
knockback: f32,
range: f32,
max_angle: f32,
2020-03-12 14:36:02 +00:00
},
BasicRanged {
energy_cost: f32,
buildup_duration: f32,
recover_duration: f32,
projectile: ProjectileConstructor,
2020-03-22 19:39:50 +00:00
projectile_body: Body,
2020-03-24 19:31:54 +00:00
projectile_light: Option<LightEmitter>,
projectile_gravity: Option<Gravity>,
projectile_speed: f32,
can_continue: bool,
2020-03-22 19:39:50 +00:00
},
RepeaterRanged {
energy_cost: f32,
movement_duration: f32,
buildup_duration: f32,
shoot_duration: f32,
recover_duration: f32,
2020-09-28 02:38:23 +00:00
leap: Option<f32>,
projectile: ProjectileConstructor,
projectile_body: Body,
projectile_light: Option<LightEmitter>,
projectile_gravity: Option<Gravity>,
projectile_speed: f32,
reps_remaining: u32,
},
Boost {
movement_duration: f32,
only_up: bool,
},
2020-03-16 15:34:53 +00:00
DashMelee {
energy_cost: f32,
base_damage: f32,
scaled_damage: f32,
base_poise_damage: f32,
scaled_poise_damage: f32,
base_knockback: f32,
scaled_knockback: f32,
range: f32,
angle: f32,
energy_drain: f32,
forward_speed: f32,
buildup_duration: f32,
charge_duration: f32,
swing_duration: f32,
recover_duration: f32,
infinite_charge: bool,
is_interruptible: bool,
2020-03-16 15:34:53 +00:00
},
2020-03-07 18:15:02 +00:00
BasicBlock,
Roll {
energy_cost: f32,
buildup_duration: f32,
movement_duration: f32,
recover_duration: f32,
roll_strength: f32,
immune_melee: bool,
},
ComboMelee {
stage_data: Vec<combo_melee::Stage<f32>>,
initial_energy_gain: f32,
max_energy_gain: f32,
energy_increase: f32,
speed_increase: f32,
max_speed_increase: f32,
scales_from_combo: u32,
is_interruptible: bool,
2020-03-19 22:40:03 +00:00
},
LeapMelee {
energy_cost: f32,
buildup_duration: f32,
movement_duration: f32,
swing_duration: f32,
recover_duration: f32,
base_damage: f32,
base_poise_damage: f32,
range: f32,
max_angle: f32,
2020-09-25 05:51:26 +00:00
knockback: f32,
2020-09-28 23:55:38 +00:00
forward_leap_strength: f32,
vertical_leap_strength: f32,
},
2020-07-08 19:58:41 +00:00
SpinMelee {
buildup_duration: f32,
swing_duration: f32,
recover_duration: f32,
base_damage: f32,
base_poise_damage: f32,
knockback: f32,
range: f32,
energy_cost: f32,
is_infinite: bool,
2021-01-21 22:45:03 +00:00
movement_behavior: spin_melee::MovementBehavior,
is_interruptible: bool,
forward_speed: f32,
num_spins: u32,
2020-07-08 19:58:41 +00:00
},
ChargedMelee {
energy_cost: f32,
energy_drain: f32,
initial_damage: f32,
scaled_damage: f32,
initial_poise_damage: f32,
scaled_poise_damage: f32,
initial_knockback: f32,
scaled_knockback: f32,
range: f32,
max_angle: f32,
speed: f32,
charge_duration: f32,
swing_duration: f32,
hit_timing: f32,
recover_duration: f32,
},
2020-07-26 03:06:53 +00:00
ChargedRanged {
energy_cost: f32,
energy_drain: f32,
initial_damage: f32,
scaled_damage: f32,
2020-07-26 03:06:53 +00:00
initial_knockback: f32,
scaled_knockback: f32,
speed: f32,
buildup_duration: f32,
charge_duration: f32,
recover_duration: f32,
2020-07-26 03:06:53 +00:00
projectile_body: Body,
projectile_light: Option<LightEmitter>,
projectile_gravity: Option<Gravity>,
initial_projectile_speed: f32,
scaled_projectile_speed: f32,
2020-12-23 02:28:55 +00:00
move_speed: f32,
2020-07-26 03:06:53 +00:00
},
Shockwave {
energy_cost: f32,
buildup_duration: f32,
swing_duration: f32,
recover_duration: f32,
damage: f32,
poise_damage: f32,
2020-10-18 18:21:58 +00:00
knockback: Knockback,
2020-08-08 20:53:55 +00:00
shockwave_angle: f32,
2020-10-12 22:55:55 +00:00
shockwave_vertical_angle: f32,
2020-08-08 20:53:55 +00:00
shockwave_speed: f32,
shockwave_duration: f32,
2020-09-19 16:55:31 +00:00
requires_ground: bool,
2020-10-09 17:42:15 +00:00
move_efficiency: f32,
2020-08-08 20:53:55 +00:00
},
BasicBeam {
buildup_duration: f32,
recover_duration: f32,
beam_duration: f32,
damage: f32,
2020-08-31 21:55:38 +00:00
tick_rate: f32,
range: f32,
max_angle: f32,
lifesteal_eff: f32,
energy_regen: f32,
energy_drain: f32,
orientation_behavior: basic_beam::MovementBehavior,
specifier: beam::FrontendSpecifier,
},
2021-03-01 20:44:29 +00:00
CastAura {
buildup_duration: f32,
cast_duration: f32,
recover_duration: f32,
targets: combat::GroupTarget,
aura: aura::AuraBuffConstructor,
range: f32,
energy_cost: f32,
},
HealingBeam {
buildup_duration: f32,
recover_duration: f32,
beam_duration: f32,
heal: f32,
tick_rate: f32,
range: f32,
max_angle: f32,
energy_cost: f32,
specifier: beam::FrontendSpecifier,
},
2020-01-01 17:16:29 +00:00
}
impl Default for CharacterAbility {
fn default() -> Self {
CharacterAbility::BasicMelee {
energy_cost: 0.0,
buildup_duration: 0.25,
swing_duration: 0.25,
recover_duration: 0.5,
base_damage: 10.0,
base_poise_damage: 0.0,
knockback: 0.0,
range: 3.5,
max_angle: 15.0,
}
}
}
impl Asset for CharacterAbility {
2020-12-12 22:14:24 +00:00
type Loader = assets::RonLoader;
2020-12-13 01:09:57 +00:00
const EXTENSION: &'static str = "ron";
}
2020-03-17 14:01:41 +00:00
impl CharacterAbility {
2020-03-21 22:55:20 +00:00
/// Attempts to fulfill requirements, mutating `update` (taking energy) if
/// applicable.
pub fn requirements_paid(&self, data: &JoinData, update: &mut StateUpdate) -> bool {
2020-03-17 14:01:41 +00:00
match self {
2020-11-05 20:22:30 +00:00
CharacterAbility::Roll { energy_cost, .. } => {
2020-03-17 14:01:41 +00:00
data.physics.on_ground
&& data.vel.0.xy().magnitude_squared() > 0.5
2020-03-17 14:01:41 +00:00
&& update
.energy
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
2020-03-22 19:39:50 +00:00
.is_ok()
},
2021-03-01 20:44:29 +00:00
CharacterAbility::DashMelee { energy_cost, .. }
| CharacterAbility::BasicMelee { energy_cost, .. }
| CharacterAbility::BasicRanged { energy_cost, .. }
| CharacterAbility::SpinMelee { energy_cost, .. }
| CharacterAbility::ChargedRanged { energy_cost, .. }
| CharacterAbility::ChargedMelee { energy_cost, .. }
| CharacterAbility::Shockwave { energy_cost, .. }
| CharacterAbility::CastAura { energy_cost, .. } => update
2020-03-26 13:46:08 +00:00
.energy
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
.is_ok(),
2021-03-01 20:44:29 +00:00
CharacterAbility::RepeaterRanged {
energy_cost, leap, ..
} => {
(leap.is_none() || update.vel.0.z >= 0.0)
&& update
.energy
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
.is_ok()
},
2021-03-01 20:44:29 +00:00
CharacterAbility::LeapMelee { energy_cost, .. } => {
update.vel.0.z >= 0.0
&& update
.energy
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
.is_ok()
},
2020-03-17 14:01:41 +00:00
_ => true,
}
}
pub fn default_roll() -> CharacterAbility {
CharacterAbility::Roll {
2021-02-06 20:20:08 +00:00
energy_cost: 150.0,
buildup_duration: 0.05,
movement_duration: 0.28,
recover_duration: 0.125,
roll_strength: 1.8,
immune_melee: false,
}
}
pub fn adjusted_by_stats(mut self, power: f32, poise_strength: f32, speed: f32) -> Self {
use CharacterAbility::*;
match self {
BasicMelee {
ref mut buildup_duration,
ref mut swing_duration,
ref mut recover_duration,
ref mut base_damage,
2020-12-16 23:30:33 +00:00
ref mut base_poise_damage,
..
} => {
*buildup_duration /= speed;
*swing_duration /= speed;
*recover_duration /= speed;
*base_damage *= power;
*base_poise_damage *= poise_strength;
},
BasicRanged {
ref mut buildup_duration,
ref mut recover_duration,
ref mut projectile,
..
} => {
*buildup_duration /= speed;
*recover_duration /= speed;
2020-12-25 16:28:35 +00:00
*projectile = projectile.modified_projectile(power, 1_f32, 1_f32, power);
},
RepeaterRanged {
ref mut movement_duration,
ref mut buildup_duration,
ref mut shoot_duration,
ref mut recover_duration,
ref mut projectile,
..
} => {
*movement_duration /= speed;
*buildup_duration /= speed;
*shoot_duration /= speed;
*recover_duration /= speed;
2020-12-25 16:28:35 +00:00
*projectile = projectile.modified_projectile(power, 1_f32, 1_f32, power);
},
Boost {
ref mut movement_duration,
..
} => {
*movement_duration /= speed;
},
DashMelee {
ref mut base_damage,
ref mut scaled_damage,
2020-12-16 23:30:33 +00:00
ref mut base_poise_damage,
ref mut scaled_poise_damage,
ref mut buildup_duration,
ref mut swing_duration,
ref mut recover_duration,
..
} => {
*base_damage *= power;
*scaled_damage *= power;
*base_poise_damage *= poise_strength;
*scaled_poise_damage *= poise_strength;
*buildup_duration /= speed;
*swing_duration /= speed;
*recover_duration /= speed;
},
BasicBlock => {},
Roll {
ref mut buildup_duration,
ref mut movement_duration,
ref mut recover_duration,
..
} => {
*buildup_duration /= speed;
*movement_duration /= speed;
*recover_duration /= speed;
},
ComboMelee {
ref mut stage_data, ..
} => {
*stage_data = stage_data
.iter_mut()
.map(|s| s.adjusted_by_stats(power, poise_strength, speed))
.collect();
},
LeapMelee {
ref mut buildup_duration,
ref mut swing_duration,
ref mut recover_duration,
ref mut base_damage,
2020-12-16 23:30:33 +00:00
ref mut base_poise_damage,
..
} => {
*buildup_duration /= speed;
*swing_duration /= speed;
*recover_duration /= speed;
*base_damage *= power;
*base_poise_damage *= poise_strength;
},
SpinMelee {
ref mut buildup_duration,
ref mut swing_duration,
ref mut recover_duration,
ref mut base_damage,
2020-12-16 23:30:33 +00:00
ref mut base_poise_damage,
..
} => {
*buildup_duration /= speed;
*swing_duration /= speed;
*recover_duration /= speed;
*base_damage *= power;
*base_poise_damage *= poise_strength;
},
ChargedMelee {
ref mut initial_damage,
ref mut scaled_damage,
2020-12-16 23:30:33 +00:00
ref mut initial_poise_damage,
ref mut scaled_poise_damage,
speed: ref mut ability_speed,
ref mut charge_duration,
ref mut swing_duration,
ref mut recover_duration,
..
} => {
*initial_damage *= power;
*scaled_damage *= power;
*initial_poise_damage *= poise_strength;
*scaled_poise_damage *= poise_strength;
*ability_speed *= speed;
*charge_duration /= speed;
*swing_duration /= speed;
*recover_duration /= speed;
},
ChargedRanged {
ref mut initial_damage,
ref mut scaled_damage,
speed: ref mut ability_speed,
ref mut buildup_duration,
ref mut charge_duration,
ref mut recover_duration,
..
} => {
*initial_damage *= power;
*scaled_damage *= power;
*ability_speed *= speed;
*buildup_duration /= speed;
*charge_duration /= speed;
*recover_duration /= speed;
},
Shockwave {
ref mut buildup_duration,
ref mut swing_duration,
ref mut recover_duration,
ref mut damage,
2020-12-16 23:30:33 +00:00
ref mut poise_damage,
..
} => {
*buildup_duration /= speed;
*swing_duration /= speed;
*recover_duration /= speed;
*damage *= power;
*poise_damage *= poise_strength;
},
BasicBeam {
ref mut buildup_duration,
ref mut recover_duration,
ref mut damage,
ref mut tick_rate,
..
} => {
*buildup_duration /= speed;
*recover_duration /= speed;
*damage *= power;
*tick_rate *= speed;
},
2021-03-01 20:44:29 +00:00
CastAura {
ref mut buildup_duration,
ref mut recover_duration,
// cast_duration explicitly not affected by speed
ref mut aura,
..
} => {
*buildup_duration /= speed;
*recover_duration /= speed;
aura.strength *= power;
},
HealingBeam {
ref mut buildup_duration,
ref mut recover_duration,
ref mut heal,
ref mut tick_rate,
..
} => {
*buildup_duration /= speed;
*recover_duration /= speed;
*heal *= power;
*tick_rate *= speed;
},
}
self
}
pub fn get_energy_cost(&self) -> u32 {
use CharacterAbility::*;
match self {
BasicMelee { energy_cost, .. }
| BasicRanged { energy_cost, .. }
| RepeaterRanged { energy_cost, .. }
| DashMelee { energy_cost, .. }
| Roll { energy_cost, .. }
| LeapMelee { energy_cost, .. }
| SpinMelee { energy_cost, .. }
| ChargedMelee { energy_cost, .. }
| ChargedRanged { energy_cost, .. }
| Shockwave { energy_cost, .. }
| HealingBeam { energy_cost, .. }
2021-03-01 20:44:29 +00:00
| CastAura { energy_cost, .. } => *energy_cost as u32,
BasicBeam { energy_drain, .. } => {
if *energy_drain > f32::EPSILON {
1
} else {
0
}
},
2020-12-24 17:54:00 +00:00
BasicBlock | Boost { .. } | ComboMelee { .. } => 0,
}
}
2020-12-07 03:35:29 +00:00
pub fn adjusted_by_skills(
mut self,
skillset: &skills::SkillSet,
2020-12-07 03:35:29 +00:00
tool: Option<ToolKind>,
) -> Self {
use skills::Skill::{self, *};
2020-12-07 03:35:29 +00:00
use CharacterAbility::*;
match tool {
Some(ToolKind::Sword) => {
use skills::SwordSkill::*;
match self {
ComboMelee {
ref mut is_interruptible,
ref mut speed_increase,
ref mut max_speed_increase,
ref stage_data,
ref mut max_energy_gain,
ref mut scales_from_combo,
..
} => {
*is_interruptible = skillset.has_skill(Sword(InterruptingAttacks));
let speed_segments = Sword(TsSpeed).max_level().map_or(1, |l| l + 1) as f32;
let speed_level = if skillset.has_skill(Sword(TsCombo)) {
skillset
.skill_level(Sword(TsSpeed))
.unwrap_or(None)
.map_or(1, |l| l + 1) as f32
} else {
0.0
};
{
*speed_increase *= speed_level / speed_segments;
*max_speed_increase *= speed_level / speed_segments;
}
let energy_level =
if let Ok(Some(level)) = skillset.skill_level(Sword(TsRegen)) {
level
2020-12-07 03:35:29 +00:00
} else {
0
2020-12-07 03:35:29 +00:00
};
*max_energy_gain = *max_energy_gain
* ((energy_level + 1) * stage_data.len() as u16 - 1) as f32
/ (Sword(TsRegen).max_level().unwrap() + 1) as f32
* (stage_data.len() - 1) as f32;
*scales_from_combo = skillset
.skill_level(Sword(TsDamage))
.unwrap_or(None)
.unwrap_or(0)
.into();
},
DashMelee {
ref mut is_interruptible,
ref mut energy_cost,
ref mut energy_drain,
ref mut base_damage,
ref mut scaled_damage,
ref mut forward_speed,
ref mut infinite_charge,
..
} => {
*is_interruptible = skillset.has_skill(Sword(InterruptingAttacks));
if let Ok(Some(level)) = skillset.skill_level(Sword(DCost)) {
*energy_cost *= 0.75_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Sword(DDrain)) {
*energy_drain *= 0.75_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Sword(DDamage)) {
*base_damage *= 1.2_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Sword(DScaling)) {
*scaled_damage *= 1.2_f32.powi(level.into());
}
if skillset.has_skill(Sword(DSpeed)) {
*forward_speed *= 1.3;
}
*infinite_charge = skillset.has_skill(Sword(DInfinite));
},
SpinMelee {
ref mut is_interruptible,
ref mut base_damage,
ref mut swing_duration,
ref mut energy_cost,
ref mut num_spins,
..
} => {
*is_interruptible = skillset.has_skill(Sword(InterruptingAttacks));
if let Ok(Some(level)) = skillset.skill_level(Sword(SDamage)) {
*base_damage *= 1.4_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Sword(SSpeed)) {
*swing_duration *= 0.8_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Sword(SCost)) {
*energy_cost *= 0.75_f32.powi(level.into());
}
*num_spins = skillset
.skill_level(Sword(SSpins))
.unwrap_or(None)
.unwrap_or(0) as u32
+ 1;
},
_ => {},
}
},
Some(ToolKind::Axe) => {
use skills::AxeSkill::*;
match self {
ComboMelee {
ref mut speed_increase,
ref mut max_speed_increase,
ref mut stage_data,
ref mut max_energy_gain,
ref mut scales_from_combo,
..
} => {
if !skillset.has_skill(Axe(DsCombo)) {
stage_data.pop();
}
let speed_segments = Axe(DsSpeed).max_level().unwrap_or(1) as f32;
let speed_level = skillset
.skill_level(Axe(DsSpeed))
.unwrap_or(None)
.unwrap_or(0) as f32;
{
*speed_increase *= speed_level / speed_segments;
*max_speed_increase *= speed_level / speed_segments;
}
let energy_level =
if let Ok(Some(level)) = skillset.skill_level(Axe(DsRegen)) {
2020-12-07 03:35:29 +00:00
level
} else {
0
};
*max_energy_gain = *max_energy_gain
* ((energy_level + 1) * stage_data.len() as u16 - 1) as f32
/ (Axe(DsRegen).max_level().unwrap() + 1) as f32
* (stage_data.len() - 1) as f32;
*scales_from_combo = skillset
.skill_level(Axe(DsDamage))
.unwrap_or(None)
.unwrap_or(0)
.into();
},
SpinMelee {
ref mut base_damage,
ref mut swing_duration,
ref mut energy_cost,
ref mut is_infinite,
2021-01-21 22:45:03 +00:00
ref mut movement_behavior,
..
} => {
*is_infinite = skillset.has_skill(Axe(SInfinite));
2021-01-21 22:45:03 +00:00
*movement_behavior = if skillset.has_skill(Axe(SHelicopter)) {
spin_melee::MovementBehavior::AxeHover
2021-01-20 16:20:12 +00:00
} else {
2021-01-21 22:45:03 +00:00
spin_melee::MovementBehavior::ForwardGround
2021-01-20 16:20:12 +00:00
};
if let Ok(Some(level)) = skillset.skill_level(Axe(SDamage)) {
*base_damage *= 1.3_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Axe(SSpeed)) {
*swing_duration *= 0.8_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Axe(SCost)) {
*energy_cost *= 0.75_f32.powi(level.into());
}
},
LeapMelee {
ref mut base_damage,
ref mut knockback,
ref mut energy_cost,
ref mut forward_leap_strength,
ref mut vertical_leap_strength,
..
} => {
if let Ok(Some(level)) = skillset.skill_level(Axe(LDamage)) {
*base_damage *= 1.35_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Axe(LKnockback)) {
*knockback *= 1.4_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Axe(LCost)) {
*energy_cost *= 0.75_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Axe(LDistance)) {
*forward_leap_strength *= 1.2_f32.powi(level.into());
*vertical_leap_strength *= 1.2_f32.powi(level.into());
}
},
_ => {},
}
},
Some(ToolKind::Hammer) => {
use skills::HammerSkill::*;
match self {
ComboMelee {
ref mut speed_increase,
ref mut max_speed_increase,
ref mut stage_data,
ref mut max_energy_gain,
ref mut scales_from_combo,
..
} => {
if let Ok(Some(level)) = skillset.skill_level(Hammer(SsKnockback)) {
*stage_data = (*stage_data)
.iter()
.map(|s| s.modify_strike(1.5_f32.powi(level.into())))
.collect::<Vec<combo_melee::Stage<f32>>>();
}
let speed_segments = Hammer(SsSpeed).max_level().unwrap_or(1) as f32;
let speed_level = skillset
.skill_level(Hammer(SsSpeed))
.unwrap_or(None)
.unwrap_or(0) as f32;
{
*speed_increase *= speed_level / speed_segments;
*max_speed_increase *= speed_level / speed_segments;
}
let energy_level =
if let Ok(Some(level)) = skillset.skill_level(Hammer(SsRegen)) {
2020-12-20 22:28:17 +00:00
level
} else {
0
};
*max_energy_gain = *max_energy_gain
* ((energy_level + 1) * stage_data.len() as u16) as f32
/ ((Hammer(SsRegen).max_level().unwrap() + 1) * stage_data.len() as u16)
as f32;
*scales_from_combo = skillset
.skill_level(Hammer(SsDamage))
.unwrap_or(None)
.unwrap_or(0)
.into();
},
ChargedMelee {
ref mut scaled_damage,
ref mut scaled_knockback,
ref mut energy_drain,
ref mut speed,
..
} => {
if let Ok(Some(level)) = skillset.skill_level(Hammer(CDamage)) {
*scaled_damage *= 1.25_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Hammer(CKnockback)) {
*scaled_knockback *= 1.5_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Hammer(CDrain)) {
*energy_drain *= 0.75_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Hammer(CSpeed)) {
*speed *= 1.25_f32.powi(level.into());
}
},
LeapMelee {
ref mut base_damage,
ref mut knockback,
ref mut energy_cost,
ref mut forward_leap_strength,
ref mut vertical_leap_strength,
ref mut range,
..
} => {
if let Ok(Some(level)) = skillset.skill_level(Hammer(LDamage)) {
*base_damage *= 1.4_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Hammer(LKnockback)) {
*knockback *= 1.5_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Hammer(LCost)) {
*energy_cost *= 0.75_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Hammer(LDistance)) {
*forward_leap_strength *= 1.25_f32.powi(level.into());
*vertical_leap_strength *= 1.25_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Hammer(LRange)) {
*range += 1.0 * level as f32;
}
},
_ => {},
}
},
Some(ToolKind::Bow) => {
use skills::BowSkill::*;
match self {
BasicRanged {
ref mut projectile,
ref mut projectile_speed,
..
} => {
if let Ok(Some(level)) = skillset.skill_level(Bow(ProjSpeed)) {
*projectile_speed *= 1.3_f32.powi(level.into());
}
let damage_level = skillset
.skill_level(Bow(BDamage))
.unwrap_or(None)
.unwrap_or(0);
let regen_level = skillset
.skill_level(Bow(BRegen))
.unwrap_or(None)
.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);
},
ChargedRanged {
ref mut scaled_damage,
ref mut scaled_knockback,
ref mut energy_drain,
ref mut speed,
ref mut initial_projectile_speed,
ref mut scaled_projectile_speed,
ref mut move_speed,
..
} => {
if let Ok(Some(level)) = skillset.skill_level(Bow(ProjSpeed)) {
*initial_projectile_speed *= 1.3_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Bow(CDamage)) {
*scaled_damage *= 1.2_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Bow(CKnockback)) {
*scaled_knockback *= 1.25_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Bow(CProjSpeed)) {
*scaled_projectile_speed *= 1.2_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Bow(CDrain)) {
*energy_drain *= 0.85_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Bow(CSpeed)) {
*speed *= 1.10_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Bow(CMove)) {
*move_speed *= 1.25_f32.powi(level.into());
}
},
RepeaterRanged {
ref mut energy_cost,
ref mut buildup_duration,
ref mut projectile,
ref mut reps_remaining,
ref mut projectile_speed,
..
} => {
if let Ok(Some(level)) = skillset.skill_level(Bow(ProjSpeed)) {
*projectile_speed *= 1.3_f32.powi(level.into());
}
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);
}
if !skillset.has_skill(Bow(RGlide)) {
*buildup_duration = 0.001;
}
if let Ok(Some(level)) = skillset.skill_level(Bow(RArrows)) {
*reps_remaining += level as u32;
}
if let Ok(Some(level)) = skillset.skill_level(Bow(RCost)) {
*energy_cost *= 0.70_f32.powi(level.into());
}
},
_ => {},
}
},
Some(ToolKind::Staff) => {
use skills::StaffSkill::*;
match self {
BasicRanged {
ref mut projectile, ..
} => {
if !skillset.has_skill(Staff(BExplosion)) {
*projectile = projectile.fireball_to_firebolt();
}
let damage_level = skillset
.skill_level(Staff(BDamage))
.unwrap_or(None)
.unwrap_or(0);
let regen_level = skillset
.skill_level(Staff(BRegen))
.unwrap_or(None)
.unwrap_or(0);
let range_level = skillset
.skill_level(Staff(BRadius))
.unwrap_or(None)
.unwrap_or(0);
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);
},
BasicBeam {
ref mut damage,
ref mut range,
ref mut energy_drain,
ref mut beam_duration,
..
} => {
if let Ok(Some(level)) = skillset.skill_level(Staff(FDamage)) {
*damage *= 1.3_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Staff(FRange)) {
let range_mod = 1.25_f32.powi(level.into());
*range *= range_mod;
// Duration modified to keep velocity constant
*beam_duration *= range_mod;
}
if let Ok(Some(level)) = skillset.skill_level(Staff(FDrain)) {
*energy_drain *= 0.8_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Staff(FVelocity)) {
let velocity_increase = 1.25_f32.powi(level.into());
let duration_mod = 1.0 / (1.0 + velocity_increase);
*beam_duration *= duration_mod;
}
},
Shockwave {
ref mut damage,
ref mut knockback,
ref mut shockwave_duration,
ref mut energy_cost,
..
} => {
if let Ok(Some(level)) = skillset.skill_level(Staff(SDamage)) {
*damage *= 1.3_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Staff(SKnockback)) {
*knockback = knockback.modify_strength(1.3_f32.powi(level.into()));
}
if let Ok(Some(level)) = skillset.skill_level(Staff(SRange)) {
*shockwave_duration *= 1.2_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Staff(SCost)) {
*energy_cost *= 0.8_f32.powi(level.into());
}
},
_ => {},
}
},
Some(ToolKind::Sceptre) => {
//use skills::SceptreSkill::*;
/*match self {
BasicBeam {
ref mut base_hps,
ref mut base_dps,
ref mut lifesteal_eff,
ref mut range,
ref mut energy_regen,
ref mut energy_cost,
ref mut beam_duration,
..
} => {
if let Ok(Some(level)) = skillset.skill_level(Sceptre(BHeal)) {
*base_hps *= 1.15_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Sceptre(BDamage)) {
*base_dps *= 1.25_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Sceptre(BRange)) {
2021-01-23 03:46:18 +00:00
let range_mod = 1.20_f32.powi(level.into());
*range *= range_mod;
// Duration modified to keep velocity constant
*beam_duration *= range_mod;
}
if let Ok(Some(level)) = skillset.skill_level(Sceptre(BLifesteal)) {
2021-01-23 03:46:18 +00:00
*lifesteal_eff *= 1.25_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Sceptre(BRegen)) {
*energy_regen *= 1.1_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Sceptre(BCost)) {
*energy_cost *= 0.9_f32.powi(level.into());
}
},
BasicRanged {
ref mut energy_cost,
ref mut projectile,
ref mut projectile_speed,
..
} => {
{
let heal_level = skillset
.skill_level(Sceptre(PHeal))
.unwrap_or(None)
.unwrap_or(0);
let damage_level = skillset
.skill_level(Sceptre(PDamage))
.unwrap_or(None)
.unwrap_or(0);
let range_level = skillset
.skill_level(Sceptre(PRadius))
.unwrap_or(None)
.unwrap_or(0);
2021-01-23 03:46:18 +00:00
let heal = 1.15_f32.powi(heal_level.into());
let power = 1.2_f32.powi(damage_level.into());
2021-01-23 03:46:18 +00:00
let range = 1.3_f32.powi(range_level.into());
*projectile = projectile.modified_projectile(power, 1_f32, range, heal);
}
if let Ok(Some(level)) = skillset.skill_level(Sceptre(PCost)) {
*energy_cost *= 0.85_f32.powi(level.into());
}
if let Ok(Some(level)) = skillset.skill_level(Sceptre(PProjSpeed)) {
*projectile_speed *= 1.25_f32.powi(level.into());
}
},
_ => {},
}*/
},
None => {
use skills::RollSkill::*;
if let CharacterAbility::Roll {
ref mut immune_melee,
ref mut energy_cost,
ref mut roll_strength,
ref mut movement_duration,
..
} = self
{
*immune_melee = skillset.has_skill(Skill::Roll(ImmuneMelee));
if let Ok(Some(level)) = skillset.skill_level(Skill::Roll(Cost)) {
*energy_cost *= 0.8_f32.powi(level.into());
2020-12-23 02:28:55 +00:00
}
if let Ok(Some(level)) = skillset.skill_level(Skill::Roll(Strength)) {
*roll_strength *= 1.2_f32.powi(level.into());
2020-12-24 17:54:00 +00:00
}
if let Ok(Some(level)) = skillset.skill_level(Skill::Roll(Duration)) {
*movement_duration *= 1.2_f32.powi(level.into());
2020-12-25 16:28:35 +00:00
}
}
},
Some(_) => {},
2020-12-07 03:35:29 +00:00
}
self
}
2020-03-17 14:01:41 +00:00
}
impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
fn from((ability, ability_info): (&CharacterAbility, AbilityInfo)) -> Self {
2020-03-14 15:40:29 +00:00
match ability {
CharacterAbility::BasicMelee {
2020-03-14 15:40:29 +00:00
buildup_duration,
swing_duration,
2020-03-14 15:40:29 +00:00
recover_duration,
base_damage,
base_poise_damage,
knockback,
range,
max_angle,
2020-03-24 21:03:11 +00:00
energy_cost: _,
} => CharacterState::BasicMelee(basic_melee::Data {
static_data: basic_melee::StaticData {
buildup_duration: Duration::from_secs_f32(*buildup_duration),
swing_duration: Duration::from_secs_f32(*swing_duration),
recover_duration: Duration::from_secs_f32(*recover_duration),
base_damage: *base_damage,
base_poise_damage: *base_poise_damage,
knockback: *knockback,
range: *range,
max_angle: *max_angle,
ability_info,
},
timer: Duration::default(),
stage_section: StageSection::Buildup,
2020-03-14 15:40:29 +00:00
exhausted: false,
}),
CharacterAbility::BasicRanged {
buildup_duration,
2020-03-14 15:40:29 +00:00
recover_duration,
projectile,
projectile_body,
2020-03-24 19:31:54 +00:00
projectile_light,
projectile_gravity,
projectile_speed,
can_continue,
2020-03-24 19:09:23 +00:00
energy_cost: _,
} => CharacterState::BasicRanged(basic_ranged::Data {
static_data: basic_ranged::StaticData {
buildup_duration: Duration::from_secs_f32(*buildup_duration),
recover_duration: Duration::from_secs_f32(*recover_duration),
projectile: *projectile,
projectile_body: *projectile_body,
projectile_light: *projectile_light,
projectile_gravity: *projectile_gravity,
projectile_speed: *projectile_speed,
can_continue: *can_continue,
ability_info,
},
timer: Duration::default(),
stage_section: StageSection::Buildup,
exhausted: false,
continue_next: false,
}),
CharacterAbility::Boost {
movement_duration,
only_up,
} => CharacterState::Boost(boost::Data {
static_data: boost::StaticData {
movement_duration: Duration::from_secs_f32(*movement_duration),
only_up: *only_up,
},
timer: Duration::default(),
}),
2020-03-16 15:34:53 +00:00
CharacterAbility::DashMelee {
energy_cost: _,
base_damage,
scaled_damage,
base_poise_damage,
2020-12-16 23:30:33 +00:00
scaled_poise_damage,
base_knockback,
scaled_knockback,
range,
angle,
energy_drain,
forward_speed,
2020-03-16 15:34:53 +00:00
buildup_duration,
charge_duration,
swing_duration,
2020-03-16 15:34:53 +00:00
recover_duration,
infinite_charge,
is_interruptible,
2020-03-16 15:34:53 +00:00
} => CharacterState::DashMelee(dash_melee::Data {
2020-09-11 13:59:45 +00:00
static_data: dash_melee::StaticData {
base_damage: *base_damage,
scaled_damage: *scaled_damage,
base_poise_damage: *base_poise_damage,
2020-12-16 23:30:33 +00:00
scaled_poise_damage: *scaled_poise_damage,
2020-09-11 13:59:45 +00:00
base_knockback: *base_knockback,
scaled_knockback: *scaled_knockback,
2020-09-11 13:59:45 +00:00
range: *range,
angle: *angle,
energy_drain: *energy_drain,
forward_speed: *forward_speed,
infinite_charge: *infinite_charge,
buildup_duration: Duration::from_secs_f32(*buildup_duration),
charge_duration: Duration::from_secs_f32(*charge_duration),
swing_duration: Duration::from_secs_f32(*swing_duration),
recover_duration: Duration::from_secs_f32(*recover_duration),
is_interruptible: *is_interruptible,
ability_info,
2020-09-11 13:59:45 +00:00
},
2020-10-18 16:46:28 +00:00
auto_charge: false,
timer: Duration::default(),
refresh_distance: 0.0,
stage_section: StageSection::Buildup,
2020-09-11 13:59:45 +00:00
exhausted: false,
2020-03-16 15:34:53 +00:00
}),
CharacterAbility::BasicBlock => CharacterState::BasicBlock,
CharacterAbility::Roll {
energy_cost: _,
buildup_duration,
movement_duration,
recover_duration,
roll_strength,
immune_melee,
} => CharacterState::Roll(roll::Data {
static_data: roll::StaticData {
buildup_duration: Duration::from_secs_f32(*buildup_duration),
movement_duration: Duration::from_secs_f32(*movement_duration),
recover_duration: Duration::from_secs_f32(*recover_duration),
roll_strength: *roll_strength,
immune_melee: *immune_melee,
},
timer: Duration::default(),
stage_section: StageSection::Buildup,
2020-03-26 13:46:08 +00:00
was_wielded: false, // false by default. utils might set it to true
was_sneak: false,
was_combo: None,
2020-03-14 21:17:27 +00:00
}),
CharacterAbility::ComboMelee {
stage_data,
initial_energy_gain,
max_energy_gain,
energy_increase,
speed_increase,
max_speed_increase,
scales_from_combo,
is_interruptible,
} => CharacterState::ComboMelee(combo_melee::Data {
2020-09-21 22:38:01 +00:00
static_data: combo_melee::StaticData {
num_stages: stage_data.len() as u32,
2020-11-13 03:50:40 +00:00
stage_data: stage_data.iter().map(|stage| stage.to_duration()).collect(),
2020-09-21 22:38:01 +00:00
initial_energy_gain: *initial_energy_gain,
max_energy_gain: *max_energy_gain,
energy_increase: *energy_increase,
speed_increase: 1.0 - *speed_increase,
2020-12-07 03:35:29 +00:00
max_speed_increase: *max_speed_increase,
scales_from_combo: *scales_from_combo,
2020-09-21 22:38:01 +00:00
is_interruptible: *is_interruptible,
ability_info,
2020-09-21 22:38:01 +00:00
},
stage: 1,
timer: Duration::default(),
stage_section: StageSection::Buildup,
next_stage: false,
2020-03-27 17:40:15 +00:00
}),
CharacterAbility::LeapMelee {
energy_cost: _,
buildup_duration,
2020-09-28 23:55:38 +00:00
movement_duration,
swing_duration,
recover_duration,
base_damage,
base_poise_damage,
2020-09-28 23:55:38 +00:00
knockback,
range,
max_angle,
2020-09-28 23:55:38 +00:00
forward_leap_strength,
vertical_leap_strength,
} => CharacterState::LeapMelee(leap_melee::Data {
2020-09-28 23:55:38 +00:00
static_data: leap_melee::StaticData {
buildup_duration: Duration::from_secs_f32(*buildup_duration),
movement_duration: Duration::from_secs_f32(*movement_duration),
swing_duration: Duration::from_secs_f32(*swing_duration),
recover_duration: Duration::from_secs_f32(*recover_duration),
2020-09-28 23:55:38 +00:00
base_damage: *base_damage,
base_poise_damage: *base_poise_damage,
2020-09-28 23:55:38 +00:00
knockback: *knockback,
range: *range,
max_angle: *max_angle,
forward_leap_strength: *forward_leap_strength,
vertical_leap_strength: *vertical_leap_strength,
ability_info,
2020-09-28 23:55:38 +00:00
},
timer: Duration::default(),
stage_section: StageSection::Buildup,
exhausted: false,
}),
2020-07-08 19:58:41 +00:00
CharacterAbility::SpinMelee {
buildup_duration,
swing_duration,
2020-07-08 19:58:41 +00:00
recover_duration,
base_damage,
base_poise_damage,
knockback,
range,
energy_cost,
is_infinite,
2021-01-21 22:45:03 +00:00
movement_behavior,
is_interruptible,
forward_speed,
num_spins,
2020-07-08 19:58:41 +00:00
} => CharacterState::SpinMelee(spin_melee::Data {
static_data: spin_melee::StaticData {
buildup_duration: Duration::from_secs_f32(*buildup_duration),
swing_duration: Duration::from_secs_f32(*swing_duration),
recover_duration: Duration::from_secs_f32(*recover_duration),
base_damage: *base_damage,
2020-12-16 23:30:33 +00:00
base_poise_damage: *base_poise_damage,
knockback: *knockback,
range: *range,
energy_cost: *energy_cost,
is_infinite: *is_infinite,
2021-01-21 22:45:03 +00:00
movement_behavior: *movement_behavior,
is_interruptible: *is_interruptible,
forward_speed: *forward_speed,
num_spins: *num_spins,
ability_info,
},
timer: Duration::default(),
spins_remaining: *num_spins - 1,
stage_section: StageSection::Buildup,
2020-09-18 19:27:02 +00:00
exhausted: false,
2020-07-08 19:58:41 +00:00
}),
CharacterAbility::ChargedMelee {
2020-10-06 05:21:22 +00:00
energy_cost,
energy_drain,
initial_damage,
scaled_damage,
initial_poise_damage,
2020-12-16 23:30:33 +00:00
scaled_poise_damage,
initial_knockback,
scaled_knockback,
speed,
charge_duration,
2020-09-28 01:58:49 +00:00
swing_duration,
hit_timing,
recover_duration,
range,
max_angle,
} => CharacterState::ChargedMelee(charged_melee::Data {
2020-09-28 01:58:49 +00:00
static_data: charged_melee::StaticData {
2020-10-06 05:21:22 +00:00
energy_cost: *energy_cost,
2020-09-28 01:58:49 +00:00
energy_drain: *energy_drain,
initial_damage: *initial_damage,
scaled_damage: *scaled_damage,
initial_poise_damage: *initial_poise_damage,
2020-12-16 23:30:33 +00:00
scaled_poise_damage: *scaled_poise_damage,
2020-09-28 01:58:49 +00:00
initial_knockback: *initial_knockback,
scaled_knockback: *scaled_knockback,
speed: *speed,
2020-09-28 01:58:49 +00:00
range: *range,
max_angle: *max_angle,
charge_duration: Duration::from_secs_f32(*charge_duration),
swing_duration: Duration::from_secs_f32(*swing_duration),
hit_timing: *hit_timing,
recover_duration: Duration::from_secs_f32(*recover_duration),
ability_info,
2020-09-28 01:58:49 +00:00
},
stage_section: StageSection::Charge,
2020-09-28 01:58:49 +00:00
timer: Duration::default(),
exhausted: false,
2020-09-28 01:58:49 +00:00
charge_amount: 0.0,
}),
2020-07-26 03:06:53 +00:00
CharacterAbility::ChargedRanged {
energy_cost: _,
energy_drain,
initial_damage,
scaled_damage,
2020-07-26 03:06:53 +00:00
initial_knockback,
scaled_knockback,
speed,
buildup_duration,
2020-07-26 03:06:53 +00:00
charge_duration,
recover_duration,
projectile_body,
projectile_light,
projectile_gravity,
initial_projectile_speed,
scaled_projectile_speed,
2020-12-23 02:28:55 +00:00
move_speed,
2020-07-26 03:06:53 +00:00
} => CharacterState::ChargedRanged(charged_ranged::Data {
static_data: charged_ranged::StaticData {
buildup_duration: Duration::from_secs_f32(*buildup_duration),
charge_duration: Duration::from_secs_f32(*charge_duration),
recover_duration: Duration::from_secs_f32(*recover_duration),
energy_drain: *energy_drain,
initial_damage: *initial_damage,
scaled_damage: *scaled_damage,
speed: *speed,
initial_knockback: *initial_knockback,
scaled_knockback: *scaled_knockback,
projectile_body: *projectile_body,
projectile_light: *projectile_light,
projectile_gravity: *projectile_gravity,
initial_projectile_speed: *initial_projectile_speed,
scaled_projectile_speed: *scaled_projectile_speed,
2020-12-23 02:28:55 +00:00
move_speed: *move_speed,
ability_info,
},
timer: Duration::default(),
stage_section: StageSection::Buildup,
2020-07-26 03:06:53 +00:00
exhausted: false,
}),
CharacterAbility::RepeaterRanged {
energy_cost: _,
movement_duration,
2020-09-28 02:38:23 +00:00
buildup_duration,
shoot_duration,
recover_duration,
2020-09-28 02:38:23 +00:00
leap,
projectile,
projectile_body,
projectile_light,
projectile_gravity,
projectile_speed,
reps_remaining,
} => CharacterState::RepeaterRanged(repeater_ranged::Data {
2020-09-28 02:38:23 +00:00
static_data: repeater_ranged::StaticData {
movement_duration: Duration::from_secs_f32(*movement_duration),
buildup_duration: Duration::from_secs_f32(*buildup_duration),
shoot_duration: Duration::from_secs_f32(*shoot_duration),
recover_duration: Duration::from_secs_f32(*recover_duration),
2020-09-28 02:38:23 +00:00
leap: *leap,
projectile: *projectile,
2020-09-28 02:38:23 +00:00
projectile_body: *projectile_body,
projectile_light: *projectile_light,
projectile_gravity: *projectile_gravity,
projectile_speed: *projectile_speed,
ability_info,
2020-09-28 02:38:23 +00:00
},
timer: Duration::default(),
stage_section: StageSection::Movement,
reps_remaining: *reps_remaining,
}),
CharacterAbility::Shockwave {
2020-08-08 20:53:55 +00:00
energy_cost: _,
buildup_duration,
swing_duration,
2020-08-08 20:53:55 +00:00
recover_duration,
damage,
poise_damage,
2020-08-08 20:53:55 +00:00
knockback,
shockwave_angle,
2020-10-12 22:55:55 +00:00
shockwave_vertical_angle,
2020-08-08 20:53:55 +00:00
shockwave_speed,
shockwave_duration,
2020-09-19 16:55:31 +00:00
requires_ground,
2020-10-09 17:42:15 +00:00
move_efficiency,
} => CharacterState::Shockwave(shockwave::Data {
static_data: shockwave::StaticData {
buildup_duration: Duration::from_secs_f32(*buildup_duration),
swing_duration: Duration::from_secs_f32(*swing_duration),
recover_duration: Duration::from_secs_f32(*recover_duration),
damage: *damage,
poise_damage: *poise_damage,
knockback: *knockback,
shockwave_angle: *shockwave_angle,
2020-10-12 22:55:55 +00:00
shockwave_vertical_angle: *shockwave_vertical_angle,
shockwave_speed: *shockwave_speed,
shockwave_duration: Duration::from_secs_f32(*shockwave_duration),
requires_ground: *requires_ground,
2020-10-09 17:42:15 +00:00
move_efficiency: *move_efficiency,
ability_info,
},
timer: Duration::default(),
stage_section: StageSection::Buildup,
2020-08-08 20:53:55 +00:00
}),
CharacterAbility::BasicBeam {
buildup_duration,
recover_duration,
beam_duration,
damage,
2020-08-31 21:55:38 +00:00
tick_rate,
range,
max_angle,
lifesteal_eff,
energy_regen,
energy_drain,
2021-01-19 19:38:32 +00:00
orientation_behavior,
specifier,
} => CharacterState::BasicBeam(basic_beam::Data {
static_data: basic_beam::StaticData {
buildup_duration: Duration::from_secs_f32(*buildup_duration),
recover_duration: Duration::from_secs_f32(*recover_duration),
beam_duration: Duration::from_secs_f32(*beam_duration),
damage: *damage,
tick_rate: *tick_rate,
range: *range,
max_angle: *max_angle,
lifesteal_eff: *lifesteal_eff,
energy_regen: *energy_regen,
energy_drain: *energy_drain,
ability_info,
2021-01-19 19:38:32 +00:00
orientation_behavior: *orientation_behavior,
specifier: *specifier,
},
timer: Duration::default(),
stage_section: StageSection::Buildup,
}),
2021-03-01 20:44:29 +00:00
CharacterAbility::CastAura {
buildup_duration,
cast_duration,
recover_duration,
targets,
aura,
range,
energy_cost: _,
} => CharacterState::CastAura(cast_aura::Data {
static_data: cast_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,
range: *range,
ability_info,
},
timer: Duration::default(),
stage_section: StageSection::Buildup,
}),
CharacterAbility::HealingBeam {
buildup_duration,
recover_duration,
beam_duration,
heal,
tick_rate,
range,
max_angle,
energy_cost,
specifier,
} => CharacterState::HealingBeam(healing_beam::Data {
static_data: healing_beam::StaticData {
buildup_duration: Duration::from_secs_f32(*buildup_duration),
recover_duration: Duration::from_secs_f32(*recover_duration),
beam_duration: Duration::from_secs_f32(*beam_duration),
heal: *heal,
tick_rate: *tick_rate,
range: *range,
max_angle: *max_angle,
energy_cost: *energy_cost,
ability_info,
specifier: *specifier,
},
timer: Duration::default(),
stage_section: StageSection::Buildup,
}),
2020-02-03 10:54:50 +00:00
}
}
}