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