From d3cfd120f7a6201035e7e39ca6762a13717496d8 Mon Sep 17 00:00:00 2001
From: jshipsey <jshipsey18@gmail.com>
Date: Fri, 27 Mar 2020 01:57:30 -0400
Subject: [PATCH] third attack for triple strike

---
 voxygen/src/anim/character/alpha.rs  | 14 +++---
 voxygen/src/anim/character/beta.rs   | 71 ++++++++++++++--------------
 voxygen/src/anim/character/charge.rs |  4 +-
 voxygen/src/anim/character/mod.rs    | 11 +++--
 voxygen/src/anim/character/run.rs    | 12 ++---
 voxygen/src/anim/character/spin.rs   | 12 ++---
 voxygen/src/anim/character/wield.rs  |  6 +--
 voxygen/src/scene/figure/mod.rs      |  2 +-
 8 files changed, 67 insertions(+), 65 deletions(-)

diff --git a/voxygen/src/anim/character/alpha.rs b/voxygen/src/anim/character/alpha.rs
index e2a0ac9a0d..bc1a7ca73d 100644
--- a/voxygen/src/anim/character/alpha.rs
+++ b/voxygen/src/anim/character/alpha.rs
@@ -22,8 +22,8 @@ impl Animation for AlphaAnimation {
         let lab = 1.0;
 
         let foot = (((5.0)
-            / (1.1
-                + 3.9
+            / (0.2
+                + 4.8
                     * ((anim_time as f32 * lab as f32 * 1.3 * velocity).sin()).powf(2.0 as f32)))
         .sqrt())
             * ((anim_time as f32 * lab as f32 * 1.3 * velocity).sin());
@@ -91,11 +91,13 @@ impl Animation for AlphaAnimation {
                     * Quaternion::rotation_z(1.4 + slow * 0.5);
                 next.control.scale = Vec3::one();
                 next.l_foot.offset = Vec3::new(-3.4, foot * 3.0 + slow * -5.0, 8.0);
-                next.l_foot.ori = Quaternion::rotation_x(foot * -0.6);
+                next.l_foot.ori =
+                    Quaternion::rotation_x(foot * -0.6) * Quaternion::rotation_y(foot * 0.2);
                 next.l_foot.scale = Vec3::one();
 
                 next.r_foot.offset = Vec3::new(3.4, foot * -3.0 + slow * 5.0, 8.0);
-                next.r_foot.ori = Quaternion::rotation_x(foot * 0.6);
+                next.r_foot.ori =
+                    Quaternion::rotation_x(foot * 0.6) * Quaternion::rotation_y(foot * -0.2);
                 next.r_foot.scale = Vec3::one();
                 next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
                 next.torso.ori = Quaternion::rotation_z(0.0)
@@ -226,8 +228,8 @@ impl Animation for AlphaAnimation {
                     next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
                 }
 
-                next.control.offset = Vec3::new(-6.0, 3.0, 8.0 + slower * 5.0);
-                next.control.ori = Quaternion::rotation_x(-0.2 + slower * 2.0)
+                next.control.offset = Vec3::new(-6.0, 3.0 + slower * 2.0, 8.0 + slower * 5.0);
+                next.control.ori = Quaternion::rotation_x(-0.2 + slower * 1.8)
                     * Quaternion::rotation_y(0.0)
                     * Quaternion::rotation_z(1.4 + 1.57);
                 next.control.scale = Vec3::one();
diff --git a/voxygen/src/anim/character/beta.rs b/voxygen/src/anim/character/beta.rs
index ffeba742a5..0ae34b22a7 100644
--- a/voxygen/src/anim/character/beta.rs
+++ b/voxygen/src/anim/character/beta.rs
@@ -1,6 +1,5 @@
 use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
 use common::comp::item::ToolKind;
-use std::f32::consts::PI;
 use vek::*;
 
 pub struct BetaAnimation;
@@ -11,7 +10,7 @@ impl Animation for BetaAnimation {
 
     fn update_skeleton(
         skeleton: &Self::Skeleton,
-        (active_tool_kind, velocity, _global_time): Self::Dependency,
+        (active_tool_kind, _velocity, _global_time): Self::Dependency,
         anim_time: f64,
         rate: &mut f32,
         skeleton_attr: &SkeletonAttr,
@@ -21,28 +20,22 @@ impl Animation for BetaAnimation {
 
         let lab = 1.0;
 
+        let fast = (((5.0)
+            / (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 28.0).sin()).powf(2.0 as f32)))
+        .sqrt())
+            * ((anim_time as f32 * lab as f32 * 28.0).sin());
+        let footquick = (((5.0)
+            / (0.4 + 4.6 * ((anim_time as f32 * lab as f32 * 14.0).sin()).powf(2.0 as f32)))
+        .sqrt())
+            * ((anim_time as f32 * lab as f32 * 14.0).sin());
         let foot = (((5.0)
-            / (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 1.3 * velocity).sin()).powf(2.0 as f32)))
+            / (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 14.0).sin()).powf(2.0 as f32)))
         .sqrt())
