diff --git a/assets/common/abilities/staff/flamethrower.ron b/assets/common/abilities/staff/flamethrower.ron index f451b9347e..9c94bc65c7 100644 --- a/assets/common/abilities/staff/flamethrower.ron +++ b/assets/common/abilities/staff/flamethrower.ron @@ -1,7 +1,7 @@ BasicBeam( buildup_duration: 0.25, recover_duration: 0.25, - beam_duration: 1.5, + beam_duration: 0.5, base_hps: 0, base_dps: 150, tick_rate: 3.0, diff --git a/assets/common/abilities/unique/stonegolemfist/basic.ron b/assets/common/abilities/unique/stonegolemfist/basic.ron deleted file mode 100644 index 49d111c38d..0000000000 --- a/assets/common/abilities/unique/stonegolemfist/basic.ron +++ /dev/null @@ -1,11 +0,0 @@ -BasicMelee( - energy_cost: 0, - buildup_duration: 0.4, - swing_duration: 0.1, - recover_duration: 0.25, - knockback: 25.0, - base_damage: 200, - base_poise_damage: 0, - range: 5.0, - max_angle: 120.0, -) diff --git a/assets/common/abilities/unique/stonegolemfist/singlestrike.ron b/assets/common/abilities/unique/stonegolemfist/singlestrike.ron new file mode 100644 index 0000000000..7b728bc18c --- /dev/null +++ b/assets/common/abilities/unique/stonegolemfist/singlestrike.ron @@ -0,0 +1,25 @@ +ComboMelee( + stage_data: [ + ( + stage: 1, + base_damage: 100, + damage_increase: 0, + base_poise_damage: 0, + poise_damage_increase: 0, + knockback: 5.0, + range: 3.5, + angle: 60.0, + base_buildup_duration: 0.9, + base_swing_duration: 0.1, + base_recover_duration: 0.9, + forward_movement: 3.0, + ), + ], + initial_energy_gain: 0, + max_energy_gain: 0, + energy_increase: 0, + speed_increase: 0.0, + max_speed_increase: 0.0, + scales_from_combo: 0, + is_interruptible: false, +) diff --git a/assets/common/abilities/weapon_ability_manifest.ron b/assets/common/abilities/weapon_ability_manifest.ron index 5b54bfeb16..4683401e1d 100644 --- a/assets/common/abilities/weapon_ability_manifest.ron +++ b/assets/common/abilities/weapon_ability_manifest.ron @@ -81,7 +81,7 @@ abilities: [], ), Unique(StoneGolemFist): ( - primary: "common.abilities.unique.stonegolemfist.basic", + primary: "common.abilities.unique.stonegolemfist.singlestrike", secondary: "common.abilities.unique.stonegolemfist.shockwave", abilities: [ (None, "common.abilities.unique.stonegolemfist.spin"), diff --git a/voxygen/anim/src/golem/alpha.rs b/voxygen/anim/src/golem/alpha.rs index d147dfca34..dde2065b89 100644 --- a/voxygen/anim/src/golem/alpha.rs +++ b/voxygen/anim/src/golem/alpha.rs @@ -2,12 +2,13 @@ use super::{ super::{vek::*, Animation}, GolemSkeleton, SkeletonAttr, }; +use common::states::utils::StageSection; use std::f32::consts::PI; pub struct AlphaAnimation; impl Animation for AlphaAnimation { - type Dependency = (f32, f64); + type Dependency = (Option, f64, f64); type Skeleton = GolemSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,78 +18,69 @@ impl Animation for AlphaAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, - (_velocity, global_time): Self::Dependency, + (stage_section, global_time, timer): Self::Dependency, anim_time: f64, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let lab = 1.0; - - let slower = (((1.0) - / (0.05 + 0.95 * ((anim_time as f32 * lab as f32 * 8.0 - 0.5 * PI).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * lab as f32 * 8.0 - 0.5 * PI).sin()) - + 1.0; - let twist = (anim_time as f32 * lab as f32 * 4.0).sin() + 0.5; - - let random = ((((2.0 - * (((global_time as f32 - anim_time as f32) * 10.0) - - (((global_time as f32 - anim_time as f32) * 10.0).round()))) - .abs()) - * 10.0) - .round()) - / 10.0; - - let switch = if random > 0.5 { 1.0 } else { -1.0 }; - - if switch > 0.0 { - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02; - next.head.orientation = Quaternion::rotation_x(-0.2); - - next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1) / 8.0; - next.upper_torso.orientation = Quaternion::rotation_z(twist * 1.1); - - 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(twist * -1.1) * Quaternion::rotation_x(0.0); - - next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); - next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - - 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(slower * 0.4); - - next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2); - next.hand_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.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(slower * 0.35); - } else { - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02; - next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.2); - - next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1) / 8.0; - next.upper_torso.orientation = Quaternion::rotation_z(twist * -1.1); - - 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(twist * 1.1); - - 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(slower * 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_z(0.0); - - 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(slower * 0.35); - - next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2); - next.hand_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + let (move1base, move2base, move3) = match stage_section { + Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)), + _ => (0.0, 0.0, 0.0), }; - next.torso.position = Vec3::new(0.0, 0.0, 0.0); - next.torso.orientation = Quaternion::rotation_z(0.0); + + let pullback = 1.0 - move3; + let subtract = global_time - timer; + let check = subtract - subtract.trunc(); + let mirror = (check - 0.5).signum() as f32; + + 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 * 0.7, move1 * -0.3); next } } diff --git a/voxygen/anim/src/golem/idle.rs b/voxygen/anim/src/golem/idle.rs index 7b5945750d..5f8744a771 100644 --- a/voxygen/anim/src/golem/idle.rs +++ b/voxygen/anim/src/golem/idle.rs @@ -41,7 +41,7 @@ impl Animation for IdleAnimation { ); next.head.scale = Vec3::one() * 1.02; next.jaw.scale = Vec3::one() * 1.02; - next.upper_torso.scale = Vec3::one() / 8.0; + next.upper_torso.scale = Vec3::one() * s_a.scaler / 8.0; next.hand_l.scale = Vec3::one() * 1.04; next.hand_r.scale = Vec3::one() * 1.04; next.leg_l.scale = Vec3::one() * 1.02; @@ -56,7 +56,7 @@ impl Animation for IdleAnimation { next.jaw.orientation = Quaternion::rotation_x(-0.1 + breathe * 0.1); next.upper_torso.position = - Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + breathe * 0.5) / 8.0; + Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + breathe * 0.5) * s_a.scaler / 8.0; next.upper_torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.lower_torso.position = diff --git a/voxygen/anim/src/golem/jump.rs b/voxygen/anim/src/golem/jump.rs deleted file mode 100644 index 2f9c536c79..0000000000 --- a/voxygen/anim/src/golem/jump.rs +++ /dev/null @@ -1,54 +0,0 @@ -use super::{super::Animation, GolemSkeleton, SkeletonAttr}; -//use std::f32::consts::PI; -use super::super::vek::*; - -pub struct JumpAnimation; - -impl Animation for JumpAnimation { - type Dependency = (f32, f64); - type Skeleton = GolemSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"golem_jump\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "golem_jump")] - - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - _global_time: Self::Dependency, - _anim_time: f64, - _rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - let mut next = (*skeleton).clone(); - - next.head.scale = Vec3::one() * 1.02; - next.jaw.scale = Vec3::one() * 1.02; - next.upper_torso.scale = Vec3::one() / 8.0; - next.hand_l.scale = Vec3::one() * 1.04; - next.hand_r.scale = Vec3::one() * 1.04; - next.leg_l.scale = Vec3::one() * 1.02; - next.leg_r.scale = Vec3::one() * 1.02; - - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02; - - next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1) / 8.0; - - next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); - - next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); - - next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2); - - next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2); - - next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) * 1.02; - - next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) * 1.02; - - next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2) / 8.0; - - next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) / 8.0; - next - } -} diff --git a/voxygen/anim/src/golem/mod.rs b/voxygen/anim/src/golem/mod.rs index a3bcf69f60..93703771ad 100644 --- a/voxygen/anim/src/golem/mod.rs +++ b/voxygen/anim/src/golem/mod.rs @@ -1,14 +1,13 @@ pub mod alpha; pub mod idle; -pub mod jump; pub mod run; pub mod shockwave; pub mod spinmelee; // Reexports pub use self::{ - alpha::AlphaAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation, - shockwave::ShockwaveAnimation, spinmelee::SpinMeleeAnimation, + alpha::AlphaAnimation, idle::IdleAnimation, run::RunAnimation, shockwave::ShockwaveAnimation, + spinmelee::SpinMeleeAnimation, }; use super::{make_bone, vek::*, FigureBoneData, Skeleton}; @@ -82,6 +81,8 @@ pub struct SkeletonAttr { hand: (f32, f32, f32), leg: (f32, f32, f32), foot: (f32, f32, f32), + scaler: f32, + tempo: f32, } impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr { @@ -106,6 +107,8 @@ impl Default for SkeletonAttr { hand: (0.0, 0.0, 0.0), leg: (0.0, 0.0, 0.0), foot: (0.0, 0.0, 0.0), + scaler: 0.0, + tempo: 0.0, } } } @@ -146,6 +149,14 @@ impl<'a> From<&'a Body> for SkeletonAttr { (StoneGolem, _) => (3.5, 0.5, -9.5), (Treant, _) => (3.5, -5.0, -8.5), }, + scaler: match (body.species, body.body_type) { + (StoneGolem, _) => 1.8, + (Treant, _) => 1.8, + }, + tempo: match (body.species, body.body_type) { + (StoneGolem, _) => 1.0, + (Treant, _) => 1.0, + }, } } } diff --git a/voxygen/anim/src/golem/run.rs b/voxygen/anim/src/golem/run.rs index 1f37f2f21f..1bd3c46881 100644 --- a/voxygen/anim/src/golem/run.rs +++ b/voxygen/anim/src/golem/run.rs @@ -7,7 +7,7 @@ use std::f32::consts::PI; pub struct RunAnimation; impl Animation for RunAnimation { - type Dependency = (f32, Vec3, Vec3, f64); + type Dependency = (Vec3, Vec3, Vec3, f64, f32); type Skeleton = GolemSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,37 +17,43 @@ impl Animation for RunAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, - (_velocity, orientation, last_ori, _global_time): Self::Dependency, - anim_time: f64, + (velocity, orientation, last_ori, _global_time, acc_vel): Self::Dependency, + _anim_time: f64, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); + let speed = Vec2::::from(velocity).magnitude(); - let lab = 0.45; //.65 + let lab = 0.45 * s_a.tempo; //.65 + let speednorm = (speed / 7.0).powf(0.6); //.powf(0.4) let foothoril = (((1.0) - / (0.4 + (0.6) * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()).powi(2))) + / (0.4 + (0.6) * ((acc_vel * 2.0 * lab as f32 + PI * 1.4).sin()).powi(2))) .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()); + * ((acc_vel * 2.0 * lab as f32 + PI * 1.4).sin()) + * speednorm; let foothorir = (((1.0) - / (0.4 + (0.6) * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()).powi(2))) + / (0.4 + (0.6) * ((acc_vel * 2.0 * lab as f32 + PI * 0.4).sin()).powi(2))) .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()); - let footvertl = (anim_time as f32 * 16.0 * lab as f32).sin(); - let footvertr = (anim_time as f32 * 16.0 * lab as f32 + PI).sin(); + * ((acc_vel * 2.0 * lab as f32 + PI * 0.4).sin()) + * speednorm; + let footvertl = (acc_vel * 2.0 * lab as f32).sin() * speednorm; + let footvertr = (acc_vel * 2.0 * lab as f32 + PI).sin() * speednorm; - let footrotl = (((5.0) - / (2.5 + (2.5) * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()).powi(2))) + let footrotl = (((1.0) + / (0.5 + (0.5) * ((acc_vel * 2.0 * lab as f32 + PI * 1.4).sin()).powi(2))) .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()); + * ((acc_vel * 2.0 * lab as f32 + PI * 1.4).sin()) + * speednorm; - let footrotr = (((5.0) - / (1.0 + (4.0) * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()).powi(2))) + let footrotr = (((1.0) + / (0.2 + (0.8) * ((acc_vel * 2.0 * lab as f32 + PI * 0.4).sin()).powi(2))) .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()); + * ((acc_vel * 2.0 * lab as f32 + PI * 0.4).sin()) + * speednorm; - let short = (anim_time as f32 * lab as f32 * 16.0).sin(); - let shortalt = (anim_time as f32 * lab as f32 * 16.0 + PI / 2.0).sin(); + let short = (acc_vel * lab as f32 * 2.0).sin() * speednorm; + let shortalt = (acc_vel * lab as f32 * 2.0 + PI / 2.0).sin() * speednorm; let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); let tilt = if ::vek::Vec2::new(ori, last_ori) @@ -64,19 +70,20 @@ impl Animation for RunAnimation { next.head.scale = Vec3::one() * 1.02; next.jaw.scale = Vec3::one() * 1.02; - next.upper_torso.scale = Vec3::one() / 8.0; + next.upper_torso.scale = Vec3::one() * s_a.scaler / 8.0; next.hand_l.scale = Vec3::one() * 1.04; next.hand_r.scale = Vec3::one() * 1.04; next.leg_l.scale = Vec3::one() * 1.02; next.leg_r.scale = Vec3::one() * 1.02; next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02; - next.head.orientation = Quaternion::rotation_z(short * -0.3) * Quaternion::rotation_x(-0.2); + next.head.orientation = + Quaternion::rotation_z(short * -0.3) * Quaternion::rotation_x(-0.2 * speednorm); next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1) * 1.02; next.upper_torso.position = - Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + short * 1.0) / 8.0; + Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + short * 1.0) * s_a.scaler / 8.0; next.upper_torso.orientation = Quaternion::rotation_z(tilt * -4.0 + short * 0.40); next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1); @@ -89,7 +96,7 @@ impl Animation for RunAnimation { next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); next.shoulder_r.orientation = Quaternion::rotation_z(footrotr * -0.07) - * Quaternion::rotation_y(-0.15) + * Quaternion::rotation_y(-0.15 * speednorm) * Quaternion::rotation_x(footrotr * -0.25); next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2); @@ -104,13 +111,13 @@ impl Animation for RunAnimation { next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) * 1.02; next.leg_l.orientation = Quaternion::rotation_x(footrotl * 0.3) - * Quaternion::rotation_y(0.1) + * Quaternion::rotation_y(0.1 * speednorm) * Quaternion::rotation_z(footrotl * -0.2); next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) * 1.02; next.leg_r.orientation = Quaternion::rotation_x(footrotr * 0.3) - * Quaternion::rotation_y(-0.1) + * Quaternion::rotation_y(-0.1 * speednorm) * Quaternion::rotation_z(footrotr * 0.2); next.foot_l.position = Vec3::new( @@ -119,7 +126,7 @@ impl Animation for RunAnimation { s_a.foot.2 + (footvertl * 3.0).max(0.0), ); next.foot_l.orientation = - Quaternion::rotation_x(footrotl * 0.2) * Quaternion::rotation_y(-0.08); + Quaternion::rotation_x(footrotl * 0.2) * Quaternion::rotation_y(-0.08 * speednorm); next.foot_r.position = Vec3::new( s_a.foot.0, @@ -128,10 +135,10 @@ impl Animation for RunAnimation { ); next.foot_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(footrotr * 0.2) - * Quaternion::rotation_y(0.08); + * Quaternion::rotation_y(0.08 * speednorm); next.torso.position = Vec3::new(0.0, 0.0, 0.0); - next.torso.orientation = Quaternion::rotation_x(-0.2); + next.torso.orientation = Quaternion::rotation_x(-0.2 * speednorm); next } } diff --git a/voxygen/anim/src/golem/shockwave.rs b/voxygen/anim/src/golem/shockwave.rs index 1072138087..eda067608a 100644 --- a/voxygen/anim/src/golem/shockwave.rs +++ b/voxygen/anim/src/golem/shockwave.rs @@ -42,7 +42,8 @@ impl Animation for ShockwaveAnimation { 0.0, s_a.upper_torso.0, s_a.upper_torso.1 + slower * -3.0 + breathe * 1.0, - ) / 8.0; + ) * s_a.scaler + / 8.0; next.upper_torso.orientation = Quaternion::rotation_z((twist * 2.0).min(PI)) * Quaternion::rotation_x(0.0); diff --git a/voxygen/anim/src/golem/spinmelee.rs b/voxygen/anim/src/golem/spinmelee.rs index 7cda164165..9d283a2edb 100644 --- a/voxygen/anim/src/golem/spinmelee.rs +++ b/voxygen/anim/src/golem/spinmelee.rs @@ -38,7 +38,8 @@ impl Animation for SpinMeleeAnimation { next.head.orientation = Quaternion::rotation_z(movement2 * -2.0 * PI) * Quaternion::rotation_x(-0.2); - next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1) / 8.0; + next.upper_torso.position = + Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1) * s_a.scaler / 8.0; next.upper_torso.orientation = Quaternion::rotation_z(movement2 * 2.0 * PI); next.lower_torso.position = diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 89caf22f31..95a7e7f4ef 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -3656,20 +3656,21 @@ impl FigureMgr { (true, true, false) => anim::golem::RunAnimation::update_skeleton( &GolemSkeleton::default(), ( - vel.0.magnitude(), + vel.0, // TODO: Update to use the quaternion. ori * anim::vek::Vec3::::unit_y(), state.last_ori * anim::vek::Vec3::::unit_y(), time, + state.acc_vel, ), state.state_time, &mut state_animation_rate, skeleton_attr, ), // In air - (false, _, false) => anim::golem::JumpAnimation::update_skeleton( + (false, _, false) => anim::golem::RunAnimation::update_skeleton( &GolemSkeleton::default(), - (vel.0.magnitude(), time), + (vel.0, ori, state.last_ori, time, state.acc_vel), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -3684,11 +3685,35 @@ impl FigureMgr { ), }; let target_bones = match &character { - CharacterState::BasicMelee(_) => { + CharacterState::ComboMelee(s) => { + let stage_index = (s.stage - 1) as usize; + let stage_time = s.timer.as_secs_f64(); + let stage_progress = match s.stage_section { + StageSection::Buildup => { + stage_time + / s.static_data.stage_data[stage_index] + .base_buildup_duration + .as_secs_f64() + }, + StageSection::Swing => { + stage_time + / s.static_data.stage_data[stage_index] + .base_swing_duration + .as_secs_f64() + }, + StageSection::Recover => { + stage_time + / s.static_data.stage_data[stage_index] + .base_recover_duration + .as_secs_f64() + }, + _ => 0.0, + }; + anim::golem::AlphaAnimation::update_skeleton( &target_base, - (vel.0.magnitude(), time), - state.state_time, + (Some(s.stage_section), time, state.state_time), + stage_progress, &mut state_animation_rate, skeleton_attr, ) diff --git a/voxygen/src/scene/particle.rs b/voxygen/src/scene/particle.rs index 3498b4c1a9..91093ba1be 100644 --- a/voxygen/src/scene/particle.rs +++ b/voxygen/src/scene/particle.rs @@ -67,14 +67,14 @@ impl ParticleMgr { self.particles.len() + (200.0 * power.abs()) as usize, || { Particle::new_directed( - Duration::from_secs_f32(rng.gen_range(1.0, 8.0)), + Duration::from_secs_f32(rng.gen_range(1.0..8.0)), time, ParticleMode::EnergyNature, *pos, *pos + Vec3::::zero() .map(|_| rng.gen_range(-1.0..1.0)) .normalized() - * rng.gen_range(1.0, radius) + * rng.gen_range(1.0..*radius), ) }, ); @@ -679,7 +679,8 @@ impl ParticleMgr { for d in 0..8 * distance as i32 { let arc_position = theta - radians / 2.0 + dtheta * d as f32 / 3.0; - let diff = distance * Vec3::new(arc_position.cos(), arc_position.sin(), 0.0); + let diff = + distance * Vec3::new(arc_position.cos(), arc_position.sin(), 0.0); let position = pos.0 + diff; self.particles.push(Particle::new_directed(