veloren_voxygen_anim/character/
basic.rs

1use super::{
2    super::{Animation, vek::*},
3    CharacterSkeleton, SkeletonAttr, dual_wield_start, hammer_start, twist_back, twist_forward,
4};
5use common::{
6    comp::item::Hands,
7    states::utils::{AbilityInfo, HandInfo, StageSection},
8    util::Dir,
9};
10use core::f32::consts::{PI, TAU};
11
12pub struct BasicAction;
13
14pub struct BasicActionDependency<'a> {
15    pub ability_id: Option<&'a str>,
16    pub hands: (Option<Hands>, Option<Hands>),
17    pub stage_section: Option<StageSection>,
18    pub ability_info: Option<AbilityInfo>,
19    pub velocity: Vec3<f32>,
20    pub last_ori: Vec3<f32>,
21    pub orientation: Vec3<f32>,
22    pub look_dir: Dir,
23    pub is_riding: bool,
24}
25
26impl Animation for BasicAction {
27    type Dependency<'a> = BasicActionDependency<'a>;
28    type Skeleton = CharacterSkeleton;
29
30    #[cfg(feature = "use-dyn-lib")]
31    const UPDATE_FN: &'static [u8] = b"character_basic\0";
32
33    #[cfg_attr(feature = "be-dyn-lib", export_name = "character_basic")]
34    fn update_skeleton_inner(
35        skeleton: &Self::Skeleton,
36        d: Self::Dependency<'_>,
37        anim_time: f32,
38        rate: &mut f32,
39        s_a: &SkeletonAttr,
40    ) -> Self::Skeleton {
41        *rate = 1.0;
42        let mut next = (*skeleton).clone();
43
44        // Don't use this for future animations
45        let mut legacy_initialize = || {
46            next.main.position = Vec3::new(0.0, 0.0, 0.0);
47            next.main.orientation = Quaternion::rotation_z(0.0);
48            next.second.position = Vec3::new(0.0, 0.0, 0.0);
49            next.second.orientation = Quaternion::rotation_z(0.0);
50        };
51
52        if matches!(d.stage_section, Some(StageSection::Action)) {
53            next.main_weapon_trail = true;
54            next.off_weapon_trail = true;
55        }
56        let (move1base, chargebase, movementbase, move2base, move3base) = match d.stage_section {
57            Some(StageSection::Buildup) => (anim_time, 0.0, 0.0, 0.0, 0.0),
58            Some(StageSection::Charge) => (1.0, anim_time, 0.0, 0.0, 0.0),
59            Some(StageSection::Movement) => (1.0, 1.0, anim_time, 0.0, 0.0),
60            Some(StageSection::Action) => (1.0, 1.0, 1.0, anim_time, 0.0),
61            Some(StageSection::Recover) => (1.0, 1.0, 1.0, 1.0, anim_time),
62            _ => (0.0, 0.0, 0.0, 0.0, 0.0),
63        };
64        let pullback = 1.0 - move3base;
65        let move1 = move1base * pullback;
66        let move2 = move2base * pullback;
67
68        match d.ability_id {
69            // ==================================
70            //               SWORD
71            // ==================================
72            Some(
73                "common.abilities.sword.basic_guard" | "common.abilities.sword.defensive_guard",
74            ) => {
75                legacy_initialize();
76                let pullback = 1.0 - move3base.powi(4);
77                let move1 = move1base.powf(0.25) * pullback;
78                let move2 = (move2base * 10.0).sin();
79
80                if d.velocity.xy().magnitude_squared() < 0.5_f32.powi(2) {
81                    next.chest.position =
82                        Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move1 * -1.0 + move2 * 0.2);
83                    next.chest.orientation = Quaternion::rotation_x(move1 * -0.15);
84                    next.head.orientation = Quaternion::rotation_x(move1 * 0.25);
85
86                    next.belt.position =
87                        Vec3::new(0.0, s_a.belt.0 + move1 * 0.5, s_a.belt.1 + move1 * 0.5);
88                    next.shorts.position =
89                        Vec3::new(0.0, s_a.shorts.0 + move1 * 1.3, s_a.shorts.1 + move1 * 1.0);
90
91                    next.belt.orientation = Quaternion::rotation_x(move1 * 0.15);
92                    next.shorts.orientation = Quaternion::rotation_x(move1 * 0.25);
93
94                    if !d.is_riding {
95                        next.foot_l.position =
96                            Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * 2.0, s_a.foot.2);
97                        next.foot_l.orientation = Quaternion::rotation_z(move1 * -0.5);
98
99                        next.foot_r.position =
100                            Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * -2.0, s_a.foot.2);
101                        next.foot_r.orientation = Quaternion::rotation_x(move1 * -0.5);
102                    }
103                }
104
105                match d.hands {
106                    (Some(Hands::Two), _) => {
107                        next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
108                        next.hand_l.orientation =
109                            Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
110                        next.hand_r.position = Vec3::new(
111                            s_a.shr.0 + move1 * -2.0,
112                            s_a.shr.1,
113                            s_a.shr.2 + move1 * 20.0,
114                        );
115                        next.hand_r.orientation = Quaternion::rotation_x(s_a.shr.3)
116                            * Quaternion::rotation_y(s_a.shr.4)
117                            * Quaternion::rotation_z(move1 * 1.5);
118
119                        next.control.position =
120                            Vec3::new(s_a.sc.0 + move1 * -3.0, s_a.sc.1, s_a.sc.2 + move1 * 4.0);
121                        next.control.orientation = Quaternion::rotation_x(s_a.sc.3)
122                            * Quaternion::rotation_y(move1 * 1.1)
123                            * Quaternion::rotation_z(move1 * 1.7);
124                    },
125                    (Some(Hands::One), offhand) => {
126                        next.control_l.position =
127                            Vec3::new(-7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0);
128                        next.control_l.orientation =
129                            Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(move1 * 1.0);
130                        next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
131                        next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
132                        if offhand.is_some() {
133                            next.control_r.position =
134                                Vec3::new(7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0);
135                            next.control_r.orientation =
136                                Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(move1 * -1.0);
137                            next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
138                            next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0)
139                        } else {
140                            next.hand_r.position = Vec3::new(4.5, 8.0, 5.0);
141                            next.hand_r.orientation =
142                                Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5)
143                        }
144                    },
145                    (_, _) => {},
146                }
147            },
148            Some("common.abilities.sword.defensive_deflect") => {
149                legacy_initialize();
150                let move1 = move1base.powi(2);
151                let move2 = (move2base * 20.0).sin();
152                let move3 = move3base.powf(0.5);
153
154                next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
155                next.hand_l.orientation =
156                    Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
157                next.hand_r.position =
158                    Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
159                next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5);
160                next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
161                next.control.orientation =
162                    Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move1 * -0.9);
163
164                next.chest.orientation = Quaternion::rotation_z(move1 * -0.6);
165                next.head.orientation = Quaternion::rotation_z(move1 * 0.2);
166                next.belt.orientation = Quaternion::rotation_z(move1 * -0.1);
167                next.shorts.orientation = Quaternion::rotation_z(move1 * 0.1);
168                next.control.orientation.rotate_y(move1 * -1.7);
169                next.control.orientation.rotate_z(move1 * 0.6);
170                next.control.position += Vec3::new(move1 * 11.0, move1 * 2.0, move1 * 5.0);
171
172                next.control.orientation.rotate_y(move2 / 50.0);
173
174                next.chest.orientation.rotate_z(move3 * -0.6);
175                next.head.orientation.rotate_z(move3 * 0.4);
176                next.belt.orientation.rotate_z(move3 * 0.2);
177                next.shorts.orientation.rotate_z(move3 * 0.6);
178                next.control.position += Vec3::new(move3 * 6.0, 0.0, move3 * 9.0);
179                next.control.orientation.rotate_z(move3 * -0.5);
180                next.control.orientation.rotate_y(move3 * 0.6);
181            },
182            Some(
183                "common.abilities.sword.basic_thrust"
184                | "common.abilities.sword.defensive_vital_jab",
185            ) => {
186                legacy_initialize();
187                let pullback = 1.0 - move3base.powi(4);
188                let move1 = chargebase.powf(0.25).min(1.0) * pullback;
189                let move2 = move2base.powi(2) * pullback;
190                let tension = (chargebase * 20.0).sin();
191
192                next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
193                next.hand_l.orientation =
194                    Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
195                next.hand_r.position =
196                    Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
197                next.hand_r.orientation = Quaternion::rotation_x(PI * 0.5);
198                next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2 + move2 * 5.0);
199                next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + move1 * -0.9)
200                    * Quaternion::rotation_y(move1 * 1.0 + move2 * -1.0)
201                    * Quaternion::rotation_z(move1 * 1.3 + move2 * -1.3);
202
203                next.chest.orientation =
204                    Quaternion::rotation_z(move1 * 1.0 + tension * 0.02 + move2 * -1.2);
205                next.head.orientation = Quaternion::rotation_z(move1 * -0.4 + move2 * 0.3);
206                next.belt.orientation = Quaternion::rotation_z(move1 * -0.25 + move2 * 0.2);
207                next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5 + move2 * 0.4);
208            },
209            Some("common.abilities.sword.heavy_slam") => {
210                legacy_initialize();
211                let pullback = 1.0 - move3base.powi(4);
212                let move1 = chargebase.powf(0.25).min(1.0) * pullback;
213                let move2 = move2base.powi(2) * pullback;
214                let tension = (chargebase * 20.0).sin();
215
216                next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
217                next.hand_l.orientation =
218                    Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
219                next.hand_r.position =
220                    Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
221                next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
222                next.control.orientation = Quaternion::rotation_x(s_a.sc.3)
223                    * Quaternion::rotation_z(move1 * 0.3 + move2 * -0.7);
224
225                next.control
226                    .orientation
227                    .rotate_x(move1 * 1.4 + tension / 50.0);
228                next.control.position +=
229                    Vec3::new(move1 * -1.0, move1 * 2.0, move1 * 8.0) + Vec3::one() * tension / 4.0;
230                next.chest.orientation = Quaternion::rotation_z(move1 * 0.4 + tension / 50.0);
231
232                if move2 < f32::EPSILON {
233                    next.main_weapon_trail = false;
234                    next.off_weapon_trail = false;
235                }
236                next.control.orientation.rotate_x(move2 * -3.0);
237                next.control.orientation.rotate_z(move2 * -0.4);
238                next.control.position += Vec3::new(move2 * 10.0, 0.0, move2 * -10.0);
239                next.chest.orientation.rotate_z(move2 * -0.6);
240            },
241            Some("common.abilities.sword.crippling_deep_rend") => {
242                legacy_initialize();
243                let pullback = 1.0 - move3base;
244                let move1pre = move1base.min(0.5) * 2.0 * pullback;
245                let move1post = (move1base.max(0.5) * 2.0 - 1.0) * pullback;
246                let move2 = chargebase.min(1.0) * pullback;
247                let move3 = move2base * pullback;
248                let tension = (chargebase * 20.0).sin();
249
250                next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
251                next.hand_l.orientation =
252                    Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
253                next.hand_r.position =
254                    Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
255                next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1pre * 0.5);
256                next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
257                next.control.orientation =
258                    Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move1pre * PI / 2.0);
259
260                next.foot_r.position += Vec3::new(0.0, move1pre * -3.0, 0.0);
261                next.foot_r.orientation.rotate_z(move1pre * -1.2);
262                next.chest.orientation = Quaternion::rotation_z(move1pre * -1.3);
263                next.head.orientation = Quaternion::rotation_z(move1pre * 0.7);
264                next.belt.orientation = Quaternion::rotation_z(move1pre * 0.4);
265                next.shorts.orientation = Quaternion::rotation_z(move1pre * 0.8);
266                next.control.orientation.rotate_y(move1pre * -1.5);
267                next.control.orientation.rotate_z(move1pre * 0.0);
268                next.control.position += Vec3::new(move1pre * 12.0, 0.0, 0.0);
269
270                next.chest.orientation.rotate_z(move1post * 1.2);
271                next.head.orientation.rotate_z(move1post * -0.7);
272                next.belt.orientation.rotate_z(move1post * -0.3);
273                next.shorts.orientation.rotate_z(move1post * -0.8);
274                next.foot_r.orientation.rotate_z(move1post * 1.2);
275                next.foot_r.orientation.rotate_x(move1post * -0.6);
276                next.control.orientation.rotate_z(move1post * -1.2);
277                next.control.position += Vec3::new(0.0, move1post * 4.0, move1post * 3.0);
278
279                next.control
280                    .orientation
281                    .rotate_y(move2 * -2.0 + tension / 10.0);
282                next.chest.orientation.rotate_z(move2 * -0.4 + move3 * -1.4);
283                next.control
284                    .orientation
285                    .rotate_z(move2 * 0.3 + move3 * -1.2);
286                next.head.orientation.rotate_z(move2 * 0.2 + move3 * 0.7);
287                next.belt.orientation.rotate_z(move3 * 0.3);
288                next.shorts.orientation.rotate_z(move2 * 0.2 + move3 * 0.7);
289                next.chest
290                    .orientation
291                    .rotate_y(move2 * -0.3 - tension / 100.0);
292                next.foot_r.orientation.rotate_z(move3 * -1.5);
293            },
294            Some(
295                "common.abilities.sword.cleaving_spiral_slash"
296                | "common.abilities.sword.cleaving_dual_spiral_slash",
297            ) => {
298                legacy_initialize();
299                let move1 = chargebase.powf(0.25).min(1.0) * pullback;
300                let move2_pre = move2base.min(0.3) * 10.0 / 3.0 * pullback;
301                let tension = (chargebase * 15.0).sin();
302
303                next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
304                next.hand_l.orientation =
305                    Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
306                next.hand_r.position =
307                    Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
308                next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5);
309                next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
310                next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
311
312                next.chest.orientation = Quaternion::rotation_z(move1 * 1.2 + tension / 50.0);
313                next.head.orientation = Quaternion::rotation_z(move1 * -0.7);
314                next.belt.orientation = Quaternion::rotation_z(move1 * -0.3);
315                next.shorts.orientation = Quaternion::rotation_z(move1 * -0.8);
316                next.control.orientation.rotate_x(move1 * 0.2);
317                next.foot_r
318                    .orientation
319                    .rotate_x(move1 * -0.4 + move2_pre * 0.4);
320                next.foot_r.orientation.rotate_z(move1 * 1.4);
321
322                next.control.orientation.rotate_y(move2_pre * -1.6);
323                next.control.position += Vec3::new(0.0, 0.0, move2_pre * 4.0);
324                next.torso.orientation.rotate_z(move2base * -TAU);
325                next.chest.orientation.rotate_z(move2 * -2.0);
326                next.head.orientation.rotate_z(move2 * 1.3);
327                next.belt.orientation.rotate_z(move2 * 0.6);
328                next.shorts.orientation.rotate_z(move2 * 1.5);
329                next.foot_r.orientation.rotate_z(move2_pre * -1.7);
330                next.control.orientation.rotate_z(move2 * -1.8);
331                next.control.position += Vec3::new(move2 * 14.0, 0.0, 0.0);
332            },
333            Some("common.abilities.sword.cleaving_earth_splitter") => {
334                legacy_initialize();
335
336                let pullback = 1.0 - move3base.powi(4);
337                let move1 = movementbase.min(1.0).powi(2) * pullback;
338                let move1alt = movementbase.min(1.0).powf(0.5);
339                let move2 = move2base;
340                let move3 = move2base.powf(0.25) * pullback;
341
342                next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
343                next.hand_l.orientation =
344                    Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
345                next.hand_r.position =
346                    Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
347                next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5);
348                next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
349                next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
350                next.torso.orientation.rotate_x(move1alt * -TAU);
351
352                next.torso.orientation.rotate_x(move1 * -0.8);
353                next.control.orientation.rotate_x(move1 * 1.5);
354                next.control.position += Vec3::new(move1 * 7.0, move1.powi(4) * -6.0, move1 * 20.0);
355
356                next.torso.orientation.rotate_x(move2 * 0.8);
357                next.chest.orientation = Quaternion::rotation_x(move2 * -0.4);
358                next.control.orientation.rotate_x(move2 * -1.2);
359                next.control.position += Vec3::new(0.0, move2 * 12.0, move2 * -8.0);
360
361                next.control.orientation.rotate_x(move3 * -1.2);
362                next.control.position += Vec3::new(0.0, move3 * 4.0, move3 * -8.0);
363            },
364            Some("common.abilities.sword.heavy_pillar_thrust") => {
365                legacy_initialize();
366                let pullback = 1.0 - move3base.powi(4);
367                let move1 = move1base.powf(0.5) * pullback;
368                let move1alt1 = move1base.powf(0.5).min(0.5) * 2.0 * pullback;
369                let move1alt2 = (move1base.powf(0.5).max(0.5) - 0.5) * 2.0 * pullback;
370                let move2 = move2base.powi(2) * pullback;
371
372                next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
373                next.hand_l.orientation = Quaternion::rotation_x(s_a.shl.3 + move1alt2 * PI)
374                    * Quaternion::rotation_y(s_a.shl.4);
375                next.hand_r.position = Vec3::new(
376                    -s_a.sc.0 + 6.0 + move1alt1 * -12.0,
377                    -4.0 + move1alt1 * 3.0,
378                    -2.0,
379                );
380                next.hand_r.orientation =
381                    Quaternion::rotation_x(0.9 + move1 * 0.5 + move1alt1 * PI);
382                next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
383                next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
384
385                next.control.position += Vec3::new(
386                    move1 * 6.0,
387                    (1.0 - (move1 - 0.5).abs() * 2.0) * 3.0,
388                    move1 * 22.0,
389                );
390                next.control.orientation.rotate_x(move1 * -1.5);
391
392                next.chest.orientation = Quaternion::rotation_x(move2 * -0.4);
393                next.head.orientation = Quaternion::rotation_x(move2 * 0.2);
394                next.belt.orientation = Quaternion::rotation_x(move2 * 0.4);
395                next.shorts.orientation = Quaternion::rotation_x(move2 * 0.8);
396                next.control.orientation.rotate_x(move2 * -0.4);
397                next.control.position += Vec3::new(0.0, 0.0, move2 * -10.0);
398                next.belt.position += Vec3::new(0.0, move2 * 2.0, move2 * 0.0);
399                next.shorts.position += Vec3::new(0.0, move2 * 4.0, move2 * 1.0);
400                next.chest.position += Vec3::new(0.0, move2 * -2.5, 0.0);
401            },
402            Some("common.abilities.sword.basic_mighty_strike") => {
403                legacy_initialize();
404                let pullback = 1.0 - move3base.powi(4);
405                let move1 = move1base.powf(0.25) * pullback;
406                let move2 = move2base.powf(0.1) * pullback;
407
408                next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
409                next.hand_l.orientation =
410                    Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
411                next.hand_r.position =
412                    Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
413                next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5);
414                next.control.position = Vec3::new(
415                    s_a.sc.0 + move2 * 12.0,
416                    s_a.sc.1,
417                    s_a.sc.2 + move1 * 6.0 - move2 * 8.0,
418                );
419                next.control.orientation =
420                    Quaternion::rotation_x(s_a.sc.3 + move1 * 1.6 + move2 * -2.6)
421                        * Quaternion::rotation_y(move1 * -0.4 + move2 * 0.6)
422                        * Quaternion::rotation_z(move1 * -0.2 + move2 * -0.2);
423
424                next.chest.orientation = Quaternion::rotation_z(move1 * 1.0 + move2 * -1.2);
425                next.head.orientation = Quaternion::rotation_z(move1 * -0.4 + move2 * 0.3);
426                next.belt.orientation = Quaternion::rotation_z(move1 * -0.25 + move2 * 0.2);
427                next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5 + move2 * 0.4);
428            },
429            Some("common.abilities.sword.heavy_guillotine") => {
430                legacy_initialize();
431                let pullback = 1.0 - move3base.powi(4);
432                let move1 = move1base.powf(0.25) * pullback;
433                let move2 = move2base.powi(2) * pullback;
434
435                next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
436                next.hand_l.orientation =
437                    Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
438                next.hand_r.position =
439                    Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
440                next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
441                next.control.orientation = Quaternion::rotation_x(s_a.sc.3)
442                    * Quaternion::rotation_z(move1 * 0.3 + move2 * -0.7);
443
444                next.control.orientation.rotate_x(move1 * 1.4);
445                next.control.position += Vec3::new(move1 * -1.0, move1 * 2.0, move1 * 8.0);
446                next.chest.orientation = Quaternion::rotation_z(move1 * 0.4);
447
448                next.control.orientation.rotate_x(move2 * -3.0);
449                next.control.orientation.rotate_z(move2 * -0.4);
450                next.control.position += Vec3::new(move2 * 10.0, 0.0, move2 * -10.0);
451                next.chest.orientation.rotate_z(move2 * -0.6);
452            },
453            Some("common.abilities.sword.defensive_counter") => {
454                legacy_initialize();
455                let pullback = 1.0 - move3base.powi(4);
456                let move1 = move1base.powf(0.5) * pullback;
457                let move2 = (move2base.min(2.0 / 3.0) * 1.5).powi(2) * pullback;
458
459                next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
460                next.hand_l.orientation =
461                    Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
462                next.hand_r.position =
463                    Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
464                next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5);
465                next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
466                next.control.orientation =
467                    Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move2 * -PI / 4.0);
468
469                if !d.is_riding {
470                    next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
471                    next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
472                    next.foot_l.orientation = Quaternion::identity();
473                    next.foot_r.orientation = Quaternion::identity();
474                }
475
476                next.foot_r.position +=
477                    Vec3::new(0.0, move1 * 4.0, (1.0 - (move1 - 0.5) * 2.0) * 2.0);
478                next.torso.position += Vec3::new(0.0, move1 * -2.0, 0.0);
479                next.chest.position += Vec3::new(0.0, move1 * 2.0, move1 * -3.0);
480                next.shorts.orientation = Quaternion::rotation_x(move1 * 0.5);
481                next.shorts.position += Vec3::new(0.0, move1 * 1.5, 0.0);
482                next.control.orientation.rotate_y(move1 * -1.5);
483                next.control.orientation.rotate_z(move1 * 0.8);
484
485                next.chest.orientation = Quaternion::rotation_z(move2 * -0.7);
486                next.head.orientation = Quaternion::rotation_z(move2 * 0.4);
487                next.shorts.orientation.rotate_z(move2 * 0.5);
488                next.belt.orientation = Quaternion::rotation_z(move2 * 0.1);
489                next.control.orientation.rotate_z(move2 * -1.4);
490                next.control.orientation.rotate_x(move2 * 0.5);
491                next.control.position += Vec3::new(move2 * 7.0, 0.0, move2 * 6.0);
492            },
493            Some("common.abilities.sword.defensive_riposte") => {
494                legacy_initialize();
495                let pullback = 1.0 - move3base.powi(4);
496                let move1 = move1base.powf(0.25) * pullback;
497                let move2_slow = move2base.powi(8) * pullback;
498                let move2 = move2base.powi(2) * pullback;
499
500                next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
501                next.hand_l.orientation =
502                    Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
503                next.hand_r.position =
504                    Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
505                next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5);
506                next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
507                next.control.orientation = Quaternion::rotation_x(s_a.sc.3)
508                    * Quaternion::rotation_z(move1 * 1.3 + move2 * -0.7);
509
510                next.chest.orientation = Quaternion::rotation_z(move1 * 0.8);
511                next.head.orientation = Quaternion::rotation_z(move1 * -0.4);
512                next.belt.orientation = Quaternion::rotation_z(move1 * -0.2);
513                next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5);
514                next.control.orientation.rotate_x(move1 * 0.5);
515                next.control.orientation.rotate_y(move1 * 2.1);
516                next.control.orientation.rotate_z(move1 * -0.5);
517                next.control.position += Vec3::new(0.0, move1 * 5.0, move1 * 8.0);
518
519                next.chest.orientation.rotate_z(move2 * -1.4);
520                next.head.orientation.rotate_z(move2 * 0.9);
521                next.belt.orientation.rotate_z(move2 * -0.3);
522                next.shorts.orientation.rotate_z(move2 * 0.6);
523                next.control.orientation.rotate_y(move2 * -4.0);
524                next.control
525                    .orientation
526                    .rotate_z(move2_slow * -3.0 + move2 * 1.0);
527                next.control.position +=
528                    Vec3::new(move2_slow * 11.0, move2_slow * -4.0, move2_slow * -6.0);
529            },
530            Some("common.abilities.sword.heavy_fortitude") => {
531                legacy_initialize();
532                let pullback = 1.0 - move3base.powi(4);
533                let move1 = move1base.powf(0.25) * pullback;
534                let move2 = move2base.powi(2) * pullback;
535
536                next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
537                next.hand_l.orientation =
538                    Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
539                next.hand_r.position =
540                    Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
541                next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5);
542                next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
543                next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
544
545                next.foot_l.position += Vec3::new(move1 * 1.0, move1 * 2.0, 0.0);
546                next.chest.orientation = Quaternion::rotation_z(move1 * -0.4);
547                next.head.orientation = Quaternion::rotation_z(move1 * 0.2);
548                next.shorts.orientation = Quaternion::rotation_z(move1 * 0.3);
549                next.belt.orientation = Quaternion::rotation_z(move1 * 0.1);
550                next.control.orientation.rotate_x(move1 * 0.4 + move2 * 0.6);
551                next.control.orientation.rotate_z(move1 * 0.4);
552
553                next.foot_r.position += Vec3::new(move2 * -1.0, move2 * -2.0, 0.0);
554                next.control.position += Vec3::new(move2 * 5.0, move2 * 7.0, move2 * 5.0);
555                next.chest.position += Vec3::new(0.0, 0.0, move2 * -1.0);
556                next.shorts.orientation.rotate_x(move2 * 0.2);
557                next.shorts.position += Vec3::new(0.0, move2 * 1.0, 0.0);
558            },
559            Some("common.abilities.sword.defensive_stalwart_sword") => {
560                legacy_initialize();
561                let pullback = 1.0 - move3base.powi(4);
562                let move1 = move1base.powf(0.25) * pullback;
563                let move2 = move2base.powi(2) * pullback;
564
565                next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
566                next.hand_l.orientation =
567                    Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
568                next.hand_r.position =
569                    Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
570                next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5);
571                next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
572                next.control.orientation =
573                    Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move2 * -0.5);
574
575                next.foot_r.position += Vec3::new(move1 * 1.0, move1 * -2.0, 0.0);
576                next.foot_r.orientation.rotate_z(move1 * -0.9);
577                next.chest.orientation = Quaternion::rotation_z(move1 * -0.5);
578                next.head.orientation = Quaternion::rotation_z(move1 * 0.3);
579                next.shorts.orientation = Quaternion::rotation_z(move1 * 0.1);
580                next.control.orientation.rotate_x(move1 * 0.4);
581                next.control.orientation.rotate_z(move1 * 0.5);
582                next.control.position += Vec3::new(0.0, 0.0, move1 * 4.0);
583
584                next.control.position += Vec3::new(move2 * 8.0, 0.0, move2 * -1.0);
585                next.control.orientation.rotate_x(move2 * -0.6);
586                next.chest.position += Vec3::new(0.0, 0.0, move2 * -2.0);
587                next.belt.position += Vec3::new(0.0, 0.0, move2 * 1.0);
588                next.shorts.position += Vec3::new(0.0, 0.0, move2 * 1.0);
589                next.shorts.orientation.rotate_x(move2 * 0.2);
590                next.control.orientation.rotate_z(move2 * 0.4);
591            },
592            Some("common.abilities.sword.agile_dancing_edge") => {
593                legacy_initialize();
594                let pullback = 1.0 - move3base.powi(4);
595                let move1 = move1base.powf(0.25) * pullback;
596                let move2 = move2base.powi(2) * pullback;
597
598                next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
599                next.hand_l.orientation =
600                    Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
601                next.hand_r.position =
602                    Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
603                next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5);
604                next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
605                next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
606
607                next.head.orientation = Quaternion::rotation_x(move1 * 0.3);
608                next.head.position += Vec3::new(0.0, 0.0, move1 * -1.0);
609                next.control.position += Vec3::new(move1 * 8.0, move1 * 5.0, 0.0);
610
611                next.head.orientation.rotate_x(move2 * 0.2);
612                next.head.position += Vec3::new(0.0, 0.0, move2 * -1.0);
613                next.control.position += Vec3::new(0.0, move2 * -2.0, move2 * 12.0);
614                next.control.orientation.rotate_x(move2 * 1.1);
615            },
616            Some("common.abilities.sword.cleaving_blade_fever") => {
617                legacy_initialize();
618                let pullback = 1.0 - move3base.powi(4);
619                let move1 = move1base.powf(0.25) * pullback;
620                let move2 = move2base.powi(2) * pullback;
621
622                next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
623                next.hand_l.orientation =
624                    Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
625                next.hand_r.position =
626                    Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
627                next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5);
628                next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
629                next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
630
631                next.foot_l.position += Vec3::new(move1 * 1.0, move1 * 2.0, 0.0);
632                next.chest.orientation = Quaternion::rotation_z(move1 * -0.4);
633                next.head.orientation = Quaternion::rotation_z(move1 * 0.2);
634                next.shorts.orientation = Quaternion::rotation_z(move1 * 0.3);
635                next.belt.orientation = Quaternion::rotation_z(move1 * 0.1);
636                next.control.orientation.rotate_x(move1 * 0.4 + move2 * 0.6);
637                next.control.orientation.rotate_z(move1 * 0.4);
638
639                next.foot_r.position += Vec3::new(move2 * -1.0, move2 * -2.0, 0.0);
640                next.control.position += Vec3::new(move2 * 5.0, move2 * 7.0, move2 * 5.0);
641                next.chest.position += Vec3::new(0.0, 0.0, move2 * -1.0);
642                next.shorts.orientation.rotate_x(move2 * 0.2);
643                next.shorts.position += Vec3::new(0.0, move2 * 1.0, 0.0);
644            },
645            // ==================================
646            //                AXE
647            // ==================================
648            Some("common.abilities.axe.basic_guard") => {
649                let pullback = 1.0 - move3base.powi(4);
650                let move1 = move1base.powf(0.25) * pullback;
651                let move2 = (move2base * 10.0).sin();
652
653                if d.velocity.xy().magnitude_squared() < 0.5_f32.powi(2) {
654                    next.chest.position =
655                        Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move1 * -1.0 + move2 * 0.2);
656                    next.chest.orientation = Quaternion::rotation_x(move1 * -0.15);
657                    next.head.orientation = Quaternion::rotation_x(move1 * 0.25);
658
659                    next.belt.position =
660                        Vec3::new(0.0, s_a.belt.0 + move1 * 0.5, s_a.belt.1 + move1 * 0.5);
661                    next.shorts.position =
662                        Vec3::new(0.0, s_a.shorts.0 + move1 * 1.3, s_a.shorts.1 + move1 * 1.0);
663
664                    next.belt.orientation = Quaternion::rotation_x(move1 * 0.15);
665                    next.shorts.orientation = Quaternion::rotation_x(move1 * 0.25);
666
667                    if !d.is_riding {
668                        next.foot_l.position =
669                            Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * 2.0, s_a.foot.2);
670                        next.foot_l.orientation = Quaternion::rotation_z(move1 * -0.5);
671
672                        next.foot_r.position =
673                            Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * -2.0, s_a.foot.2);
674                        next.foot_r.orientation = Quaternion::rotation_x(move1 * -0.5);
675                    }
676                }
677
678                match d.hands {
679                    (Some(Hands::Two), _) => {
680                        next.main.position = Vec3::new(0.0, 0.0, 0.0);
681                        next.main.orientation = Quaternion::rotation_x(0.0);
682
683                        next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
684                        next.hand_l.orientation =
685                            Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
686                        next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
687                        next.hand_r.orientation =
688                            Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
689
690                        next.control.position = Vec3::new(
691                            s_a.ac.0 + move1 * 13.0,
692                            s_a.ac.1 + move1 * -3.0,
693                            s_a.ac.2 + move1 * 8.0,
694                        );
695                        next.control.orientation = Quaternion::rotation_x(s_a.ac.3 + move1 * -2.0)
696                            * Quaternion::rotation_y(s_a.ac.4 + move1 * -1.8)
697                            * Quaternion::rotation_z(s_a.ac.5 + move1 * 4.0);
698                    },
699                    (Some(Hands::One), offhand) => {
700                        next.main.position = Vec3::new(0.0, 0.0, 0.0);
701                        next.main.orientation = Quaternion::rotation_x(0.0);
702
703                        next.control_l.position =
704                            Vec3::new(-7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0);
705                        next.control_l.orientation =
706                            Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(move1 * 1.0);
707                        next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
708                        next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
709                        if offhand.is_some() {
710                            next.second.position = Vec3::new(0.0, 0.0, 0.0);
711                            next.second.orientation = Quaternion::rotation_x(0.0);
712                            next.control_r.position =
713                                Vec3::new(7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0);
714                            next.control_r.orientation =
715                                Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(move1 * -1.0);
716                            next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
717                            next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0)
718                        } else {
719                            next.hand_r.position = Vec3::new(4.5, 8.0, 5.0);
720                            next.hand_r.orientation =
721                                Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5)
722                        }
723                    },
724                    (_, _) => {},
725                }
726            },
727            Some("common.abilities.axe.cleave") => {
728                legacy_initialize();
729                let move1 = chargebase.min(1.0) * pullback;
730                let move2 = move2base.powi(2) * pullback;
731                let tension = (chargebase * 20.0).sin();
732
733                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
734                next.hand_l.orientation =
735                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
736                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
737                next.hand_r.orientation =
738                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
739
740                next.control.position = Vec3::new(
741                    s_a.ac.0 + move1 * 7.0,
742                    s_a.ac.1 + move1 * -4.0,
743                    s_a.ac.2 + move1 * 18.0 + tension / 5.0,
744                );
745                next.control.orientation =
746                    Quaternion::rotation_x(s_a.ac.3 + move1 * -1.0 + tension / 30.0)
747                        * Quaternion::rotation_y(s_a.ac.4)
748                        * Quaternion::rotation_z(s_a.ac.5 - move1 * PI);
749
750                next.control.orientation.rotate_x(move2 * -3.0);
751                next.control.position += Vec3::new(0.0, move2 * 8.0, move2 * -30.0);
752            },
753            Some("common.abilities.axe.execute") => {
754                legacy_initialize();
755                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
756                next.hand_l.orientation =
757                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
758                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
759                next.hand_r.orientation =
760                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
761
762                next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
763                next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
764                    * Quaternion::rotation_y(s_a.ac.4)
765                    * Quaternion::rotation_z(s_a.ac.5 - move1 * PI);
766
767                next.control.orientation.rotate_x(move1 * 0.9);
768                next.chest.orientation.rotate_z(move1 * 1.2);
769                next.head.orientation.rotate_z(move1 * -0.5);
770                next.belt.orientation.rotate_z(move1 * -0.3);
771                next.shorts.orientation.rotate_z(move1 * -0.7);
772                next.control.position += Vec3::new(move1 * 4.0, move1 * -12.0, move1 * 11.0);
773
774                next.chest.orientation.rotate_z(move2 * -2.0);
775                next.head.orientation.rotate_z(move2 * 0.9);
776                next.belt.orientation.rotate_z(move2 * 0.4);
777                next.shorts.orientation.rotate_z(move2 * 1.1);
778                next.control.orientation.rotate_x(move2 * -5.0);
779                next.control.position += Vec3::new(move2 * -3.0, move2 * 12.0, move2 * -17.0);
780                next.control.orientation.rotate_z(move2 * 0.7);
781            },
782            Some("common.abilities.axe.maelstrom") => {
783                legacy_initialize();
784                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
785                next.hand_l.orientation =
786                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
787                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
788                next.hand_r.orientation =
789                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
790
791                next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
792                next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
793                    * Quaternion::rotation_y(s_a.ac.4)
794                    * Quaternion::rotation_z(s_a.ac.5 - move1 * PI);
795
796                next.control.orientation.rotate_x(move1 * 0.9);
797                next.chest.orientation.rotate_z(move1 * 1.2);
798                next.head.orientation.rotate_z(move1 * -0.5);
799                next.belt.orientation.rotate_z(move1 * -0.3);
800                next.shorts.orientation.rotate_z(move1 * -0.7);
801                next.control.position += Vec3::new(move1 * 4.0, move1 * -12.0, move1 * 11.0);
802
803                next.chest.orientation.rotate_z(move2 * -2.0);
804                next.head.orientation.rotate_z(move2 * 0.9);
805                next.belt.orientation.rotate_z(move2 * 0.4);
806                next.shorts.orientation.rotate_z(move2 * 1.1);
807                next.control.orientation.rotate_x(move2 * -5.0);
808                next.control.position += Vec3::new(move2 * 5.0, move2 * 12.0, move2 * -17.0);
809                next.control.orientation.rotate_y(move2 * -2.0);
810                next.control.orientation.rotate_z(move2 * -1.0);
811                next.torso.orientation.rotate_z(move2base * -4.0 * PI);
812            },
813            Some("common.abilities.axe.lacerate") => {
814                legacy_initialize();
815                let move2_reset = ((move2base - 0.5).abs() - 0.5).abs() * 2.0;
816
817                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2 + 10.0);
818                next.hand_l.orientation =
819                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
820                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
821                next.hand_r.orientation =
822                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
823
824                next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
825                next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
826                    * Quaternion::rotation_y(s_a.ac.4)
827                    * Quaternion::rotation_z(s_a.ac.5 - move1 * PI * 0.75);
828
829                next.chest.orientation.rotate_z(move1 * 1.2);
830                next.head.orientation.rotate_z(move1 * -0.7);
831                next.shorts.orientation.rotate_z(move1 * -0.9);
832                next.belt.orientation.rotate_z(move1 * -0.3);
833
834                next.chest.orientation.rotate_z(move2 * -2.9);
835                next.head.orientation.rotate_z(move2 * 1.2);
836                next.shorts.orientation.rotate_z(move2 * 2.0);
837                next.belt.orientation.rotate_z(move2 * 0.7);
838                next.control.orientation.rotate_x(move2_reset * -1.0);
839                next.control.orientation.rotate_z(move2 * -5.0);
840                next.control.position += Vec3::new(move2 * 17.0, move2 * 3.0, 0.0);
841            },
842            Some("common.abilities.axe.riptide") => {
843                legacy_initialize();
844                let move2_reset = ((move2base - 0.5).abs() - 0.5).abs() * 2.0;
845
846                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
847                next.hand_l.orientation =
848                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
849                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
850                next.hand_r.orientation =
851                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
852
853                next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
854                next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
855                    * Quaternion::rotation_y(s_a.ac.4)
856                    * Quaternion::rotation_z(s_a.ac.5 - move1 * PI * 0.75);
857
858                next.chest.orientation.rotate_z(move1 * 1.2);
859                next.head.orientation.rotate_z(move1 * -0.7);
860                next.shorts.orientation.rotate_z(move1 * -0.9);
861                next.belt.orientation.rotate_z(move1 * -0.3);
862
863                next.chest.orientation.rotate_z(move2 * -2.9);
864                next.head.orientation.rotate_z(move2 * 1.2);
865                next.shorts.orientation.rotate_z(move2 * 2.0);
866                next.belt.orientation.rotate_z(move2 * 0.7);
867                next.control.orientation.rotate_x(move2_reset * -1.0);
868                next.control.orientation.rotate_z(move2 * -5.0);
869                next.control.position += Vec3::new(move2 * 17.0, move2 * 3.0, 0.0);
870                next.torso.orientation.rotate_z(move2base * -TAU)
871            },
872            Some("common.abilities.axe.keelhaul") => {
873                legacy_initialize();
874                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
875                next.hand_l.orientation =
876                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
877                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
878                next.hand_r.orientation =
879                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
880
881                next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
882                next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
883                    * Quaternion::rotation_y(s_a.ac.4)
884                    * Quaternion::rotation_z(s_a.ac.5);
885
886                next.control.orientation.rotate_z(move1 * -3.3);
887                next.control.orientation.rotate_x(move1 * 0.8);
888                next.control.position +=
889                    Vec3::new(move1 * 4.0, move1 * 4.0 - move2 * 6.0, move1 * 10.0);
890
891                next.chest.orientation.rotate_z(move2 * 1.2);
892                next.head.orientation.rotate_z(move2 * -0.5);
893                next.belt.orientation.rotate_z(move2 * -0.3);
894                next.shorts.orientation.rotate_z(move2 * -0.9);
895                next.control.orientation.rotate_z(move2 * -1.2);
896            },
897            Some("common.abilities.axe.bulkhead") => {
898                legacy_initialize();
899                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
900                next.hand_l.orientation =
901                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
902                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
903                next.hand_r.orientation =
904                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
905
906                next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
907                next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
908                    * Quaternion::rotation_y(s_a.ac.4)
909                    * Quaternion::rotation_z(s_a.ac.5 + move1 * -PI * 0.75 + move2 * PI * 0.25);
910
911                next.chest.orientation.rotate_z(move1 * 1.8);
912                next.head.orientation.rotate_z(move1 * -0.6);
913                next.belt.orientation.rotate_z(move1 * -0.4);
914                next.shorts.orientation.rotate_z(move1 * -1.3);
915                next.control.orientation.rotate_x(move1 * -0.8);
916
917                next.chest.orientation.rotate_z(move2 * -3.8);
918                next.head.orientation.rotate_z(move2 * 1.2);
919                next.belt.orientation.rotate_z(move2 * 0.8);
920                next.shorts.orientation.rotate_z(move2 * 2.1);
921                next.control.orientation.rotate_x(move2 * 0.6);
922                next.control.orientation.rotate_z(move2 * -4.0);
923                next.control.position += Vec3::new(move2 * 12.0, move2 * -6.0, 0.0);
924            },
925            Some("common.abilities.axe.capsize") => {
926                legacy_initialize();
927                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
928                next.hand_l.orientation =
929                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
930                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
931                next.hand_r.orientation =
932                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
933
934                next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
935                next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
936                    * Quaternion::rotation_y(s_a.ac.4)
937                    * Quaternion::rotation_z(s_a.ac.5 + move1 * -PI * 0.75 + move2 * PI * 0.25);
938
939                next.chest.orientation.rotate_z(move1 * 1.8);
940                next.head.orientation.rotate_z(move1 * -0.6);
941                next.belt.orientation.rotate_z(move1 * -0.4);
942                next.shorts.orientation.rotate_z(move1 * -1.3);
943                next.control.orientation.rotate_x(move1 * -0.8);
944
945                next.chest.orientation.rotate_z(move2 * -3.8);
946                next.head.orientation.rotate_z(move2 * 1.2);
947                next.belt.orientation.rotate_z(move2 * 0.8);
948                next.shorts.orientation.rotate_z(move2 * 2.1);
949                next.control.orientation.rotate_x(move2 * 0.6);
950                next.control.orientation.rotate_z(move2 * -4.0);
951                next.control.position += Vec3::new(move2 * 12.0, move2 * -6.0, 0.0);
952                next.torso.orientation.rotate_z(move2base * -TAU);
953            },
954            Some("common.abilities.axe.fracture") => {
955                legacy_initialize();
956                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
957                next.hand_l.orientation =
958                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
959                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
960                next.hand_r.orientation =
961                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
962
963                next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
964                next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
965                    * Quaternion::rotation_y(s_a.ac.4)
966                    * Quaternion::rotation_z(s_a.ac.5 + move1 * -PI / 2.0 + move2 * -0.5);
967
968                next.control.orientation.rotate_x(move1 * 0.0);
969                next.chest.orientation.rotate_x(move1 * -0.5);
970                next.chest.orientation.rotate_z(move1 * 0.7);
971                next.head.orientation.rotate_z(move1 * -0.3);
972                next.belt.orientation.rotate_z(move1 * -0.1);
973                next.shorts.orientation.rotate_z(move1 * -0.4);
974
975                next.chest.orientation.rotate_z(move2 * -1.8);
976                next.head.orientation.rotate_z(move2 * 0.9);
977                next.shorts.orientation.rotate_z(move2 * 1.3);
978                next.belt.orientation.rotate_z(move2 * 0.6);
979                next.control.orientation.rotate_x(move2 * -0.9);
980                next.control.orientation.rotate_z(move2 * -3.5);
981                next.control.position += Vec3::new(move2 * 14.0, move2 * 6.0, 0.0);
982            },
983            Some("common.abilities.axe.berserk") => {
984                legacy_initialize();
985                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
986                next.hand_l.orientation =
987                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
988                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
989                next.hand_r.orientation =
990                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
991
992                next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
993                next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
994                    * Quaternion::rotation_y(s_a.ac.4)
995                    * Quaternion::rotation_z(s_a.ac.5);
996
997                next.control.orientation.rotate_z(move1 * -2.0);
998                next.control.orientation.rotate_x(move1 * 3.5);
999                next.control.position += Vec3::new(move1 * 14.0, move1 * -6.0, move1 * 15.0);
1000
1001                next.head.orientation.rotate_x(move2 * 0.6);
1002                next.chest.orientation.rotate_x(move2 * 0.4);
1003            },
1004            Some("common.abilities.axe.savage_sense") => {
1005                legacy_initialize();
1006                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
1007                next.hand_l.orientation =
1008                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
1009                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
1010                next.hand_r.orientation =
1011                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
1012
1013                next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
1014                next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
1015                    * Quaternion::rotation_y(s_a.ac.4)
1016                    * Quaternion::rotation_z(s_a.ac.5);
1017
1018                next.chest.orientation = Quaternion::rotation_z(move1 * 0.6);
1019                next.head.orientation = Quaternion::rotation_z(move1 * -0.2);
1020                next.belt.orientation = Quaternion::rotation_z(move1 * -0.3);
1021                next.shorts.orientation = Quaternion::rotation_z(move1 * -0.1);
1022                next.foot_r.position += Vec3::new(0.0, move1 * 4.0, move1 * 4.0);
1023                next.foot_r.orientation.rotate_x(move1 * 1.2);
1024
1025                next.foot_r.position += Vec3::new(0.0, move2 * 4.0, move2 * -4.0);
1026                next.foot_r.orientation.rotate_x(move2 * -1.2);
1027            },
1028            Some("common.abilities.axe.adrenaline_rush") => {
1029                legacy_initialize();
1030                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
1031                next.hand_l.orientation =
1032                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
1033                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
1034                next.hand_r.orientation =
1035                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
1036
1037                next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
1038                next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
1039                    * Quaternion::rotation_y(s_a.ac.4)
1040                    * Quaternion::rotation_z(s_a.ac.5 - move1 * PI);
1041
1042                next.control.orientation.rotate_z(move1 * -1.8);
1043                next.control.orientation.rotate_y(move1 * 1.5);
1044                next.control.position += Vec3::new(move1 * 11.0, 0.0, 0.0);
1045
1046                next.control.orientation.rotate_y(move2 * 0.7);
1047                next.control.orientation.rotate_z(move2 * 1.6);
1048                next.control.position += Vec3::new(move2 * -8.0, 0.0, move2 * -3.0);
1049            },
1050            Some("common.abilities.axe.bloodfeast") => {
1051                legacy_initialize();
1052                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
1053                next.hand_l.orientation =
1054                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
1055                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
1056                next.hand_r.orientation =
1057                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
1058
1059                next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
1060                next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
1061                    * Quaternion::rotation_y(s_a.ac.4)
1062                    * Quaternion::rotation_z(s_a.ac.5);
1063
1064                next.control.orientation.rotate_z(move1 * -3.4);
1065                next.control.orientation.rotate_x(move1 * 1.1);
1066                next.control.position += Vec3::new(move1 * 14.0, move1 * -3.0, 0.0);
1067
1068                next.control.orientation.rotate_x(move2 * 1.7);
1069                next.control.orientation.rotate_z(move2 * -1.3);
1070                next.control.orientation.rotate_y(move2 * 0.8);
1071            },
1072            Some("common.abilities.axe.furor") => {
1073                legacy_initialize();
1074                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
1075                next.hand_l.orientation =
1076                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
1077                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
1078                next.hand_r.orientation =
1079                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
1080
1081                next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
1082                next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
1083                    * Quaternion::rotation_y(s_a.ac.4)
1084                    * Quaternion::rotation_z(s_a.ac.5 - move1 * PI);
1085
1086                next.control.orientation.rotate_x(move1 * -1.0);
1087                next.control.position += Vec3::new(move1 * 3.0, move1 * -2.0, move1 * 14.0);
1088                next.control.orientation.rotate_z(move1 * 1.5);
1089
1090                next.control.orientation.rotate_y(move2 * -1.0);
1091                next.control.orientation.rotate_z(move2 * -1.6);
1092                next.control.orientation.rotate_y(move2 * 0.7);
1093                next.control.orientation.rotate_x(move2 * -0.5);
1094                next.control.position += Vec3::new(move2 * 9.0, move2 * -3.0, move2 * -14.0);
1095            },
1096            Some("common.abilities.axe.sunder") => {
1097                legacy_initialize();
1098                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
1099                next.hand_l.orientation =
1100                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
1101                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
1102                next.hand_r.orientation =
1103                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
1104
1105                next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
1106                next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
1107                    * Quaternion::rotation_y(s_a.ac.4)
1108                    * Quaternion::rotation_z(s_a.ac.5);
1109
1110                next.control.orientation.rotate_z(move1 * -1.5);
1111                next.control.position += Vec3::new(move1 * 12.0, 0.0, move1 * 5.0);
1112                next.control.orientation.rotate_y(move1 * 0.5);
1113                next.main.position += Vec3::new(0.0, move1 * 10.0, 0.0);
1114                next.main.orientation.rotate_z(move1base * TAU);
1115                next.second.position += Vec3::new(0.0, move1 * 10.0, 0.0);
1116                next.second.orientation.rotate_z(move1base * -TAU);
1117
1118                next.main.orientation.rotate_z(move2base * TAU);
1119                next.main.position += Vec3::new(0.0, move2 * -10.0, 0.0);
1120                next.second.orientation.rotate_z(move2base * -TAU);
1121                next.second.position += Vec3::new(0.0, move2 * -10.0, 0.0);
1122                next.control.position += Vec3::new(0.0, 0.0, move2 * -5.0);
1123            },
1124            Some("common.abilities.axe.defiance") => {
1125                legacy_initialize();
1126                let tension = (move2base * 20.0).sin();
1127
1128                next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
1129                next.hand_l.orientation =
1130                    Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
1131                next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
1132                next.hand_r.orientation =
1133                    Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
1134
1135                next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
1136                next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
1137                    * Quaternion::rotation_y(s_a.ac.4)
1138                    * Quaternion::rotation_z(s_a.ac.5);
1139
1140                next.control.orientation.rotate_z(move1 * -1.6);
1141                next.control.orientation.rotate_x(move1 * 1.7);
1142                next.control.position += Vec3::new(move1 * 12.0, move1 * -10.0, move1 * 18.0);
1143                next.head.orientation.rotate_x(move1 * 0.6);
1144                next.head.position += Vec3::new(0.0, 0.0, move1 * -3.0);
1145                next.control.orientation.rotate_z(move1 * 0.4);
1146
1147                next.head.orientation.rotate_x(tension * 0.3);
1148                next.control.position += Vec3::new(0.0, 0.0, tension * 2.0);
1149            },
1150            // ==================================
1151            //               HAMMER
1152            // ==================================
1153            Some("common.abilities.hammer.basic_guard") => {
1154                let pullback = 1.0 - move3base.powi(4);
1155                let move1 = move1base.powf(0.25) * pullback;
1156                let move2 = (move2base * 10.0).sin();
1157
1158                if d.velocity.xy().magnitude_squared() < 0.5_f32.powi(2) {
1159                    next.chest.position =
1160                        Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move1 * -1.0 + move2 * 0.2);
1161                    next.chest.orientation = Quaternion::rotation_x(move1 * -0.15);
1162                    next.head.orientation = Quaternion::rotation_x(move1 * 0.25);
1163
1164                    next.belt.position =
1165                        Vec3::new(0.0, s_a.belt.0 + move1 * 0.5, s_a.belt.1 + move1 * 0.5);
1166                    next.shorts.position =
1167                        Vec3::new(0.0, s_a.shorts.0 + move1 * 1.3, s_a.shorts.1 + move1 * 1.0);
1168
1169                    next.belt.orientation = Quaternion::rotation_x(move1 * 0.15);
1170                    next.shorts.orientation = Quaternion::rotation_x(move1 * 0.25);
1171
1172                    if !d.is_riding {
1173                        next.foot_l.position =
1174                            Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * 2.0, s_a.foot.2);
1175                        next.foot_l.orientation = Quaternion::rotation_z(move1 * -0.5);
1176
1177                        next.foot_r.position =
1178                            Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * -2.0, s_a.foot.2);
1179                        next.foot_r.orientation = Quaternion::rotation_x(move1 * -0.5);
1180                    }
1181                }
1182
1183                match d.hands {
1184                    (Some(Hands::Two), _) => {
1185                        next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
1186                        next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3)
1187                            * Quaternion::rotation_y(s_a.hhl.4)
1188                            * Quaternion::rotation_z(s_a.hhl.5);
1189                        next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
1190                        next.hand_r.orientation = Quaternion::rotation_x(s_a.hhr.3)
1191                            * Quaternion::rotation_y(s_a.hhr.4)
1192                            * Quaternion::rotation_z(s_a.hhr.5);
1193
1194                        next.main.position = Vec3::new(0.0, 0.0, 0.0);
1195                        next.main.orientation = Quaternion::rotation_x(0.0);
1196                        next.control.position = Vec3::new(
1197                            s_a.hc.0 + move1 * 3.0,
1198                            s_a.hc.1 + move1 * 3.0,
1199                            s_a.hc.2 + move1 * 10.0,
1200                        );
1201                        next.control.orientation = Quaternion::rotation_x(s_a.hc.3)
1202                            * Quaternion::rotation_y(s_a.hc.4)
1203                            * Quaternion::rotation_z(s_a.hc.5 + move1 * -1.0);
1204                    },
1205                    (Some(Hands::One), offhand) => {
1206                        next.control_l.position =
1207                            Vec3::new(-7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0);
1208                        next.control_l.orientation =
1209                            Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(move1 * 1.0);
1210                        next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
1211                        next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
1212
1213                        next.main.position = Vec3::new(0.0, 0.0, 0.0);
1214                        next.main.orientation = Quaternion::rotation_x(0.0);
1215
1216                        if offhand.is_some() {
1217                            next.control_r.position =
1218                                Vec3::new(7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0);
1219                            next.control_r.orientation =
1220                                Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(move1 * -1.0);
1221                            next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
1222                            next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
1223                            next.second.position = Vec3::new(0.0, 0.0, 0.0);
1224                            next.second.orientation = Quaternion::rotation_x(0.0);
1225                        } else {
1226                            next.hand_r.position = Vec3::new(4.5, 8.0, 5.0);
1227                            next.hand_r.orientation =
1228                                Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5)
1229                        }
1230                    },
1231                    (_, _) => {},
1232                }
1233            },
1234            Some("common.abilities.hammer.solid_smash") => {
1235                hammer_start(&mut next, s_a);
1236
1237                next.control.orientation.rotate_x(move1 * 2.7);
1238                next.control.orientation.rotate_z(move1 * 1.4);
1239                next.control.position += Vec3::new(-12.0, 0.0, 0.0) * move1;
1240                next.control.orientation.rotate_x(move1 * -1.2);
1241                twist_back(&mut next, move1, 0.8, 0.3, 0.1, 0.5);
1242
1243                twist_forward(&mut next, move2, 1.4, 0.5, 0.3, 1.0);
1244                next.control.orientation.rotate_x(move2 * -1.9);
1245                next.control.orientation.rotate_z(move2 * 0.6);
1246            },
1247            Some("common.abilities.hammer.scornful_swipe") => {
1248                hammer_start(&mut next, s_a);
1249                let move1_pre = move1.min(0.5) * 2.0;
1250                let move1_shake = ((move1.max(0.3) - 0.3) * 15.0).sin();
1251                let move1_late = move1.powi(4);
1252
1253                next.control.orientation.rotate_x(move1_pre * 2.3);
1254                next.control.position += Vec3::new(0.0, 2.0, 16.0) * move1_pre;
1255                next.control.position += Vec3::new(0.0, 0.0, 4.0) * move1_shake;
1256                next.control.orientation.rotate_y(move1_late * 1.6);
1257                next.control.position += Vec3::new(-8.0, 0.0, -8.0) * move1_late;
1258                twist_back(&mut next, move1_late, 1.0, 0.4, 0.2, 0.7);
1259                next.control.orientation.rotate_z(move1_late * 1.2);
1260
1261                twist_forward(&mut next, move2, 1.9, 0.9, 0.6, 1.1);
1262                next.control.orientation.rotate_y(move2 * -1.7);
1263                next.control.orientation.rotate_z(move2 * -2.7);
1264            },
1265            Some("common.abilities.hammer.heavy_whorl") => {
1266                hammer_start(&mut next, s_a);
1267
1268                twist_back(&mut next, move1, 2.0, 0.8, 0.4, 1.4);
1269                next.control.orientation.rotate_x(move1 * 0.6);
1270
1271                next.torso.orientation.rotate_z(move2base * -2.0 * PI);
1272                twist_forward(&mut next, move2, 3.4, 1.2, 0.8, 1.8);
1273                next.control.orientation.rotate_z(move2 * -2.3);
1274                next.control.position += Vec3::new(6.0, 0.0, 6.0) * move2;
1275            },
1276            Some("common.abilities.hammer.dual_heavy_whorl") => {
1277                dual_wield_start(&mut next);
1278
1279                twist_back(&mut next, move1, 2.0, 0.8, 0.4, 1.4);
1280                next.control_l.orientation.rotate_y(move1 * -PI / 2.0);
1281                next.control_r.orientation.rotate_y(move1 * -PI / 2.0);
1282                next.control.position += Vec3::new(0.0, 0.0, 4.0) * move1;
1283
1284                next.torso.orientation.rotate_z(move2base * -2.0 * PI);
1285                twist_forward(&mut next, move2, 3.4, 1.2, 0.8, 1.8);
1286                next.control_l.orientation.rotate_z(move2 * -2.3);
1287                next.control_r.orientation.rotate_z(move2 * -2.3);
1288            },
1289            Some("common.abilities.hammer.breach") => {
1290                hammer_start(&mut next, s_a);
1291
1292                next.control.orientation.rotate_x(move1 * 2.5);
1293                next.control.orientation.rotate_z(move1 * -4.8);
1294                next.control.position += Vec3::new(-12.0, 0.0, 22.0) * move1;
1295                twist_back(&mut next, move1, 0.6, 0.2, 0.0, 0.3);
1296
1297                twist_forward(&mut next, move2, 1.6, 0.4, 0.2, 0.7);
1298                next.control.orientation.rotate_x(move2 * -4.5);
1299                next.control.position += Vec3::new(0.0, 0.0, -20.0) * move2;
1300            },
1301            Some("common.abilities.hammer.pile_driver") => {
1302                hammer_start(&mut next, s_a);
1303                let shake = (move1base * 15.0).sin();
1304                let move1 = (move1base * 2.0).min(1.0) * pullback;
1305
1306                twist_back(&mut next, move1, 0.9, 0.3, 0.1, 0.5);
1307                next.control.orientation.rotate_x(move1 * 2.4);
1308                next.control.position += Vec3::new(-14.0, 0.0, 14.0) * move1;
1309                next.control.orientation.rotate_z(move1 * 1.8);
1310
1311                next.control.orientation.rotate_x(shake * 0.15);
1312
1313                twist_forward(&mut next, move2, 1.6, 0.5, 0.2, 0.9);
1314                next.control.orientation.rotate_x(move2 * -4.0);
1315                next.control.orientation.rotate_z(move2 * 0.4);
1316                next.control.position += Vec3::new(0.0, 0.0, -12.0) * move2;
1317            },
1318            Some("common.abilities.hammer.upheaval") => {
1319                hammer_start(&mut next, s_a);
1320                let move1_twist = move1 * (move1 * PI * 1.5).sin();
1321
1322                twist_forward(&mut next, move1_twist, 0.8, 0.3, 0.0, 0.4);
1323                let angle1 = 5.0;
1324                let angle2 = 4.0;
1325                next.control
1326                    .orientation
1327                    .rotate_x(move1base * (2.0 - angle1) + move2base * (2.0 - angle2));
1328                next.control.orientation.rotate_y(move1 * -0.8);
1329                next.control
1330                    .orientation
1331                    .rotate_x(move1base * angle1 + move2base * angle2);
1332                next.control.orientation.rotate_z(move1 * 1.0);
1333                next.control.orientation.rotate_x(move2 * 6.0);
1334                next.control.orientation.rotate_z(move2 * -0.6);
1335                next.control.position += Vec3::new(-16.0, 0.0, 0.0) * move1;
1336                next.control.position += Vec3::new(12.0, 0.0, 10.0) * move2;
1337                twist_forward(&mut next, move2, 1.0, 0.9, 0.4, 1.1);
1338            },
1339            Some("common.abilities.hammer.dual_upheaval") => {
1340                dual_wield_start(&mut next);
1341                let move1_return = (3.0 * move1base).sin();
1342
1343                next.control.orientation.rotate_x(4.0 * move1base);
1344                next.control_l.orientation.rotate_z(move1 * 0.6);
1345                next.control_r.orientation.rotate_z(move1 * -0.6);
1346                next.control.position += Vec3::new(0.0, 6.0, 8.0) * move1_return;
1347                next.control.orientation.rotate_x(3.5 * move2base);
1348                next.control_l.orientation.rotate_z(move2 * -1.4);
1349                next.control_r.orientation.rotate_z(move2 * 1.4);
1350                next.control.position += Vec3::new(0.0, 12.0, 10.0) * move2;
1351            },
1352            Some("common.abilities.hammer.wide_wallop") => {
1353                hammer_start(&mut next, s_a);
1354                let move1 = chargebase.min(1.0) * pullback;
1355                let tension = (chargebase * 7.0).sin();
1356
1357                next.control.orientation.rotate_x(move1 * 1.1 + move2 * 0.6);
1358                twist_back(&mut next, move1 + tension / 25.0, 1.7, 0.7, 0.3, 1.1);
1359                next.control.orientation.rotate_y(move1 * -0.8);
1360                next.control.position += Vec3::new(0.0, 0.0, 6.0) * move1;
1361
1362                twist_forward(&mut next, move2, 4.8, 1.7, 0.7, 3.2);
1363                next.control.orientation.rotate_y(move2 * 2.0);
1364                next.control.orientation.rotate_z(move2 * -1.8);
1365            },
1366            Some("common.abilities.hammer.intercept") => {
1367                hammer_start(&mut next, s_a);
1368                twist_back(&mut next, move1, 1.6, 0.7, 0.3, 1.1);
1369                next.control.orientation.rotate_x(move1 * 1.8);
1370
1371                twist_forward(&mut next, move2, 2.4, 0.9, 0.5, 1.4);
1372                next.control.orientation.rotate_z(move2 * -2.7);
1373                next.control.orientation.rotate_x(move2 * 2.0);
1374                next.control.position += Vec3::new(5.0, 0.0, 11.0) * move2;
1375            },
1376            Some("common.abilities.hammer.dual_intercept") => {
1377                dual_wield_start(&mut next);
1378                next.control_l.orientation.rotate_x(move1 * -1.4);
1379                next.control_l.orientation.rotate_z(move1 * 0.8);
1380                next.control_r.orientation.rotate_x(move1 * -1.4);
1381                next.control_r.orientation.rotate_z(move1 * -0.8);
1382                next.control.position += Vec3::new(0.0, 0.0, -6.0) * move1;
1383
1384                next.control_l.orientation.rotate_z(move2 * -2.6);
1385                next.control_l.orientation.rotate_x(move2 * 4.0);
1386                next.control_r.orientation.rotate_z(move2 * 2.6);
1387                next.control_r.orientation.rotate_x(move2 * 4.0);
1388                next.control.position += Vec3::new(0.0, 0.0, 20.0) * move2;
1389            },
1390            Some("common.abilities.hammer.spine_cracker") => {
1391                hammer_start(&mut next, s_a);
1392
1393                twist_back(&mut next, move1, 1.9, 1.5, 0.5, 1.2);
1394                next.head.position += Vec3::new(-2.0, 2.0, 0.0) * move1;
1395                next.control.orientation.rotate_x(move1 * 1.8);
1396                next.control.position += Vec3::new(0.0, 0.0, 8.0) * move1;
1397                next.control.orientation.rotate_y(move1 * 0.4);
1398
1399                twist_forward(&mut next, move2, 2.1, 1.6, 0.4, 1.3);
1400                next.control.orientation.rotate_z(move2 * 1.6);
1401                next.control.position += Vec3::new(-16.0, 12.0, -8.0) * move2;
1402            },
1403            Some("common.abilities.hammer.lung_pummel") => {
1404                hammer_start(&mut next, s_a);
1405
1406                twist_back(&mut next, move1, 1.9, 0.7, 0.3, 1.2);
1407                next.control.orientation.rotate_x(move1 * 1.2);
1408                next.control.orientation.rotate_z(move1 * 1.0);
1409                next.control.position += Vec3::new(-12.0, 0.0, 0.0) * move1;
1410
1411                twist_forward(&mut next, move2, 3.4, 1.4, 0.9, 2.1);
1412                next.control.orientation.rotate_z(move2 * -4.0);
1413                next.control.position += Vec3::new(12.0, 0.0, 14.0) * move2;
1414            },
1415            Some("common.abilities.hammer.helm_crusher") => {
1416                hammer_start(&mut next, s_a);
1417
1418                twist_back(&mut next, move1, 0.8, 0.3, 0.1, 0.5);
1419                next.control.orientation.rotate_x(move1 * -0.8);
1420                next.control.orientation.rotate_z(move1 * -1.6);
1421                next.control.orientation.rotate_x(move1 * 2.8);
1422                next.control.position += Vec3::new(-9.0, 0.0, 8.0) * move1;
1423                next.control.orientation.rotate_z(move1 * -0.4);
1424
1425                twist_forward(&mut next, move2, 1.8, 0.7, 0.4, 1.1);
1426                next.control.orientation.rotate_x(move2 * -5.0);
1427                next.control.orientation.rotate_z(move2 * -1.0);
1428                next.control.position += Vec3::new(-12.0, 0.0, -8.0) * move2;
1429            },
1430            Some("common.abilities.hammer.thunderclap") => {
1431                hammer_start(&mut next, s_a);
1432
1433                twist_back(&mut next, move1, 1.8, 0.9, 0.5, 1.1);
1434                next.control.orientation.rotate_x(move1 * 2.4);
1435                next.control.position += Vec3::new(-16.0, -8.0, 12.0) * move1;
1436                next.control.orientation.rotate_z(move1 * PI / 2.0);
1437                next.control.orientation.rotate_x(move1 * 0.6);
1438
1439                twist_forward(&mut next, move2, 2.4, 1.1, 0.6, 1.4);
1440                next.control.orientation.rotate_x(move2 * -5.0);
1441                next.control.position += Vec3::new(4.0, 12.0, -12.0) * move2;
1442                next.control.orientation.rotate_z(move2 * 0.6);
1443            },
1444            Some("common.abilities.hammer.earthshaker") => {
1445                hammer_start(&mut next, s_a);
1446
1447                next.hand_l.orientation.rotate_y(move1 * -PI);
1448                next.hand_r.orientation.rotate_y(move1 * -PI);
1449                next.control.orientation.rotate_x(2.4 * move1);
1450                next.control.orientation.rotate_z(move1 * -PI / 2.0);
1451                next.control.orientation.rotate_x(-0.6 * move1);
1452                next.control.position += Vec3::new(-8.0, 0.0, 24.0) * move1;
1453                next.chest.orientation.rotate_x(move1 * 0.5);
1454                next.torso.position += Vec3::new(0.0, 0.0, 8.0) * move1;
1455
1456                next.torso.position += Vec3::new(0.0, 0.0, -8.0) * move2;
1457                next.control.orientation.rotate_x(move2 * -0.8);
1458                next.control.position += Vec3::new(0.0, 0.0, -10.0) * move2;
1459                next.chest.orientation.rotate_x(move2 * -0.8);
1460            },
1461            Some("common.abilities.hammer.judgement") => {
1462                hammer_start(&mut next, s_a);
1463
1464                next.control.orientation.rotate_x(2.4 * move1);
1465                next.control.orientation.rotate_z(move1 * PI / 2.0);
1466                next.control.orientation.rotate_x(-0.6 * move1);
1467                next.control.position += Vec3::new(-8.0, 6.0, 24.0) * move1;
1468                next.chest.orientation.rotate_x(move1 * 0.5);
1469                next.torso.position += Vec3::new(0.0, 0.0, 8.0) * move1;
1470
1471                next.torso.position += Vec3::new(0.0, 0.0, -8.0) * move2;
1472                next.chest.orientation.rotate_x(-1.5 * move2);
1473                next.belt.orientation.rotate_x(0.3 * move2);
1474                next.shorts.orientation.rotate_x(0.6 * move2);
1475                next.control.orientation.rotate_x(-3.0 * move2);
1476                next.control.position += Vec3::new(0.0, 0.0, -16.0) * move2;
1477            },
1478            Some("common.abilities.hammer.retaliate") => {
1479                hammer_start(&mut next, s_a);
1480
1481                twist_back(&mut next, move1, 0.6, 0.2, 0.0, 0.3);
1482                next.control.orientation.rotate_x(move1 * 1.5);
1483                next.control.orientation.rotate_y(move1 * 0.4);
1484                next.control.position += Vec3::new(0.0, 0.0, 16.0) * move1;
1485
1486                twist_forward(&mut next, move2, 2.1, 0.6, 0.4, 0.9);
1487                next.control.orientation.rotate_y(move2 * 2.0);
1488                next.control.orientation.rotate_x(move2 * -2.5);
1489                next.control.orientation.rotate_z(move2 * -0.6);
1490                next.control.position += Vec3::new(6.0, -10.0, -14.0) * move2;
1491            },
1492            Some("common.abilities.hammer.tenacity") => {
1493                hammer_start(&mut next, s_a);
1494
1495                next.control.orientation.rotate_x(move1 * 0.6);
1496                next.control.orientation.rotate_y(move1 * 0.9);
1497                next.control.orientation.rotate_x(move1 * -0.6);
1498                next.chest.orientation.rotate_x(move1 * 0.4);
1499                next.control.position += Vec3::new(0.0, 4.0, 3.0) * move1;
1500
1501                next.control.position += Vec3::new(
1502                    (move2 * 50.0).sin(),
1503                    (move2 * 67.0).sin(),
1504                    (move2 * 83.0).sin(),
1505                );
1506            },
1507            Some("common.abilities.hammer.tremor") => {
1508                hammer_start(&mut next, s_a);
1509
1510                twist_back(&mut next, move1, 1.4, 0.7, 0.5, 0.9);
1511                next.foot_l.orientation.rotate_z(move1 * 1.4);
1512                next.foot_l.position += Vec3::new(-1.0, -3.0, 0.0) * move1;
1513                next.control.orientation.rotate_x(move1 * 2.6);
1514                next.control.orientation.rotate_y(move1 * 0.8);
1515
1516                twist_forward(&mut next, move2, 2.1, 1.2, 0.9, 1.6);
1517                next.foot_l.orientation.rotate_z(move2 * -1.4);
1518                next.foot_l.position += Vec3::new(2.0, 7.0, 0.0) * move2;
1519                next.control.orientation.rotate_z(move2 * 2.1);
1520                next.control.orientation.rotate_x(move2 * -2.0);
1521                next.control.orientation.rotate_z(move2 * 1.2);
1522                next.control.position += Vec3::new(-16.0, 0.0, 0.0) * move2;
1523                next.chest.orientation.rotate_x(-0.8 * move2);
1524            },
1525            Some("common.abilities.hammer.rampart") => {
1526                hammer_start(&mut next, s_a);
1527
1528                next.control.orientation.rotate_x(move1 * 0.6);
1529                next.control.orientation.rotate_y(move1 * -PI / 2.0);
1530                next.hand_l.orientation.rotate_y(move1 * -PI);
1531                next.hand_r.orientation.rotate_y(move1 * -PI);
1532                next.control.position += Vec3::new(-5.0, 0.0, 30.0) * move1;
1533
1534                next.control.position += Vec3::new(0.0, 0.0, -10.0) * move2;
1535                next.torso.orientation.rotate_x(move2 * -0.6);
1536                next.control.orientation.rotate_x(move2 * 0.6);
1537            },
1538            Some("common.abilities.hammer.seismic_shock") => {
1539                hammer_start(&mut next, s_a);
1540
1541                next.control.orientation.rotate_x(move1 * 2.5);
1542                next.control.position += Vec3::new(0.0, 0.0, 28.0) * move1;
1543                next.head.orientation.rotate_x(move1 * 0.3);
1544                next.chest.orientation.rotate_x(move1 * 0.3);
1545                next.belt.orientation.rotate_x(move1 * -0.2);
1546                next.shorts.orientation.rotate_x(move1 * -0.3);
1547
1548                next.control.orientation.rotate_z(move2 * 2.0);
1549                next.control.orientation.rotate_x(move2 * -4.0);
1550                next.control.position += Vec3::new(-6.0, 0.0, -30.0) * move2;
1551                next.head.orientation.rotate_x(move2 * -0.9);
1552                next.chest.orientation.rotate_x(move2 * -0.5);
1553                next.belt.orientation.rotate_x(move2 * 0.2);
1554                next.shorts.orientation.rotate_x(move2 * 0.4);
1555            },
1556            // ==================================
1557            //                BOW
1558            // ==================================
1559            Some("common.abilities.bow.charged" | "common.abilities.bow.shotgun") => {
1560                let move2 = move2base;
1561
1562                let ori: Vec2<f32> = Vec2::from(d.orientation);
1563                let last_ori = Vec2::from(d.last_ori);
1564                let tilt = if vek::Vec2::new(ori, last_ori)
1565                    .map(|o| o.magnitude_squared())
1566                    .map(|m| m > 0.001 && m.is_finite())
1567                    .reduce_and()
1568                    && ori.angle_between(last_ori).is_finite()
1569                {
1570                    ori.angle_between(last_ori).min(0.2)
1571                        * last_ori.determine_side(Vec2::zero(), ori).signum()
1572                } else {
1573                    0.0
1574                } * 1.3;
1575                let ori_angle = d.orientation.y.atan2(d.orientation.x);
1576                let lookdir_angle = d.look_dir.y.atan2(d.look_dir.x);
1577                let swivel = lookdir_angle - ori_angle;
1578
1579                next.main.position = Vec3::new(0.0, 0.0, 0.0);
1580                next.main.orientation = Quaternion::rotation_x(0.0);
1581                next.hand_l.position = Vec3::new(
1582                    s_a.bhl.0 + move2 * -8.0,
1583                    s_a.bhl.1 + move2 * -10.0,
1584                    s_a.bhl.2,
1585                );
1586                next.hand_l.orientation =
1587                    Quaternion::rotation_x(s_a.bhl.3) * Quaternion::rotation_y(move2 * 0.7);
1588                next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
1589                next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
1590
1591                next.hold.position = Vec3::new(0.0, -1.0 + move2 * 2.0, -5.2 + move2 * 7.0);
1592                next.hold.orientation = Quaternion::rotation_x(-PI / 2.0);
1593                next.hold.scale = Vec3::one() * 1.0 * (1.0 - move2);
1594
1595                next.control.position = Vec3::new(
1596                    s_a.bc.0 + 11.0 + move2 * 2.0,
1597                    s_a.bc.1 + 2.0 + (d.look_dir.z * -5.0).min(-2.0) + move2 * -1.0,
1598                    s_a.bc.2 + 8.0 + (d.look_dir.z * 15.0).max(-8.0),
1599                );
1600                next.control.orientation = Quaternion::rotation_x(d.look_dir.z)
1601                    * Quaternion::rotation_y(-d.look_dir.z + s_a.bc.4 - 1.25)
1602                    * Quaternion::rotation_z(s_a.bc.5 - 0.2 + move2 * -0.1);
1603
1604                next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
1605
1606                next.head.orientation = Quaternion::rotation_x(d.look_dir.z * 0.7)
1607                    * Quaternion::rotation_z(tilt * -0.0);
1608                next.chest.orientation = Quaternion::rotation_z(swivel * 0.8 + 0.8 + move2 * 0.5);
1609                next.torso.orientation = Quaternion::rotation_z(swivel * 0.2);
1610
1611                next.shoulder_l.orientation = Quaternion::rotation_x(move2 * 0.5);
1612            },
1613            // ==================================
1614            //             FIRE STAFF
1615            // ==================================
1616            Some("common.abilities.staff.flamethrower") => {
1617                let move1 = move1base;
1618                let move2 = move2base;
1619                let move3 = move3base;
1620
1621                next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
1622                next.hand_l.orientation =
1623                    Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4);
1624                next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthl.2);
1625                next.hand_r.orientation =
1626                    Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
1627                next.main.position = Vec3::new(0.0, 0.0, 0.0);
1628                next.main.orientation = Quaternion::rotation_x(0.0);
1629
1630                next.control.position = Vec3::new(-4.0, 7.0, 4.0);
1631                next.control.orientation = Quaternion::rotation_x(-0.3)
1632                    * Quaternion::rotation_y(0.15)
1633                    * Quaternion::rotation_z(0.0);
1634
1635                next.control.position = Vec3::new(
1636                    s_a.stc.0 + (move1 * 16.0) * (1.0 - move3),
1637                    s_a.stc.1 + (move1 + (move2 * 8.0).sin() * 2.0) * (1.0 - move3),
1638                    s_a.stc.2 + (move1 * 10.0) * (1.0 - move3),
1639                );
1640                next.control.orientation =
1641                    Quaternion::rotation_x(s_a.stc.3 + (move1 * -1.2) * (1.0 - move3))
1642                        * Quaternion::rotation_y(
1643                            s_a.stc.4
1644                                + (move1 * -1.4 + (move2 * 16.0).sin() * 0.07) * (1.0 - move3),
1645                        )
1646                        * Quaternion::rotation_z(
1647                            (move1 * -1.7 + (move2 * 8.0 + PI / 4.0).sin() * 0.3) * (1.0 - move3),
1648                        );
1649                next.head.orientation = Quaternion::rotation_x(0.0);
1650
1651                next.hand_l.position = Vec3::new(
1652                    0.0 + (move1 * -1.0 + (move2 * 8.0).sin() * 3.5) * (1.0 - move3),
1653                    0.0 + (move1 * -5.0 + (move2 * 8.0).sin() * -2.0 + (move2 * 16.0).sin() * -1.5)
1654                        * (1.0 - move3),
1655                    -4.0 + (move1 * 19.0 + (move2 * 8.0 + PI / 2.0).sin() * 3.5) * (1.0 - move3),
1656                );
1657                next.hand_l.orientation =
1658                    Quaternion::rotation_x(s_a.sthr.3 + (move1 * -0.3) * (1.0 - move3))
1659                        * Quaternion::rotation_y(
1660                            (move1 * -1.1 + (move2 * 8.0 + PI / 2.0).sin() * -0.3) * (1.0 - move3),
1661                        )
1662                        * Quaternion::rotation_z((move1 * -2.8) * (1.0 - move3));
1663
1664                if d.velocity.magnitude_squared() < 0.5_f32.powi(2) {
1665                    next.head.orientation =
1666                        Quaternion::rotation_z(move1 * -0.5 + (move2 * 16.0).sin() * 0.05);
1667
1668                    if !d.is_riding {
1669                        next.foot_l.position =
1670                            Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * -3.0, s_a.foot.2);
1671                        next.foot_l.orientation = Quaternion::rotation_x(move1 * -0.5)
1672                            * Quaternion::rotation_z(move1 * 0.5);
1673
1674                        next.foot_r.position =
1675                            Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * 4.0, s_a.foot.2);
1676                        next.foot_r.orientation = Quaternion::rotation_z(move1 * 0.5);
1677                    }
1678
1679                    next.chest.orientation =
1680                        Quaternion::rotation_x(move1 * -0.2 + (move2 * 8.0).sin() * 0.05)
1681                            * Quaternion::rotation_z(move1 * 0.5);
1682                    next.belt.orientation =
1683                        Quaternion::rotation_x(move1 * 0.1) * Quaternion::rotation_z(move1 * -0.1);
1684                    next.shorts.orientation =
1685                        Quaternion::rotation_x(move1 * 0.2) * Quaternion::rotation_z(move1 * -0.2);
1686                };
1687            },
1688            Some("common.abilities.staff.fireshockwave") => {
1689                let move1 = move1base;
1690                let move2 = move2base;
1691                let move3 = move3base;
1692
1693                next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
1694
1695                next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
1696                next.hand_l.orientation =
1697                    Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4);
1698                next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2);
1699                next.hand_r.orientation =
1700                    Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
1701                next.main.position = Vec3::new(0.0, 0.0, 0.0);
1702                next.main.orientation = Quaternion::rotation_x(0.0);
1703
1704                next.control.position = Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2);
1705                next.control.orientation =
1706                    Quaternion::rotation_x(s_a.stc.3) * Quaternion::rotation_y(s_a.stc.4);
1707
1708                let twist = move1 * 0.8;
1709
1710                next.control.position = Vec3::new(
1711                    s_a.stc.0 + (move1 * 5.0) * (1.0 - move3),
1712                    s_a.stc.1 + (move1 * 5.0) * (1.0 - move3),
1713                    s_a.stc.2 + (move1 * 10.0 + move2 * -10.0) * (1.0 - move3),
1714                );
1715                next.control.orientation =
1716                    Quaternion::rotation_x(s_a.stc.3 + (move1 * 0.8) * (1.0 - move3))
1717                        * Quaternion::rotation_y(
1718                            s_a.stc.4 + (move1 * -0.15 + move2 * -0.15) * (1.0 - move3),
1719                        )
1720                        * Quaternion::rotation_z((move1 * 0.8 + move2 * -0.8) * (1.0 - move3));
1721
1722                next.head.orientation = Quaternion::rotation_x((move1 * 0.4) * (1.0 - move3))
1723                    * Quaternion::rotation_z((twist * 0.2 + move2 * -0.8) * (1.0 - move3));
1724
1725                next.chest.position = Vec3::new(
1726                    0.0,
1727                    s_a.chest.0,
1728                    s_a.chest.1 + (move1 * 2.0 + move2 * -4.0) * (1.0 - move3),
1729                );
1730                next.chest.orientation = Quaternion::rotation_x((move2 * -0.8) * (1.0 - move3))
1731                    * Quaternion::rotation_z(twist * -0.2 + move2 * -0.1 + (1.0 - move3));
1732
1733                next.belt.orientation = Quaternion::rotation_x((move2 * 0.2) * (1.0 - move3))
1734                    * Quaternion::rotation_z((twist * 0.6 + move2 * -0.48) * (1.0 - move3));
1735
1736                next.shorts.orientation = Quaternion::rotation_x((move2 * 0.3) * (1.0 - move3))
1737                    * Quaternion::rotation_z((twist + move2 * -0.8) * (1.0 - move3));
1738
1739                if d.velocity.magnitude() < 0.5 && !d.is_riding {
1740                    next.foot_l.position = Vec3::new(
1741                        -s_a.foot.0,
1742                        s_a.foot.1 + move1 * -7.0 + move2 * 7.0,
1743                        s_a.foot.2,
1744                    );
1745                    next.foot_l.orientation = Quaternion::rotation_x(move1 * -0.8 + move2 * 0.8)
1746                        * Quaternion::rotation_z(move1 * 0.3 + move2 * -0.3);
1747
1748                    next.foot_r.position = Vec3::new(
1749                        s_a.foot.0,
1750                        s_a.foot.1 + move1 * 5.0 + move2 * -5.0,
1751                        s_a.foot.2,
1752                    );
1753                    next.foot_r.orientation = Quaternion::rotation_y(move1 * -0.3 + move2 * 0.3)
1754                        * Quaternion::rotation_z(move1 * 0.4 + move2 * -0.4);
1755                }
1756            },
1757            Some("common.abilities.staff.firebomb") => {
1758                let move1 = move1base;
1759                let move2 = move2base.powf(0.25);
1760                let move3 = move3base;
1761
1762                let ori: Vec2<f32> = Vec2::from(d.orientation);
1763                let last_ori = Vec2::from(d.last_ori);
1764                let tilt = if vek::Vec2::new(ori, last_ori)
1765                    .map(|o| o.magnitude_squared())
1766                    .map(|m| m > 0.001 && m.is_finite())
1767                    .reduce_and()
1768                    && ori.angle_between(last_ori).is_finite()
1769                {
1770                    ori.angle_between(last_ori).min(0.2)
1771                        * last_ori.determine_side(Vec2::zero(), ori).signum()
1772                } else {
1773                    0.0
1774                } * 1.3;
1775                let ori_angle = d.orientation.y.atan2(d.orientation.x);
1776                let lookdir_angle = d.look_dir.y.atan2(d.look_dir.x);
1777                let swivel = lookdir_angle - ori_angle;
1778                let xmove = (move1 * 6.0 + PI).sin();
1779                let ymove = (move1 * 6.0 + PI * (0.5)).sin();
1780
1781                next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
1782                next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3);
1783
1784                next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2);
1785                next.hand_r.orientation =
1786                    Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
1787
1788                next.main.position = Vec3::new(0.0, 0.0, 0.0);
1789                next.main.orientation = Quaternion::rotation_y(0.0);
1790
1791                next.control.position = Vec3::new(
1792                    s_a.stc.0 + (xmove * 3.0 + move1 * -4.0) * (1.0 - move3),
1793                    s_a.stc.1 + (2.0 + ymove * 3.0 + move2 * 3.0) * (1.0 - move3),
1794                    s_a.stc.2 + d.look_dir.z * 4.0,
1795                );
1796                next.control.orientation = Quaternion::rotation_x(
1797                    d.look_dir.z + s_a.stc.3 + (move2 * 0.6) * (1.0 - move3),
1798                ) * Quaternion::rotation_y(
1799                    s_a.stc.4 + (move1 * 0.5 + move2 * -0.5),
1800                ) * Quaternion::rotation_z(
1801                    s_a.stc.5 - (0.2 + move1 * -0.5 + move2 * 0.8) * (1.0 - move3),
1802                );
1803
1804                next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
1805                next.head.orientation = Quaternion::rotation_x(d.look_dir.z * 0.7)
1806                    * Quaternion::rotation_z(
1807                        tilt * -2.5 + (move1 * -0.2 + move2 * -0.4) * (1.0 - move3),
1808                    );
1809                next.chest.orientation = Quaternion::rotation_z(swivel * 0.8);
1810                next.torso.orientation = Quaternion::rotation_z(swivel * 0.2);
1811            },
1812            // ==================================
1813            //           NATURE SCEPTRE
1814            // ==================================
1815            Some(
1816                "common.abilities.sceptre.lifestealbeam"
1817                | "common.abilities.custom.cardinal.steambeam",
1818            ) => {
1819                let move1 = move1base;
1820                let move2 = move2base;
1821                let move3 = move3base;
1822
1823                next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
1824                next.hand_l.orientation =
1825                    Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4);
1826                next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthl.2);
1827                next.hand_r.orientation =
1828                    Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
1829                next.main.position = Vec3::new(0.0, 0.0, 0.0);
1830                next.main.orientation = Quaternion::rotation_x(0.0);
1831
1832                next.control.position = Vec3::new(-4.0, 7.0, 4.0);
1833                next.control.orientation = Quaternion::rotation_x(-0.3)
1834                    * Quaternion::rotation_y(0.15)
1835                    * Quaternion::rotation_z(0.0);
1836
1837                next.control.position = Vec3::new(
1838                    s_a.stc.0 + (move1 * 16.0) * (1.0 - move3),
1839                    s_a.stc.1 + (move1 + (move2 * 8.0).sin() * 2.0) * (1.0 - move3),
1840                    s_a.stc.2 + (move1 * 10.0) * (1.0 - move3),
1841                );
1842                next.control.orientation =
1843                    Quaternion::rotation_x(s_a.stc.3 + (move1 * -1.2) * (1.0 - move3))
1844                        * Quaternion::rotation_y(
1845                            s_a.stc.4
1846                                + (move1 * -1.4 + (move2 * 16.0).sin() * 0.07) * (1.0 - move3),
1847                        )
1848                        * Quaternion::rotation_z(
1849                            (move1 * -1.7 + (move2 * 8.0 + PI / 4.0).sin() * 0.3) * (1.0 - move3),
1850                        );
1851                next.head.orientation = Quaternion::rotation_x(0.0);
1852
1853                next.hand_l.position = Vec3::new(
1854                    0.0 + (move1 * -1.0 + (move2 * 8.0).sin() * 3.5) * (1.0 - move3),
1855                    0.0 + (move1 * -5.0 + (move2 * 8.0).sin() * -2.0 + (move2 * 16.0).sin() * -1.5)
1856                        * (1.0 - move3),
1857                    -4.0 + (move1 * 19.0 + (move2 * 8.0 + PI / 2.0).sin() * 3.5) * (1.0 - move3),
1858                );
1859                next.hand_l.orientation =
1860                    Quaternion::rotation_x(s_a.sthr.3 + (move1 * -0.3) * (1.0 - move3))
1861                        * Quaternion::rotation_y(
1862                            (move1 * -1.1 + (move2 * 8.0 + PI / 2.0).sin() * -0.3) * (1.0 - move3),
1863                        )
1864                        * Quaternion::rotation_z((move1 * -2.8) * (1.0 - move3));
1865
1866                if d.velocity.magnitude_squared() < 0.5_f32.powi(2) {
1867                    next.head.orientation =
1868                        Quaternion::rotation_z(move1 * -0.5 + (move2 * 16.0).sin() * 0.05);
1869
1870                    if !d.is_riding {
1871                        next.foot_l.position =
1872                            Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * -3.0, s_a.foot.2);
1873                        next.foot_l.orientation = Quaternion::rotation_x(move1 * -0.5)
1874                            * Quaternion::rotation_z(move1 * 0.5);
1875
1876                        next.foot_r.position =
1877                            Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * 4.0, s_a.foot.2);
1878                        next.foot_r.orientation = Quaternion::rotation_z(move1 * 0.5);
1879                    }
1880
1881                    next.chest.orientation =
1882                        Quaternion::rotation_x(move1 * -0.2 + (move2 * 8.0).sin() * 0.05)
1883                            * Quaternion::rotation_z(move1 * 0.5);
1884                    next.belt.orientation =
1885                        Quaternion::rotation_x(move1 * 0.1) * Quaternion::rotation_z(move1 * -0.1);
1886                    next.shorts.orientation =
1887                        Quaternion::rotation_x(move1 * 0.2) * Quaternion::rotation_z(move1 * -0.2);
1888                };
1889            },
1890            Some(
1891                "common.abilities.sceptre.healingaura" | "common.abilities.sceptre.wardingaura",
1892            ) => {
1893                let move1 = move1base;
1894                let move2 = move2base;
1895                let move3 = move3base;
1896
1897                next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
1898
1899                next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
1900                next.hand_l.orientation =
1901                    Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4);
1902                next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2);
1903                next.hand_r.orientation =
1904                    Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
1905                next.main.position = Vec3::new(0.0, 0.0, 0.0);
1906                next.main.orientation = Quaternion::rotation_x(0.0);
1907
1908                next.control.position = Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2);
1909                next.control.orientation =
1910                    Quaternion::rotation_x(s_a.stc.3) * Quaternion::rotation_y(s_a.stc.4);
1911
1912                let twist = move1 * 0.8;
1913
1914                next.control.position = Vec3::new(
1915                    s_a.stc.0 + (move1 * 5.0) * (1.0 - move3),
1916                    s_a.stc.1 + (move1 * 5.0) * (1.0 - move3),
1917                    s_a.stc.2 + (move1 * 10.0 + move2 * -10.0) * (1.0 - move3),
1918                );
1919                next.control.orientation =
1920                    Quaternion::rotation_x(s_a.stc.3 + (move1 * 0.8) * (1.0 - move3))
1921                        * Quaternion::rotation_y(
1922                            s_a.stc.4 + (move1 * -0.15 + move2 * -0.15) * (1.0 - move3),
1923                        )
1924                        * Quaternion::rotation_z((move1 * 0.8 + move2 * -0.8) * (1.0 - move3));
1925
1926                next.head.orientation = Quaternion::rotation_x((move1 * 0.4) * (1.0 - move3))
1927                    * Quaternion::rotation_z((twist * 0.2 + move2 * -0.8) * (1.0 - move3));
1928
1929                next.chest.position = Vec3::new(
1930                    0.0,
1931                    s_a.chest.0,
1932                    s_a.chest.1 + (move1 * 2.0 + move2 * -4.0) * (1.0 - move3),
1933                );
1934                next.chest.orientation = Quaternion::rotation_x((move2 * -0.8) * (1.0 - move3))
1935                    * Quaternion::rotation_z(twist * -0.2 + move2 * -0.1 + (1.0 - move3));
1936
1937                next.belt.orientation = Quaternion::rotation_x((move2 * 0.2) * (1.0 - move3))
1938                    * Quaternion::rotation_z((twist * 0.6 + move2 * -0.48) * (1.0 - move3));
1939
1940                next.shorts.orientation = Quaternion::rotation_x((move2 * 0.3) * (1.0 - move3))
1941                    * Quaternion::rotation_z((twist + move2 * -0.8) * (1.0 - move3));
1942
1943                if d.velocity.magnitude() < 0.5 && !d.is_riding {
1944                    next.foot_l.position = Vec3::new(
1945                        -s_a.foot.0,
1946                        s_a.foot.1 + move1 * -7.0 + move2 * 7.0,
1947                        s_a.foot.2,
1948                    );
1949                    next.foot_l.orientation = Quaternion::rotation_x(move1 * -0.8 + move2 * 0.8)
1950                        * Quaternion::rotation_z(move1 * 0.3 + move2 * -0.3);
1951
1952                    next.foot_r.position = Vec3::new(
1953                        s_a.foot.0,
1954                        s_a.foot.1 + move1 * 5.0 + move2 * -5.0,
1955                        s_a.foot.2,
1956                    );
1957                    next.foot_r.orientation = Quaternion::rotation_y(move1 * -0.3 + move2 * 0.3)
1958                        * Quaternion::rotation_z(move1 * 0.4 + move2 * -0.4);
1959                }
1960            },
1961            // ==================================
1962            //               SHIELD
1963            // ==================================
1964            Some("common.abilities.shield.basic_guard" | "common.abilities.shield.power_guard") => {
1965                legacy_initialize();
1966                let pullback = 1.0 - move3base.powi(4);
1967                let move1 = move1base.powf(0.25) * pullback;
1968                let move2 = (move2base * 10.0).sin();
1969
1970                if d.velocity.xy().magnitude_squared() < 0.5_f32.powi(2) {
1971                    next.chest.position =
1972                        Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move1 * -1.0 + move2 * 0.2);
1973                    next.chest.orientation = Quaternion::rotation_x(move1 * -0.15);
1974                    next.head.orientation = Quaternion::rotation_x(move1 * 0.25);
1975
1976                    next.belt.position =
1977                        Vec3::new(0.0, s_a.belt.0 + move1 * 0.5, s_a.belt.1 + move1 * 0.5);
1978                    next.shorts.position =
1979                        Vec3::new(0.0, s_a.shorts.0 + move1 * 1.3, s_a.shorts.1 + move1 * 1.0);
1980
1981                    next.belt.orientation = Quaternion::rotation_x(move1 * 0.15);
1982                    next.shorts.orientation = Quaternion::rotation_x(move1 * 0.25);
1983
1984                    if !d.is_riding {
1985                        next.foot_l.position =
1986                            Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * 2.0, s_a.foot.2);
1987                        next.foot_l.orientation = Quaternion::rotation_z(move1 * -0.5);
1988
1989                        next.foot_r.position =
1990                            Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * -2.0, s_a.foot.2);
1991                        next.foot_r.orientation = Quaternion::rotation_x(move1 * -0.5);
1992                    }
1993                }
1994
1995                if let Some(info) = d.ability_info {
1996                    match info.hand {
1997                        Some(HandInfo::MainHand) => {
1998                            next.control_l.position = Vec3::new(1.5, 8.0, 4.0 + move1 * 3.0);
1999                            next.control_l.orientation = Quaternion::rotation_x(0.25)
2000                                * Quaternion::rotation_y(0.0)
2001                                * Quaternion::rotation_z(-1.5);
2002                            next.hand_l.position = Vec3::new(0.0, -2.0, 0.0);
2003                            next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
2004
2005                            next.control_r.position = Vec3::new(9.0, -5.0, 0.0);
2006                            next.control_r.orientation =
2007                                Quaternion::rotation_x(-1.75) * Quaternion::rotation_y(0.3);
2008                            next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
2009                            next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
2010                        },
2011                        Some(HandInfo::OffHand) => {
2012                            next.control_r.position = Vec3::new(-1.5, 8.0, 4.0 + move1 * 3.0);
2013                            next.control_r.orientation = Quaternion::rotation_x(0.25)
2014                                * Quaternion::rotation_y(0.0)
2015                                * Quaternion::rotation_z(1.5);
2016                            next.hand_r.position = Vec3::new(0.0, -2.0, 0.0);
2017                            next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
2018
2019                            next.control_l.position = Vec3::new(-9.0, -5.0, 0.0);
2020                            next.control_l.orientation =
2021                                Quaternion::rotation_x(-1.75) * Quaternion::rotation_y(-0.3);
2022                            next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
2023                            next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
2024                        },
2025                        Some(HandInfo::TwoHanded) | None => {},
2026                    }
2027                }
2028            },
2029            // ==================================
2030            //            MISCELLANEOUS
2031            // ==================================
2032            Some("common.abilities.pick.swing") => {
2033                next.main.position = Vec3::new(0.0, 0.0, 0.0);
2034                next.main.orientation = Quaternion::rotation_x(0.0);
2035                next.second.position = Vec3::new(0.0, 0.0, 0.0);
2036                next.second.orientation = Quaternion::rotation_z(0.0);
2037                next.torso.position = Vec3::new(0.0, 0.0, 1.1);
2038                next.torso.orientation = Quaternion::rotation_z(0.0);
2039
2040                let move1 = move1base.powf(0.25);
2041                let move3 = move3base.powi(4);
2042                let pullback = 1.0 - move3;
2043                let moveret1 = move1base * pullback;
2044                let moveret2 = move2base * pullback;
2045
2046                next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
2047                next.head.orientation = Quaternion::rotation_x(moveret1 * 0.1 + moveret2 * 0.3)
2048                    * Quaternion::rotation_z(move1 * -0.2 + moveret2 * 0.2);
2049                next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + moveret2 * -2.0);
2050                next.chest.orientation = Quaternion::rotation_x(moveret1 * 0.4 + moveret2 * -0.7)
2051                    * Quaternion::rotation_y(moveret1 * 0.3 + moveret2 * -0.4)
2052                    * Quaternion::rotation_z(moveret1 * 0.5 + moveret2 * -0.5);
2053
2054                next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2 + moveret2 * -7.0);
2055                next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3)
2056                    * Quaternion::rotation_y(s_a.hhl.4)
2057                    * Quaternion::rotation_z(s_a.hhl.5);
2058                next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
2059                next.hand_r.orientation = Quaternion::rotation_x(s_a.hhr.3)
2060                    * Quaternion::rotation_y(s_a.hhr.4)
2061                    * Quaternion::rotation_z(s_a.hhr.5);
2062
2063                next.control.position = Vec3::new(
2064                    s_a.hc.0 + moveret1 * -13.0 + moveret2 * 3.0,
2065                    s_a.hc.1 + (moveret2 * 5.0),
2066                    s_a.hc.2 + moveret1 * 8.0 + moveret2 * -6.0,
2067                );
2068                next.control.orientation =
2069                    Quaternion::rotation_x(s_a.hc.3 + (moveret1 * 1.5 + moveret2 * -2.55))
2070                        * Quaternion::rotation_y(s_a.hc.4 + moveret1 * PI / 2.0 + moveret2 * 0.5)
2071                        * Quaternion::rotation_z(s_a.hc.5 + (moveret2 * -0.5));
2072
2073                if skeleton.holding_lantern {
2074                    next.hand_r.position =
2075                        Vec3::new(s_a.hand.0, s_a.hand.1 + 5.0, s_a.hand.2 + 12.0);
2076                    next.hand_r.orientation =
2077                        Quaternion::rotation_x(2.25) * Quaternion::rotation_z(0.9);
2078
2079                    next.lantern.position = Vec3::new(-0.5, -0.5, -1.5);
2080                    next.lantern.orientation = next.hand_r.orientation.inverse();
2081                }
2082            },
2083            Some("common.abilities.shovel.dig") => {
2084                next.main.position = Vec3::new(0.0, 0.0, 0.0);
2085                next.main.orientation = Quaternion::rotation_x(0.0);
2086                next.second.position = Vec3::new(0.0, 0.0, 0.0);
2087                next.second.orientation = Quaternion::rotation_z(0.0);
2088                next.torso.position = Vec3::new(0.0, 0.0, 1.1);
2089                next.torso.orientation = Quaternion::rotation_z(0.0);
2090
2091                let move1 = move1base.powf(0.25);
2092                let move3 = move3base.powi(4);
2093                let pullback = 1.0 - move3;
2094                let moveret1 = move1base * pullback;
2095                let moveret2 = move2base * pullback;
2096
2097                next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
2098                next.head.orientation = Quaternion::rotation_x(moveret1 * 0.1 + moveret2 * 0.3)
2099                    * Quaternion::rotation_z(move1 * -0.2 + moveret2 * 0.2);
2100                next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + moveret2 * -2.0);
2101                next.chest.orientation = Quaternion::rotation_x(moveret1 * 0.4 + moveret2 * -0.7)
2102                    * Quaternion::rotation_y(moveret1 * 0.3 + moveret2 * -0.4)
2103                    * Quaternion::rotation_z(moveret1 * 0.5 + moveret2 * -0.5);
2104
2105                next.hand_l.position = Vec3::new(8.0, 6.0, 3.0);
2106                next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
2107                next.hand_r.position = Vec3::new(8.0, 6.0, 15.0);
2108                next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
2109                next.main.position = Vec3::new(7.5, 7.5, 13.2);
2110                next.main.orientation = Quaternion::rotation_y(PI);
2111
2112                next.control.position = Vec3::new(-11.0 + moveret1 * 8.0, 1.8, 4.0);
2113                next.control.orientation = Quaternion::rotation_x(moveret1 * 0.3 + moveret2 * 0.2)
2114                    * Quaternion::rotation_y(0.8 - moveret1 * 0.7 + moveret2 * 0.7)
2115                    * Quaternion::rotation_z(moveret2 * 0.1 - moveret1 * 0.4);
2116
2117                if skeleton.holding_lantern {
2118                    next.hand_r.position =
2119                        Vec3::new(s_a.hand.0, s_a.hand.1 + 5.0, s_a.hand.2 + 12.0);
2120                    next.hand_r.orientation =
2121                        Quaternion::rotation_x(2.25) * Quaternion::rotation_z(0.9);
2122
2123                    next.lantern.position = Vec3::new(-0.5, -0.5, -1.5);
2124                    next.lantern.orientation = next.hand_r.orientation.inverse();
2125                }
2126            },
2127            _ => {},
2128        }
2129
2130        next
2131    }
2132}