mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'sam/deprecate-spinmelee' into 'master'
Deprecated SpinMelee Character State See merge request veloren/veloren!4186
This commit is contained in:
commit
f9a7c83c5a
@ -1,21 +1,17 @@
|
||||
SpinMelee(
|
||||
BasicMelee(
|
||||
energy_cost: 0,
|
||||
buildup_duration: 0.9,
|
||||
swing_duration: 0.3,
|
||||
recover_duration: 0.6,
|
||||
melee_constructor: (
|
||||
kind: Bash(
|
||||
damage: 45.0,
|
||||
poise: 30.0,
|
||||
knockback: 20.0,
|
||||
energy_regen: 0.0,
|
||||
damage: 45,
|
||||
poise: 30,
|
||||
knockback: 20,
|
||||
energy_regen: 0,
|
||||
),
|
||||
range: 7.5,
|
||||
angle: 360.0,
|
||||
),
|
||||
energy_cost: 0,
|
||||
is_infinite: false,
|
||||
movement_behavior: Stationary,
|
||||
forward_speed: 0.0,
|
||||
num_spins: 1,
|
||||
specifier: None,
|
||||
ori_modifier: 1.0,
|
||||
)
|
||||
|
@ -1,13 +1,13 @@
|
||||
SpinMelee(
|
||||
RapidMelee(
|
||||
buildup_duration: 1.1,
|
||||
swing_duration: 0.4,
|
||||
recover_duration: 0.6,
|
||||
melee_constructor: (
|
||||
kind: Bash(
|
||||
damage: 45.0,
|
||||
poise: 30.0,
|
||||
knockback: 55.0,
|
||||
energy_regen: 0.0,
|
||||
damage: 45,
|
||||
poise: 30,
|
||||
knockback: 55,
|
||||
energy_regen: 0,
|
||||
),
|
||||
range: 20.5,
|
||||
angle: 360.0,
|
||||
@ -20,9 +20,8 @@ SpinMelee(
|
||||
multi_target: Some(Normal),
|
||||
),
|
||||
energy_cost: 0,
|
||||
is_infinite: false,
|
||||
movement_behavior: Stationary,
|
||||
forward_speed: 0.0,
|
||||
num_spins: 3,
|
||||
specifier: Some(Whirlwind),
|
||||
max_strikes: Some(3),
|
||||
ori_modifier: 1.0,
|
||||
move_modifier: 1.0,
|
||||
frontend_specifier: Some(Whirlwind),
|
||||
)
|
||||
|
@ -1,4 +1,5 @@
|
||||
SpinMelee(
|
||||
BasicMelee(
|
||||
energy_cost: 0,
|
||||
buildup_duration: 0.25,
|
||||
swing_duration: 0.3,
|
||||
recover_duration: 1.0,
|
||||
@ -7,14 +8,12 @@ SpinMelee(
|
||||
damage: 10,
|
||||
poise: 100,
|
||||
knockback: 20,
|
||||
energy_regen: 0,
|
||||
),
|
||||
range: 10,
|
||||
angle: 360.0,
|
||||
angle: 360,
|
||||
multi_target: Some(Normal),
|
||||
),
|
||||
energy_cost: 0.0,
|
||||
is_infinite: false,
|
||||
movement_behavior: Stationary,
|
||||
forward_speed: 0.0,
|
||||
num_spins: 1,
|
||||
specifier: None,
|
||||
ori_modifier: 1.0,
|
||||
)
|
||||
|
||||
|
@ -1,21 +1,19 @@
|
||||
SpinMelee(
|
||||
RapidMelee(
|
||||
buildup_duration: 1.2,
|
||||
swing_duration: 0.5,
|
||||
recover_duration: 1.2,
|
||||
melee_constructor: (
|
||||
kind: NecroticVortex(
|
||||
damage: 30.0,
|
||||
pull: 7.0,
|
||||
lifesteal: 2.0,
|
||||
damage: 30,
|
||||
pull: 7,
|
||||
lifesteal: 2,
|
||||
),
|
||||
range: 16.0,
|
||||
angle: 360.0,
|
||||
multi_target: Some(Normal),
|
||||
),
|
||||
energy_cost: 0.0,
|
||||
is_infinite: true,
|
||||
movement_behavior: Stationary,
|
||||
forward_speed: 0.0,
|
||||
num_spins: 1,
|
||||
specifier: Some(CultistVortex),
|
||||
energy_cost: 0,
|
||||
ori_modifier: 1.0,
|
||||
move_modifier: 0.0,
|
||||
frontend_specifier: Some(CultistVortex),
|
||||
)
|
||||
|
@ -1,22 +1,18 @@
|
||||
SpinMelee(
|
||||
BasicMelee(
|
||||
energy_cost: 0,
|
||||
buildup_duration: 0.2,
|
||||
swing_duration: 0.3,
|
||||
recover_duration: 0.1,
|
||||
melee_constructor: (
|
||||
kind: Bash(
|
||||
damage: 100.0,
|
||||
poise: 30.0,
|
||||
knockback: 0.0,
|
||||
energy_regen: 0.0,
|
||||
damage: 100,
|
||||
poise: 30,
|
||||
knockback: 0,
|
||||
energy_regen: 0,
|
||||
),
|
||||
range: 7.5,
|
||||
angle: 360.0,
|
||||
angle: 360,
|
||||
multi_target: Some(Normal),
|
||||
),
|
||||
energy_cost: 0,
|
||||
is_infinite: false,
|
||||
movement_behavior: Stationary,
|
||||
forward_speed: 0.0,
|
||||
num_spins: 1,
|
||||
specifier: None,
|
||||
ori_modifier: 1.0,
|
||||
)
|
||||
|
@ -1,22 +1,19 @@
|
||||
SpinMelee(
|
||||
RapidMelee(
|
||||
buildup_duration: 0.0,
|
||||
swing_duration: 0.5,
|
||||
recover_duration: 0.0,
|
||||
melee_constructor: (
|
||||
kind: Slash(
|
||||
damage: 80.0,
|
||||
poise: 0.0,
|
||||
knockback: 50.0,
|
||||
energy_regen: 0.0,
|
||||
damage: 80,
|
||||
poise: 0,
|
||||
knockback: 50,
|
||||
energy_regen: 0,
|
||||
),
|
||||
range: 3.5,
|
||||
angle: 360.0,
|
||||
angle: 360,
|
||||
multi_target: Some(Normal),
|
||||
),
|
||||
energy_cost: 0,
|
||||
is_infinite: true,
|
||||
movement_behavior: ForwardGround,
|
||||
forward_speed: 0.0,
|
||||
num_spins: 1,
|
||||
specifier: None,
|
||||
ori_modifier: 1.0,
|
||||
move_modifier: 1.0,
|
||||
)
|
||||
|
@ -1,21 +1,17 @@
|
||||
SpinMelee(
|
||||
BasicMelee(
|
||||
energy_cost: 0,
|
||||
buildup_duration: 0.9,
|
||||
swing_duration: 0.3,
|
||||
recover_duration: 0.6,
|
||||
melee_constructor: (
|
||||
kind: Bash(
|
||||
damage: 45.0,
|
||||
poise: 30.0,
|
||||
knockback: 20.0,
|
||||
energy_regen: 0.0,
|
||||
damage: 45,
|
||||
poise: 30,
|
||||
knockback: 20,
|
||||
energy_regen: 0,
|
||||
),
|
||||
range: 7.5,
|
||||
angle: 360.0,
|
||||
angle: 360,
|
||||
),
|
||||
energy_cost: 0,
|
||||
is_infinite: false,
|
||||
movement_behavior: Stationary,
|
||||
forward_speed: 0.0,
|
||||
num_spins: 1,
|
||||
specifier: None,
|
||||
ori_modifier: 1.0,
|
||||
)
|
||||
|
@ -397,13 +397,6 @@
|
||||
threshold: 0.7,
|
||||
subtitle: "subtitle-hammer-attack",
|
||||
),
|
||||
Attack(SpinMelee(Action), Sword): (
|
||||
files: [
|
||||
"voxygen.audio.sfx.abilities.swing_sword",
|
||||
],
|
||||
threshold: 0.7,
|
||||
subtitle: "subtitle-sword_attack",
|
||||
),
|
||||
Attack(ComboMelee(Action, 1), Sword): (
|
||||
files: [
|
||||
"voxygen.audio.sfx.abilities.swing_sword",
|
||||
@ -510,7 +503,7 @@
|
||||
threshold: 0.7,
|
||||
subtitle: "subtitle-axe_attack",
|
||||
),
|
||||
Attack(SpinMelee(Action), Axe): (
|
||||
Attack(RapidMelee(Action), Axe): (
|
||||
files: [
|
||||
"voxygen.audio.sfx.abilities.swing",
|
||||
],
|
||||
|
@ -623,7 +623,6 @@ pub enum CharacterAbilityType {
|
||||
RapidMelee(StageSection),
|
||||
LeapMelee(StageSection),
|
||||
LeapShockwave(StageSection),
|
||||
SpinMelee(StageSection),
|
||||
Music(StageSection),
|
||||
Shockwave,
|
||||
BasicBeam,
|
||||
@ -649,7 +648,6 @@ impl From<&CharacterState> for CharacterAbilityType {
|
||||
CharacterState::DiveMelee(data) => Self::DiveMelee(data.stage_section),
|
||||
CharacterState::RiposteMelee(data) => Self::RiposteMelee(data.stage_section),
|
||||
CharacterState::RapidMelee(data) => Self::RapidMelee(data.stage_section),
|
||||
CharacterState::SpinMelee(data) => Self::SpinMelee(data.stage_section),
|
||||
CharacterState::ChargedMelee(data) => Self::ChargedMelee(data.stage_section),
|
||||
CharacterState::ChargedRanged(_) => Self::ChargedRanged,
|
||||
CharacterState::Shockwave(_) => Self::Shockwave,
|
||||
@ -827,20 +825,6 @@ pub enum CharacterAbility {
|
||||
#[serde(default)]
|
||||
meta: AbilityMeta,
|
||||
},
|
||||
SpinMelee {
|
||||
buildup_duration: f32,
|
||||
swing_duration: f32,
|
||||
recover_duration: f32,
|
||||
energy_cost: f32,
|
||||
is_infinite: bool,
|
||||
movement_behavior: spin_melee::MovementBehavior,
|
||||
forward_speed: f32,
|
||||
num_spins: u32,
|
||||
specifier: Option<spin_melee::FrontendSpecifier>,
|
||||
melee_constructor: MeleeConstructor,
|
||||
#[serde(default)]
|
||||
meta: AbilityMeta,
|
||||
},
|
||||
ChargedMelee {
|
||||
energy_cost: f32,
|
||||
energy_drain: f32,
|
||||
@ -1028,6 +1012,7 @@ pub enum CharacterAbility {
|
||||
melee_constructor: MeleeConstructor,
|
||||
move_modifier: f32,
|
||||
ori_modifier: f32,
|
||||
frontend_specifier: Option<rapid_melee::FrontendSpecifier>,
|
||||
#[serde(default)]
|
||||
minimum_combo: u32,
|
||||
#[serde(default)]
|
||||
@ -1087,7 +1072,6 @@ impl CharacterAbility {
|
||||
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, .. }
|
||||
@ -1407,25 +1391,6 @@ impl CharacterAbility {
|
||||
*strength *= stats.buff_strength;
|
||||
}
|
||||
},
|
||||
SpinMelee {
|
||||
ref mut buildup_duration,
|
||||
ref mut swing_duration,
|
||||
ref mut recover_duration,
|
||||
ref mut energy_cost,
|
||||
ref mut melee_constructor,
|
||||
is_infinite: _,
|
||||
movement_behavior: _,
|
||||
forward_speed: _,
|
||||
num_spins: _,
|
||||
specifier: _,
|
||||
meta: _,
|
||||
} => {
|
||||
*buildup_duration /= stats.speed;
|
||||
*swing_duration /= stats.speed;
|
||||
*recover_duration /= stats.speed;
|
||||
*energy_cost /= stats.energy_efficiency;
|
||||
*melee_constructor = melee_constructor.adjusted_by_stats(stats);
|
||||
},
|
||||
ChargedMelee {
|
||||
ref mut energy_cost,
|
||||
ref mut energy_drain,
|
||||
@ -1702,6 +1667,7 @@ impl CharacterAbility {
|
||||
move_modifier: _,
|
||||
ori_modifier: _,
|
||||
minimum_combo: _,
|
||||
frontend_specifier: _,
|
||||
meta: _,
|
||||
} => {
|
||||
*buildup_duration /= stats.speed;
|
||||
@ -1724,7 +1690,6 @@ impl CharacterAbility {
|
||||
| Roll { energy_cost, .. }
|
||||
| LeapMelee { energy_cost, .. }
|
||||
| LeapShockwave { energy_cost, .. }
|
||||
| SpinMelee { energy_cost, .. }
|
||||
| ChargedMelee { energy_cost, .. }
|
||||
| ChargedRanged { energy_cost, .. }
|
||||
| Shockwave { energy_cost, .. }
|
||||
@ -1786,7 +1751,6 @@ impl CharacterAbility {
|
||||
| Roll { .. }
|
||||
| LeapMelee { .. }
|
||||
| LeapShockwave { .. }
|
||||
| SpinMelee { .. }
|
||||
| ChargedMelee { .. }
|
||||
| ChargedRanged { .. }
|
||||
| Shockwave { .. }
|
||||
@ -1815,7 +1779,6 @@ impl CharacterAbility {
|
||||
| Roll { meta, .. }
|
||||
| LeapMelee { meta, .. }
|
||||
| LeapShockwave { meta, .. }
|
||||
| SpinMelee { meta, .. }
|
||||
| ChargedMelee { meta, .. }
|
||||
| ChargedRanged { meta, .. }
|
||||
| Shockwave { meta, .. }
|
||||
@ -2536,37 +2499,6 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
|
||||
stage_section: StageSection::Buildup,
|
||||
exhausted: false,
|
||||
}),
|
||||
CharacterAbility::SpinMelee {
|
||||
buildup_duration,
|
||||
swing_duration,
|
||||
recover_duration,
|
||||
melee_constructor,
|
||||
energy_cost,
|
||||
is_infinite,
|
||||
movement_behavior,
|
||||
forward_speed,
|
||||
num_spins,
|
||||
specifier,
|
||||
meta: _,
|
||||
} => CharacterState::SpinMelee(spin_melee::Data {
|
||||
static_data: spin_melee::StaticData {
|
||||
buildup_duration: Duration::from_secs_f32(*buildup_duration),
|
||||
swing_duration: Duration::from_secs_f32(*swing_duration),
|
||||
recover_duration: Duration::from_secs_f32(*recover_duration),
|
||||
melee_constructor: *melee_constructor,
|
||||
energy_cost: *energy_cost,
|
||||
is_infinite: *is_infinite,
|
||||
movement_behavior: *movement_behavior,
|
||||
forward_speed: *forward_speed,
|
||||
num_spins: *num_spins,
|
||||
ability_info,
|
||||
specifier: *specifier,
|
||||
},
|
||||
timer: Duration::default(),
|
||||
consecutive_spins: 1,
|
||||
stage_section: StageSection::Buildup,
|
||||
exhausted: false,
|
||||
}),
|
||||
CharacterAbility::ChargedMelee {
|
||||
energy_cost,
|
||||
energy_drain,
|
||||
@ -2985,6 +2917,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
|
||||
move_modifier,
|
||||
ori_modifier,
|
||||
minimum_combo,
|
||||
frontend_specifier,
|
||||
meta: _,
|
||||
} => CharacterState::RapidMelee(rapid_melee::Data {
|
||||
static_data: rapid_melee::StaticData {
|
||||
@ -2997,6 +2930,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
|
||||
move_modifier: *move_modifier,
|
||||
ori_modifier: *ori_modifier,
|
||||
minimum_combo: *minimum_combo,
|
||||
frontend_specifier: *frontend_specifier,
|
||||
ability_info,
|
||||
},
|
||||
timer: Duration::default(),
|
||||
|
@ -102,8 +102,6 @@ pub enum CharacterState {
|
||||
LeapMelee(leap_melee::Data),
|
||||
/// A leap followed by a shockwave
|
||||
LeapShockwave(leap_shockwave::Data),
|
||||
/// Spin around, dealing damage to enemies surrounding you
|
||||
SpinMelee(spin_melee::Data),
|
||||
/// A charged ranged attack (e.g. bow)
|
||||
ChargedRanged(charged_ranged::Data),
|
||||
/// A charged melee attack
|
||||
@ -161,7 +159,6 @@ impl CharacterState {
|
||||
| CharacterState::BasicBlock(_)
|
||||
| CharacterState::LeapMelee(_)
|
||||
| CharacterState::LeapShockwave(_)
|
||||
| CharacterState::SpinMelee(_)
|
||||
| CharacterState::ChargedMelee(_)
|
||||
| CharacterState::ChargedRanged(_)
|
||||
| CharacterState::RepeaterRanged(_)
|
||||
@ -227,7 +224,6 @@ impl CharacterState {
|
||||
| CharacterState::ComboMelee2(_)
|
||||
| CharacterState::LeapMelee(_)
|
||||
| CharacterState::LeapShockwave(_)
|
||||
| CharacterState::SpinMelee(_)
|
||||
| CharacterState::ChargedMelee(_)
|
||||
| CharacterState::ChargedRanged(_)
|
||||
| CharacterState::RepeaterRanged(_)
|
||||
@ -385,7 +381,6 @@ impl CharacterState {
|
||||
|| matches!(self, CharacterState::ComboMelee2(s) if s.stage_section == StageSection::Action)
|
||||
|| matches!(self, CharacterState::DashMelee(s) if s.stage_section == StageSection::Charge)
|
||||
|| matches!(self, CharacterState::LeapMelee(s) if s.stage_section == StageSection::Movement)
|
||||
|| matches!(self, CharacterState::SpinMelee(s) if s.stage_section == StageSection::Action)
|
||||
|| matches!(self, CharacterState::Roll(s) if s.stage_section == StageSection::Movement)
|
||||
}
|
||||
|
||||
@ -471,7 +466,6 @@ impl CharacterState {
|
||||
CharacterState::DashMelee(data) => data.behavior(j, output_events),
|
||||
CharacterState::LeapMelee(data) => data.behavior(j, output_events),
|
||||
CharacterState::LeapShockwave(data) => data.behavior(j, output_events),
|
||||
CharacterState::SpinMelee(data) => data.behavior(j, output_events),
|
||||
CharacterState::ChargedMelee(data) => data.behavior(j, output_events),
|
||||
CharacterState::ChargedRanged(data) => data.behavior(j, output_events),
|
||||
CharacterState::RepeaterRanged(data) => data.behavior(j, output_events),
|
||||
@ -525,7 +519,6 @@ impl CharacterState {
|
||||
CharacterState::DashMelee(data) => data.handle_event(j, output_events, action),
|
||||
CharacterState::LeapMelee(data) => data.handle_event(j, output_events, action),
|
||||
CharacterState::LeapShockwave(data) => data.handle_event(j, output_events, action),
|
||||
CharacterState::SpinMelee(data) => data.handle_event(j, output_events, action),
|
||||
CharacterState::ChargedMelee(data) => data.handle_event(j, output_events, action),
|
||||
CharacterState::ChargedRanged(data) => data.handle_event(j, output_events, action),
|
||||
CharacterState::RepeaterRanged(data) => data.handle_event(j, output_events, action),
|
||||
@ -579,7 +572,6 @@ impl CharacterState {
|
||||
CharacterState::DashMelee(data) => Some(data.static_data.ability_info),
|
||||
CharacterState::LeapMelee(data) => Some(data.static_data.ability_info),
|
||||
CharacterState::LeapShockwave(data) => Some(data.static_data.ability_info),
|
||||
CharacterState::SpinMelee(data) => Some(data.static_data.ability_info),
|
||||
CharacterState::ChargedMelee(data) => Some(data.static_data.ability_info),
|
||||
CharacterState::ChargedRanged(data) => Some(data.static_data.ability_info),
|
||||
CharacterState::RepeaterRanged(data) => Some(data.static_data.ability_info),
|
||||
@ -624,7 +616,6 @@ impl CharacterState {
|
||||
CharacterState::DashMelee(data) => Some(data.stage_section),
|
||||
CharacterState::LeapMelee(data) => Some(data.stage_section),
|
||||
CharacterState::LeapShockwave(data) => Some(data.stage_section),
|
||||
CharacterState::SpinMelee(data) => Some(data.stage_section),
|
||||
CharacterState::ChargedMelee(data) => Some(data.stage_section),
|
||||
CharacterState::ChargedRanged(data) => Some(data.stage_section),
|
||||
CharacterState::RepeaterRanged(data) => Some(data.stage_section),
|
||||
@ -732,12 +723,6 @@ impl CharacterState {
|
||||
movement: Some(data.static_data.movement_duration),
|
||||
..Default::default()
|
||||
}),
|
||||
CharacterState::SpinMelee(data) => Some(DurationsInfo {
|
||||
buildup: Some(data.static_data.buildup_duration),
|
||||
action: Some(data.static_data.swing_duration),
|
||||
recover: Some(data.static_data.recover_duration),
|
||||
..Default::default()
|
||||
}),
|
||||
CharacterState::ChargedMelee(data) => Some(DurationsInfo {
|
||||
action: Some(data.static_data.swing_duration),
|
||||
recover: Some(data.static_data.recover_duration),
|
||||
@ -863,7 +848,6 @@ impl CharacterState {
|
||||
CharacterState::DashMelee(data) => Some(data.timer),
|
||||
CharacterState::LeapMelee(data) => Some(data.timer),
|
||||
CharacterState::LeapShockwave(data) => Some(data.timer),
|
||||
CharacterState::SpinMelee(data) => Some(data.timer),
|
||||
CharacterState::ChargedMelee(data) => Some(data.timer),
|
||||
CharacterState::ChargedRanged(data) => Some(data.timer),
|
||||
CharacterState::RepeaterRanged(data) => Some(data.timer),
|
||||
@ -913,7 +897,6 @@ impl CharacterState {
|
||||
CharacterState::Boost(_) => None,
|
||||
CharacterState::DashMelee(_) => Some(AttackSource::Melee),
|
||||
CharacterState::LeapMelee(_) => Some(AttackSource::Melee),
|
||||
CharacterState::SpinMelee(_) => Some(AttackSource::Melee),
|
||||
CharacterState::ChargedMelee(_) => Some(AttackSource::Melee),
|
||||
// TODO: When charged ranged not only arrow make this check projectile type
|
||||
CharacterState::ChargedRanged(_) => Some(AttackSource::Projectile),
|
||||
|
@ -31,7 +31,6 @@ pub mod self_buff;
|
||||
pub mod shockwave;
|
||||
pub mod sit;
|
||||
pub mod skate;
|
||||
pub mod spin_melee;
|
||||
pub mod sprite_interact;
|
||||
pub mod sprite_summon;
|
||||
pub mod stunned;
|
||||
|
@ -28,6 +28,9 @@ pub struct StaticData {
|
||||
pub move_modifier: f32,
|
||||
pub ori_modifier: f32,
|
||||
pub minimum_combo: u32,
|
||||
/// Used to indicate to the frontend what ability this is for any special
|
||||
/// effects
|
||||
pub frontend_specifier: Option<FrontendSpecifier>,
|
||||
/// What key is used to press ability
|
||||
pub ability_info: AbilityInfo,
|
||||
}
|
||||
@ -140,3 +143,9 @@ impl CharacterBehavior for Data {
|
||||
update
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub enum FrontendSpecifier {
|
||||
CultistVortex,
|
||||
Whirlwind,
|
||||
}
|
||||
|
@ -1,176 +0,0 @@
|
||||
use crate::{
|
||||
combat,
|
||||
comp::{character_state::OutputEvents, CharacterState, Melee, MeleeConstructor, StateUpdate},
|
||||
states::{
|
||||
behavior::{CharacterBehavior, JoinData},
|
||||
utils::*,
|
||||
},
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::time::Duration;
|
||||
|
||||
/// Separated out to condense update portions of character state
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct StaticData {
|
||||
/// How long until the state attacks
|
||||
pub buildup_duration: Duration,
|
||||
/// How long the state is in the swing duration
|
||||
pub swing_duration: Duration,
|
||||
/// How long until state ends
|
||||
pub recover_duration: Duration,
|
||||
/// Used to construct the Melee attack
|
||||
pub melee_constructor: MeleeConstructor,
|
||||
/// Energy cost per attack
|
||||
pub energy_cost: f32,
|
||||
/// Whether spin state is infinite
|
||||
pub is_infinite: bool,
|
||||
/// Used to dictate how movement functions in this state
|
||||
pub movement_behavior: MovementBehavior,
|
||||
/// Used for forced forward movement
|
||||
pub forward_speed: f32,
|
||||
/// Number of spins
|
||||
pub num_spins: u32,
|
||||
/// What key is used to press ability
|
||||
pub ability_info: AbilityInfo,
|
||||
/// Used to specify the melee attack to the frontend
|
||||
pub specifier: Option<FrontendSpecifier>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Data {
|
||||
/// Struct containing data that does not change over the course of the
|
||||
/// character state
|
||||
pub static_data: StaticData,
|
||||
/// Timer for each stage
|
||||
pub timer: Duration,
|
||||
/// How many spins it has done
|
||||
pub consecutive_spins: u32,
|
||||
/// What section the character stage is in
|
||||
pub stage_section: StageSection,
|
||||
/// Whether the state can deal damage
|
||||
pub exhausted: bool,
|
||||
}
|
||||
|
||||
impl CharacterBehavior for Data {
|
||||
fn behavior(&self, data: &JoinData, output_events: &mut OutputEvents) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
|
||||
match self.static_data.movement_behavior {
|
||||
MovementBehavior::ForwardGround | MovementBehavior::Stationary => {},
|
||||
MovementBehavior::Walking => {
|
||||
handle_move(data, &mut update, 0.2);
|
||||
},
|
||||
}
|
||||
|
||||
match self.stage_section {
|
||||
StageSection::Buildup => {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Build up
|
||||
update.character = CharacterState::SpinMelee(Data {
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
// Transitions to swing section of stage
|
||||
update.character = CharacterState::SpinMelee(Data {
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Action,
|
||||
..*self
|
||||
});
|
||||
}
|
||||
},
|
||||
StageSection::Action => {
|
||||
if !self.exhausted {
|
||||
update.character = CharacterState::SpinMelee(Data {
|
||||
timer: Duration::default(),
|
||||
exhausted: true,
|
||||
..*self
|
||||
});
|
||||
|
||||
let precision_mult = combat::compute_precision_mult(data.inventory, data.msm);
|
||||
let tool_stats = get_tool_stats(data, self.static_data.ability_info);
|
||||
|
||||
data.updater.insert(
|
||||
data.entity,
|
||||
self.static_data
|
||||
.melee_constructor
|
||||
.create_melee(precision_mult, tool_stats),
|
||||
);
|
||||
} else if self.timer < self.static_data.swing_duration {
|
||||
if matches!(
|
||||
self.static_data.movement_behavior,
|
||||
MovementBehavior::ForwardGround
|
||||
) {
|
||||
handle_forced_movement(
|
||||
data,
|
||||
&mut update,
|
||||
ForcedMovement::Forward(self.static_data.forward_speed),
|
||||
);
|
||||
}
|
||||
|
||||
// Swings
|
||||
update.character = CharacterState::SpinMelee(Data {
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else if update.energy.current() >= self.static_data.energy_cost
|
||||
&& (self.consecutive_spins < self.static_data.num_spins
|
||||
|| (self.static_data.is_infinite
|
||||
&& input_is_pressed(data, self.static_data.ability_info.input)))
|
||||
{
|
||||
update.character = CharacterState::SpinMelee(Data {
|
||||
timer: Duration::default(),
|
||||
consecutive_spins: self.consecutive_spins + 1,
|
||||
exhausted: false,
|
||||
..*self
|
||||
});
|
||||
// Consumes energy if there's enough left and RMB is held down
|
||||
update.energy.change_by(-self.static_data.energy_cost);
|
||||
} else {
|
||||
// Transitions to recover section of stage
|
||||
update.character = CharacterState::SpinMelee(Data {
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Recover,
|
||||
..*self
|
||||
});
|
||||
// Remove melee attack component
|
||||
data.updater.remove::<Melee>(data.entity);
|
||||
}
|
||||
},
|
||||
StageSection::Recover => {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
// Recover
|
||||
update.character = CharacterState::SpinMelee(Data {
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
// Done
|
||||
end_melee_ability(data, &mut update);
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
// If it somehow ends up in an incorrect stage section
|
||||
end_melee_ability(data, &mut update);
|
||||
},
|
||||
}
|
||||
|
||||
// At end of state logic so an interrupt isn't overwritten
|
||||
handle_interrupts(data, &mut update, output_events);
|
||||
|
||||
update
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum MovementBehavior {
|
||||
Stationary,
|
||||
ForwardGround,
|
||||
Walking,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub enum FrontendSpecifier {
|
||||
CultistVortex,
|
||||
Whirlwind,
|
||||
}
|
@ -174,7 +174,6 @@ impl<'a> System<'a> for Sys {
|
||||
| CharacterState::DashMelee(_)
|
||||
| CharacterState::LeapMelee(_)
|
||||
| CharacterState::LeapShockwave(_)
|
||||
| CharacterState::SpinMelee(_)
|
||||
| CharacterState::ComboMelee(_)
|
||||
| CharacterState::ComboMelee2(_)
|
||||
| CharacterState::BasicRanged(_)
|
||||
|
@ -2749,7 +2749,7 @@ impl<'a> AgentData<'a> {
|
||||
{
|
||||
// If already using primary, keep using primary until 10 consecutive seconds
|
||||
controller.push_basic_input(InputKind::Primary);
|
||||
} else if matches!(self.char_state, CharacterState::SpinMelee(c) if c.consecutive_spins < 50 && !matches!(c.stage_section, StageSection::Recover))
|
||||
} else if matches!(self.char_state, CharacterState::RapidMelee(c) if c.current_strike < 50 && !matches!(c.stage_section, StageSection::Recover))
|
||||
{
|
||||
// If already using secondary, keep using secondary until 10 consecutive
|
||||
// seconds
|
||||
@ -4289,7 +4289,7 @@ impl<'a> AgentData<'a> {
|
||||
// Long whirlwind attack
|
||||
4 => {
|
||||
controller.push_basic_input(InputKind::Ability(7));
|
||||
matches!(self.char_state, CharacterState::SpinMelee(c) if matches!(c.stage_section, StageSection::Recover))
|
||||
matches!(self.char_state, CharacterState::RapidMelee(c) if matches!(c.stage_section, StageSection::Recover))
|
||||
},
|
||||
// Remote ice spikes
|
||||
5 => {
|
||||
@ -4992,8 +4992,8 @@ impl<'a> AgentData<'a> {
|
||||
}
|
||||
|
||||
// After spinning, reset timer
|
||||
if matches!(self.char_state, CharacterState::SpinMelee(s) if s.stage_section == StageSection::Recover)
|
||||
{
|
||||
let current_input = self.char_state.ability_info().map(|ai| ai.input);
|
||||
if matches!(current_input, Some(InputKind::Secondary)) {
|
||||
agent.combat_state.timers[ActionStateTimers::TimerSpinWait as usize] = 0.0;
|
||||
}
|
||||
|
||||
|
@ -11,12 +11,12 @@ pub mod idle;
|
||||
pub mod jump;
|
||||
pub mod leapmelee;
|
||||
pub mod leapshockwave;
|
||||
pub mod rapidmelee;
|
||||
pub mod run;
|
||||
pub mod selfbuff;
|
||||
pub mod shockwave;
|
||||
pub mod shoot;
|
||||
pub mod spin;
|
||||
pub mod spinmelee;
|
||||
pub mod spritesummon;
|
||||
pub mod stunned;
|
||||
pub mod summon;
|
||||
@ -27,9 +27,9 @@ pub use self::{
|
||||
alpha::AlphaAnimation, beam::BeamAnimation, beta::BetaAnimation, blink::BlinkAnimation,
|
||||
charge::ChargeAnimation, chargemelee::ChargeMeleeAnimation, combomelee::ComboAnimation,
|
||||
dash::DashAnimation, equip::EquipAnimation, idle::IdleAnimation, jump::JumpAnimation,
|
||||
leapmelee::LeapAnimation, leapshockwave::LeapShockAnimation, run::RunAnimation,
|
||||
selfbuff::SelfBuffAnimation, shockwave::ShockwaveAnimation, shoot::ShootAnimation,
|
||||
spin::SpinAnimation, spinmelee::SpinMeleeAnimation, spritesummon::SpriteSummonAnimation,
|
||||
leapmelee::LeapAnimation, leapshockwave::LeapShockAnimation, rapidmelee::RapidMeleeAnimation,
|
||||
run::RunAnimation, selfbuff::SelfBuffAnimation, shockwave::ShockwaveAnimation,
|
||||
shoot::ShootAnimation, spin::SpinAnimation, spritesummon::SpriteSummonAnimation,
|
||||
stunned::StunnedAnimation, summon::SummonAnimation, wield::WieldAnimation,
|
||||
};
|
||||
|
||||
|
@ -5,9 +5,9 @@ use super::{
|
||||
use common::{comp::item::ToolKind, states::utils::StageSection};
|
||||
use core::f32::consts::{PI, TAU};
|
||||
|
||||
pub struct SpinMeleeAnimation;
|
||||
pub struct RapidMeleeAnimation;
|
||||
|
||||
impl Animation for SpinMeleeAnimation {
|
||||
impl Animation for RapidMeleeAnimation {
|
||||
type Dependency<'a> = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
@ -19,9 +19,9 @@ impl Animation for SpinMeleeAnimation {
|
||||
type Skeleton = BipedLargeSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"biped_large_spinmelee\0";
|
||||
const UPDATE_FN: &'static [u8] = b"biped_large_rapidmelee\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_spinmelee")]
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_rapidmelee")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency<'_>,
|
@ -232,6 +232,25 @@ impl Animation for AlphaAnimation {
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * -0.8 + move2 * 0.8);
|
||||
},
|
||||
},
|
||||
Some(ToolKind::Natural) => {
|
||||
let tension = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time * 10.0).sin(),
|
||||
Some(StageSection::Action) => 1.0,
|
||||
Some(StageSection::Recover) => 1.0,
|
||||
_ => 0.0,
|
||||
};
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_x(move1abs * 1.0 + move2abs * -1.5 + tension * 0.2);
|
||||
next.pants.orientation = Quaternion::rotation_x(move1abs * -0.5 + move2abs * 0.5);
|
||||
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(1.2 + move1abs * 1.5 + move2abs * -1.0)
|
||||
* Quaternion::rotation_y(tension * 0.5);
|
||||
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(1.2 + move1abs * 1.5 + move2abs * -1.0)
|
||||
* Quaternion::rotation_y(tension * -0.5);
|
||||
},
|
||||
_ => {
|
||||
next.chest.orientation = Quaternion::rotation_x(move2abs * -1.0)
|
||||
* Quaternion::rotation_z(move1 * 1.2 + move2 * -1.8);
|
||||
|
@ -7,7 +7,6 @@ pub mod leapmelee;
|
||||
pub mod run;
|
||||
pub mod shockwave;
|
||||
pub mod shoot;
|
||||
pub mod spinmelee;
|
||||
pub mod stunned;
|
||||
pub mod summon;
|
||||
pub mod wield;
|
||||
@ -16,8 +15,8 @@ pub mod wield;
|
||||
pub use self::{
|
||||
alpha::AlphaAnimation, beam::BeamAnimation, combomelee::ComboAnimation, dash::DashAnimation,
|
||||
idle::IdleAnimation, leapmelee::LeapAnimation, run::RunAnimation,
|
||||
shockwave::ShockwaveAnimation, shoot::ShootAnimation, spinmelee::SpinMeleeAnimation,
|
||||
stunned::StunnedAnimation, summon::SummonAnimation, wield::WieldAnimation,
|
||||
shockwave::ShockwaveAnimation, shoot::ShootAnimation, stunned::StunnedAnimation,
|
||||
summon::SummonAnimation, wield::WieldAnimation,
|
||||
};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
|
@ -1,87 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
BipedSmallSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::{comp::item::ToolKind, states::utils::StageSection};
|
||||
|
||||
pub struct SpinMeleeAnimation;
|
||||
|
||||
type SpinMeleeAnimationDependency = (
|
||||
Option<ToolKind>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
f32,
|
||||
Vec3<f32>,
|
||||
f32,
|
||||
Option<StageSection>,
|
||||
f32,
|
||||
);
|
||||
|
||||
impl Animation for SpinMeleeAnimation {
|
||||
type Dependency<'a> = SpinMeleeAnimationDependency;
|
||||
type Skeleton = BipedSmallSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"biped_small_spinmelee\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_small_spinmelee")]
|
||||
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(
|
||||
active_tool_kind,
|
||||
_velocity,
|
||||
_orientation,
|
||||
_last_ori,
|
||||
_global_time,
|
||||
_avg_vel,
|
||||
_acc_vel,
|
||||
stage_section,
|
||||
_timer,
|
||||
): Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
_rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
let anim_time = anim_time.min(1.0);
|
||||
let (move1base, tension, move2base, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.sqrt(), (anim_time * 10.0).sin(), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, 1.0, anim_time.powf(0.25), 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time.powi(4)),
|
||||
_ => (0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let tension = tension * pullback;
|
||||
let move1abs = move1base * pullback;
|
||||
let move2abs = move2base * pullback;
|
||||
next.hand_l.position = Vec3::new(s_a.grip.0 * 4.0, 0.0, s_a.grip.2);
|
||||
next.hand_r.position = Vec3::new(-s_a.grip.0 * 4.0, 0.0, s_a.grip.2);
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
||||
match active_tool_kind {
|
||||
Some(ToolKind::Spear) => {
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_x(move1abs * -0.2 + move2abs * 0.3)
|
||||
* Quaternion::rotation_z(move1abs * 0.5 + move2abs * -0.6);
|
||||
},
|
||||
_ => {
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_x(move1abs * 1.0 + move2abs * -1.5 + tension * 0.2);
|
||||
next.pants.orientation = Quaternion::rotation_x(move1abs * -0.5 + move2abs * 0.5);
|
||||
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(1.2 + move1abs * 1.5 + move2abs * -1.0)
|
||||
* Quaternion::rotation_y(tension * 0.5);
|
||||
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(1.2 + move1abs * 1.5 + move2abs * -1.0)
|
||||
* Quaternion::rotation_y(tension * -0.5);
|
||||
},
|
||||
}
|
||||
next
|
||||
}
|
||||
}
|
@ -3,11 +3,12 @@ use super::{
|
||||
GolemSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::StageSection;
|
||||
use core::f32::consts::PI;
|
||||
|
||||
pub struct AlphaAnimation;
|
||||
|
||||
impl Animation for AlphaAnimation {
|
||||
type Dependency<'a> = (Option<StageSection>, f32, f32);
|
||||
type Dependency<'a> = (Option<StageSection>, f32, f32, Option<&'a str>);
|
||||
type Skeleton = GolemSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -17,69 +18,139 @@ impl Animation for AlphaAnimation {
|
||||
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(stage_section, global_time, timer): Self::Dependency<'_>,
|
||||
(stage_section, global_time, timer, ability_id): Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
_rate: &mut f32,
|
||||
_s_a: &SkeletonAttr,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let (move1base, move2base, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(4.0)),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
match ability_id {
|
||||
Some(
|
||||
"common.abilities.custom.stonegolemfist.spin"
|
||||
| "common.abilities.custom.woodgolem.spin"
|
||||
| "common.abilities.custom.coralgolem.spin",
|
||||
) => {
|
||||
let (movement1, movement2, movement3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(4.0)),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
|
||||
let pullback = 1.0 - move3;
|
||||
let subtract = global_time - timer;
|
||||
let check = subtract - subtract.trunc();
|
||||
let mirror = (check - 0.5).signum();
|
||||
let pullback = 1.0 - movement3;
|
||||
|
||||
let move1 = move1base * pullback;
|
||||
let move2 = move2base * pullback;
|
||||
if mirror > 0.0 {
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_x(-0.2) * Quaternion::rotation_z(move1 * -1.2 + move2 * 2.0);
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_z(movement1 * 0.5 * PI + movement2 * -2.5 * PI)
|
||||
* Quaternion::rotation_x(-0.2);
|
||||
|
||||
next.upper_torso.orientation = Quaternion::rotation_x(move1 * -0.6)
|
||||
* Quaternion::rotation_z(move1 * 1.2 + move2 * -3.2);
|
||||
next.upper_torso.position =
|
||||
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + movement1 * -6.0);
|
||||
next.upper_torso.orientation =
|
||||
Quaternion::rotation_z(movement1 * -0.5 * PI + movement2 * 2.5 * PI);
|
||||
|
||||
next.lower_torso.orientation = Quaternion::rotation_z(move1 * -1.2 + move2 * 3.2)
|
||||
* Quaternion::rotation_x(move1 * 0.6);
|
||||
next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
|
||||
next.lower_torso.orientation =
|
||||
Quaternion::rotation_z(movement1 * 0.5 * PI + movement2 * -2.5 * PI);
|
||||
|
||||
next.shoulder_l.orientation = Quaternion::rotation_y(move1 * 0.8)
|
||||
* Quaternion::rotation_x(move1 * -1.0 + move2 * 1.6);
|
||||
next.shoulder_l.position =
|
||||
Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
|
||||
next.shoulder_l.orientation = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_x(movement1 * 1.2 * pullback);
|
||||
|
||||
next.shoulder_r.orientation = Quaternion::rotation_x(move1 * 0.4);
|
||||
next.shoulder_r.position =
|
||||
Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
|
||||
next.shoulder_r.orientation = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_x(movement1 * -1.2 * pullback);
|
||||
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(move1 * -1.0 + move2 * 1.8);
|
||||
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(movement1 * -0.2 * pullback);
|
||||
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_y(move1 * 0.5) * Quaternion::rotation_x(move1 * 0.4);
|
||||
} else {
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_x(-0.2) * Quaternion::rotation_z(move1 * 1.2 + move2 * -2.0);
|
||||
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(movement1 * 0.2 * pullback);
|
||||
|
||||
next.upper_torso.orientation = Quaternion::rotation_x(move1 * -0.6)
|
||||
* Quaternion::rotation_z(move1 * -1.2 + move2 * 3.2);
|
||||
next.leg_l.position =
|
||||
Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + movement1 * 2.0) * 1.02;
|
||||
next.leg_l.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.lower_torso.orientation = Quaternion::rotation_z(move1 * 1.2 + move2 * -3.2)
|
||||
* Quaternion::rotation_x(move1 * 0.6);
|
||||
next.leg_r.position =
|
||||
Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + movement1 * 2.0) * 1.02;
|
||||
next.leg_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.shoulder_l.orientation = Quaternion::rotation_x(move1 * 0.4);
|
||||
next.foot_l.position =
|
||||
Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2 + movement1 * 4.0);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.shoulder_r.orientation = Quaternion::rotation_y(move1 * -0.8)
|
||||
* Quaternion::rotation_x(move1 * -1.0 + move2 * 1.6);
|
||||
next.foot_r.position =
|
||||
Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2 + movement1 * 4.0);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_y(move1 * -0.5) * Quaternion::rotation_x(move1 * 0.4);
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||
},
|
||||
_ => {
|
||||
let (move1base, move2base, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(4.0)),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
|
||||
let pullback = 1.0 - move3;
|
||||
let subtract = global_time - timer;
|
||||
let check = subtract - subtract.trunc();
|
||||
let mirror = (check - 0.5).signum();
|
||||
|
||||
let move1 = move1base * pullback;
|
||||
let move2 = move2base * pullback;
|
||||
if mirror > 0.0 {
|
||||
next.head.orientation = Quaternion::rotation_x(-0.2)
|
||||
* Quaternion::rotation_z(move1 * -1.2 + move2 * 2.0);
|
||||
|
||||
next.upper_torso.orientation = Quaternion::rotation_x(move1 * -0.6)
|
||||
* Quaternion::rotation_z(move1 * 1.2 + move2 * -3.2);
|
||||
|
||||
next.lower_torso.orientation =
|
||||
Quaternion::rotation_z(move1 * -1.2 + move2 * 3.2)
|
||||
* Quaternion::rotation_x(move1 * 0.6);
|
||||
|
||||
next.shoulder_l.orientation = Quaternion::rotation_y(move1 * 0.8)
|
||||
* Quaternion::rotation_x(move1 * -1.0 + move2 * 1.6);
|
||||
|
||||
next.shoulder_r.orientation = Quaternion::rotation_x(move1 * 0.4);
|
||||
|
||||
next.hand_l.orientation = Quaternion::rotation_z(0.0)
|
||||
* Quaternion::rotation_x(move1 * -1.0 + move2 * 1.8);
|
||||
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_y(move1 * 0.5) * Quaternion::rotation_x(move1 * 0.4);
|
||||
} else {
|
||||
next.head.orientation = Quaternion::rotation_x(-0.2)
|
||||
* Quaternion::rotation_z(move1 * 1.2 + move2 * -2.0);
|
||||
|
||||
next.upper_torso.orientation = Quaternion::rotation_x(move1 * -0.6)
|
||||
* Quaternion::rotation_z(move1 * -1.2 + move2 * 3.2);
|
||||
|
||||
next.lower_torso.orientation =
|
||||
Quaternion::rotation_z(move1 * 1.2 + move2 * -3.2)
|
||||
* Quaternion::rotation_x(move1 * 0.6);
|
||||
|
||||
next.shoulder_l.orientation = Quaternion::rotation_x(move1 * 0.4);
|
||||
|
||||
next.shoulder_r.orientation = Quaternion::rotation_y(move1 * -0.8)
|
||||
* Quaternion::rotation_x(move1 * -1.0 + move2 * 1.6);
|
||||
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_y(move1 * -0.5) * Quaternion::rotation_x(move1 * 0.4);
|
||||
|
||||
next.hand_r.orientation = Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_x(move1 * -1.0 + move2 * 1.8);
|
||||
};
|
||||
next.torso.position = Vec3::new(0.0, move1 * 3.7, move1 * -1.6);
|
||||
},
|
||||
}
|
||||
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_y(0.0) * Quaternion::rotation_x(move1 * -1.0 + move2 * 1.8);
|
||||
};
|
||||
next.torso.position = Vec3::new(0.0, move1 * 3.7, move1 * -1.6);
|
||||
next
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,11 @@ pub mod idle;
|
||||
pub mod run;
|
||||
pub mod shockwave;
|
||||
pub mod shoot;
|
||||
pub mod spinmelee;
|
||||
|
||||
// Reexports
|
||||
pub use self::{
|
||||
alpha::AlphaAnimation, beam::BeamAnimation, idle::IdleAnimation, run::RunAnimation,
|
||||
shockwave::ShockwaveAnimation, shoot::ShootAnimation, spinmelee::SpinMeleeAnimation,
|
||||
shockwave::ShockwaveAnimation, shoot::ShootAnimation,
|
||||
};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
|
@ -1,81 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
GolemSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::StageSection;
|
||||
use core::f32::consts::PI;
|
||||
|
||||
pub struct SpinMeleeAnimation;
|
||||
|
||||
impl Animation for SpinMeleeAnimation {
|
||||
type Dependency<'a> = Option<StageSection>;
|
||||
type Skeleton = GolemSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"golem_spinmelee\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "golem_spinmelee")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
stage_section: Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
_rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let (movement1, movement2, movement3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(4.0)),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
|
||||
let pullback = 1.0 - movement3;
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_z(movement1 * 0.5 * PI + movement2 * -2.5 * PI)
|
||||
* Quaternion::rotation_x(-0.2);
|
||||
|
||||
next.upper_torso.position =
|
||||
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + movement1 * -6.0);
|
||||
next.upper_torso.orientation =
|
||||
Quaternion::rotation_z(movement1 * -0.5 * PI + movement2 * 2.5 * PI);
|
||||
|
||||
next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
|
||||
next.lower_torso.orientation =
|
||||
Quaternion::rotation_z(movement1 * 0.5 * PI + movement2 * -2.5 * PI);
|
||||
|
||||
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
|
||||
next.shoulder_l.orientation =
|
||||
Quaternion::rotation_x(0.0) * Quaternion::rotation_x(movement1 * 1.2 * pullback);
|
||||
|
||||
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
|
||||
next.shoulder_r.orientation =
|
||||
Quaternion::rotation_x(0.0) * Quaternion::rotation_x(movement1 * -1.2 * pullback);
|
||||
|
||||
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(movement1 * -0.2 * pullback);
|
||||
|
||||
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(movement1 * 0.2 * pullback);
|
||||
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + movement1 * 2.0) * 1.02;
|
||||
next.leg_l.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + movement1 * 2.0) * 1.02;
|
||||
next.leg_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2 + movement1 * 4.0);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2 + movement1 * 4.0);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -3950,38 +3950,6 @@ impl FigureMgr {
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::SpinMelee(s) => {
|
||||
let stage_time = s.timer.as_secs_f32();
|
||||
let stage_progress = match s.stage_section {
|
||||
StageSection::Buildup => {
|
||||
stage_time / s.static_data.buildup_duration.as_secs_f32()
|
||||
},
|
||||
StageSection::Action => {
|
||||
stage_time / s.static_data.swing_duration.as_secs_f32()
|
||||
},
|
||||
StageSection::Recover => {
|
||||
stage_time / s.static_data.recover_duration.as_secs_f32()
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
anim::biped_small::SpinMeleeAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
active_tool_kind,
|
||||
rel_vel,
|
||||
ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
time,
|
||||
rel_avg_vel,
|
||||
state.acc_vel,
|
||||
Some(s.stage_section),
|
||||
state.state_time,
|
||||
),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::BasicRanged(s) => {
|
||||
let stage_time = s.timer.as_secs_f32();
|
||||
|
||||
@ -5708,7 +5676,7 @@ impl FigureMgr {
|
||||
),
|
||||
}
|
||||
},
|
||||
CharacterState::SpinMelee(s) => {
|
||||
CharacterState::RapidMelee(s) => {
|
||||
let stage_time = s.timer.as_secs_f32();
|
||||
let stage_progress = match s.stage_section {
|
||||
StageSection::Buildup => {
|
||||
@ -5724,7 +5692,7 @@ impl FigureMgr {
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
anim::biped_large::SpinMeleeAnimation::update_skeleton(
|
||||
anim::biped_large::RapidMeleeAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
active_tool_kind,
|
||||
@ -6051,7 +6019,7 @@ impl FigureMgr {
|
||||
|
||||
anim::golem::AlphaAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(Some(s.stage_section), time, state.state_time),
|
||||
(Some(s.stage_section), time, state.state_time, ability_id),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -6119,7 +6087,7 @@ impl FigureMgr {
|
||||
|
||||
anim::golem::AlphaAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(Some(s.stage_section), time, state.state_time),
|
||||
(Some(s.stage_section), time, state.state_time, ability_id),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -6147,31 +6115,6 @@ impl FigureMgr {
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::SpinMelee(s) => {
|
||||
let stage_progress = {
|
||||
let stage_time = s.timer.as_secs_f32();
|
||||
match s.stage_section {
|
||||
StageSection::Buildup => {
|
||||
stage_time / s.static_data.buildup_duration.as_secs_f32()
|
||||
},
|
||||
StageSection::Action => {
|
||||
stage_time / s.static_data.swing_duration.as_secs_f32()
|
||||
},
|
||||
StageSection::Recover => {
|
||||
stage_time / s.static_data.recover_duration.as_secs_f32()
|
||||
},
|
||||
_ => 0.0,
|
||||
}
|
||||
};
|
||||
|
||||
anim::golem::SpinMeleeAnimation::update_skeleton(
|
||||
&target_base,
|
||||
Some(s.stage_section),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
// TODO!
|
||||
_ => target_base,
|
||||
};
|
||||
|
@ -855,12 +855,12 @@ impl ParticleMgr {
|
||||
},
|
||||
);
|
||||
},
|
||||
CharacterState::SpinMelee(spin) => {
|
||||
if let Some(specifier) = spin.static_data.specifier {
|
||||
CharacterState::RapidMelee(c) => {
|
||||
if let Some(specifier) = c.static_data.frontend_specifier {
|
||||
match specifier {
|
||||
states::spin_melee::FrontendSpecifier::CultistVortex => {
|
||||
if matches!(spin.stage_section, StageSection::Action) {
|
||||
let range = spin.static_data.melee_constructor.range;
|
||||
states::rapid_melee::FrontendSpecifier::CultistVortex => {
|
||||
if matches!(c.stage_section, StageSection::Action) {
|
||||
let range = c.static_data.melee_constructor.range;
|
||||
// Particles for vortex
|
||||
let heartbeats =
|
||||
self.scheduler.heartbeats(Duration::from_millis(3));
|
||||
@ -931,8 +931,8 @@ impl ParticleMgr {
|
||||
}
|
||||
}
|
||||
},
|
||||
states::spin_melee::FrontendSpecifier::Whirlwind => {
|
||||
if matches!(spin.stage_section, StageSection::Action) {
|
||||
states::rapid_melee::FrontendSpecifier::Whirlwind => {
|
||||
if matches!(c.stage_section, StageSection::Action) {
|
||||
let time = scene_data.state.get_time();
|
||||
let mut rng = thread_rng();
|
||||
self.particles.resize_with(
|
||||
|
Loading…
Reference in New Issue
Block a user