-            * ((anim_time as f32 * lab as f32 * 1.3 * velocity).sin());
-
-        let accel_med = 1.0 - (anim_time as f32 * 16.0 * lab as f32).cos();
-        let accel_slow = 1.0 - (anim_time as f32 * 12.0 * lab as f32).cos();
-        let accel_fast = 1.0 - (anim_time as f32 * 24.0 * lab as f32).cos();
-        let decel = (anim_time as f32 * 16.0 * lab as f32).min(PI / 2.0).sin();
-
+            * ((anim_time as f32 * lab as f32 * 14.0).sin());
         let slow = (((5.0)
-            / (0.6 + 4.4 * ((anim_time as f32 * lab as f32 * 11.0).sin()).powf(2.0 as f32)))
+            / (0.6 + 4.4 * ((anim_time as f32 * lab as f32 * 14.0).sin()).powf(2.0 as f32)))
         .sqrt())
-            * ((anim_time as f32 * lab as f32 * 11.0).sin());
-        let slower = (((5.0)
-            / (0.1 + 4.9 * ((anim_time as f32 * lab as f32 * 4.0).sin()).powf(2.0 as f32)))
-        .sqrt())
-            * ((anim_time as f32 * lab as f32 * 4.0).sin());
-        let slowax = (((5.0)
-            / (0.1 + 4.9 * ((anim_time as f32 * lab as f32 * 4.0 + 1.9).cos()).powf(2.0 as f32)))
-        .sqrt())
-            * ((anim_time as f32 * lab as f32 * 4.0 + 1.9).cos());
+            * ((anim_time as f32 * lab as f32 * 14.0).sin());
 
         match active_tool_kind {
             //TODO: Inventory
@@ -52,23 +45,27 @@ impl Animation for BetaAnimation {
                     -2.0 + skeleton_attr.neck_forward,
                     skeleton_attr.neck_height + 14.0,
                 );
-                next.head.ori = Quaternion::rotation_z(slow * 0.08)
-                    * Quaternion::rotation_x(0.0 + slow * 0.08)
-                    * Quaternion::rotation_y(slow * -0.08);
+                next.head.ori = Quaternion::rotation_z(slow * -0.18)
+                    * Quaternion::rotation_x(-0.1 + slow * -0.28)
+                    * Quaternion::rotation_y(0.2 + slow * 0.18);
                 next.head.scale = Vec3::one() * skeleton_attr.head_scale;
 
-                next.chest.offset = Vec3::new(0.0, 0.0, 7.0);
-                next.chest.ori = Quaternion::rotation_z(slow * -0.2)
-                    * Quaternion::rotation_x(0.0 + slow * -0.2)
-                    * Quaternion::rotation_y(slow * 0.2);
+                next.chest.offset = Vec3::new(0.0 + foot * 2.0, 0.0, 7.0);
+                next.chest.ori = Quaternion::rotation_z(slow * 0.2)
+                    * Quaternion::rotation_x(0.0 + slow * 0.2)
+                    * Quaternion::rotation_y(slow * -0.1);
                 next.chest.scale = Vec3::one();
 
                 next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
-                next.belt.ori = next.chest.ori * -0.2;
+                next.belt.ori = Quaternion::rotation_z(slow * 0.1)
+                    * Quaternion::rotation_x(0.0 + slow * 0.1)
+                    * Quaternion::rotation_y(slow * -0.04);
                 next.belt.scale = Vec3::one();
 
                 next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
-                next.shorts.ori = next.chest.ori * -0.15;
+                next.shorts.ori = Quaternion::rotation_z(slow * 0.1)
+                    * Quaternion::rotation_x(0.0 + slow * 0.1)
+                    * Quaternion::rotation_y(slow * -0.05);
                 next.shorts.scale = Vec3::one();
 
                 next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
@@ -83,17 +80,19 @@ impl Animation for BetaAnimation {
                     * Quaternion::rotation_z(0.0);
                 next.main.scale = Vec3::one();
 
-                next.control.offset = Vec3::new(-8.0 - slow * 1.0, 3.0 - slow * 5.0, 0.0);
+                next.control.offset = Vec3::new(-8.0 + slow * 1.5, 1.5 + slow * 1.0, 0.0);
                 next.control.ori = Quaternion::rotation_x(-1.4)
-                    * Quaternion::rotation_y(slow * 1.5 + 0.7)
-                    * Quaternion::rotation_z(1.4 + slow * 0.5);
+                    * Quaternion::rotation_y(slow * 2.0 + 0.7)
+                    * Quaternion::rotation_z(1.7 - slow * 0.4 + fast * 0.6);
                 next.control.scale = Vec3::one();
-                next.l_foot.offset = Vec3::new(-3.4, foot * 3.0 + slow * -5.0, 8.0);
-                next.l_foot.ori = Quaternion::rotation_x(foot * -0.6);
+                next.l_foot.offset = Vec3::new(-3.4, footquick * -9.5, 8.0);
+                next.l_foot.ori = Quaternion::rotation_x(footquick * 0.3)
+                    * Quaternion::rotation_y(footquick * -0.6);
                 next.l_foot.scale = Vec3::one();
 
-                next.r_foot.offset = Vec3::new(3.4, foot * -3.0 + slow * 5.0, 8.0);
-                next.r_foot.ori = Quaternion::rotation_x(foot * 0.6);
+                next.r_foot.offset = Vec3::new(3.4, footquick * 9.5, 8.0);
+                next.r_foot.ori = Quaternion::rotation_x(footquick * -0.3)
+                    * Quaternion::rotation_y(footquick * 0.2);
                 next.r_foot.scale = Vec3::one();
                 next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
                 next.torso.ori = Quaternion::rotation_z(0.0)
diff --git a/voxygen/src/anim/character/charge.rs b/voxygen/src/anim/character/charge.rs
index 01672ecfeb..c5d489bdf9 100644
--- a/voxygen/src/anim/character/charge.rs
+++ b/voxygen/src/anim/character/charge.rs
@@ -80,11 +80,11 @@ impl Animation for ChargeAnimation {
                     * Quaternion::rotation_y(0.0)
                     * Quaternion::rotation_z(1.1 + slow * 0.2);
                 next.control.scale = Vec3::one();
-                next.l_foot.offset = Vec3::new(-1.4, foot * 3.0, 8.0);
+                next.l_foot.offset = Vec3::new(-1.4, foot * 3.0 + 2.0, 8.0);
                 next.l_foot.ori = Quaternion::rotation_x(foot * -0.4 - 0.8);
                 next.l_foot.scale = Vec3::one();
 
-                next.r_foot.offset = Vec3::new(5.4, foot * -3.0 - 3.0, 8.0);
+                next.r_foot.offset = Vec3::new(5.4, foot * -3.0 - 1.0, 8.0);
                 next.r_foot.ori = Quaternion::rotation_x(foot * 0.4 - 0.8);
                 next.r_foot.scale = Vec3::one();
             },
diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs
index 122f427312..c506aafc88 100644
--- a/voxygen/src/anim/character/mod.rs
+++ b/voxygen/src/anim/character/mod.rs
@@ -1,4 +1,5 @@
 pub mod alpha;
+pub mod beta;
 pub mod block;
 pub mod blockidle;
 pub mod charge;
@@ -18,11 +19,11 @@ pub mod wield;
 
 // Reexports
 pub use self::{
-    alpha::AlphaAnimation, block::BlockAnimation, blockidle::BlockIdleAnimation,
-    charge::ChargeAnimation, climb::ClimbAnimation, equip::EquipAnimation,
-    gliding::GlidingAnimation, idle::IdleAnimation, jump::JumpAnimation, roll::RollAnimation,
-    run::RunAnimation, shoot::ShootAnimation, sit::SitAnimation, spin::SpinAnimation,
-    stand::StandAnimation, swim::SwimAnimation, wield::WieldAnimation,
+    alpha::AlphaAnimation, beta::BetaAnimation, block::BlockAnimation,
+    blockidle::BlockIdleAnimation, charge::ChargeAnimation, climb::ClimbAnimation,
+    equip::EquipAnimation, gliding::GlidingAnimation, idle::IdleAnimation, jump::JumpAnimation,
+    roll::RollAnimation, run::RunAnimation, shoot::ShootAnimation, sit::SitAnimation,
+    spin::SpinAnimation, stand::StandAnimation, swim::SwimAnimation, wield::WieldAnimation,
 };
 
 use super::{Bone, Skeleton};
diff --git a/voxygen/src/anim/character/run.rs b/voxygen/src/anim/character/run.rs
index 36a3fab7aa..27643664a1 100644
--- a/voxygen/src/anim/character/run.rs
+++ b/voxygen/src/anim/character/run.rs
@@ -82,7 +82,7 @@ impl Animation for RunAnimation {
             * Quaternion::rotation_x(head_look.y + 0.35);
         next.head.scale = Vec3::one() * skeleton_attr.head_scale;
 
-        next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + short * 1.1);
+        next.chest.offset = Vec3::new(0.0, 0.0, 10.5 + short * 1.1);
         next.chest.ori = Quaternion::rotation_z(short * 0.3);
         next.chest.scale = Vec3::one();
 
@@ -97,7 +97,7 @@ impl Animation for RunAnimation {
         next.l_hand.offset = Vec3::new(
             -6.0 + wave_stop * -1.0,
             -0.25 + short * 3.0,
-            4.0 + short * -1.5,
+            5.0 + short * -1.5,
         );
         next.l_hand.ori =
             Quaternion::rotation_x(0.8 + short * 1.2) * Quaternion::rotation_y(wave_stop * 0.1);
@@ -106,17 +106,17 @@ impl Animation for RunAnimation {
         next.r_hand.offset = Vec3::new(
             6.0 + wave_stop * 1.0,
             -0.25 + short * -3.0,
-            4.0 + short * 1.5,
+            5.0 + short * 1.5,
         );
         next.r_hand.ori =
             Quaternion::rotation_x(0.8 + short * -1.2) * Quaternion::rotation_y(wave_stop * -0.1);
         next.r_hand.scale = Vec3::one();
 
-        next.l_foot.offset = Vec3::new(-3.4, foot * 1.0, 6.0);
+        next.l_foot.offset = Vec3::new(-3.4, foot * 1.0, 9.5);
         next.l_foot.ori = Quaternion::rotation_x(foot * -1.2);
         next.l_foot.scale = Vec3::one();
 
-        next.r_foot.offset = Vec3::new(3.4, foot * -1.0, 6.0);
+        next.r_foot.offset = Vec3::new(3.4, foot * -1.0, 9.5);
         next.r_foot.ori = Quaternion::rotation_x(foot * 1.2);
         next.r_foot.scale = Vec3::one();
 
@@ -152,7 +152,7 @@ impl Animation for RunAnimation {
         next.lantern.ori = Quaternion::rotation_y(0.0);
         next.lantern.scale = Vec3::one() * 0.0;
 
-        next.torso.offset = Vec3::new(0.0, -0.3 + shortalt * -0.065, 0.4) * skeleton_attr.scaler;
+        next.torso.offset = Vec3::new(0.0, -0.3 + shortalt * -0.065, 0.0) * skeleton_attr.scaler;
         next.torso.ori =
             Quaternion::rotation_x(wave_stop * speed * -0.05 + wave_stop * speed * -0.005)
                 * Quaternion::rotation_y(tilt);
diff --git a/voxygen/src/anim/character/spin.rs b/voxygen/src/anim/character/spin.rs
index b9b19f7dcb..98f37e1c5e 100644
--- a/voxygen/src/anim/character/spin.rs
+++ b/voxygen/src/anim/character/spin.rs
@@ -56,16 +56,16 @@ impl Animation for SpinAnimation {
                 next.control.scale = Vec3::one();
                 next.head.offset = Vec3::new(
                     0.0 + skeleton_attr.neck_right,
-                    -2.0 + skeleton_attr.neck_forward + decel * -0.8,
+                    -2.0 + skeleton_attr.neck_forward + spin * -0.8,
                     skeleton_attr.neck_height + 14.0,
                 );
-                next.head.ori = Quaternion::rotation_z(decel * -0.25)
-                    * Quaternion::rotation_x(0.0 + decel * -0.1)
-                    * Quaternion::rotation_y(decel * 0.1);
+                next.head.ori = Quaternion::rotation_z(spin * -0.25)
+                    * Quaternion::rotation_x(0.0 + spin * -0.1)
+                    * Quaternion::rotation_y(spin * -0.2);
                 next.head.scale = Vec3::one() * skeleton_attr.head_scale;
                 next.chest.offset = Vec3::new(0.0, 0.0, 7.0);
-                next.chest.ori = Quaternion::rotation_z(decel * 0.1)
-                    * Quaternion::rotation_x(0.0 + decel * 0.1)
+                next.chest.ori = Quaternion::rotation_z(spin * 0.1)
+                    * Quaternion::rotation_x(0.0 + spin * 0.1)
                     * Quaternion::rotation_y(decel * -0.2);
                 next.chest.scale = Vec3::one();
 
diff --git a/voxygen/src/anim/character/wield.rs b/voxygen/src/anim/character/wield.rs
index 44f2d6ba74..05e61b67a2 100644
--- a/voxygen/src/anim/character/wield.rs
+++ b/voxygen/src/anim/character/wield.rs
@@ -237,15 +237,15 @@ impl Animation for WieldAnimation {
             next.shorts.ori = Quaternion::rotation_z(0.3);
             next.shorts.scale = Vec3::one();
 
-            next.l_foot.offset = Vec3::new(-3.4, -2.5, 8.0);
+            next.l_foot.offset = Vec3::new(-3.4, -2.5, 9.0);
             next.l_foot.ori = Quaternion::rotation_x(ultra_slow_cos * 0.035 - 0.2);
             next.l_foot.scale = Vec3::one();
 
-            next.r_foot.offset = Vec3::new(3.4, 3.5, 8.0);
+            next.r_foot.offset = Vec3::new(3.4, 3.5, 9.0);
             next.r_foot.ori = Quaternion::rotation_x(ultra_slow * 0.035);
             next.r_foot.scale = Vec3::one();
 
-            next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
+            next.torso.offset = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
             next.torso.ori = Quaternion::rotation_x(0.0);
             next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
 
diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs
index 322620727a..4120c2da22 100644
--- a/voxygen/src/scene/figure/mod.rs
+++ b/voxygen/src/scene/figure/mod.rs
@@ -527,7 +527,7 @@ impl FigureMgr {
                                 )
                             },
                             triple_strike::Stage::Third => {
-                                anim::character::AlphaAnimation::update_skeleton(
+                                anim::character::BetaAnimation::update_skeleton(
                                     &target_base,
                                     (active_tool_kind, vel.0.magnitude(), time),
                                     state.state_time,