2020-03-14 18:50:07 +00:00
|
|
|
use crate::{
|
2020-11-11 01:49:05 +00:00
|
|
|
assets::{self, Asset},
|
2020-03-24 19:31:54 +00:00
|
|
|
comp::{
|
2020-12-07 03:35:29 +00:00
|
|
|
inventory::item::tool::ToolKind,
|
2020-11-15 02:05:18 +00:00
|
|
|
projectile::ProjectileConstructor,
|
2020-12-07 03:35:29 +00:00
|
|
|
skills, Body, CharacterState, EnergySource, Gravity, LightEmitter, StateUpdate,
|
2020-03-24 19:31:54 +00:00
|
|
|
},
|
2020-10-07 02:32:57 +00:00
|
|
|
states::{
|
2020-12-01 00:28:00 +00:00
|
|
|
behavior::JoinData,
|
2020-10-07 02:32:57 +00:00
|
|
|
utils::{AbilityKey, StageSection},
|
|
|
|
*,
|
|
|
|
},
|
2020-10-18 18:21:58 +00:00
|
|
|
Knockback,
|
2020-03-14 18:50:07 +00:00
|
|
|
};
|
2020-12-07 03:35:29 +00:00
|
|
|
use hashbrown::HashMap;
|
2020-07-06 14:23:08 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2020-12-12 22:14:24 +00:00
|
|
|
use std::time::Duration;
|
2020-08-28 02:13:57 +00:00
|
|
|
use vek::Vec3;
|
2020-01-01 17:16:29 +00:00
|
|
|
|
2020-04-04 07:48:17 +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),
|
2020-04-04 07:48:17 +00:00
|
|
|
BasicBlock,
|
2020-09-13 01:33:46 +00:00
|
|
|
ComboMelee(StageSection, u32),
|
2020-10-14 22:30:58 +00:00
|
|
|
LeapMelee(StageSection),
|
|
|
|
SpinMelee(StageSection),
|
2020-10-04 01:24:15 +00:00
|
|
|
Shockwave,
|
2020-08-27 00:08:29 +00:00
|
|
|
BasicBeam,
|
2020-09-21 04:16:52 +00:00
|
|
|
RepeaterRanged,
|
2020-04-04 07:48:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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),
|
2020-04-04 07:48:17 +00:00
|
|
|
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,
|
2020-12-08 04:00:24 +00:00
|
|
|
CharacterState::Shockwave(_) => Self::Shockwave,
|
2020-08-27 00:08:29 +00:00
|
|
|
CharacterState::BasicBeam(_) => Self::BasicBeam,
|
2020-09-21 04:16:52 +00:00
|
|
|
CharacterState::RepeaterRanged(_) => Self::RepeaterRanged,
|
2020-04-04 07:48:17 +00:00
|
|
|
_ => Self::BasicMelee,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-16 11:32:57 +00:00
|
|
|
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
|
2020-03-14 15:40:29 +00:00
|
|
|
pub enum CharacterAbility {
|
2020-03-16 11:32:57 +00:00
|
|
|
BasicMelee {
|
2020-03-24 21:03:11 +00:00
|
|
|
energy_cost: u32,
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: u64,
|
|
|
|
swing_duration: u64,
|
|
|
|
recover_duration: u64,
|
2020-10-17 02:29:14 +00:00
|
|
|
base_damage: u32,
|
2020-08-05 22:49:04 +00:00
|
|
|
knockback: f32,
|
2020-03-22 15:25:47 +00:00
|
|
|
range: f32,
|
|
|
|
max_angle: f32,
|
2020-03-12 14:36:02 +00:00
|
|
|
},
|
2020-03-16 11:32:57 +00:00
|
|
|
BasicRanged {
|
2020-03-24 19:09:23 +00:00
|
|
|
energy_cost: u32,
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: u64,
|
|
|
|
recover_duration: u64,
|
2020-11-09 04:04:51 +00:00
|
|
|
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>,
|
2020-08-06 18:17:38 +00:00
|
|
|
projectile_speed: f32,
|
2020-11-08 19:06:44 +00:00
|
|
|
can_continue: bool,
|
2020-03-22 19:39:50 +00:00
|
|
|
},
|
2020-09-21 04:16:52 +00:00
|
|
|
RepeaterRanged {
|
|
|
|
energy_cost: u32,
|
2020-11-11 01:49:05 +00:00
|
|
|
movement_duration: u64,
|
|
|
|
buildup_duration: u64,
|
|
|
|
shoot_duration: u64,
|
|
|
|
recover_duration: u64,
|
2020-09-28 02:38:23 +00:00
|
|
|
leap: Option<f32>,
|
2020-11-09 04:04:51 +00:00
|
|
|
projectile: ProjectileConstructor,
|
2020-09-21 04:16:52 +00:00
|
|
|
projectile_body: Body,
|
|
|
|
projectile_light: Option<LightEmitter>,
|
|
|
|
projectile_gravity: Option<Gravity>,
|
|
|
|
projectile_speed: f32,
|
2020-09-25 06:25:56 +00:00
|
|
|
reps_remaining: u32,
|
2020-09-21 04:16:52 +00:00
|
|
|
},
|
2020-03-16 11:32:57 +00:00
|
|
|
Boost {
|
2020-11-11 01:49:05 +00:00
|
|
|
movement_duration: u64,
|
2020-03-16 11:32:57 +00:00
|
|
|
only_up: bool,
|
|
|
|
},
|
2020-03-16 15:34:53 +00:00
|
|
|
DashMelee {
|
2020-07-03 15:40:12 +00:00
|
|
|
energy_cost: u32,
|
2020-09-10 02:58:28 +00:00
|
|
|
base_damage: u32,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_damage: u32,
|
2020-09-10 02:58:28 +00:00
|
|
|
base_knockback: f32,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_knockback: f32,
|
2020-09-10 02:58:28 +00:00
|
|
|
range: f32,
|
|
|
|
angle: f32,
|
|
|
|
energy_drain: u32,
|
|
|
|
forward_speed: f32,
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: u64,
|
|
|
|
charge_duration: u64,
|
|
|
|
swing_duration: u64,
|
|
|
|
recover_duration: u64,
|
2020-09-11 19:56:04 +00:00
|
|
|
infinite_charge: bool,
|
2020-09-12 16:46:21 +00:00
|
|
|
is_interruptible: bool,
|
2020-03-16 15:34:53 +00:00
|
|
|
},
|
2020-03-07 18:15:02 +00:00
|
|
|
BasicBlock,
|
2020-11-05 18:28:18 +00:00
|
|
|
Roll {
|
|
|
|
energy_cost: u32,
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: u64,
|
|
|
|
movement_duration: u64,
|
|
|
|
recover_duration: u64,
|
2020-11-05 18:28:18 +00:00
|
|
|
roll_strength: f32,
|
|
|
|
},
|
2020-09-04 01:54:59 +00:00
|
|
|
ComboMelee {
|
2020-11-11 01:49:05 +00:00
|
|
|
stage_data: Vec<combo_melee::Stage<u64>>,
|
2020-09-04 01:54:59 +00:00
|
|
|
initial_energy_gain: u32,
|
|
|
|
max_energy_gain: u32,
|
|
|
|
energy_increase: u32,
|
2020-09-11 19:24:55 +00:00
|
|
|
speed_increase: f32,
|
|
|
|
max_speed_increase: f32,
|
2020-12-08 04:00:24 +00:00
|
|
|
scales_from_combo: u32,
|
2020-09-12 16:46:21 +00:00
|
|
|
is_interruptible: bool,
|
2020-03-19 22:40:03 +00:00
|
|
|
},
|
2020-07-03 15:40:12 +00:00
|
|
|
LeapMelee {
|
|
|
|
energy_cost: u32,
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: u64,
|
|
|
|
movement_duration: u64,
|
|
|
|
swing_duration: u64,
|
|
|
|
recover_duration: u64,
|
2020-07-03 15:40:12 +00:00
|
|
|
base_damage: u32,
|
2020-09-21 04:16:52 +00:00
|
|
|
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-03 15:40:12 +00:00
|
|
|
},
|
2020-07-08 19:58:41 +00:00
|
|
|
SpinMelee {
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: u64,
|
|
|
|
swing_duration: u64,
|
|
|
|
recover_duration: u64,
|
2020-07-08 19:58:41 +00:00
|
|
|
base_damage: u32,
|
2020-09-17 01:31:27 +00:00
|
|
|
knockback: f32,
|
|
|
|
range: f32,
|
|
|
|
energy_cost: u32,
|
|
|
|
is_infinite: bool,
|
|
|
|
is_helicopter: bool,
|
2020-09-20 17:23:33 +00:00
|
|
|
is_interruptible: bool,
|
2020-09-17 01:31:27 +00:00
|
|
|
forward_speed: f32,
|
|
|
|
num_spins: u32,
|
2020-07-08 19:58:41 +00:00
|
|
|
},
|
2020-09-21 04:16:52 +00:00
|
|
|
ChargedMelee {
|
|
|
|
energy_cost: u32,
|
|
|
|
energy_drain: u32,
|
|
|
|
initial_damage: u32,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_damage: u32,
|
2020-09-21 04:16:52 +00:00
|
|
|
initial_knockback: f32,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_knockback: f32,
|
2020-09-21 04:16:52 +00:00
|
|
|
range: f32,
|
|
|
|
max_angle: f32,
|
2020-11-10 10:34:22 +00:00
|
|
|
speed: f32,
|
2020-11-11 01:49:05 +00:00
|
|
|
charge_duration: u64,
|
|
|
|
swing_duration: u64,
|
2020-11-18 19:35:43 +00:00
|
|
|
hit_timing: f32,
|
2020-11-11 01:49:05 +00:00
|
|
|
recover_duration: u64,
|
2020-09-21 04:16:52 +00:00
|
|
|
},
|
2020-07-26 03:06:53 +00:00
|
|
|
ChargedRanged {
|
|
|
|
energy_cost: u32,
|
|
|
|
energy_drain: u32,
|
|
|
|
initial_damage: u32,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_damage: u32,
|
2020-07-26 03:06:53 +00:00
|
|
|
initial_knockback: f32,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_knockback: f32,
|
2020-11-10 10:34:22 +00:00
|
|
|
speed: f32,
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: u64,
|
|
|
|
charge_duration: u64,
|
|
|
|
recover_duration: u64,
|
2020-07-26 03:06:53 +00:00
|
|
|
projectile_body: Body,
|
|
|
|
projectile_light: Option<LightEmitter>,
|
2020-08-06 18:17:38 +00:00
|
|
|
projectile_gravity: Option<Gravity>,
|
|
|
|
initial_projectile_speed: f32,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_projectile_speed: f32,
|
2020-07-26 03:06:53 +00:00
|
|
|
},
|
2020-10-04 01:24:15 +00:00
|
|
|
Shockwave {
|
2020-08-08 20:53:55 +00:00
|
|
|
energy_cost: u32,
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: u64,
|
|
|
|
swing_duration: u64,
|
|
|
|
recover_duration: u64,
|
2020-08-08 20:53:55 +00:00
|
|
|
damage: u32,
|
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,
|
2020-11-11 01:49:05 +00:00
|
|
|
shockwave_duration: u64,
|
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
|
|
|
},
|
2020-08-27 00:08:29 +00:00
|
|
|
BasicBeam {
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: u64,
|
|
|
|
recover_duration: u64,
|
|
|
|
beam_duration: u64,
|
2020-08-27 00:08:29 +00:00
|
|
|
base_hps: u32,
|
|
|
|
base_dps: u32,
|
2020-08-31 21:55:38 +00:00
|
|
|
tick_rate: f32,
|
2020-08-27 00:08:29 +00:00
|
|
|
range: f32,
|
|
|
|
max_angle: f32,
|
|
|
|
lifesteal_eff: f32,
|
|
|
|
energy_regen: u32,
|
2020-10-07 02:32:57 +00:00
|
|
|
energy_cost: u32,
|
2020-09-15 23:39:19 +00:00
|
|
|
energy_drain: u32,
|
2020-08-27 00:08:29 +00:00
|
|
|
},
|
2020-01-01 17:16:29 +00:00
|
|
|
}
|
|
|
|
|
2020-11-11 01:49:05 +00:00
|
|
|
impl Default for CharacterAbility {
|
|
|
|
fn default() -> Self {
|
|
|
|
CharacterAbility::BasicMelee {
|
|
|
|
energy_cost: 0,
|
|
|
|
buildup_duration: 250,
|
|
|
|
swing_duration: 250,
|
|
|
|
recover_duration: 500,
|
|
|
|
base_damage: 10,
|
|
|
|
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-11-11 01:49:05 +00:00
|
|
|
|
2020-12-13 01:09:57 +00:00
|
|
|
const EXTENSION: &'static str = "ron";
|
2020-11-11 01:49:05 +00:00
|
|
|
}
|
|
|
|
|
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
|
2020-03-26 19:02:01 +00:00
|
|
|
&& data.vel.0.xy().magnitude_squared() > 0.5
|
2020-03-17 14:01:41 +00:00
|
|
|
&& update
|
|
|
|
.energy
|
2020-11-05 18:28:18 +00:00
|
|
|
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
|
2020-03-22 19:39:50 +00:00
|
|
|
.is_ok()
|
|
|
|
},
|
2020-07-03 15:40:12 +00:00
|
|
|
CharacterAbility::DashMelee { energy_cost, .. } => update
|
2020-03-26 13:46:08 +00:00
|
|
|
.energy
|
2020-07-03 15:40:12 +00:00
|
|
|
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
|
2020-03-26 13:46:08 +00:00
|
|
|
.is_ok(),
|
|
|
|
CharacterAbility::BasicMelee { energy_cost, .. } => update
|
|
|
|
.energy
|
|
|
|
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
|
|
|
|
.is_ok(),
|
|
|
|
CharacterAbility::BasicRanged { energy_cost, .. } => update
|
|
|
|
.energy
|
|
|
|
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
|
|
|
|
.is_ok(),
|
2020-10-17 16:29:15 +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-07-08 19:58:41 +00:00
|
|
|
CharacterAbility::SpinMelee { energy_cost, .. } => update
|
|
|
|
.energy
|
|
|
|
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
|
|
|
|
.is_ok(),
|
2020-07-26 03:06:53 +00:00
|
|
|
CharacterAbility::ChargedRanged { energy_cost, .. } => update
|
|
|
|
.energy
|
|
|
|
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
|
|
|
|
.is_ok(),
|
2020-09-21 04:16:52 +00:00
|
|
|
CharacterAbility::ChargedMelee { energy_cost, .. } => update
|
|
|
|
.energy
|
|
|
|
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
|
|
|
|
.is_ok(),
|
2020-10-17 16:29:15 +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()
|
|
|
|
},
|
2020-10-04 01:24:15 +00:00
|
|
|
CharacterAbility::Shockwave { energy_cost, .. } => update
|
2020-08-08 20:53:55 +00:00
|
|
|
.energy
|
|
|
|
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
|
|
|
|
.is_ok(),
|
2020-03-17 14:01:41 +00:00
|
|
|
_ => true,
|
|
|
|
}
|
|
|
|
}
|
2020-11-06 01:22:26 +00:00
|
|
|
|
2021-01-08 19:12:09 +00:00
|
|
|
pub fn default_roll() -> CharacterAbility {
|
2020-11-06 01:22:26 +00:00
|
|
|
CharacterAbility::Roll {
|
|
|
|
energy_cost: 100,
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: 100,
|
|
|
|
movement_duration: 250,
|
|
|
|
recover_duration: 150,
|
2020-11-06 01:22:26 +00:00
|
|
|
roll_strength: 2.5,
|
|
|
|
}
|
|
|
|
}
|
2020-11-13 03:24:19 +00:00
|
|
|
|
2020-11-13 03:50:40 +00:00
|
|
|
pub fn adjusted_by_stats(mut self, power: f32, speed: f32) -> Self {
|
2020-11-13 03:24:19 +00:00
|
|
|
use CharacterAbility::*;
|
|
|
|
match self {
|
|
|
|
BasicMelee {
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut swing_duration,
|
|
|
|
ref mut recover_duration,
|
|
|
|
ref mut base_damage,
|
|
|
|
..
|
|
|
|
} => {
|
|
|
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
|
|
|
*swing_duration = (*swing_duration as f32 / speed) as u64;
|
|
|
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
|
|
|
*base_damage = (*base_damage as f32 * power) as u32;
|
|
|
|
},
|
|
|
|
BasicRanged {
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut recover_duration,
|
|
|
|
ref mut projectile,
|
|
|
|
..
|
|
|
|
} => {
|
|
|
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
|
|
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
2020-11-13 03:50:40 +00:00
|
|
|
*projectile = projectile.modified_projectile(power);
|
2020-11-13 03:24:19 +00:00
|
|
|
},
|
|
|
|
RepeaterRanged {
|
|
|
|
ref mut movement_duration,
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut shoot_duration,
|
|
|
|
ref mut recover_duration,
|
|
|
|
ref mut projectile,
|
|
|
|
..
|
|
|
|
} => {
|
|
|
|
*movement_duration = (*movement_duration as f32 / speed) as u64;
|
|
|
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
|
|
|
*shoot_duration = (*shoot_duration as f32 / speed) as u64;
|
|
|
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
2020-11-13 03:50:40 +00:00
|
|
|
*projectile = projectile.modified_projectile(power);
|
2020-11-13 03:24:19 +00:00
|
|
|
},
|
|
|
|
Boost {
|
|
|
|
ref mut movement_duration,
|
|
|
|
..
|
|
|
|
} => {
|
|
|
|
*movement_duration = (*movement_duration as f32 / speed) as u64;
|
|
|
|
},
|
|
|
|
DashMelee {
|
|
|
|
ref mut base_damage,
|
2020-12-08 04:00:24 +00:00
|
|
|
ref mut scaled_damage,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut swing_duration,
|
|
|
|
ref mut recover_duration,
|
|
|
|
..
|
|
|
|
} => {
|
|
|
|
*base_damage = (*base_damage as f32 * power) as u32;
|
2020-12-08 04:00:24 +00:00
|
|
|
*scaled_damage = (*scaled_damage as f32 * power) as u32;
|
2020-11-13 03:24:19 +00:00
|
|
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
|
|
|
*swing_duration = (*swing_duration as f32 / speed) as u64;
|
|
|
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
|
|
|
},
|
|
|
|
BasicBlock => {},
|
|
|
|
Roll {
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut movement_duration,
|
|
|
|
ref mut recover_duration,
|
|
|
|
..
|
|
|
|
} => {
|
|
|
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
|
|
|
*movement_duration = (*movement_duration as f32 / speed) as u64;
|
|
|
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
|
|
|
},
|
|
|
|
ComboMelee {
|
|
|
|
ref mut stage_data, ..
|
|
|
|
} => {
|
|
|
|
*stage_data = stage_data
|
|
|
|
.iter_mut()
|
2020-11-13 03:50:40 +00:00
|
|
|
.map(|s| s.adjusted_by_stats(power, speed))
|
2020-11-13 03:24:19 +00:00
|
|
|
.collect();
|
|
|
|
},
|
|
|
|
LeapMelee {
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut movement_duration,
|
|
|
|
ref mut swing_duration,
|
|
|
|
ref mut recover_duration,
|
|
|
|
ref mut base_damage,
|
|
|
|
..
|
|
|
|
} => {
|
|
|
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
|
|
|
*movement_duration = (*movement_duration as f32 / speed) as u64;
|
|
|
|
*swing_duration = (*swing_duration as f32 / speed) as u64;
|
|
|
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
|
|
|
*base_damage = (*base_damage as f32 * power) as u32;
|
|
|
|
},
|
|
|
|
SpinMelee {
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut swing_duration,
|
|
|
|
ref mut recover_duration,
|
|
|
|
ref mut base_damage,
|
|
|
|
..
|
|
|
|
} => {
|
|
|
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
|
|
|
*swing_duration = (*swing_duration as f32 / speed) as u64;
|
|
|
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
|
|
|
*base_damage = (*base_damage as f32 * power) as u32;
|
|
|
|
},
|
|
|
|
ChargedMelee {
|
|
|
|
ref mut initial_damage,
|
2020-12-08 04:00:24 +00:00
|
|
|
ref mut scaled_damage,
|
2020-11-13 03:24:19 +00:00
|
|
|
speed: ref mut ability_speed,
|
|
|
|
ref mut charge_duration,
|
|
|
|
ref mut swing_duration,
|
|
|
|
ref mut recover_duration,
|
|
|
|
..
|
|
|
|
} => {
|
|
|
|
*initial_damage = (*initial_damage as f32 * power) as u32;
|
2020-12-08 04:00:24 +00:00
|
|
|
*scaled_damage = (*scaled_damage as f32 * power) as u32;
|
2020-11-13 03:24:19 +00:00
|
|
|
*ability_speed *= speed;
|
|
|
|
*charge_duration = (*charge_duration as f32 / speed) as u64;
|
|
|
|
*swing_duration = (*swing_duration as f32 / speed) as u64;
|
|
|
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
|
|
|
},
|
|
|
|
ChargedRanged {
|
|
|
|
ref mut initial_damage,
|
2020-12-08 04:00:24 +00:00
|
|
|
ref mut scaled_damage,
|
2020-11-13 03:24:19 +00:00
|
|
|
speed: ref mut ability_speed,
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut charge_duration,
|
|
|
|
ref mut recover_duration,
|
|
|
|
..
|
|
|
|
} => {
|
|
|
|
*initial_damage = (*initial_damage as f32 * power) as u32;
|
2020-12-08 04:00:24 +00:00
|
|
|
*scaled_damage = (*scaled_damage as f32 * power) as u32;
|
2020-11-13 03:24:19 +00:00
|
|
|
*ability_speed *= speed;
|
|
|
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
|
|
|
*charge_duration = (*charge_duration as f32 / speed) as u64;
|
|
|
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
|
|
|
},
|
|
|
|
Shockwave {
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut swing_duration,
|
|
|
|
ref mut recover_duration,
|
|
|
|
ref mut damage,
|
|
|
|
..
|
|
|
|
} => {
|
|
|
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
|
|
|
*swing_duration = (*swing_duration as f32 / speed) as u64;
|
|
|
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
|
|
|
*damage = (*damage as f32 * power) as u32;
|
|
|
|
},
|
|
|
|
BasicBeam {
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut recover_duration,
|
|
|
|
ref mut base_hps,
|
|
|
|
ref mut base_dps,
|
|
|
|
ref mut tick_rate,
|
|
|
|
..
|
|
|
|
} => {
|
|
|
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
|
|
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
|
|
|
*base_hps = (*base_hps as f32 * power) as u32;
|
|
|
|
*base_dps = (*base_dps as f32 * power) as u32;
|
|
|
|
*tick_rate *= speed;
|
|
|
|
},
|
|
|
|
}
|
|
|
|
self
|
|
|
|
}
|
2020-11-27 16:27:09 +00:00
|
|
|
|
|
|
|
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, .. }
|
|
|
|
| BasicBeam { energy_cost, .. } => *energy_cost,
|
|
|
|
_ => 0,
|
|
|
|
}
|
|
|
|
}
|
2020-12-07 03:35:29 +00:00
|
|
|
|
|
|
|
pub fn adjusted_by_skills(
|
|
|
|
mut self,
|
|
|
|
skills: &HashMap<skills::Skill, skills::Level>,
|
|
|
|
tool: Option<ToolKind>,
|
|
|
|
) -> Self {
|
|
|
|
use skills::Skill::*;
|
|
|
|
use CharacterAbility::*;
|
|
|
|
if let Some(tool) = tool {
|
|
|
|
match tool {
|
|
|
|
ToolKind::Sword => {
|
|
|
|
use skills::SwordSkill::*;
|
|
|
|
match self {
|
|
|
|
ComboMelee {
|
|
|
|
ref mut is_interruptible,
|
|
|
|
ref mut speed_increase,
|
|
|
|
ref mut max_speed_increase,
|
|
|
|
ref mut stage_data,
|
|
|
|
ref mut max_energy_gain,
|
|
|
|
ref mut scales_from_combo,
|
|
|
|
..
|
|
|
|
} => {
|
|
|
|
*is_interruptible = skills.contains_key(&Sword(InterruptingAttacks));
|
|
|
|
let speed_segments =
|
|
|
|
Sword(TsSpeed).get_max_level().map_or(1, |l| l + 1) as f32;
|
|
|
|
let speed_level = if skills.contains_key(&Sword(TsCombo)) {
|
|
|
|
skills
|
|
|
|
.get(&Sword(TsSpeed))
|
|
|
|
.copied()
|
|
|
|
.flatten()
|
|
|
|
.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 Some(level) =
|
|
|
|
skills.get(&Sword(TsRegen)).copied().flatten()
|
|
|
|
{
|
|
|
|
level
|
|
|
|
} else {
|
|
|
|
0
|
|
|
|
};
|
|
|
|
{
|
|
|
|
*max_energy_gain = (*max_energy_gain as f32
|
|
|
|
* ((energy_level + 1) * stage_data.len() as u16 - 1) as f32
|
|
|
|
/ ((Sword(TsRegen).get_max_level().unwrap() + 1)
|
|
|
|
* stage_data.len() as u16
|
|
|
|
- 1) as f32)
|
|
|
|
as u32;
|
|
|
|
}
|
|
|
|
*scales_from_combo = skills
|
|
|
|
.get(&Sword(TsDamage))
|
|
|
|
.copied()
|
|
|
|
.flatten()
|
|
|
|
.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 = skills.contains_key(&Sword(InterruptingAttacks));
|
|
|
|
if let Some(level) = skills.get(&Sword(DCost)).copied().flatten() {
|
|
|
|
*energy_cost =
|
|
|
|
(*energy_cost as f32 * 0.75_f32.powi(level.into())) as u32;
|
|
|
|
}
|
|
|
|
if let Some(level) = skills.get(&Sword(DDrain)).copied().flatten() {
|
|
|
|
*energy_drain =
|
|
|
|
(*energy_drain as f32 * 0.75_f32.powi(level.into())) as u32;
|
|
|
|
}
|
|
|
|
if let Some(level) = skills.get(&Sword(DDamage)).copied().flatten() {
|
|
|
|
*base_damage =
|
|
|
|
(*base_damage as f32 * 1.2_f32.powi(level.into())) as u32;
|
|
|
|
}
|
|
|
|
if let Some(level) = skills.get(&Sword(DScaling)).copied().flatten() {
|
|
|
|
*scaled_damage =
|
|
|
|
(*scaled_damage as f32 * 1.2_f32.powi(level.into())) as u32;
|
|
|
|
}
|
|
|
|
if skills.contains_key(&Sword(DSpeed)) {
|
|
|
|
*forward_speed *= 1.5;
|
|
|
|
}
|
|
|
|
*infinite_charge = skills.contains_key(&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 = skills.contains_key(&Sword(InterruptingAttacks));
|
|
|
|
if let Some(level) = skills.get(&Sword(SDamage)).copied().flatten() {
|
|
|
|
*base_damage =
|
|
|
|
(*base_damage as f32 * 1.4_f32.powi(level.into())) as u32;
|
|
|
|
}
|
|
|
|
if let Some(level) = skills.get(&Sword(SSpeed)).copied().flatten() {
|
|
|
|
*swing_duration =
|
|
|
|
(*swing_duration as f32 * 0.8_f32.powi(level.into())) as u64;
|
|
|
|
}
|
|
|
|
if let Some(level) = skills.get(&Sword(SCost)).copied().flatten() {
|
|
|
|
*energy_cost =
|
|
|
|
(*energy_cost as f32 * 0.75_f32.powi(level.into())) as u32;
|
|
|
|
}
|
|
|
|
*num_spins = skills.get(&Sword(SSpins)).copied().flatten().unwrap_or(0)
|
|
|
|
as u32
|
|
|
|
+ 1;
|
|
|
|
},
|
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
self
|
|
|
|
}
|
2020-03-17 14:01:41 +00:00
|
|
|
}
|
|
|
|
|
2020-10-16 01:05:58 +00:00
|
|
|
impl From<(&CharacterAbility, AbilityKey)> for CharacterState {
|
|
|
|
fn from((ability, key): (&CharacterAbility, AbilityKey)) -> Self {
|
2020-03-14 15:40:29 +00:00
|
|
|
match ability {
|
2020-03-16 11:32:57 +00:00
|
|
|
CharacterAbility::BasicMelee {
|
2020-03-14 15:40:29 +00:00
|
|
|
buildup_duration,
|
2020-10-17 02:29:14 +00:00
|
|
|
swing_duration,
|
2020-03-14 15:40:29 +00:00
|
|
|
recover_duration,
|
2020-10-17 02:29:14 +00:00
|
|
|
base_damage,
|
2020-08-05 22:49:04 +00:00
|
|
|
knockback,
|
2020-03-22 15:25:47 +00:00
|
|
|
range,
|
|
|
|
max_angle,
|
2020-03-24 21:03:11 +00:00
|
|
|
energy_cost: _,
|
2020-03-16 11:32:57 +00:00
|
|
|
} => CharacterState::BasicMelee(basic_melee::Data {
|
2020-10-17 02:29:14 +00:00
|
|
|
static_data: basic_melee::StaticData {
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: Duration::from_millis(*buildup_duration),
|
|
|
|
swing_duration: Duration::from_millis(*swing_duration),
|
|
|
|
recover_duration: Duration::from_millis(*recover_duration),
|
2020-10-17 02:29:14 +00:00
|
|
|
base_damage: *base_damage,
|
|
|
|
knockback: *knockback,
|
|
|
|
range: *range,
|
|
|
|
max_angle: *max_angle,
|
2020-11-20 17:30:48 +00:00
|
|
|
ability_key: key,
|
2020-10-17 02:29:14 +00:00
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: StageSection::Buildup,
|
2020-03-14 15:40:29 +00:00
|
|
|
exhausted: false,
|
2020-03-16 11:32:57 +00:00
|
|
|
}),
|
|
|
|
CharacterAbility::BasicRanged {
|
2020-10-17 02:29:14 +00:00
|
|
|
buildup_duration,
|
2020-03-14 15:40:29 +00:00
|
|
|
recover_duration,
|
2020-03-16 11:32:57 +00:00
|
|
|
projectile,
|
|
|
|
projectile_body,
|
2020-03-24 19:31:54 +00:00
|
|
|
projectile_light,
|
|
|
|
projectile_gravity,
|
2020-08-06 18:17:38 +00:00
|
|
|
projectile_speed,
|
2020-11-08 19:06:44 +00:00
|
|
|
can_continue,
|
2020-03-24 19:09:23 +00:00
|
|
|
energy_cost: _,
|
2020-03-16 11:32:57 +00:00
|
|
|
} => CharacterState::BasicRanged(basic_ranged::Data {
|
2020-10-17 02:29:14 +00:00
|
|
|
static_data: basic_ranged::StaticData {
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: Duration::from_millis(*buildup_duration),
|
|
|
|
recover_duration: Duration::from_millis(*recover_duration),
|
2020-11-09 04:04:51 +00:00
|
|
|
projectile: *projectile,
|
2020-10-17 02:29:14 +00:00
|
|
|
projectile_body: *projectile_body,
|
|
|
|
projectile_light: *projectile_light,
|
|
|
|
projectile_gravity: *projectile_gravity,
|
|
|
|
projectile_speed: *projectile_speed,
|
2020-11-08 19:06:44 +00:00
|
|
|
can_continue: *can_continue,
|
2020-10-17 02:29:14 +00:00
|
|
|
ability_key: key,
|
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: StageSection::Buildup,
|
2020-03-16 11:32:57 +00:00
|
|
|
exhausted: false,
|
2020-11-08 19:06:44 +00:00
|
|
|
continue_next: false,
|
2020-03-14 18:50:07 +00:00
|
|
|
}),
|
2020-10-17 02:29:14 +00:00
|
|
|
CharacterAbility::Boost {
|
|
|
|
movement_duration,
|
|
|
|
only_up,
|
|
|
|
} => CharacterState::Boost(boost::Data {
|
|
|
|
static_data: boost::StaticData {
|
2020-11-11 01:49:05 +00:00
|
|
|
movement_duration: Duration::from_millis(*movement_duration),
|
2020-10-17 02:29:14 +00:00
|
|
|
only_up: *only_up,
|
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
2020-03-16 11:32:57 +00:00
|
|
|
}),
|
2020-03-16 15:34:53 +00:00
|
|
|
CharacterAbility::DashMelee {
|
2020-07-03 15:40:12 +00:00
|
|
|
energy_cost: _,
|
2020-09-10 02:58:28 +00:00
|
|
|
base_damage,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_damage,
|
2020-09-10 02:58:28 +00:00
|
|
|
base_knockback,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_knockback,
|
2020-09-10 02:58:28 +00:00
|
|
|
range,
|
|
|
|
angle,
|
|
|
|
energy_drain,
|
|
|
|
forward_speed,
|
2020-03-16 15:34:53 +00:00
|
|
|
buildup_duration,
|
2020-09-10 02:58:28 +00:00
|
|
|
charge_duration,
|
2020-09-11 19:56:04 +00:00
|
|
|
swing_duration,
|
2020-03-16 15:34:53 +00:00
|
|
|
recover_duration,
|
2020-09-11 19:56:04 +00:00
|
|
|
infinite_charge,
|
2020-09-12 16:46:21 +00:00
|
|
|
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,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_damage: *scaled_damage,
|
2020-09-11 13:59:45 +00:00
|
|
|
base_knockback: *base_knockback,
|
2020-12-08 04:00:24 +00:00
|
|
|
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,
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: Duration::from_millis(*buildup_duration),
|
|
|
|
charge_duration: Duration::from_millis(*charge_duration),
|
|
|
|
swing_duration: Duration::from_millis(*swing_duration),
|
|
|
|
recover_duration: Duration::from_millis(*recover_duration),
|
2020-09-12 16:46:21 +00:00
|
|
|
is_interruptible: *is_interruptible,
|
2020-10-31 18:44:00 +00:00
|
|
|
ability_key: key,
|
2020-09-11 13:59:45 +00:00
|
|
|
},
|
2020-10-18 16:46:28 +00:00
|
|
|
auto_charge: false,
|
2020-09-10 02:58:28 +00:00
|
|
|
timer: Duration::default(),
|
2020-10-18 16:46:28 +00:00
|
|
|
refresh_timer: Duration::default(),
|
2020-09-10 02:58:28 +00:00
|
|
|
stage_section: StageSection::Buildup,
|
2020-09-11 13:59:45 +00:00
|
|
|
exhausted: false,
|
2020-03-16 15:34:53 +00:00
|
|
|
}),
|
2020-03-16 11:32:57 +00:00
|
|
|
CharacterAbility::BasicBlock => CharacterState::BasicBlock,
|
2020-11-05 18:28:18 +00:00
|
|
|
CharacterAbility::Roll {
|
|
|
|
energy_cost: _,
|
|
|
|
buildup_duration,
|
|
|
|
movement_duration,
|
|
|
|
recover_duration,
|
|
|
|
roll_strength,
|
|
|
|
} => CharacterState::Roll(roll::Data {
|
2020-10-17 02:29:14 +00:00
|
|
|
static_data: roll::StaticData {
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: Duration::from_millis(*buildup_duration),
|
|
|
|
movement_duration: Duration::from_millis(*movement_duration),
|
|
|
|
recover_duration: Duration::from_millis(*recover_duration),
|
2020-11-05 18:28:18 +00:00
|
|
|
roll_strength: *roll_strength,
|
2020-10-17 02:29:14 +00:00
|
|
|
},
|
|
|
|
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
|
2020-11-03 04:09:38 +00:00
|
|
|
was_sneak: false,
|
2020-11-15 22:08:14 +00:00
|
|
|
was_combo: None,
|
2020-03-14 21:17:27 +00:00
|
|
|
}),
|
2020-09-04 01:54:59 +00:00
|
|
|
CharacterAbility::ComboMelee {
|
|
|
|
stage_data,
|
|
|
|
initial_energy_gain,
|
|
|
|
max_energy_gain,
|
|
|
|
energy_increase,
|
2020-09-11 19:24:55 +00:00
|
|
|
speed_increase,
|
|
|
|
max_speed_increase,
|
2020-12-08 04:00:24 +00:00
|
|
|
scales_from_combo,
|
2020-09-12 16:46:21 +00:00
|
|
|
is_interruptible,
|
2020-09-04 01:54:59 +00:00
|
|
|
} => 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,
|
2020-12-08 04:00:24 +00:00
|
|
|
scales_from_combo: *scales_from_combo,
|
2020-09-21 22:38:01 +00:00
|
|
|
is_interruptible: *is_interruptible,
|
2020-10-31 18:44:00 +00:00
|
|
|
ability_key: key,
|
2020-09-21 22:38:01 +00:00
|
|
|
},
|
2020-09-04 01:54:59 +00:00
|
|
|
stage: 1,
|
|
|
|
combo: 0,
|
|
|
|
timer: Duration::default(),
|
2020-09-10 02:58:28 +00:00
|
|
|
stage_section: StageSection::Buildup,
|
2020-09-09 00:28:59 +00:00
|
|
|
next_stage: false,
|
2020-03-27 17:40:15 +00:00
|
|
|
}),
|
2020-07-03 15:40:12 +00:00
|
|
|
CharacterAbility::LeapMelee {
|
|
|
|
energy_cost: _,
|
|
|
|
buildup_duration,
|
2020-09-28 23:55:38 +00:00
|
|
|
movement_duration,
|
|
|
|
swing_duration,
|
2020-07-03 15:40:12 +00:00
|
|
|
recover_duration,
|
|
|
|
base_damage,
|
2020-09-28 23:55:38 +00:00
|
|
|
knockback,
|
2020-09-21 04:16:52 +00:00
|
|
|
range,
|
|
|
|
max_angle,
|
2020-09-28 23:55:38 +00:00
|
|
|
forward_leap_strength,
|
|
|
|
vertical_leap_strength,
|
2020-07-03 15:40:12 +00:00
|
|
|
} => CharacterState::LeapMelee(leap_melee::Data {
|
2020-09-28 23:55:38 +00:00
|
|
|
static_data: leap_melee::StaticData {
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: Duration::from_millis(*buildup_duration),
|
|
|
|
movement_duration: Duration::from_millis(*movement_duration),
|
|
|
|
swing_duration: Duration::from_millis(*swing_duration),
|
|
|
|
recover_duration: Duration::from_millis(*recover_duration),
|
2020-09-28 23:55:38 +00:00
|
|
|
base_damage: *base_damage,
|
|
|
|
knockback: *knockback,
|
|
|
|
range: *range,
|
|
|
|
max_angle: *max_angle,
|
|
|
|
forward_leap_strength: *forward_leap_strength,
|
|
|
|
vertical_leap_strength: *vertical_leap_strength,
|
2020-11-20 17:30:48 +00:00
|
|
|
ability_key: key,
|
2020-09-28 23:55:38 +00:00
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: StageSection::Buildup,
|
2020-07-03 15:40:12 +00:00
|
|
|
exhausted: false,
|
|
|
|
}),
|
2020-07-08 19:58:41 +00:00
|
|
|
CharacterAbility::SpinMelee {
|
|
|
|
buildup_duration,
|
2020-09-17 01:31:27 +00:00
|
|
|
swing_duration,
|
2020-07-08 19:58:41 +00:00
|
|
|
recover_duration,
|
|
|
|
base_damage,
|
2020-09-17 01:31:27 +00:00
|
|
|
knockback,
|
|
|
|
range,
|
|
|
|
energy_cost,
|
|
|
|
is_infinite,
|
|
|
|
is_helicopter,
|
2020-09-20 17:23:33 +00:00
|
|
|
is_interruptible,
|
2020-09-17 01:31:27 +00:00
|
|
|
forward_speed,
|
|
|
|
num_spins,
|
2020-07-08 19:58:41 +00:00
|
|
|
} => CharacterState::SpinMelee(spin_melee::Data {
|
2020-09-17 01:31:27 +00:00
|
|
|
static_data: spin_melee::StaticData {
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: Duration::from_millis(*buildup_duration),
|
|
|
|
swing_duration: Duration::from_millis(*swing_duration),
|
|
|
|
recover_duration: Duration::from_millis(*recover_duration),
|
2020-09-17 01:31:27 +00:00
|
|
|
base_damage: *base_damage,
|
|
|
|
knockback: *knockback,
|
|
|
|
range: *range,
|
|
|
|
energy_cost: *energy_cost,
|
|
|
|
is_infinite: *is_infinite,
|
|
|
|
is_helicopter: *is_helicopter,
|
2020-09-20 17:23:33 +00:00
|
|
|
is_interruptible: *is_interruptible,
|
2020-09-17 01:31:27 +00:00
|
|
|
forward_speed: *forward_speed,
|
|
|
|
num_spins: *num_spins,
|
2020-10-31 18:44:00 +00:00
|
|
|
ability_key: key,
|
2020-09-17 01:31:27 +00:00
|
|
|
},
|
|
|
|
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
|
|
|
}),
|
2020-09-21 04:16:52 +00:00
|
|
|
CharacterAbility::ChargedMelee {
|
2020-10-06 05:21:22 +00:00
|
|
|
energy_cost,
|
2020-09-21 04:16:52 +00:00
|
|
|
energy_drain,
|
|
|
|
initial_damage,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_damage,
|
2020-09-21 04:16:52 +00:00
|
|
|
initial_knockback,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_knockback,
|
2020-11-10 10:34:22 +00:00
|
|
|
speed,
|
2020-09-21 04:16:52 +00:00
|
|
|
charge_duration,
|
2020-09-28 01:58:49 +00:00
|
|
|
swing_duration,
|
2020-11-18 19:35:43 +00:00
|
|
|
hit_timing,
|
2020-09-21 04:16:52 +00:00
|
|
|
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,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_damage: *scaled_damage,
|
2020-09-28 01:58:49 +00:00
|
|
|
initial_knockback: *initial_knockback,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_knockback: *scaled_knockback,
|
2020-11-10 10:34:22 +00:00
|
|
|
speed: *speed,
|
2020-09-28 01:58:49 +00:00
|
|
|
range: *range,
|
|
|
|
max_angle: *max_angle,
|
2020-11-11 01:49:05 +00:00
|
|
|
charge_duration: Duration::from_millis(*charge_duration),
|
|
|
|
swing_duration: Duration::from_millis(*swing_duration),
|
2020-11-18 19:35:43 +00:00
|
|
|
hit_timing: *hit_timing,
|
2020-11-11 01:49:05 +00:00
|
|
|
recover_duration: Duration::from_millis(*recover_duration),
|
2020-10-31 18:44:00 +00:00
|
|
|
ability_key: key,
|
2020-09-28 01:58:49 +00:00
|
|
|
},
|
2020-09-29 00:38:35 +00:00
|
|
|
stage_section: StageSection::Charge,
|
2020-09-28 01:58:49 +00:00
|
|
|
timer: Duration::default(),
|
2020-09-21 04:16:52 +00:00
|
|
|
exhausted: false,
|
2020-09-28 01:58:49 +00:00
|
|
|
charge_amount: 0.0,
|
2020-09-21 04:16:52 +00:00
|
|
|
}),
|
2020-07-26 03:06:53 +00:00
|
|
|
CharacterAbility::ChargedRanged {
|
|
|
|
energy_cost: _,
|
|
|
|
energy_drain,
|
|
|
|
initial_damage,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_damage,
|
2020-07-26 03:06:53 +00:00
|
|
|
initial_knockback,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_knockback,
|
2020-11-10 10:34:22 +00:00
|
|
|
speed,
|
2020-10-17 02:29:14 +00:00
|
|
|
buildup_duration,
|
2020-07-26 03:06:53 +00:00
|
|
|
charge_duration,
|
|
|
|
recover_duration,
|
|
|
|
projectile_body,
|
|
|
|
projectile_light,
|
2020-08-06 18:17:38 +00:00
|
|
|
projectile_gravity,
|
|
|
|
initial_projectile_speed,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_projectile_speed,
|
2020-07-26 03:06:53 +00:00
|
|
|
} => CharacterState::ChargedRanged(charged_ranged::Data {
|
2020-10-17 02:29:14 +00:00
|
|
|
static_data: charged_ranged::StaticData {
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: Duration::from_millis(*buildup_duration),
|
|
|
|
charge_duration: Duration::from_millis(*charge_duration),
|
|
|
|
recover_duration: Duration::from_millis(*recover_duration),
|
2020-10-17 02:29:14 +00:00
|
|
|
energy_drain: *energy_drain,
|
|
|
|
initial_damage: *initial_damage,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_damage: *scaled_damage,
|
2020-11-10 10:34:22 +00:00
|
|
|
speed: *speed,
|
2020-10-17 02:29:14 +00:00
|
|
|
initial_knockback: *initial_knockback,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_knockback: *scaled_knockback,
|
2020-10-17 02:29:14 +00:00
|
|
|
projectile_body: *projectile_body,
|
|
|
|
projectile_light: *projectile_light,
|
|
|
|
projectile_gravity: *projectile_gravity,
|
|
|
|
initial_projectile_speed: *initial_projectile_speed,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_projectile_speed: *scaled_projectile_speed,
|
2020-10-31 18:44:00 +00:00
|
|
|
ability_key: key,
|
2020-10-17 02:29:14 +00:00
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: StageSection::Buildup,
|
2020-07-26 03:06:53 +00:00
|
|
|
exhausted: false,
|
|
|
|
}),
|
2020-09-21 04:16:52 +00:00
|
|
|
CharacterAbility::RepeaterRanged {
|
|
|
|
energy_cost: _,
|
|
|
|
movement_duration,
|
2020-09-28 02:38:23 +00:00
|
|
|
buildup_duration,
|
|
|
|
shoot_duration,
|
2020-09-21 04:16:52 +00:00
|
|
|
recover_duration,
|
2020-09-28 02:38:23 +00:00
|
|
|
leap,
|
2020-09-21 04:16:52 +00:00
|
|
|
projectile,
|
|
|
|
projectile_body,
|
|
|
|
projectile_light,
|
|
|
|
projectile_gravity,
|
|
|
|
projectile_speed,
|
2020-09-25 06:25:56 +00:00
|
|
|
reps_remaining,
|
2020-09-21 04:16:52 +00:00
|
|
|
} => CharacterState::RepeaterRanged(repeater_ranged::Data {
|
2020-09-28 02:38:23 +00:00
|
|
|
static_data: repeater_ranged::StaticData {
|
2020-11-11 01:49:05 +00:00
|
|
|
movement_duration: Duration::from_millis(*movement_duration),
|
|
|
|
buildup_duration: Duration::from_millis(*buildup_duration),
|
|
|
|
shoot_duration: Duration::from_millis(*shoot_duration),
|
|
|
|
recover_duration: Duration::from_millis(*recover_duration),
|
2020-09-28 02:38:23 +00:00
|
|
|
leap: *leap,
|
2020-11-09 04:04:51 +00:00
|
|
|
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,
|
2020-11-20 17:30:48 +00:00
|
|
|
ability_key: key,
|
2020-09-28 02:38:23 +00:00
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: StageSection::Movement,
|
2020-09-25 06:25:56 +00:00
|
|
|
reps_remaining: *reps_remaining,
|
2020-09-21 04:16:52 +00:00
|
|
|
}),
|
2020-10-04 01:24:15 +00:00
|
|
|
CharacterAbility::Shockwave {
|
2020-08-08 20:53:55 +00:00
|
|
|
energy_cost: _,
|
|
|
|
buildup_duration,
|
2020-10-08 02:12:44 +00:00
|
|
|
swing_duration,
|
2020-08-08 20:53:55 +00:00
|
|
|
recover_duration,
|
|
|
|
damage,
|
|
|
|
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,
|
2020-10-04 01:24:15 +00:00
|
|
|
} => CharacterState::Shockwave(shockwave::Data {
|
2020-10-08 02:12:44 +00:00
|
|
|
static_data: shockwave::StaticData {
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: Duration::from_millis(*buildup_duration),
|
|
|
|
swing_duration: Duration::from_millis(*swing_duration),
|
|
|
|
recover_duration: Duration::from_millis(*recover_duration),
|
2020-10-08 02:12:44 +00:00
|
|
|
damage: *damage,
|
|
|
|
knockback: *knockback,
|
|
|
|
shockwave_angle: *shockwave_angle,
|
2020-10-12 22:55:55 +00:00
|
|
|
shockwave_vertical_angle: *shockwave_vertical_angle,
|
2020-10-08 02:12:44 +00:00
|
|
|
shockwave_speed: *shockwave_speed,
|
2020-11-11 01:49:05 +00:00
|
|
|
shockwave_duration: Duration::from_millis(*shockwave_duration),
|
2020-10-08 02:12:44 +00:00
|
|
|
requires_ground: *requires_ground,
|
2020-10-09 17:42:15 +00:00
|
|
|
move_efficiency: *move_efficiency,
|
2020-11-20 17:30:48 +00:00
|
|
|
ability_key: key,
|
2020-10-08 02:12:44 +00:00
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: StageSection::Buildup,
|
2020-08-08 20:53:55 +00:00
|
|
|
}),
|
2020-08-27 00:08:29 +00:00
|
|
|
CharacterAbility::BasicBeam {
|
|
|
|
buildup_duration,
|
|
|
|
recover_duration,
|
2020-09-05 16:27:36 +00:00
|
|
|
beam_duration,
|
2020-08-27 00:08:29 +00:00
|
|
|
base_hps,
|
|
|
|
base_dps,
|
2020-08-31 21:55:38 +00:00
|
|
|
tick_rate,
|
2020-08-27 00:08:29 +00:00
|
|
|
range,
|
|
|
|
max_angle,
|
|
|
|
lifesteal_eff,
|
|
|
|
energy_regen,
|
2020-10-07 02:32:57 +00:00
|
|
|
energy_cost,
|
2020-09-15 23:39:19 +00:00
|
|
|
energy_drain,
|
2020-08-27 00:08:29 +00:00
|
|
|
} => CharacterState::BasicBeam(basic_beam::Data {
|
2020-09-25 20:02:30 +00:00
|
|
|
static_data: basic_beam::StaticData {
|
2020-11-11 01:49:05 +00:00
|
|
|
buildup_duration: Duration::from_millis(*buildup_duration),
|
|
|
|
recover_duration: Duration::from_millis(*recover_duration),
|
|
|
|
beam_duration: Duration::from_millis(*beam_duration),
|
2020-09-25 20:02:30 +00:00
|
|
|
base_hps: *base_hps,
|
|
|
|
base_dps: *base_dps,
|
|
|
|
tick_rate: *tick_rate,
|
|
|
|
range: *range,
|
|
|
|
max_angle: *max_angle,
|
|
|
|
lifesteal_eff: *lifesteal_eff,
|
|
|
|
energy_regen: *energy_regen,
|
2020-10-07 02:32:57 +00:00
|
|
|
energy_cost: *energy_cost,
|
2020-09-25 20:02:30 +00:00
|
|
|
energy_drain: *energy_drain,
|
2020-10-16 01:05:58 +00:00
|
|
|
ability_key: key,
|
2020-09-25 20:02:30 +00:00
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: StageSection::Buildup,
|
2020-08-28 02:13:57 +00:00
|
|
|
particle_ori: None::<Vec3<f32>>,
|
2020-11-15 20:06:07 +00:00
|
|
|
offset: Vec3::zero(),
|
2020-08-27 00:08:29 +00:00
|
|
|
}),
|
2020-02-03 10:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|