2020-03-14 18:50:07 +00:00
|
|
|
use crate::{
|
2020-11-11 01:49:05 +00:00
|
|
|
assets::{self, Asset},
|
2021-05-06 18:50:16 +00:00
|
|
|
combat::{self, CombatEffect, DamageKind, Knockback},
|
2020-03-24 19:31:54 +00:00
|
|
|
comp::{
|
2021-07-06 01:32:12 +00:00
|
|
|
self, aura, beam, buff,
|
|
|
|
inventory::item::tool::{Stats, ToolKind},
|
|
|
|
projectile::ProjectileConstructor,
|
2021-08-22 10:50:01 +00:00
|
|
|
skills::{self, SKILL_MODIFIERS},
|
|
|
|
Body, CharacterState, EnergySource, 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,
|
2021-02-14 06:01:53 +00:00
|
|
|
utils::{AbilityInfo, StageSection},
|
2020-10-07 02:32:57 +00:00
|
|
|
*,
|
|
|
|
},
|
2021-06-19 18:53:23 +00:00
|
|
|
terrain::SpriteKind,
|
2020-03-14 18:50:07 +00:00
|
|
|
};
|
2020-07-06 14:23:08 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2021-08-16 09:16:20 +00:00
|
|
|
use std::{convert::TryFrom, time::Duration};
|
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,
|
2021-03-17 23:54:49 +00:00
|
|
|
BasicAura,
|
2021-04-24 19:01:36 +00:00
|
|
|
SelfBuff,
|
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),
|
2021-04-10 03:40:20 +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,
|
2021-03-17 23:54:49 +00:00
|
|
|
CharacterState::BasicAura(_) => Self::BasicAura,
|
2021-04-24 19:01:36 +00:00
|
|
|
CharacterState::SelfBuff(_) => Self::SelfBuff,
|
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 {
|
2021-02-05 01:39:12 +00:00
|
|
|
energy_cost: f32,
|
|
|
|
buildup_duration: f32,
|
|
|
|
swing_duration: f32,
|
|
|
|
recover_duration: f32,
|
|
|
|
base_damage: f32,
|
|
|
|
base_poise_damage: f32,
|
2021-05-24 00:45:22 +00:00
|
|
|
knockback: Knockback,
|
2020-03-22 15:25:47 +00:00
|
|
|
range: f32,
|
|
|
|
max_angle: f32,
|
2021-04-16 17:44:11 +00:00
|
|
|
damage_effect: Option<CombatEffect>,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind: DamageKind,
|
2020-03-12 14:36:02 +00:00
|
|
|
},
|
2020-03-16 11:32:57 +00:00
|
|
|
BasicRanged {
|
2021-02-05 01:39:12 +00:00
|
|
|
energy_cost: f32,
|
|
|
|
buildup_duration: f32,
|
|
|
|
recover_duration: f32,
|
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>,
|
2020-08-06 18:17:38 +00:00
|
|
|
projectile_speed: f32,
|
2021-05-16 03:09:39 +00:00
|
|
|
num_projectiles: u32,
|
2021-05-22 05:05:27 +00:00
|
|
|
projectile_spread: f32,
|
2020-03-22 19:39:50 +00:00
|
|
|
},
|
2020-09-21 04:16:52 +00:00
|
|
|
RepeaterRanged {
|
2021-02-05 01:39:12 +00:00
|
|
|
energy_cost: f32,
|
|
|
|
buildup_duration: f32,
|
|
|
|
shoot_duration: f32,
|
|
|
|
recover_duration: f32,
|
2021-05-16 03:09:39 +00:00
|
|
|
max_speed: f32,
|
|
|
|
half_speed_at: u32,
|
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_speed: f32,
|
|
|
|
},
|
2020-03-16 11:32:57 +00:00
|
|
|
Boost {
|
2021-02-05 01:39:12 +00:00
|
|
|
movement_duration: f32,
|
2020-03-16 11:32:57 +00:00
|
|
|
only_up: bool,
|
2021-03-26 20:11:25 +00:00
|
|
|
speed: f32,
|
|
|
|
max_exit_velocity: f32,
|
2020-03-16 11:32:57 +00:00
|
|
|
},
|
2020-03-16 15:34:53 +00:00
|
|
|
DashMelee {
|
2021-02-05 01:39:12 +00:00
|
|
|
energy_cost: f32,
|
|
|
|
base_damage: f32,
|
|
|
|
scaled_damage: f32,
|
|
|
|
base_poise_damage: f32,
|
|
|
|
scaled_poise_damage: f32,
|
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,
|
2021-02-05 01:39:12 +00:00
|
|
|
energy_drain: f32,
|
2020-09-10 02:58:28 +00:00
|
|
|
forward_speed: f32,
|
2021-02-05 01:39:12 +00:00
|
|
|
buildup_duration: f32,
|
|
|
|
charge_duration: f32,
|
|
|
|
swing_duration: f32,
|
|
|
|
recover_duration: f32,
|
2021-08-15 20:57:22 +00:00
|
|
|
ori_modifier: f32,
|
2021-04-18 22:09:57 +00:00
|
|
|
charge_through: bool,
|
2020-09-12 16:46:21 +00:00
|
|
|
is_interruptible: bool,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind: DamageKind,
|
2021-07-10 16:04:12 +00:00
|
|
|
damage_effect: Option<CombatEffect>,
|
2020-03-16 15:34:53 +00:00
|
|
|
},
|
2021-04-10 03:40:20 +00:00
|
|
|
BasicBlock {
|
|
|
|
buildup_duration: f32,
|
|
|
|
recover_duration: f32,
|
|
|
|
max_angle: f32,
|
|
|
|
block_strength: f32,
|
2021-04-13 05:46:42 +00:00
|
|
|
energy_cost: f32,
|
2021-04-10 03:40:20 +00:00
|
|
|
},
|
2020-11-05 18:28:18 +00:00
|
|
|
Roll {
|
2021-02-05 01:39:12 +00:00
|
|
|
energy_cost: f32,
|
|
|
|
buildup_duration: f32,
|
|
|
|
movement_duration: f32,
|
|
|
|
recover_duration: f32,
|
2020-11-05 18:28:18 +00:00
|
|
|
roll_strength: f32,
|
2020-12-31 18:37:25 +00:00
|
|
|
immune_melee: bool,
|
2020-11-05 18:28:18 +00:00
|
|
|
},
|
2020-09-04 01:54:59 +00:00
|
|
|
ComboMelee {
|
2021-02-05 01:39:12 +00:00
|
|
|
stage_data: Vec<combo_melee::Stage<f32>>,
|
|
|
|
initial_energy_gain: f32,
|
|
|
|
max_energy_gain: f32,
|
|
|
|
energy_increase: f32,
|
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,
|
2021-04-30 02:59:29 +00:00
|
|
|
ori_modifier: f32,
|
2020-03-19 22:40:03 +00:00
|
|
|
},
|
2020-07-03 15:40:12 +00:00
|
|
|
LeapMelee {
|
2021-02-05 01:39:12 +00:00
|
|
|
energy_cost: f32,
|
|
|
|
buildup_duration: f32,
|
|
|
|
movement_duration: f32,
|
|
|
|
swing_duration: f32,
|
|
|
|
recover_duration: f32,
|
|
|
|
base_damage: f32,
|
|
|
|
base_poise_damage: f32,
|
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,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind: DamageKind,
|
2021-07-10 16:04:12 +00:00
|
|
|
damage_effect: Option<CombatEffect>,
|
2020-07-03 15:40:12 +00:00
|
|
|
},
|
2020-07-08 19:58:41 +00:00
|
|
|
SpinMelee {
|
2021-02-05 01:39:12 +00:00
|
|
|
buildup_duration: f32,
|
|
|
|
swing_duration: f32,
|
|
|
|
recover_duration: f32,
|
|
|
|
base_damage: f32,
|
|
|
|
base_poise_damage: f32,
|
2021-03-21 00:41:56 +00:00
|
|
|
knockback: Knockback,
|
2020-09-17 01:31:27 +00:00
|
|
|
range: f32,
|
2021-03-21 00:41:56 +00:00
|
|
|
damage_effect: Option<CombatEffect>,
|
2021-02-05 01:39:12 +00:00
|
|
|
energy_cost: f32,
|
2020-09-17 01:31:27 +00:00
|
|
|
is_infinite: bool,
|
2021-01-21 22:45:03 +00:00
|
|
|
movement_behavior: spin_melee::MovementBehavior,
|
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,
|
2021-03-21 00:41:56 +00:00
|
|
|
specifier: Option<spin_melee::FrontendSpecifier>,
|
2021-03-24 16:49:58 +00:00
|
|
|
target: Option<combat::GroupTarget>,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind: DamageKind,
|
2020-07-08 19:58:41 +00:00
|
|
|
},
|
2020-09-21 04:16:52 +00:00
|
|
|
ChargedMelee {
|
2021-02-05 01:39:12 +00:00
|
|
|
energy_cost: f32,
|
|
|
|
energy_drain: f32,
|
|
|
|
initial_damage: f32,
|
|
|
|
scaled_damage: f32,
|
|
|
|
initial_poise_damage: f32,
|
|
|
|
scaled_poise_damage: f32,
|
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,
|
2021-02-05 01:39:12 +00:00
|
|
|
charge_duration: f32,
|
|
|
|
swing_duration: f32,
|
2020-11-18 19:35:43 +00:00
|
|
|
hit_timing: f32,
|
2021-02-05 01:39:12 +00:00
|
|
|
recover_duration: f32,
|
2021-04-28 04:23:28 +00:00
|
|
|
specifier: Option<charged_melee::FrontendSpecifier>,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind: DamageKind,
|
2021-07-10 16:04:12 +00:00
|
|
|
damage_effect: Option<CombatEffect>,
|
2020-09-21 04:16:52 +00:00
|
|
|
},
|
2020-07-26 03:06:53 +00:00
|
|
|
ChargedRanged {
|
2021-02-05 01:39:12 +00:00
|
|
|
energy_cost: f32,
|
|
|
|
energy_drain: f32,
|
2021-05-16 03:09:39 +00:00
|
|
|
initial_regen: f32,
|
|
|
|
scaled_regen: f32,
|
2021-02-05 01:39:12 +00:00
|
|
|
initial_damage: f32,
|
|
|
|
scaled_damage: f32,
|
2020-07-26 03:06:53 +00:00
|
|
|
initial_knockback: f32,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_knockback: f32,
|
2021-02-05 01:39:12 +00:00
|
|
|
buildup_duration: f32,
|
|
|
|
charge_duration: f32,
|
|
|
|
recover_duration: f32,
|
2020-07-26 03:06:53 +00:00
|
|
|
projectile_body: Body,
|
|
|
|
projectile_light: Option<LightEmitter>,
|
2020-08-06 18:17:38 +00:00
|
|
|
initial_projectile_speed: f32,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_projectile_speed: f32,
|
2020-12-23 02:28:55 +00:00
|
|
|
move_speed: f32,
|
2020-07-26 03:06:53 +00:00
|
|
|
},
|
2020-10-04 01:24:15 +00:00
|
|
|
Shockwave {
|
2021-02-05 01:39:12 +00:00
|
|
|
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,
|
2021-02-05 01:39:12 +00:00
|
|
|
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,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind: DamageKind,
|
2021-05-29 22:27:55 +00:00
|
|
|
specifier: comp::shockwave::FrontendSpecifier,
|
2021-07-10 16:04:12 +00:00
|
|
|
damage_effect: Option<CombatEffect>,
|
2020-08-08 20:53:55 +00:00
|
|
|
},
|
2020-08-27 00:08:29 +00:00
|
|
|
BasicBeam {
|
2021-02-05 01:39:12 +00:00
|
|
|
buildup_duration: f32,
|
|
|
|
recover_duration: f32,
|
|
|
|
beam_duration: f32,
|
2021-03-02 19:26:45 +00:00
|
|
|
damage: f32,
|
2020-08-31 21:55:38 +00:00
|
|
|
tick_rate: f32,
|
2020-08-27 00:08:29 +00:00
|
|
|
range: f32,
|
|
|
|
max_angle: f32,
|
2021-03-20 17:29:57 +00:00
|
|
|
damage_effect: Option<CombatEffect>,
|
2021-01-30 14:14:25 +00:00
|
|
|
energy_regen: f32,
|
|
|
|
energy_drain: f32,
|
2021-06-18 17:30:12 +00:00
|
|
|
ori_rate: f32,
|
2021-03-03 04:56:09 +00:00
|
|
|
specifier: beam::FrontendSpecifier,
|
2020-08-27 00:08:29 +00:00
|
|
|
},
|
2021-03-06 21:29:00 +00:00
|
|
|
BasicAura {
|
2021-03-01 20:44:29 +00:00
|
|
|
buildup_duration: f32,
|
|
|
|
cast_duration: f32,
|
|
|
|
recover_duration: f32,
|
|
|
|
targets: combat::GroupTarget,
|
|
|
|
aura: aura::AuraBuffConstructor,
|
2021-03-06 21:29:00 +00:00
|
|
|
aura_duration: f32,
|
2021-03-01 20:44:29 +00:00
|
|
|
range: f32,
|
|
|
|
energy_cost: f32,
|
2021-07-10 07:10:31 +00:00
|
|
|
scales_with_combo: bool,
|
2021-07-11 04:39:11 +00:00
|
|
|
specifier: aura::Specifier,
|
2021-03-02 19:26:45 +00:00
|
|
|
},
|
2021-03-21 03:28:13 +00:00
|
|
|
Blink {
|
|
|
|
buildup_duration: f32,
|
|
|
|
recover_duration: f32,
|
|
|
|
max_range: f32,
|
|
|
|
},
|
2021-03-21 05:53:39 +00:00
|
|
|
BasicSummon {
|
|
|
|
buildup_duration: f32,
|
|
|
|
cast_duration: f32,
|
|
|
|
recover_duration: f32,
|
|
|
|
summon_amount: u32,
|
2021-06-03 22:42:50 +00:00
|
|
|
summon_distance: (f32, f32),
|
2021-03-21 05:53:39 +00:00
|
|
|
summon_info: basic_summon::SummonInfo,
|
2021-06-03 22:42:50 +00:00
|
|
|
duration: Option<Duration>,
|
2021-03-21 05:53:39 +00:00
|
|
|
},
|
2021-04-24 19:01:36 +00:00
|
|
|
SelfBuff {
|
|
|
|
buildup_duration: f32,
|
|
|
|
cast_duration: f32,
|
|
|
|
recover_duration: f32,
|
|
|
|
buff_kind: buff::BuffKind,
|
|
|
|
buff_strength: f32,
|
|
|
|
buff_duration: Option<f32>,
|
|
|
|
energy_cost: f32,
|
|
|
|
},
|
2021-06-19 18:53:23 +00:00
|
|
|
SpriteSummon {
|
|
|
|
buildup_duration: f32,
|
|
|
|
cast_duration: f32,
|
|
|
|
recover_duration: f32,
|
|
|
|
sprite: SpriteKind,
|
|
|
|
summon_distance: (f32, f32),
|
2021-06-22 04:12:39 +00:00
|
|
|
sparseness: f64,
|
2021-06-19 18:53:23 +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 {
|
2021-02-05 01:39:12 +00:00
|
|
|
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,
|
2021-05-24 00:45:22 +00:00
|
|
|
knockback: Knockback {
|
|
|
|
strength: 0.0,
|
|
|
|
direction: combat::KnockbackDir::Away,
|
|
|
|
},
|
2020-11-11 01:49:05 +00:00
|
|
|
range: 3.5,
|
|
|
|
max_angle: 15.0,
|
2021-04-16 17:44:11 +00:00
|
|
|
damage_effect: None,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind: DamageKind::Crushing,
|
2020-11-11 01:49:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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, .. } => {
|
2021-06-20 03:51:04 +00:00
|
|
|
data.physics.on_ground.is_some()
|
2021-06-27 03:42:44 +00:00
|
|
|
&& data.inputs.move_dir.magnitude_squared() > 0.25
|
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()
|
|
|
|
},
|
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, .. }
|
2021-04-24 19:01:36 +00:00
|
|
|
| CharacterAbility::BasicBlock { energy_cost, .. }
|
|
|
|
| CharacterAbility::SelfBuff { energy_cost, .. } => update
|
2020-03-26 13:46:08 +00:00
|
|
|
.energy
|
|
|
|
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
|
|
|
|
.is_ok(),
|
2021-05-16 03:09:39 +00:00
|
|
|
// Consumes energy within state, so value only checked before entering state
|
|
|
|
CharacterAbility::RepeaterRanged { energy_cost, .. } => {
|
|
|
|
update.energy.current() as f32 >= *energy_cost
|
2020-10-17 16:29:15 +00:00
|
|
|
},
|
2021-03-01 20:44:29 +00:00
|
|
|
CharacterAbility::LeapMelee { energy_cost, .. } => {
|
|
|
|
update.vel.0.z >= 0.0
|
2020-10-17 16:29:15 +00:00
|
|
|
&& update
|
|
|
|
.energy
|
|
|
|
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
|
|
|
|
.is_ok()
|
|
|
|
},
|
2021-07-10 07:10:31 +00:00
|
|
|
CharacterAbility::BasicAura {
|
|
|
|
energy_cost,
|
|
|
|
scales_with_combo,
|
|
|
|
..
|
|
|
|
} => {
|
|
|
|
((*scales_with_combo && data.combo.counter() > 0) | !*scales_with_combo)
|
|
|
|
&& update
|
|
|
|
.energy
|
|
|
|
.try_change_by(-(*energy_cost as i32), EnergySource::Ability)
|
|
|
|
.is_ok()
|
|
|
|
},
|
2021-04-24 19:01:36 +00:00
|
|
|
CharacterAbility::ComboMelee { .. }
|
|
|
|
| CharacterAbility::Boost { .. }
|
|
|
|
| CharacterAbility::BasicBeam { .. }
|
|
|
|
| CharacterAbility::Blink { .. }
|
2021-06-19 18:53:23 +00:00
|
|
|
| CharacterAbility::BasicSummon { .. }
|
|
|
|
| CharacterAbility::SpriteSummon { .. } => true,
|
2020-03-17 14:01:41 +00:00
|
|
|
}
|
|
|
|
}
|
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 {
|
2021-04-05 21:50:53 +00:00
|
|
|
energy_cost: 120.0,
|
2021-02-05 01:39:12 +00:00
|
|
|
buildup_duration: 0.05,
|
2021-04-05 21:50:53 +00:00
|
|
|
movement_duration: 0.33,
|
2021-02-05 01:39:12 +00:00
|
|
|
recover_duration: 0.125,
|
2021-04-05 21:50:53 +00:00
|
|
|
roll_strength: 2.0,
|
2021-04-17 23:45:43 +00:00
|
|
|
immune_melee: true,
|
2020-11-06 01:22:26 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-13 03:24:19 +00:00
|
|
|
|
2021-04-10 03:40:20 +00:00
|
|
|
pub fn default_block() -> CharacterAbility {
|
|
|
|
CharacterAbility::BasicBlock {
|
2021-04-24 03:34:31 +00:00
|
|
|
buildup_duration: 0.35,
|
|
|
|
recover_duration: 0.3,
|
2021-04-10 03:40:20 +00:00
|
|
|
max_angle: 60.0,
|
|
|
|
block_strength: 0.5,
|
2021-04-13 05:46:42 +00:00
|
|
|
energy_cost: 50.0,
|
2021-04-10 03:40:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-06 01:32:12 +00:00
|
|
|
pub fn adjusted_by_stats(mut self, stats: Stats) -> Self {
|
2020-11-13 03:24:19 +00:00
|
|
|
use CharacterAbility::*;
|
|
|
|
match self {
|
|
|
|
BasicMelee {
|
2021-07-07 03:51:30 +00:00
|
|
|
ref mut energy_cost,
|
2020-11-13 03:24:19 +00:00
|
|
|
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,
|
2021-07-07 03:51:30 +00:00
|
|
|
knockback: _,
|
2021-07-06 01:32:12 +00:00
|
|
|
ref mut range,
|
2021-07-07 03:51:30 +00:00
|
|
|
max_angle: _,
|
2021-07-10 16:04:12 +00:00
|
|
|
ref mut damage_effect,
|
2021-07-07 03:51:30 +00:00
|
|
|
damage_kind: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
} => {
|
2021-07-06 20:07:15 +00:00
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*swing_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
|
|
|
*base_damage *= stats.power;
|
2021-07-11 04:22:00 +00:00
|
|
|
*base_poise_damage *= stats.effect_power;
|
2021-07-06 20:07:15 +00:00
|
|
|
*range *= stats.range;
|
2021-07-07 03:51:30 +00:00
|
|
|
*energy_cost /= stats.energy_efficiency;
|
2021-07-10 16:04:12 +00:00
|
|
|
if let Some(CombatEffect::Buff(combat::CombatBuff {
|
|
|
|
kind: _,
|
|
|
|
dur_secs: _,
|
|
|
|
strength,
|
|
|
|
chance: _,
|
|
|
|
})) = damage_effect
|
|
|
|
{
|
|
|
|
*strength *= stats.buff_strength;
|
|
|
|
}
|
2020-11-13 03:24:19 +00:00
|
|
|
},
|
|
|
|
BasicRanged {
|
2021-07-07 03:51:30 +00:00
|
|
|
ref mut energy_cost,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut recover_duration,
|
|
|
|
ref mut projectile,
|
2021-07-07 03:51:30 +00:00
|
|
|
projectile_body: _,
|
|
|
|
projectile_light: _,
|
2021-07-06 01:32:12 +00:00
|
|
|
ref mut projectile_speed,
|
2021-07-07 03:51:30 +00:00
|
|
|
num_projectiles: _,
|
|
|
|
projectile_spread: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
} => {
|
2021-07-06 20:07:15 +00:00
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
|
|
|
*projectile = projectile.modified_projectile(stats.power, 1_f32, 1_f32);
|
|
|
|
*projectile_speed *= stats.range;
|
2021-07-07 03:51:30 +00:00
|
|
|
*energy_cost /= stats.energy_efficiency;
|
2020-11-13 03:24:19 +00:00
|
|
|
},
|
|
|
|
RepeaterRanged {
|
2021-07-07 03:51:30 +00:00
|
|
|
ref mut energy_cost,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut shoot_duration,
|
|
|
|
ref mut recover_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
max_speed: _,
|
|
|
|
half_speed_at: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut projectile,
|
2021-07-07 03:51:30 +00:00
|
|
|
projectile_body: _,
|
|
|
|
projectile_light: _,
|
2021-07-06 01:32:12 +00:00
|
|
|
ref mut projectile_speed,
|
2020-11-13 03:24:19 +00:00
|
|
|
} => {
|
2021-07-06 20:07:15 +00:00
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*shoot_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
|
|
|
*projectile = projectile.modified_projectile(stats.power, 1_f32, 1_f32);
|
|
|
|
*projectile_speed *= stats.range;
|
2021-07-07 03:51:30 +00:00
|
|
|
*energy_cost /= stats.energy_efficiency;
|
2020-11-13 03:24:19 +00:00
|
|
|
},
|
|
|
|
Boost {
|
|
|
|
ref mut movement_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
only_up: _,
|
2021-03-26 20:11:25 +00:00
|
|
|
speed: ref mut boost_speed,
|
2021-07-07 03:51:30 +00:00
|
|
|
max_exit_velocity: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
} => {
|
2021-07-06 20:07:15 +00:00
|
|
|
*movement_duration /= stats.speed;
|
|
|
|
*boost_speed *= stats.power;
|
2020-11-13 03:24:19 +00:00
|
|
|
},
|
|
|
|
DashMelee {
|
2021-07-07 03:51:30 +00:00
|
|
|
ref mut energy_cost,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut base_damage,
|
2020-12-08 04:00:24 +00:00
|
|
|
ref mut scaled_damage,
|
2020-12-16 23:30:33 +00:00
|
|
|
ref mut base_poise_damage,
|
|
|
|
ref mut scaled_poise_damage,
|
2021-07-07 03:51:30 +00:00
|
|
|
base_knockback: _,
|
|
|
|
scaled_knockback: _,
|
|
|
|
ref mut range,
|
|
|
|
angle: _,
|
|
|
|
ref mut energy_drain,
|
|
|
|
forward_speed: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut buildup_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
charge_duration: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut swing_duration,
|
|
|
|
ref mut recover_duration,
|
2021-08-15 20:57:22 +00:00
|
|
|
ori_modifier: _,
|
2021-07-07 03:51:30 +00:00
|
|
|
charge_through: _,
|
|
|
|
is_interruptible: _,
|
|
|
|
damage_kind: _,
|
2021-07-10 16:04:12 +00:00
|
|
|
ref mut damage_effect,
|
2020-11-13 03:24:19 +00:00
|
|
|
} => {
|
2021-07-06 20:07:15 +00:00
|
|
|
*base_damage *= stats.power;
|
|
|
|
*scaled_damage *= stats.power;
|
2021-07-11 04:22:00 +00:00
|
|
|
*base_poise_damage *= stats.effect_power;
|
|
|
|
*scaled_poise_damage *= stats.effect_power;
|
2021-07-06 20:07:15 +00:00
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*swing_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
|
|
|
*range *= stats.range;
|
2021-07-07 03:51:30 +00:00
|
|
|
*energy_cost /= stats.energy_efficiency;
|
|
|
|
*energy_drain /= stats.energy_efficiency;
|
2021-07-10 16:04:12 +00:00
|
|
|
if let Some(CombatEffect::Buff(combat::CombatBuff {
|
|
|
|
kind: _,
|
|
|
|
dur_secs: _,
|
|
|
|
strength,
|
|
|
|
chance: _,
|
|
|
|
})) = damage_effect
|
|
|
|
{
|
|
|
|
*strength *= stats.buff_strength;
|
|
|
|
}
|
2020-11-13 03:24:19 +00:00
|
|
|
},
|
2021-04-10 03:40:20 +00:00
|
|
|
BasicBlock {
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut recover_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
// Do we want angle to be adjusted by range?
|
|
|
|
max_angle: _,
|
|
|
|
// Block strength explicitly not modified by power, that will be a separate stat
|
|
|
|
block_strength: _,
|
|
|
|
ref mut energy_cost,
|
2021-04-10 03:40:20 +00:00
|
|
|
} => {
|
2021-07-06 20:07:15 +00:00
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
2021-07-07 03:51:30 +00:00
|
|
|
*energy_cost /= stats.energy_efficiency;
|
2021-04-10 03:40:20 +00:00
|
|
|
},
|
2020-11-13 03:24:19 +00:00
|
|
|
Roll {
|
2021-07-07 03:51:30 +00:00
|
|
|
ref mut energy_cost,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut movement_duration,
|
|
|
|
ref mut recover_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
roll_strength: _,
|
|
|
|
immune_melee: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
} => {
|
2021-07-06 20:07:15 +00:00
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*movement_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
2021-07-07 03:51:30 +00:00
|
|
|
*energy_cost /= stats.energy_efficiency;
|
2020-11-13 03:24:19 +00:00
|
|
|
},
|
|
|
|
ComboMelee {
|
2021-07-07 03:51:30 +00:00
|
|
|
ref mut stage_data,
|
|
|
|
initial_energy_gain: _,
|
|
|
|
max_energy_gain: _,
|
|
|
|
energy_increase: _,
|
|
|
|
speed_increase: _,
|
|
|
|
max_speed_increase: _,
|
|
|
|
scales_from_combo: _,
|
|
|
|
is_interruptible: _,
|
|
|
|
ori_modifier: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
} => {
|
|
|
|
*stage_data = stage_data
|
|
|
|
.iter_mut()
|
2021-07-06 01:32:12 +00:00
|
|
|
.map(|s| s.adjusted_by_stats(stats))
|
2020-11-13 03:24:19 +00:00
|
|
|
.collect();
|
|
|
|
},
|
|
|
|
LeapMelee {
|
2021-07-07 03:51:30 +00:00
|
|
|
ref mut energy_cost,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut buildup_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
movement_duration: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
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,
|
2021-07-06 01:32:12 +00:00
|
|
|
ref mut range,
|
2021-07-07 03:51:30 +00:00
|
|
|
max_angle: _,
|
|
|
|
knockback: _,
|
|
|
|
forward_leap_strength: _,
|
|
|
|
vertical_leap_strength: _,
|
|
|
|
damage_kind: _,
|
2021-07-10 16:04:12 +00:00
|
|
|
ref mut damage_effect,
|
2020-11-13 03:24:19 +00:00
|
|
|
} => {
|
2021-07-06 20:07:15 +00:00
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*swing_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
|
|
|
*base_damage *= stats.power;
|
2021-07-11 04:22:00 +00:00
|
|
|
*base_poise_damage *= stats.effect_power;
|
2021-07-06 20:07:15 +00:00
|
|
|
*range *= stats.range;
|
2021-07-07 03:51:30 +00:00
|
|
|
*energy_cost /= stats.energy_efficiency;
|
2021-07-10 16:04:12 +00:00
|
|
|
if let Some(CombatEffect::Buff(combat::CombatBuff {
|
|
|
|
kind: _,
|
|
|
|
dur_secs: _,
|
|
|
|
strength,
|
|
|
|
chance: _,
|
|
|
|
})) = damage_effect
|
|
|
|
{
|
|
|
|
*strength *= stats.buff_strength;
|
|
|
|
}
|
2020-11-13 03:24:19 +00:00
|
|
|
},
|
|
|
|
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,
|
2021-07-07 03:51:30 +00:00
|
|
|
knockback: _,
|
2021-07-06 01:32:12 +00:00
|
|
|
ref mut range,
|
2021-07-10 16:04:12 +00:00
|
|
|
ref mut damage_effect,
|
2021-07-07 03:51:30 +00:00
|
|
|
ref mut energy_cost,
|
|
|
|
is_infinite: _,
|
|
|
|
movement_behavior: _,
|
|
|
|
is_interruptible: _,
|
|
|
|
forward_speed: _,
|
|
|
|
num_spins: _,
|
|
|
|
specifier: _,
|
|
|
|
target: _,
|
|
|
|
damage_kind: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
} => {
|
2021-07-06 20:07:15 +00:00
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*swing_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
|
|
|
*base_damage *= stats.power;
|
2021-07-11 04:22:00 +00:00
|
|
|
*base_poise_damage *= stats.effect_power;
|
2021-07-06 20:07:15 +00:00
|
|
|
*range *= stats.range;
|
2021-07-07 03:51:30 +00:00
|
|
|
*energy_cost /= stats.energy_efficiency;
|
2021-07-10 16:04:12 +00:00
|
|
|
if let Some(CombatEffect::Buff(combat::CombatBuff {
|
|
|
|
kind: _,
|
|
|
|
dur_secs: _,
|
|
|
|
strength,
|
|
|
|
chance: _,
|
|
|
|
})) = damage_effect
|
|
|
|
{
|
|
|
|
*strength *= stats.buff_strength;
|
|
|
|
}
|
2020-11-13 03:24:19 +00:00
|
|
|
},
|
|
|
|
ChargedMelee {
|
2021-07-07 03:51:30 +00:00
|
|
|
ref mut energy_cost,
|
|
|
|
ref mut energy_drain,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut initial_damage,
|
2020-12-08 04:00:24 +00:00
|
|
|
ref mut scaled_damage,
|
2020-12-16 23:30:33 +00:00
|
|
|
ref mut initial_poise_damage,
|
|
|
|
ref mut scaled_poise_damage,
|
2021-07-07 03:51:30 +00:00
|
|
|
initial_knockback: _,
|
|
|
|
scaled_knockback: _,
|
|
|
|
ref mut range,
|
|
|
|
max_angle: _,
|
|
|
|
charge_duration: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut swing_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
hit_timing: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut recover_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
specifier: _,
|
|
|
|
damage_kind: _,
|
2021-07-10 16:04:12 +00:00
|
|
|
ref mut damage_effect,
|
2020-11-13 03:24:19 +00:00
|
|
|
} => {
|
2021-07-06 20:07:15 +00:00
|
|
|
*initial_damage *= stats.power;
|
|
|
|
*scaled_damage *= stats.power;
|
2021-07-11 04:22:00 +00:00
|
|
|
*initial_poise_damage *= stats.effect_power;
|
|
|
|
*scaled_poise_damage *= stats.effect_power;
|
2021-07-06 20:07:15 +00:00
|
|
|
*swing_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
|
|
|
*range *= stats.range;
|
2021-07-07 03:51:30 +00:00
|
|
|
*energy_cost /= stats.energy_efficiency;
|
|
|
|
*energy_drain /= stats.energy_efficiency;
|
2021-07-10 16:04:12 +00:00
|
|
|
if let Some(CombatEffect::Buff(combat::CombatBuff {
|
|
|
|
kind: _,
|
|
|
|
dur_secs: _,
|
|
|
|
strength,
|
|
|
|
chance: _,
|
|
|
|
})) = damage_effect
|
|
|
|
{
|
|
|
|
*strength *= stats.buff_strength;
|
|
|
|
}
|
2020-11-13 03:24:19 +00:00
|
|
|
},
|
|
|
|
ChargedRanged {
|
2021-07-07 03:51:30 +00:00
|
|
|
ref mut energy_cost,
|
|
|
|
ref mut energy_drain,
|
|
|
|
initial_regen: _,
|
|
|
|
scaled_regen: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut initial_damage,
|
2020-12-08 04:00:24 +00:00
|
|
|
ref mut scaled_damage,
|
2021-07-07 03:51:30 +00:00
|
|
|
initial_knockback: _,
|
|
|
|
scaled_knockback: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut buildup_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
charge_duration: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut recover_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
projectile_body: _,
|
|
|
|
projectile_light: _,
|
2021-07-06 01:32:12 +00:00
|
|
|
ref mut initial_projectile_speed,
|
|
|
|
ref mut scaled_projectile_speed,
|
2021-07-07 03:51:30 +00:00
|
|
|
move_speed: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
} => {
|
2021-07-06 20:07:15 +00:00
|
|
|
*initial_damage *= stats.power;
|
|
|
|
*scaled_damage *= stats.power;
|
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
|
|
|
*initial_projectile_speed *= stats.range;
|
|
|
|
*scaled_projectile_speed *= stats.range;
|
2021-07-07 03:51:30 +00:00
|
|
|
*energy_cost /= stats.energy_efficiency;
|
|
|
|
*energy_drain /= stats.energy_efficiency;
|
2020-11-13 03:24:19 +00:00
|
|
|
},
|
|
|
|
Shockwave {
|
2021-07-07 03:51:30 +00:00
|
|
|
ref mut energy_cost,
|
2020-11-13 03:24:19 +00:00
|
|
|
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,
|
2021-07-07 03:51:30 +00:00
|
|
|
knockback: _,
|
|
|
|
shockwave_angle: _,
|
|
|
|
shockwave_vertical_angle: _,
|
|
|
|
shockwave_speed: _,
|
2021-07-06 01:32:12 +00:00
|
|
|
ref mut shockwave_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
requires_ground: _,
|
|
|
|
move_efficiency: _,
|
|
|
|
damage_kind: _,
|
|
|
|
specifier: _,
|
2021-07-10 16:04:12 +00:00
|
|
|
ref mut damage_effect,
|
2020-11-13 03:24:19 +00:00
|
|
|
} => {
|
2021-07-06 20:07:15 +00:00
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*swing_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
|
|
|
*damage *= stats.power;
|
2021-07-11 04:22:00 +00:00
|
|
|
*poise_damage *= stats.effect_power;
|
2021-07-06 20:07:15 +00:00
|
|
|
*shockwave_duration *= stats.range;
|
2021-07-07 03:51:30 +00:00
|
|
|
*energy_cost /= stats.energy_efficiency;
|
2021-07-10 16:04:12 +00:00
|
|
|
if let Some(CombatEffect::Buff(combat::CombatBuff {
|
|
|
|
kind: _,
|
|
|
|
dur_secs: _,
|
|
|
|
strength,
|
|
|
|
chance: _,
|
|
|
|
})) = damage_effect
|
|
|
|
{
|
|
|
|
*strength *= stats.buff_strength;
|
|
|
|
}
|
2020-11-13 03:24:19 +00:00
|
|
|
},
|
|
|
|
BasicBeam {
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut recover_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
ref mut beam_duration,
|
2021-03-02 19:26:45 +00:00
|
|
|
ref mut damage,
|
2020-11-13 03:24:19 +00:00
|
|
|
ref mut tick_rate,
|
2021-07-06 01:32:12 +00:00
|
|
|
ref mut range,
|
2021-07-07 03:51:30 +00:00
|
|
|
max_angle: _,
|
2021-07-10 16:04:12 +00:00
|
|
|
ref mut damage_effect,
|
2021-07-07 03:51:30 +00:00
|
|
|
energy_regen: _,
|
|
|
|
ref mut energy_drain,
|
|
|
|
ori_rate: _,
|
|
|
|
specifier: _,
|
2020-11-13 03:24:19 +00:00
|
|
|
} => {
|
2021-07-06 20:07:15 +00:00
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
|
|
|
*damage *= stats.power;
|
|
|
|
*tick_rate *= stats.speed;
|
|
|
|
*range *= stats.range;
|
|
|
|
// Duration modified to keep velocity constant
|
|
|
|
*beam_duration *= stats.range;
|
2021-07-07 03:51:30 +00:00
|
|
|
*energy_drain /= stats.energy_efficiency;
|
2021-07-10 16:04:12 +00:00
|
|
|
if let Some(CombatEffect::Buff(combat::CombatBuff {
|
|
|
|
kind: _,
|
|
|
|
dur_secs: _,
|
|
|
|
strength,
|
|
|
|
chance: _,
|
|
|
|
})) = damage_effect
|
|
|
|
{
|
|
|
|
*strength *= stats.buff_strength;
|
|
|
|
}
|
2020-11-13 03:24:19 +00:00
|
|
|
},
|
2021-03-06 21:29:00 +00:00
|
|
|
BasicAura {
|
2021-03-01 20:44:29 +00:00
|
|
|
ref mut buildup_duration,
|
2021-03-06 21:29:00 +00:00
|
|
|
ref mut cast_duration,
|
2021-03-01 20:44:29 +00:00
|
|
|
ref mut recover_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
targets: _,
|
|
|
|
aura:
|
|
|
|
aura::AuraBuffConstructor {
|
|
|
|
kind: _,
|
|
|
|
ref mut strength,
|
|
|
|
duration: _,
|
|
|
|
category: _,
|
|
|
|
},
|
|
|
|
aura_duration: _,
|
2021-07-06 01:32:12 +00:00
|
|
|
ref mut range,
|
2021-07-07 03:51:30 +00:00
|
|
|
ref mut energy_cost,
|
2021-07-10 07:10:31 +00:00
|
|
|
scales_with_combo: _,
|
|
|
|
specifier: _,
|
2021-03-01 20:44:29 +00:00
|
|
|
} => {
|
2021-07-06 20:07:15 +00:00
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*cast_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
2021-07-10 16:04:12 +00:00
|
|
|
// Do we want to make buff_strength affect this instead of power?
|
|
|
|
// Look into during modular weapon transition
|
2021-07-07 03:51:30 +00:00
|
|
|
*strength *= stats.power;
|
2021-07-06 20:07:15 +00:00
|
|
|
*range *= stats.range;
|
2021-07-07 03:51:30 +00:00
|
|
|
*energy_cost /= stats.energy_efficiency;
|
2021-03-01 20:44:29 +00:00
|
|
|
},
|
2021-03-21 03:28:13 +00:00
|
|
|
Blink {
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut recover_duration,
|
2021-07-06 01:32:12 +00:00
|
|
|
ref mut max_range,
|
2021-03-21 03:28:13 +00:00
|
|
|
} => {
|
2021-07-06 20:07:15 +00:00
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
|
|
|
*max_range *= stats.range;
|
2021-03-21 03:28:13 +00:00
|
|
|
},
|
2021-03-21 05:53:39 +00:00
|
|
|
BasicSummon {
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut cast_duration,
|
|
|
|
ref mut recover_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
summon_amount: _,
|
|
|
|
summon_distance: (ref mut inner_dist, ref mut outer_dist),
|
|
|
|
summon_info: _,
|
|
|
|
duration: _,
|
2021-03-21 05:53:39 +00:00
|
|
|
} => {
|
|
|
|
// TODO: Figure out how/if power should affect this
|
2021-07-06 20:07:15 +00:00
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*cast_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
2021-07-07 03:51:30 +00:00
|
|
|
*inner_dist *= stats.range;
|
|
|
|
*outer_dist *= stats.range;
|
2021-03-21 05:53:39 +00:00
|
|
|
},
|
2021-04-24 19:01:36 +00:00
|
|
|
SelfBuff {
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut cast_duration,
|
|
|
|
ref mut recover_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
buff_kind: _,
|
|
|
|
ref mut buff_strength,
|
|
|
|
buff_duration: _,
|
|
|
|
ref mut energy_cost,
|
2021-04-24 19:01:36 +00:00
|
|
|
} => {
|
2021-07-10 16:04:12 +00:00
|
|
|
// Do we want to make buff_strength affect this instead of power?
|
|
|
|
// Look into during modular weapon transition
|
2021-07-06 20:07:15 +00:00
|
|
|
*buff_strength *= stats.power;
|
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*cast_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
2021-07-07 03:51:30 +00:00
|
|
|
*energy_cost /= stats.energy_efficiency;
|
2021-04-24 19:01:36 +00:00
|
|
|
},
|
2021-06-19 18:53:23 +00:00
|
|
|
SpriteSummon {
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut cast_duration,
|
|
|
|
ref mut recover_duration,
|
2021-07-07 03:51:30 +00:00
|
|
|
sprite: _,
|
|
|
|
summon_distance: (ref mut inner_dist, ref mut outer_dist),
|
|
|
|
sparseness: _,
|
2021-06-19 18:53:23 +00:00
|
|
|
} => {
|
|
|
|
// TODO: Figure out how/if power should affect this
|
2021-07-06 20:07:15 +00:00
|
|
|
*buildup_duration /= stats.speed;
|
|
|
|
*cast_duration /= stats.speed;
|
|
|
|
*recover_duration /= stats.speed;
|
2021-07-07 03:51:30 +00:00
|
|
|
*inner_dist *= stats.range;
|
|
|
|
*outer_dist *= stats.range;
|
2021-06-19 18:53:23 +00:00
|
|
|
},
|
2020-11-13 03:24:19 +00:00
|
|
|
}
|
|
|
|
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, .. }
|
2021-04-13 05:46:42 +00:00
|
|
|
| BasicAura { energy_cost, .. }
|
2021-04-24 19:01:36 +00:00
|
|
|
| BasicBlock { energy_cost, .. }
|
|
|
|
| SelfBuff { energy_cost, .. } => *energy_cost as u32,
|
2021-03-02 19:26:45 +00:00
|
|
|
BasicBeam { energy_drain, .. } => {
|
|
|
|
if *energy_drain > f32::EPSILON {
|
|
|
|
1
|
|
|
|
} else {
|
|
|
|
0
|
|
|
|
}
|
|
|
|
},
|
2021-06-19 18:53:23 +00:00
|
|
|
Boost { .. }
|
|
|
|
| ComboMelee { .. }
|
|
|
|
| Blink { .. }
|
|
|
|
| BasicSummon { .. }
|
|
|
|
| SpriteSummon { .. } => 0,
|
2020-11-27 16:27:09 +00:00
|
|
|
}
|
|
|
|
}
|
2020-12-07 03:35:29 +00:00
|
|
|
|
2021-08-16 09:16:20 +00:00
|
|
|
#[must_use = "method returns new ability and doesn't mutate the original value"]
|
|
|
|
#[warn(clippy::pedantic)]
|
2020-12-07 03:35:29 +00:00
|
|
|
pub fn adjusted_by_skills(
|
|
|
|
mut self,
|
2021-01-16 17:01:57 +00:00
|
|
|
skillset: &skills::SkillSet,
|
2020-12-07 03:35:29 +00:00
|
|
|
tool: Option<ToolKind>,
|
|
|
|
) -> Self {
|
2020-12-31 18:37:25 +00:00
|
|
|
match tool {
|
2021-08-16 09:16:20 +00:00
|
|
|
Some(ToolKind::Sword) => self.adjusted_by_sword_skills(skillset),
|
|
|
|
Some(ToolKind::Axe) => self.adjusted_by_axe_skills(skillset),
|
|
|
|
Some(ToolKind::Hammer) => self.adjusted_by_hammer_skills(skillset),
|
|
|
|
Some(ToolKind::Bow) => self.adjusted_by_bow_skills(skillset),
|
|
|
|
Some(ToolKind::Staff) => self.adjusted_by_staff_skills(skillset),
|
|
|
|
Some(ToolKind::Sceptre) => self.adjusted_by_sceptre_skills(skillset),
|
2021-08-16 17:43:57 +00:00
|
|
|
Some(ToolKind::Pick) => self.adjusted_by_mining_skills(skillset),
|
|
|
|
None => self.adjusted_by_general_skills(skillset),
|
2021-01-10 01:05:13 +00:00
|
|
|
Some(_) => {},
|
2020-12-07 03:35:29 +00:00
|
|
|
}
|
|
|
|
self
|
|
|
|
}
|
2021-08-16 09:16:20 +00:00
|
|
|
|
2021-08-16 17:43:57 +00:00
|
|
|
#[warn(clippy::pedantic)]
|
|
|
|
fn adjusted_by_mining_skills(&mut self, skillset: &skills::SkillSet) {
|
2021-08-22 10:50:01 +00:00
|
|
|
use skills::{MiningSkill::Speed, Skill};
|
2021-08-16 17:43:57 +00:00
|
|
|
|
|
|
|
if let CharacterAbility::BasicMelee {
|
|
|
|
ref mut buildup_duration,
|
|
|
|
ref mut swing_duration,
|
|
|
|
ref mut recover_duration,
|
|
|
|
..
|
|
|
|
} = self
|
|
|
|
{
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Skill::Pick(Speed)) {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.mining_tree;
|
|
|
|
|
2021-08-16 17:43:57 +00:00
|
|
|
let speed = modifiers.speed.powi(level.into());
|
|
|
|
*buildup_duration /= speed;
|
|
|
|
*swing_duration /= speed;
|
|
|
|
*recover_duration /= speed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[warn(clippy::pedantic)]
|
|
|
|
fn adjusted_by_general_skills(&mut self, skillset: &skills::SkillSet) {
|
2021-08-22 10:50:01 +00:00
|
|
|
use skills::Skill;
|
|
|
|
|
2021-08-16 17:43:57 +00:00
|
|
|
if let CharacterAbility::Roll {
|
|
|
|
ref mut energy_cost,
|
|
|
|
ref mut roll_strength,
|
|
|
|
ref mut movement_duration,
|
|
|
|
..
|
|
|
|
} = self
|
|
|
|
{
|
|
|
|
use skills::RollSkill::{Cost, Duration, Strength};
|
2021-08-22 10:50:01 +00:00
|
|
|
|
|
|
|
let modifiers = SKILL_MODIFIERS.general_tree.roll;
|
|
|
|
|
2021-08-16 17:43:57 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Skill::Roll(Cost)) {
|
|
|
|
*energy_cost *= modifiers.energy_cost.powi(level.into());
|
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Skill::Roll(Strength)) {
|
|
|
|
*roll_strength *= modifiers.strength.powi(level.into());
|
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Skill::Roll(Duration)) {
|
|
|
|
*movement_duration *= modifiers.duration.powi(level.into());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-16 09:16:20 +00:00
|
|
|
#[warn(clippy::pedantic)]
|
|
|
|
fn adjusted_by_sword_skills(&mut self, skillset: &skills::SkillSet) {
|
|
|
|
#![allow(clippy::enum_glob_use)]
|
2021-08-22 10:50:01 +00:00
|
|
|
use skills::{Skill::Sword, SwordSkill::*};
|
2021-08-16 09:16:20 +00:00
|
|
|
|
|
|
|
match self {
|
|
|
|
CharacterAbility::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));
|
|
|
|
|
|
|
|
if skillset.has_skill(Sword(TsCombo)) {
|
|
|
|
let speed_segments = Sword(TsSpeed)
|
|
|
|
.max_level()
|
|
|
|
.map_or(1.0, |l| f32::from(l) + 1.0);
|
|
|
|
let speed_level = f32::from(skillset.skill_level_or(Sword(TsSpeed), 0));
|
|
|
|
*speed_increase = (speed_level + 1.0) / speed_segments;
|
|
|
|
*max_speed_increase = (speed_level + 1.0) / speed_segments;
|
|
|
|
} else {
|
|
|
|
*speed_increase = 0.0;
|
|
|
|
*max_speed_increase = 0.0;
|
2020-12-31 18:37:25 +00:00
|
|
|
}
|
2021-08-16 09:16:20 +00:00
|
|
|
|
|
|
|
let energy_level = skillset.skill_level_or(Sword(TsRegen), 0);
|
|
|
|
|
|
|
|
let stages = u16::try_from(stage_data.len())
|
|
|
|
.expect("number of stages can't be more than u16");
|
|
|
|
|
|
|
|
*max_energy_gain *= f32::from((energy_level + 1) * stages - 1)
|
|
|
|
* f32::from(stages - 1)
|
|
|
|
/ f32::from(Sword(TsRegen).max_level().unwrap() + 1);
|
|
|
|
*scales_from_combo = skillset.skill_level_or(Sword(TsDamage), 0).into();
|
2020-12-31 18:37:25 +00:00
|
|
|
},
|
2021-08-16 09:16:20 +00:00
|
|
|
CharacterAbility::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 charge_through,
|
|
|
|
..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.sword_tree.dash;
|
2021-08-16 09:16:20 +00:00
|
|
|
*is_interruptible = skillset.has_skill(Sword(InterruptingAttacks));
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sword(DCost)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*energy_cost *= modifiers.energy_cost.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sword(DDrain)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*energy_drain *= modifiers.energy_drain.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sword(DDamage)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*base_damage *= modifiers.base_damage.powi(level.into());
|
2020-12-31 18:37:25 +00:00
|
|
|
}
|
2021-08-16 09:16:20 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sword(DScaling)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*scaled_damage *= modifiers.scaled_damage.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if skillset.has_skill(Sword(DSpeed)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*forward_speed *= modifiers.forward_speed;
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
*charge_through = skillset.has_skill(Sword(DInfinite));
|
2020-12-31 18:37:25 +00:00
|
|
|
},
|
2021-08-16 09:16:20 +00:00
|
|
|
CharacterAbility::SpinMelee {
|
|
|
|
ref mut is_interruptible,
|
|
|
|
ref mut base_damage,
|
|
|
|
ref mut swing_duration,
|
|
|
|
ref mut energy_cost,
|
|
|
|
ref mut num_spins,
|
|
|
|
..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.sword_tree.spin;
|
2021-08-16 09:16:20 +00:00
|
|
|
*is_interruptible = skillset.has_skill(Sword(InterruptingAttacks));
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sword(SDamage)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*base_damage *= modifiers.base_damage.powi(level.into());
|
2020-12-31 18:37:25 +00:00
|
|
|
}
|
2021-08-16 09:16:20 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sword(SSpeed)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*swing_duration *= modifiers.swing_duration.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sword(SCost)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*energy_cost *= modifiers.energy_cost.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
let spin_level = skillset.skill_level_or(Sword(SSpins), 0);
|
2021-08-16 17:43:57 +00:00
|
|
|
*num_spins = u32::from(spin_level) * modifiers.num + 1;
|
2020-12-31 18:37:25 +00:00
|
|
|
},
|
2021-08-16 09:16:20 +00:00
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[warn(clippy::pedantic)]
|
|
|
|
fn adjusted_by_axe_skills(&mut self, skillset: &skills::SkillSet) {
|
|
|
|
#![allow(clippy::enum_glob_use)]
|
2021-08-22 10:50:01 +00:00
|
|
|
use skills::{AxeSkill::*, Skill::Axe};
|
2021-08-16 09:16:20 +00:00
|
|
|
|
|
|
|
match self {
|
|
|
|
CharacterAbility::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();
|
2020-12-31 18:37:25 +00:00
|
|
|
}
|
2021-08-16 09:16:20 +00:00
|
|
|
let speed_segments = f32::from(Axe(DsSpeed).max_level().unwrap_or(1));
|
|
|
|
let speed_level = f32::from(skillset.skill_level_or(Axe(DsSpeed), 0));
|
|
|
|
*speed_increase *= speed_level / speed_segments;
|
|
|
|
*max_speed_increase *= speed_level / speed_segments;
|
|
|
|
|
|
|
|
let energy_level = skillset.skill_level_or(Axe(DsRegen), 0);
|
|
|
|
|
|
|
|
let stages = u16::try_from(stage_data.len())
|
|
|
|
.expect("number of stages can't be more than u16");
|
|
|
|
|
|
|
|
*max_energy_gain *= f32::from((energy_level + 1) * stages - 1).max(1.0)
|
|
|
|
* f32::from(stages - 1).max(1.0)
|
|
|
|
/ f32::from(Axe(DsRegen).max_level().unwrap() + 1);
|
|
|
|
*scales_from_combo = skillset.skill_level_or(Axe(DsDamage), 0).into();
|
2020-12-31 18:37:25 +00:00
|
|
|
},
|
2021-08-16 09:16:20 +00:00
|
|
|
CharacterAbility::SpinMelee {
|
|
|
|
ref mut base_damage,
|
|
|
|
ref mut swing_duration,
|
|
|
|
ref mut energy_cost,
|
|
|
|
ref mut is_infinite,
|
|
|
|
ref mut movement_behavior,
|
|
|
|
..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.axe_tree.spin;
|
|
|
|
|
2021-08-16 09:16:20 +00:00
|
|
|
*is_infinite = skillset.has_skill(Axe(SInfinite));
|
|
|
|
*movement_behavior = if skillset.has_skill(Axe(SHelicopter)) {
|
|
|
|
spin_melee::MovementBehavior::AxeHover
|
|
|
|
} else {
|
|
|
|
spin_melee::MovementBehavior::ForwardGround
|
|
|
|
};
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Axe(SDamage)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*base_damage *= modifiers.base_damage.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Axe(SSpeed)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*swing_duration *= modifiers.swing_duration.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Axe(SCost)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*energy_cost *= modifiers.energy_cost.powi(level.into());
|
2020-12-31 18:37:25 +00:00
|
|
|
}
|
|
|
|
},
|
2021-08-16 09:16:20 +00:00
|
|
|
CharacterAbility::LeapMelee {
|
|
|
|
ref mut base_damage,
|
|
|
|
ref mut knockback,
|
|
|
|
ref mut energy_cost,
|
|
|
|
ref mut forward_leap_strength,
|
|
|
|
ref mut vertical_leap_strength,
|
|
|
|
..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.axe_tree.leap;
|
2021-08-16 09:16:20 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Axe(LDamage)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*base_damage *= modifiers.base_damage.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Axe(LKnockback)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*knockback *= modifiers.knockback.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Axe(LCost)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*energy_cost *= modifiers.energy_cost.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Axe(LDistance)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
let strength = modifiers.leap_strength;
|
|
|
|
*forward_leap_strength *= strength.powi(level.into());
|
|
|
|
*vertical_leap_strength *= strength.powi(level.into());
|
2021-03-07 02:16:35 +00:00
|
|
|
}
|
2020-12-31 18:37:25 +00:00
|
|
|
},
|
2021-08-16 09:16:20 +00:00
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[warn(clippy::pedantic)]
|
|
|
|
fn adjusted_by_hammer_skills(&mut self, skillset: &skills::SkillSet) {
|
|
|
|
#![allow(clippy::enum_glob_use)]
|
2021-08-22 10:50:01 +00:00
|
|
|
use skills::{HammerSkill::*, Skill::Hammer};
|
2021-08-16 17:43:57 +00:00
|
|
|
|
2021-08-16 09:16:20 +00:00
|
|
|
match self {
|
|
|
|
CharacterAbility::ComboMelee {
|
|
|
|
ref mut speed_increase,
|
|
|
|
ref mut max_speed_increase,
|
|
|
|
ref mut stage_data,
|
|
|
|
ref mut max_energy_gain,
|
|
|
|
ref mut scales_from_combo,
|
|
|
|
..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.hammer_tree.single_strike;
|
|
|
|
|
2021-08-16 09:16:20 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Hammer(SsKnockback)) {
|
|
|
|
*stage_data = (*stage_data)
|
|
|
|
.iter()
|
2021-08-16 17:43:57 +00:00
|
|
|
.map(|s| s.modify_strike(modifiers.knockback.powi(level.into())))
|
2021-08-16 09:16:20 +00:00
|
|
|
.collect::<Vec<_>>();
|
|
|
|
}
|
|
|
|
let speed_segments = f32::from(Hammer(SsSpeed).max_level().unwrap_or(1));
|
|
|
|
let speed_level = f32::from(skillset.skill_level_or(Hammer(SsSpeed), 0));
|
|
|
|
*speed_increase *= speed_level / speed_segments;
|
|
|
|
*max_speed_increase *= speed_level / speed_segments;
|
|
|
|
|
|
|
|
let energy_level = skillset.skill_level_or(Hammer(SsRegen), 0);
|
|
|
|
|
|
|
|
let stages = u16::try_from(stage_data.len())
|
|
|
|
.expect("number of stages can't be more than u16");
|
|
|
|
|
|
|
|
*max_energy_gain *= f32::from((energy_level + 1) * stages)
|
|
|
|
/ f32::from((Hammer(SsRegen).max_level().unwrap() + 1) * stages);
|
|
|
|
|
|
|
|
*scales_from_combo = skillset.skill_level_or(Hammer(SsDamage), 0).into();
|
|
|
|
},
|
|
|
|
CharacterAbility::ChargedMelee {
|
|
|
|
ref mut scaled_damage,
|
|
|
|
ref mut scaled_knockback,
|
|
|
|
ref mut energy_drain,
|
|
|
|
ref mut charge_duration,
|
|
|
|
..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.hammer_tree.charged;
|
|
|
|
|
2021-08-16 09:16:20 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Hammer(CDamage)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*scaled_damage *= modifiers.scaled_damage.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Hammer(CKnockback)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*scaled_knockback *= modifiers.scaled_knockback.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Hammer(CDrain)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*energy_drain *= modifiers.energy_drain.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Hammer(CSpeed)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
let charge_time = 1.0 / modifiers.charge_rate;
|
|
|
|
*charge_duration *= charge_time.powi(level.into());
|
2021-06-09 05:14:20 +00:00
|
|
|
}
|
|
|
|
},
|
2021-08-16 09:16:20 +00:00
|
|
|
CharacterAbility::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,
|
|
|
|
..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.hammer_tree.leap;
|
2021-08-16 09:16:20 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Hammer(LDamage)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*base_damage *= modifiers.base_damage.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Hammer(LKnockback)) {
|
2021-08-24 20:00:03 +00:00
|
|
|
*knockback *= modifiers.knockback.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Hammer(LCost)) {
|
2021-08-24 20:00:03 +00:00
|
|
|
*energy_cost *= modifiers.energy_cost.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Hammer(LDistance)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
let strength = modifiers.leap_strength;
|
|
|
|
*forward_leap_strength *= strength.powi(level.into());
|
|
|
|
*vertical_leap_strength *= strength.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Hammer(LRange)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*range += modifiers.range * f32::from(level);
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[warn(clippy::pedantic)]
|
|
|
|
fn adjusted_by_bow_skills(&mut self, skillset: &skills::SkillSet) {
|
|
|
|
#![allow(clippy::enum_glob_use)]
|
2021-08-22 10:50:01 +00:00
|
|
|
use skills::{BowSkill::*, Skill::Bow};
|
2021-08-16 09:16:20 +00:00
|
|
|
|
2021-08-22 10:50:01 +00:00
|
|
|
let projectile_speed_modifier = SKILL_MODIFIERS.bow_tree.universal.projectile_speed;
|
2021-08-16 09:16:20 +00:00
|
|
|
match self {
|
|
|
|
CharacterAbility::ChargedRanged {
|
|
|
|
ref mut initial_damage,
|
|
|
|
ref mut scaled_damage,
|
|
|
|
ref mut initial_regen,
|
|
|
|
ref mut scaled_regen,
|
|
|
|
ref mut initial_knockback,
|
|
|
|
ref mut scaled_knockback,
|
|
|
|
ref mut move_speed,
|
|
|
|
ref mut initial_projectile_speed,
|
|
|
|
ref mut scaled_projectile_speed,
|
|
|
|
ref mut charge_duration,
|
|
|
|
..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.bow_tree.charged;
|
2021-08-16 09:16:20 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Bow(ProjSpeed)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
let projectile_speed_scaling = projectile_speed_modifier.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
*initial_projectile_speed *= projectile_speed_scaling;
|
|
|
|
*scaled_projectile_speed *= projectile_speed_scaling;
|
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Bow(CDamage)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
let damage_scaling = modifiers.damage_scaling.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
*initial_damage *= damage_scaling;
|
|
|
|
*scaled_damage *= damage_scaling;
|
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Bow(CRegen)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
let regen_scaling = modifiers.regen_scaling.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
*initial_regen *= regen_scaling;
|
|
|
|
*scaled_regen *= regen_scaling;
|
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Bow(CKnockback)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
let knockback_scaling = modifiers.knockback_scaling.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
*initial_knockback *= knockback_scaling;
|
|
|
|
*scaled_knockback *= knockback_scaling;
|
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Bow(CSpeed)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
let charge_time = 1.0 / modifiers.charge_rate;
|
|
|
|
*charge_duration *= charge_time.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Bow(CMove)) {
|
2021-08-24 20:00:03 +00:00
|
|
|
*move_speed *= modifiers.move_speed.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
CharacterAbility::RepeaterRanged {
|
|
|
|
ref mut energy_cost,
|
|
|
|
ref mut projectile,
|
|
|
|
ref mut max_speed,
|
|
|
|
ref mut projectile_speed,
|
|
|
|
..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.bow_tree.repeater;
|
2021-08-16 09:16:20 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Bow(ProjSpeed)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*projectile_speed *= projectile_speed_modifier.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Bow(RDamage)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
let power = modifiers.power.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
*projectile = projectile.modified_projectile(power, 1_f32, 1_f32);
|
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Bow(RCost)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*energy_cost *= modifiers.energy_cost.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Bow(RSpeed)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*max_speed *= modifiers.max_speed.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
CharacterAbility::BasicRanged {
|
|
|
|
ref mut projectile,
|
|
|
|
ref mut energy_cost,
|
|
|
|
ref mut num_projectiles,
|
|
|
|
ref mut projectile_spread,
|
|
|
|
ref mut projectile_speed,
|
|
|
|
..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.bow_tree.shotgun;
|
2021-08-16 09:16:20 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Bow(ProjSpeed)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*projectile_speed *= projectile_speed_modifier.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Bow(SDamage)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
let power = modifiers.power.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
*projectile = projectile.modified_projectile(power, 1_f32, 1_f32);
|
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Bow(SCost)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*energy_cost *= modifiers.energy_cost.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Bow(SArrows)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*num_projectiles += u32::from(level) * modifiers.num_projectiles;
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Bow(SSpread)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*projectile_spread *= modifiers.spread.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[warn(clippy::pedantic)]
|
|
|
|
fn adjusted_by_staff_skills(&mut self, skillset: &skills::SkillSet) {
|
|
|
|
#![allow(clippy::enum_glob_use)]
|
2021-08-22 10:50:01 +00:00
|
|
|
use skills::{Skill::Staff, StaffSkill::*};
|
2021-08-16 09:16:20 +00:00
|
|
|
|
|
|
|
match self {
|
|
|
|
CharacterAbility::BasicRanged {
|
|
|
|
ref mut projectile, ..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.staff_tree.fireball;
|
2021-08-16 09:16:20 +00:00
|
|
|
let damage_level = skillset.skill_level_or(Staff(BDamage), 0);
|
|
|
|
let regen_level = skillset.skill_level_or(Staff(BRegen), 0);
|
|
|
|
let range_level = skillset.skill_level_or(Staff(BRadius), 0);
|
2021-08-16 17:43:57 +00:00
|
|
|
let power = modifiers.power.powi(damage_level.into());
|
2021-08-24 20:00:03 +00:00
|
|
|
let regen = modifiers.regen.powi(regen_level.into());
|
|
|
|
let range = modifiers.range.powi(range_level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
*projectile = projectile.modified_projectile(power, regen, range);
|
|
|
|
},
|
|
|
|
CharacterAbility::BasicBeam {
|
|
|
|
ref mut damage,
|
|
|
|
ref mut range,
|
|
|
|
ref mut energy_drain,
|
|
|
|
ref mut beam_duration,
|
|
|
|
..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.staff_tree.flamethrower;
|
2021-08-16 09:16:20 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Staff(FDamage)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*damage *= modifiers.damage.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Staff(FRange)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
let range_mod = modifiers.range.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
*range *= range_mod;
|
|
|
|
// Duration modified to keep velocity constant
|
|
|
|
*beam_duration *= range_mod;
|
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Staff(FDrain)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*energy_drain *= modifiers.energy_drain.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Staff(FVelocity)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
let velocity_increase = modifiers.velocity.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
let duration_mod = 1.0 / (1.0 + velocity_increase);
|
|
|
|
*beam_duration *= duration_mod;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
CharacterAbility::Shockwave {
|
|
|
|
ref mut damage,
|
|
|
|
ref mut knockback,
|
|
|
|
ref mut shockwave_duration,
|
|
|
|
ref mut energy_cost,
|
|
|
|
..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.staff_tree.shockwave;
|
2021-08-16 09:16:20 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Staff(SDamage)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*damage *= modifiers.damage.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Staff(SKnockback)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
let knockback_mod = modifiers.knockback.powi(level.into());
|
|
|
|
*knockback = knockback.modify_strength(knockback_mod);
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Staff(SRange)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*shockwave_duration *= modifiers.duration.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Staff(SCost)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*energy_cost *= modifiers.energy_cost.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[warn(clippy::pedantic)]
|
|
|
|
fn adjusted_by_sceptre_skills(&mut self, skillset: &skills::SkillSet) {
|
|
|
|
#![allow(clippy::enum_glob_use)]
|
2021-08-22 10:50:01 +00:00
|
|
|
use skills::{SceptreSkill::*, Skill::Sceptre};
|
2021-08-16 17:43:57 +00:00
|
|
|
|
2021-08-16 09:16:20 +00:00
|
|
|
match self {
|
|
|
|
CharacterAbility::BasicBeam {
|
|
|
|
ref mut damage,
|
|
|
|
ref mut range,
|
|
|
|
ref mut beam_duration,
|
|
|
|
ref mut damage_effect,
|
|
|
|
ref mut energy_regen,
|
|
|
|
..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.sceptre_tree.beam;
|
2021-08-16 09:16:20 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sceptre(LDamage)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*damage *= modifiers.damage.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sceptre(LRange)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
let range_mod = modifiers.range.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
*range *= range_mod;
|
|
|
|
// Duration modified to keep velocity constant
|
|
|
|
*beam_duration *= range_mod;
|
|
|
|
}
|
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sceptre(LRegen)) {
|
2021-08-16 17:43:57 +00:00
|
|
|
*energy_regen *= modifiers.energy_regen.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
if let (Ok(Some(level)), Some(CombatEffect::Lifesteal(ref mut lifesteal))) =
|
|
|
|
(skillset.skill_level(Sceptre(LLifesteal)), damage_effect)
|
2021-03-20 23:35:34 +00:00
|
|
|
{
|
2021-08-16 17:43:57 +00:00
|
|
|
*lifesteal *= modifiers.lifesteal.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
CharacterAbility::BasicAura {
|
|
|
|
ref mut aura,
|
|
|
|
ref mut range,
|
|
|
|
ref mut energy_cost,
|
2021-08-16 17:43:57 +00:00
|
|
|
specifier: aura::Specifier::HealingAura,
|
2021-08-16 09:16:20 +00:00
|
|
|
..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.sceptre_tree.healing_aura;
|
2021-08-16 17:43:57 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sceptre(HHeal)) {
|
|
|
|
aura.strength *= modifiers.strength.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
2021-08-16 17:43:57 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sceptre(HDuration)) {
|
|
|
|
if let Some(ref mut duration) = aura.duration {
|
|
|
|
*duration *= modifiers.duration.powi(level.into());
|
2021-03-20 23:35:34 +00:00
|
|
|
}
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
2021-08-16 17:43:57 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sceptre(HRange)) {
|
|
|
|
*range *= modifiers.range.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
2021-08-16 17:43:57 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sceptre(HCost)) {
|
|
|
|
*energy_cost *= modifiers.energy_cost.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
CharacterAbility::BasicAura {
|
|
|
|
ref mut aura,
|
|
|
|
ref mut range,
|
|
|
|
ref mut energy_cost,
|
2021-08-16 17:43:57 +00:00
|
|
|
specifier: aura::Specifier::WardingAura,
|
2021-08-16 09:16:20 +00:00
|
|
|
..
|
|
|
|
} => {
|
2021-08-22 10:50:01 +00:00
|
|
|
let modifiers = SKILL_MODIFIERS.sceptre_tree.warding_aura;
|
2021-08-16 17:43:57 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sceptre(AStrength)) {
|
|
|
|
aura.strength *= modifiers.strength.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
2021-08-16 17:43:57 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sceptre(ADuration)) {
|
|
|
|
if let Some(ref mut duration) = aura.duration {
|
|
|
|
*duration *= modifiers.duration.powi(level.into());
|
2021-03-20 23:35:34 +00:00
|
|
|
}
|
2021-03-20 23:22:04 +00:00
|
|
|
}
|
2021-08-16 17:43:57 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sceptre(ARange)) {
|
|
|
|
*range *= modifiers.range.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
2021-08-16 17:43:57 +00:00
|
|
|
if let Ok(Some(level)) = skillset.skill_level(Sceptre(ACost)) {
|
|
|
|
*energy_cost *= modifiers.energy_cost.powi(level.into());
|
2021-08-16 09:16:20 +00:00
|
|
|
}
|
2020-12-31 18:37:25 +00:00
|
|
|
},
|
2021-08-16 09:16:20 +00:00
|
|
|
_ => {},
|
2020-12-07 03:35:29 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-17 14:01:41 +00:00
|
|
|
}
|
|
|
|
|
2021-07-21 03:15:38 +00:00
|
|
|
impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
|
|
|
|
fn from((ability, ability_info, data): (&CharacterAbility, AbilityInfo, &JoinData)) -> 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-12-05 18:23:45 +00:00
|
|
|
base_poise_damage,
|
2020-08-05 22:49:04 +00:00
|
|
|
knockback,
|
2020-03-22 15:25:47 +00:00
|
|
|
range,
|
|
|
|
max_angle,
|
2021-04-16 17:44:11 +00:00
|
|
|
damage_effect,
|
2020-03-24 21:03:11 +00:00
|
|
|
energy_cost: _,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind,
|
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 {
|
2021-02-05 01:39:12 +00:00
|
|
|
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
|
|
|
swing_duration: Duration::from_secs_f32(*swing_duration),
|
|
|
|
recover_duration: Duration::from_secs_f32(*recover_duration),
|
2020-10-17 02:29:14 +00:00
|
|
|
base_damage: *base_damage,
|
2020-12-05 18:23:45 +00:00
|
|
|
base_poise_damage: *base_poise_damage,
|
2020-10-17 02:29:14 +00:00
|
|
|
knockback: *knockback,
|
|
|
|
range: *range,
|
|
|
|
max_angle: *max_angle,
|
2021-04-16 17:44:11 +00:00
|
|
|
damage_effect: *damage_effect,
|
2021-02-14 06:01:53 +00:00
|
|
|
ability_info,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind: *damage_kind,
|
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,
|
2020-08-06 18:17:38 +00:00
|
|
|
projectile_speed,
|
2020-03-24 19:09:23 +00:00
|
|
|
energy_cost: _,
|
2021-05-16 03:09:39 +00:00
|
|
|
num_projectiles,
|
2021-05-22 05:05:27 +00:00
|
|
|
projectile_spread,
|
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 {
|
2021-02-05 01:39:12 +00:00
|
|
|
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
|
|
|
recover_duration: Duration::from_secs_f32(*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_speed: *projectile_speed,
|
2021-05-16 03:09:39 +00:00
|
|
|
num_projectiles: *num_projectiles,
|
2021-05-22 05:05:27 +00:00
|
|
|
projectile_spread: *projectile_spread,
|
2021-02-14 06:01:53 +00:00
|
|
|
ability_info,
|
2020-10-17 02:29:14 +00:00
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: StageSection::Buildup,
|
2020-03-16 11:32:57 +00:00
|
|
|
exhausted: false,
|
2020-03-14 18:50:07 +00:00
|
|
|
}),
|
2020-10-17 02:29:14 +00:00
|
|
|
CharacterAbility::Boost {
|
|
|
|
movement_duration,
|
|
|
|
only_up,
|
2021-03-26 20:11:25 +00:00
|
|
|
speed,
|
|
|
|
max_exit_velocity,
|
2020-10-17 02:29:14 +00:00
|
|
|
} => CharacterState::Boost(boost::Data {
|
|
|
|
static_data: boost::StaticData {
|
2021-02-05 01:39:12 +00:00
|
|
|
movement_duration: Duration::from_secs_f32(*movement_duration),
|
2020-10-17 02:29:14 +00:00
|
|
|
only_up: *only_up,
|
2021-03-26 20:11:25 +00:00
|
|
|
speed: *speed,
|
|
|
|
max_exit_velocity: *max_exit_velocity,
|
2021-03-12 04:53:25 +00:00
|
|
|
ability_info,
|
2020-10-17 02:29:14 +00:00
|
|
|
},
|
|
|
|
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-12-05 18:23:45 +00:00
|
|
|
base_poise_damage,
|
2020-12-16 23:30:33 +00:00
|
|
|
scaled_poise_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,
|
2021-08-15 20:57:22 +00:00
|
|
|
ori_modifier,
|
2021-04-18 22:09:57 +00:00
|
|
|
charge_through,
|
2020-09-12 16:46:21 +00:00
|
|
|
is_interruptible,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind,
|
2021-07-10 16:04:12 +00:00
|
|
|
damage_effect,
|
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-12-05 18:23:45 +00:00
|
|
|
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,
|
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,
|
2021-04-18 22:09:57 +00:00
|
|
|
charge_through: *charge_through,
|
2021-02-05 01:39:12 +00:00
|
|
|
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),
|
2021-08-15 20:57:22 +00:00
|
|
|
ori_modifier: *ori_modifier,
|
2020-09-12 16:46:21 +00:00
|
|
|
is_interruptible: *is_interruptible,
|
2021-07-10 16:04:12 +00:00
|
|
|
damage_effect: *damage_effect,
|
2021-02-14 06:01:53 +00:00
|
|
|
ability_info,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind: *damage_kind,
|
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(),
|
2021-04-18 22:09:57 +00:00
|
|
|
charge_end_timer: Duration::from_secs_f32(*charge_duration),
|
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
|
|
|
}),
|
2021-04-10 03:40:20 +00:00
|
|
|
CharacterAbility::BasicBlock {
|
|
|
|
buildup_duration,
|
|
|
|
recover_duration,
|
|
|
|
max_angle,
|
|
|
|
block_strength,
|
2021-08-31 06:47:37 +00:00
|
|
|
energy_cost,
|
2021-04-10 03:40:20 +00:00
|
|
|
} => CharacterState::BasicBlock(basic_block::Data {
|
|
|
|
static_data: basic_block::StaticData {
|
|
|
|
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
|
|
|
recover_duration: Duration::from_secs_f32(*recover_duration),
|
|
|
|
max_angle: *max_angle,
|
|
|
|
block_strength: *block_strength,
|
2021-08-31 06:47:37 +00:00
|
|
|
energy_cost: *energy_cost as i32,
|
2021-04-10 03:40:20 +00:00
|
|
|
ability_info,
|
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: StageSection::Buildup,
|
|
|
|
}),
|
2020-11-05 18:28:18 +00:00
|
|
|
CharacterAbility::Roll {
|
|
|
|
energy_cost: _,
|
|
|
|
buildup_duration,
|
|
|
|
movement_duration,
|
|
|
|
recover_duration,
|
|
|
|
roll_strength,
|
2020-12-31 18:37:25 +00:00
|
|
|
immune_melee,
|
2020-11-05 18:28:18 +00:00
|
|
|
} => CharacterState::Roll(roll::Data {
|
2020-10-17 02:29:14 +00:00
|
|
|
static_data: roll::StaticData {
|
2021-02-05 01:39:12 +00:00
|
|
|
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
|
|
|
movement_duration: Duration::from_secs_f32(*movement_duration),
|
|
|
|
recover_duration: Duration::from_secs_f32(*recover_duration),
|
2020-11-05 18:28:18 +00:00
|
|
|
roll_strength: *roll_strength,
|
2020-12-31 18:37:25 +00:00
|
|
|
immune_melee: *immune_melee,
|
2021-03-22 22:47:13 +00:00
|
|
|
ability_info,
|
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,
|
2021-02-28 00:09:51 +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,
|
2021-04-30 02:59:29 +00:00
|
|
|
ori_modifier,
|
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,
|
2021-04-30 02:59:29 +00:00
|
|
|
ori_modifier: *ori_modifier as f32,
|
2021-02-14 06:01:53 +00:00
|
|
|
ability_info,
|
2020-09-21 22:38:01 +00:00
|
|
|
},
|
2021-06-11 19:00:06 +00:00
|
|
|
exhausted: false,
|
2020-09-04 01:54:59 +00:00
|
|
|
stage: 1,
|
|
|
|
timer: Duration::default(),
|
2020-09-10 02:58:28 +00:00
|
|
|
stage_section: StageSection::Buildup,
|
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-12-05 18:23:45 +00:00
|
|
|
base_poise_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,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind,
|
2021-07-10 16:04:12 +00:00
|
|
|
damage_effect,
|
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 {
|
2021-02-05 01:39:12 +00:00
|
|
|
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,
|
2020-12-05 18:23:45 +00:00
|
|
|
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,
|
2021-07-10 16:04:12 +00:00
|
|
|
damage_effect: *damage_effect,
|
2021-02-14 06:01:53 +00:00
|
|
|
ability_info,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind: *damage_kind,
|
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-12-05 18:23:45 +00:00
|
|
|
base_poise_damage,
|
2020-09-17 01:31:27 +00:00
|
|
|
knockback,
|
|
|
|
range,
|
2021-03-21 00:41:56 +00:00
|
|
|
damage_effect,
|
2020-09-17 01:31:27 +00:00
|
|
|
energy_cost,
|
|
|
|
is_infinite,
|
2021-01-21 22:45:03 +00:00
|
|
|
movement_behavior,
|
2020-09-20 17:23:33 +00:00
|
|
|
is_interruptible,
|
2020-09-17 01:31:27 +00:00
|
|
|
forward_speed,
|
|
|
|
num_spins,
|
2021-03-21 00:41:56 +00:00
|
|
|
specifier,
|
2021-03-24 16:49:58 +00:00
|
|
|
target,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind,
|
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 {
|
2021-02-05 01:39:12 +00:00
|
|
|
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
|
|
|
swing_duration: Duration::from_secs_f32(*swing_duration),
|
|
|
|
recover_duration: Duration::from_secs_f32(*recover_duration),
|
2020-09-17 01:31:27 +00:00
|
|
|
base_damage: *base_damage,
|
2020-12-16 23:30:33 +00:00
|
|
|
base_poise_damage: *base_poise_damage,
|
2020-09-17 01:31:27 +00:00
|
|
|
knockback: *knockback,
|
|
|
|
range: *range,
|
2021-03-21 00:41:56 +00:00
|
|
|
damage_effect: *damage_effect,
|
2020-09-17 01:31:27 +00:00
|
|
|
energy_cost: *energy_cost,
|
|
|
|
is_infinite: *is_infinite,
|
2021-01-21 22:45:03 +00:00
|
|
|
movement_behavior: *movement_behavior,
|
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,
|
2021-03-24 16:49:58 +00:00
|
|
|
target: *target,
|
2021-02-14 06:01:53 +00:00
|
|
|
ability_info,
|
2021-03-21 00:41:56 +00:00
|
|
|
specifier: *specifier,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind: *damage_kind,
|
2020-09-17 01:31:27 +00:00
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
2021-03-29 14:44:46 +00:00
|
|
|
consecutive_spins: 1,
|
2020-09-17 01:31:27 +00:00
|
|
|
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-12-05 18:23:45 +00:00
|
|
|
initial_poise_damage,
|
2020-12-16 23:30:33 +00:00
|
|
|
scaled_poise_damage,
|
2020-09-21 04:16:52 +00:00
|
|
|
initial_knockback,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_knockback,
|
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,
|
2021-04-28 04:23:28 +00:00
|
|
|
specifier,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind,
|
2021-07-10 16:04:12 +00:00
|
|
|
damage_effect,
|
2020-09-21 04:16:52 +00:00
|
|
|
} => 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-12-05 18:23:45 +00:00
|
|
|
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,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_knockback: *scaled_knockback,
|
2020-09-28 01:58:49 +00:00
|
|
|
range: *range,
|
|
|
|
max_angle: *max_angle,
|
2021-02-05 01:39:12 +00:00
|
|
|
charge_duration: Duration::from_secs_f32(*charge_duration),
|
|
|
|
swing_duration: Duration::from_secs_f32(*swing_duration),
|
2020-11-18 19:35:43 +00:00
|
|
|
hit_timing: *hit_timing,
|
2021-02-05 01:39:12 +00:00
|
|
|
recover_duration: Duration::from_secs_f32(*recover_duration),
|
2021-07-10 16:04:12 +00:00
|
|
|
damage_effect: *damage_effect,
|
2021-02-14 06:01:53 +00:00
|
|
|
ability_info,
|
2021-04-28 04:23:28 +00:00
|
|
|
specifier: *specifier,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind: *damage_kind,
|
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,
|
2021-05-16 03:09:39 +00:00
|
|
|
initial_regen,
|
|
|
|
scaled_regen,
|
2020-07-26 03:06:53 +00:00
|
|
|
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-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
|
|
|
initial_projectile_speed,
|
2020-12-08 04:00:24 +00:00
|
|
|
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 {
|
2020-10-17 02:29:14 +00:00
|
|
|
static_data: charged_ranged::StaticData {
|
2021-02-05 01:39:12 +00:00
|
|
|
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
|
|
|
charge_duration: Duration::from_secs_f32(*charge_duration),
|
|
|
|
recover_duration: Duration::from_secs_f32(*recover_duration),
|
2020-10-17 02:29:14 +00:00
|
|
|
energy_drain: *energy_drain,
|
2021-05-16 03:09:39 +00:00
|
|
|
initial_regen: *initial_regen,
|
|
|
|
scaled_regen: *scaled_regen,
|
2020-10-17 02:29:14 +00:00
|
|
|
initial_damage: *initial_damage,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_damage: *scaled_damage,
|
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,
|
|
|
|
initial_projectile_speed: *initial_projectile_speed,
|
2020-12-08 04:00:24 +00:00
|
|
|
scaled_projectile_speed: *scaled_projectile_speed,
|
2020-12-23 02:28:55 +00:00
|
|
|
move_speed: *move_speed,
|
2021-02-14 06:01:53 +00:00
|
|
|
ability_info,
|
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 {
|
2021-05-16 03:09:39 +00:00
|
|
|
energy_cost,
|
2020-09-28 02:38:23 +00:00
|
|
|
buildup_duration,
|
|
|
|
shoot_duration,
|
2020-09-21 04:16:52 +00:00
|
|
|
recover_duration,
|
2021-05-16 03:09:39 +00:00
|
|
|
max_speed,
|
|
|
|
half_speed_at,
|
2020-09-21 04:16:52 +00:00
|
|
|
projectile,
|
|
|
|
projectile_body,
|
|
|
|
projectile_light,
|
|
|
|
projectile_speed,
|
|
|
|
} => CharacterState::RepeaterRanged(repeater_ranged::Data {
|
2020-09-28 02:38:23 +00:00
|
|
|
static_data: repeater_ranged::StaticData {
|
2021-02-05 01:39:12 +00:00
|
|
|
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
|
|
|
shoot_duration: Duration::from_secs_f32(*shoot_duration),
|
|
|
|
recover_duration: Duration::from_secs_f32(*recover_duration),
|
2021-05-16 03:09:39 +00:00
|
|
|
energy_cost: *energy_cost,
|
|
|
|
// 1.0 is subtracted as 1.0 is added in state file
|
|
|
|
max_speed: *max_speed - 1.0,
|
|
|
|
half_speed_at: *half_speed_at,
|
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_speed: *projectile_speed,
|
2021-02-14 06:01:53 +00:00
|
|
|
ability_info,
|
2020-09-28 02:38:23 +00:00
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
2021-05-16 03:09:39 +00:00
|
|
|
stage_section: StageSection::Buildup,
|
|
|
|
projectiles_fired: 0,
|
|
|
|
speed: 1.0,
|
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,
|
2020-12-05 18:23:45 +00:00
|
|
|
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,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind,
|
2021-05-29 22:27:55 +00:00
|
|
|
specifier,
|
2021-07-10 16:04:12 +00:00
|
|
|
damage_effect,
|
2020-10-04 01:24:15 +00:00
|
|
|
} => CharacterState::Shockwave(shockwave::Data {
|
2020-10-08 02:12:44 +00:00
|
|
|
static_data: shockwave::StaticData {
|
2021-02-05 01:39:12 +00:00
|
|
|
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
|
|
|
swing_duration: Duration::from_secs_f32(*swing_duration),
|
|
|
|
recover_duration: Duration::from_secs_f32(*recover_duration),
|
2020-10-08 02:12:44 +00:00
|
|
|
damage: *damage,
|
2020-12-05 18:23:45 +00:00
|
|
|
poise_damage: *poise_damage,
|
2020-10-08 02:12:44 +00:00
|
|
|
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,
|
2021-02-05 01:39:12 +00:00
|
|
|
shockwave_duration: Duration::from_secs_f32(*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,
|
2021-07-10 16:04:12 +00:00
|
|
|
damage_effect: *damage_effect,
|
2021-02-14 06:01:53 +00:00
|
|
|
ability_info,
|
2021-05-06 18:50:16 +00:00
|
|
|
damage_kind: *damage_kind,
|
2021-05-29 22:27:55 +00:00
|
|
|
specifier: *specifier,
|
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,
|
2021-03-02 19:26:45 +00:00
|
|
|
damage,
|
2020-08-31 21:55:38 +00:00
|
|
|
tick_rate,
|
2020-08-27 00:08:29 +00:00
|
|
|
range,
|
|
|
|
max_angle,
|
2021-03-20 17:29:57 +00:00
|
|
|
damage_effect,
|
2020-08-27 00:08:29 +00:00
|
|
|
energy_regen,
|
2020-09-15 23:39:19 +00:00
|
|
|
energy_drain,
|
2021-06-18 17:30:12 +00:00
|
|
|
ori_rate,
|
2021-03-03 04:56:09 +00:00
|
|
|
specifier,
|
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 {
|
2021-02-05 01:39:12 +00:00
|
|
|
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
|
|
|
recover_duration: Duration::from_secs_f32(*recover_duration),
|
|
|
|
beam_duration: Duration::from_secs_f32(*beam_duration),
|
2021-03-02 19:26:45 +00:00
|
|
|
damage: *damage,
|
2020-09-25 20:02:30 +00:00
|
|
|
tick_rate: *tick_rate,
|
|
|
|
range: *range,
|
|
|
|
max_angle: *max_angle,
|
2021-03-20 17:29:57 +00:00
|
|
|
damage_effect: *damage_effect,
|
2020-09-25 20:02:30 +00:00
|
|
|
energy_regen: *energy_regen,
|
|
|
|
energy_drain: *energy_drain,
|
2021-02-14 06:01:53 +00:00
|
|
|
ability_info,
|
2021-06-18 17:30:12 +00:00
|
|
|
ori_rate: *ori_rate,
|
2021-03-03 04:56:09 +00:00
|
|
|
specifier: *specifier,
|
2020-09-25 20:02:30 +00:00
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: StageSection::Buildup,
|
2020-08-27 00:08:29 +00:00
|
|
|
}),
|
2021-03-06 21:29:00 +00:00
|
|
|
CharacterAbility::BasicAura {
|
2021-03-01 20:44:29 +00:00
|
|
|
buildup_duration,
|
|
|
|
cast_duration,
|
|
|
|
recover_duration,
|
|
|
|
targets,
|
|
|
|
aura,
|
2021-03-06 21:29:00 +00:00
|
|
|
aura_duration,
|
2021-03-01 20:44:29 +00:00
|
|
|
range,
|
|
|
|
energy_cost: _,
|
2021-07-10 07:10:31 +00:00
|
|
|
scales_with_combo,
|
|
|
|
specifier,
|
2021-03-06 21:29:00 +00:00
|
|
|
} => CharacterState::BasicAura(basic_aura::Data {
|
|
|
|
static_data: basic_aura::StaticData {
|
2021-03-01 20:44:29 +00:00
|
|
|
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,
|
2021-03-06 21:29:00 +00:00
|
|
|
aura_duration: Duration::from_secs_f32(*aura_duration),
|
2021-03-01 20:44:29 +00:00
|
|
|
range: *range,
|
|
|
|
ability_info,
|
2021-07-10 07:10:31 +00:00
|
|
|
scales_with_combo: *scales_with_combo,
|
2021-07-21 23:46:14 +00:00
|
|
|
combo_at_cast: data.combo.counter(),
|
2021-03-03 04:56:09 +00:00
|
|
|
specifier: *specifier,
|
2021-03-02 19:26:45 +00:00
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: StageSection::Buildup,
|
|
|
|
}),
|
2021-03-21 03:28:13 +00:00
|
|
|
CharacterAbility::Blink {
|
|
|
|
buildup_duration,
|
|
|
|
recover_duration,
|
|
|
|
max_range,
|
|
|
|
} => CharacterState::Blink(blink::Data {
|
|
|
|
static_data: blink::StaticData {
|
|
|
|
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
|
|
|
recover_duration: Duration::from_secs_f32(*recover_duration),
|
|
|
|
max_range: *max_range,
|
|
|
|
ability_info,
|
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: StageSection::Buildup,
|
|
|
|
}),
|
2021-03-21 05:53:39 +00:00
|
|
|
CharacterAbility::BasicSummon {
|
|
|
|
buildup_duration,
|
|
|
|
cast_duration,
|
|
|
|
recover_duration,
|
|
|
|
summon_amount,
|
2021-06-03 22:42:50 +00:00
|
|
|
summon_distance,
|
2021-03-21 05:53:39 +00:00
|
|
|
summon_info,
|
2021-06-03 22:42:50 +00:00
|
|
|
duration,
|
2021-03-21 05:53:39 +00:00
|
|
|
} => CharacterState::BasicSummon(basic_summon::Data {
|
|
|
|
static_data: basic_summon::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),
|
|
|
|
summon_amount: *summon_amount,
|
2021-06-03 22:42:50 +00:00
|
|
|
summon_distance: *summon_distance,
|
2021-03-21 05:53:39 +00:00
|
|
|
summon_info: *summon_info,
|
|
|
|
ability_info,
|
2021-06-03 22:42:50 +00:00
|
|
|
duration: *duration,
|
2021-03-21 05:53:39 +00:00
|
|
|
},
|
|
|
|
summon_count: 0,
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: StageSection::Buildup,
|
|
|
|
}),
|
2021-04-24 19:01:36 +00:00
|
|
|
CharacterAbility::SelfBuff {
|
|
|
|
buildup_duration,
|
|
|
|
cast_duration,
|
|
|
|
recover_duration,
|
|
|
|
buff_kind,
|
|
|
|
buff_strength,
|
|
|
|
buff_duration,
|
|
|
|
energy_cost: _,
|
|
|
|
} => CharacterState::SelfBuff(self_buff::Data {
|
|
|
|
static_data: self_buff::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),
|
|
|
|
buff_kind: *buff_kind,
|
|
|
|
buff_strength: *buff_strength,
|
|
|
|
buff_duration: buff_duration.map(Duration::from_secs_f32),
|
|
|
|
ability_info,
|
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: StageSection::Buildup,
|
|
|
|
}),
|
2021-06-19 18:53:23 +00:00
|
|
|
CharacterAbility::SpriteSummon {
|
|
|
|
buildup_duration,
|
|
|
|
cast_duration,
|
|
|
|
recover_duration,
|
|
|
|
sprite,
|
|
|
|
summon_distance,
|
2021-06-22 04:12:39 +00:00
|
|
|
sparseness,
|
2021-06-19 18:53:23 +00:00
|
|
|
} => CharacterState::SpriteSummon(sprite_summon::Data {
|
|
|
|
static_data: sprite_summon::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),
|
|
|
|
sprite: *sprite,
|
|
|
|
summon_distance: *summon_distance,
|
2021-06-22 04:12:39 +00:00
|
|
|
sparseness: *sparseness,
|
2021-06-19 18:53:23 +00:00
|
|
|
ability_info,
|
|
|
|
},
|
|
|
|
timer: Duration::default(),
|
|
|
|
stage_section: StageSection::Buildup,
|
2021-06-20 05:37:22 +00:00
|
|
|
achieved_radius: summon_distance.0.floor() as i32 - 1,
|
2021-06-19 18:53:23 +00:00
|
|
|
}),
|
2020-02-03 10:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|