1use super::{
2 super::{Animation, vek::*},
3 BipedLargeSkeleton, SkeletonAttr,
4};
5use common::{
6 comp::item::tool::{AbilitySpec, ToolKind},
7 states::utils::StageSection,
8};
9use core::f32::consts::PI;
10
11pub struct ShootAnimation;
12
13type ShootAnimationDependency<'a> = (
14 Option<ToolKind>,
15 (Option<ToolKind>, Option<&'a AbilitySpec>),
16 Vec3<f32>,
17 Vec3<f32>,
18 Vec3<f32>,
19 f32,
20 Option<StageSection>,
21 f32,
22 Option<&'a str>,
23);
24impl Animation for ShootAnimation {
25 type Dependency<'a> = ShootAnimationDependency<'a>;
26 type Skeleton = BipedLargeSkeleton;
27
28 #[cfg(feature = "use-dyn-lib")]
29 const UPDATE_FN: &'static [u8] = b"biped_large_shoot\0";
30
31 #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_shoot")]
32 fn update_skeleton_inner(
33 skeleton: &Self::Skeleton,
34 (
35 active_tool_kind,
36 _second_tool,
37 velocity,
38 _orientation,
39 _last_ori,
40 _global_time,
41 stage_section,
42 acc_vel,
43 ability_id,
44 ): Self::Dependency<'_>,
45 anim_time: f32,
46 rate: &mut f32,
47 s_a: &SkeletonAttr,
48 ) -> Self::Skeleton {
49 *rate = 1.0;
50 let speed = Vec2::<f32>::from(velocity).magnitude();
51
52 let mut next = (*skeleton).clone();
53
54 let lab: f32 = 0.65 * s_a.tempo;
55 let speednorm = (speed / 12.0).powf(0.4);
56 let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm;
57 let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm;
58 let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt())
59 * ((acc_vel * lab + PI * 1.4).sin())
60 * speednorm;
61
62 let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt())
63 * ((acc_vel * lab + PI * 0.4).sin())
64 * speednorm;
65
66 next.shoulder_l.position = Vec3::new(
67 -s_a.shoulder.0,
68 s_a.shoulder.1,
69 s_a.shoulder.2 - foothorir * 1.0,
70 );
71 next.shoulder_l.orientation =
72 Quaternion::rotation_x(0.8 + 1.2 * speednorm + (footrotr * -0.2) * speednorm);
73
74 next.shoulder_r.position = Vec3::new(
75 s_a.shoulder.0,
76 s_a.shoulder.1,
77 s_a.shoulder.2 - foothoril * 1.0,
78 );
79 next.shoulder_r.orientation =
80 Quaternion::rotation_x(0.8 + 1.2 * speednorm + (footrotl * -0.2) * speednorm);
81 next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
82 next.jaw.orientation = Quaternion::rotation_x(0.0);
83
84 next.main.position = Vec3::new(0.0, 0.0, 0.0);
85 next.main.orientation = Quaternion::rotation_x(0.0);
86
87 next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip.0);
88 next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip.0);
89
90 next.hand_l.orientation = Quaternion::rotation_x(0.0);
91 next.hand_r.orientation = Quaternion::rotation_x(0.0);
92
93 match active_tool_kind {
94 Some(ToolKind::Sword) => match ability_id {
95 Some(
96 "common.abilities.custom.dullahan.knife_rain"
97 | "common.abilities.custom.dullahan.fierce_darts",
98 ) => {
99 let (move1base, move2base, move3) = match stage_section {
100 Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
101 Some(StageSection::Action) => (1.0, anim_time, 0.0),
102 Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
103 _ => (0.0, 0.0, 0.0),
104 };
105 let pullback = 1.0 - move3;
106 let move1 = move1base * pullback;
107 let move2 = move2base * pullback;
108 next.main.position = Vec3::new(-10.0, -8.0, 12.0);
109 next.main.orientation =
110 Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
111 next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1 + 4.0, s_a.hand.2);
112 next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1 + 4.0, s_a.hand.2);
113 next.hand_l.orientation = Quaternion::rotation_x(move1 * 1.5)
114 * Quaternion::rotation_y(move1 * -1.0 + move2 * 1.5);
115 next.hand_r.orientation = Quaternion::rotation_x(move1 * 1.5)
116 * Quaternion::rotation_y(move1 * 1.0 + move2 * -1.5);
117 next.upper_torso.orientation =
118 Quaternion::rotation_y(move1 * -0.1 + move2 * 0.1)
119 * Quaternion::rotation_z(move1 * -0.1 + move2 * 0.1);
120 next.foot_l.orientation = Quaternion::rotation_y(move1 * 0.3 + move2 * -0.3);
121 next.foot_r.orientation = Quaternion::rotation_y(move1 * 0.3 + move2 * -0.3);
122 },
123 Some("common.abilities.adlet.elder.air_blade") => {
124 let (move1base, move2base, move3) = match stage_section {
125 Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
126 Some(StageSection::Action) => (1.0, anim_time.powf(0.25), 0.0),
127 Some(StageSection::Recover) => (1.0, 1.0, anim_time),
128 _ => (0.0, 0.0, 0.0),
129 };
130 let pullback = 1.0 - move3;
131 let move1abs = move1base * pullback;
132 let move2abs = move2base * pullback;
133 next.main.position = Vec3::new(-10.0, -8.0, 12.0);
134 next.main.orientation =
135 Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
136
137 next.hand_l.position =
138 Vec3::new(-s_a.hand.0, s_a.hand.1 + 1.0, s_a.hand.2 + 5.0);
139 next.hand_r.position =
140 Vec3::new(s_a.hand.0, s_a.hand.1 + 1.0, s_a.hand.2 + 5.0);
141
142 next.hand_r.orientation =
143 Quaternion::rotation_x(move1abs * 4.0 + move2abs * -0.7)
144 * Quaternion::rotation_y(0.0 + move1abs * -0.7);
145 next.hand_l.orientation =
146 Quaternion::rotation_x(move1abs * 4.0 + move2abs * -0.7);
147 next.hand_r.orientation =
148 Quaternion::rotation_x(move1abs * 4.0 + move2abs * -0.7);
149
150 next.shoulder_l.orientation =
151 Quaternion::rotation_x(move1abs * 4.0 + move2abs * -0.7);
152 next.shoulder_r.orientation =
153 Quaternion::rotation_x(move1abs * 4.0 + move2abs * -0.7);
154 next.head.orientation =
155 Quaternion::rotation_x(move1abs * 0.4 + move2abs * -0.2);
156 },
157 Some("common.abilities.adlet.elder.trap") => {
158 let (move1base, move2base, move3) = match stage_section {
159 Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
160 Some(StageSection::Action) => (1.0, anim_time.powf(0.25), 0.0),
161 Some(StageSection::Recover) => (1.0, 1.0, anim_time),
162 _ => (0.0, 0.0, 0.0),
163 };
164 let pullback = 1.0 - move3;
165 let move1abs = move1base * pullback;
166 let move2abs = move2base * pullback;
167 next.hand_l.position =
172 Vec3::new(-s_a.hand.0, s_a.hand.1 + 1.0, s_a.hand.2 + 5.0);
173 next.hand_r.position =
174 Vec3::new(s_a.hand.0, s_a.hand.1 + 1.0, s_a.hand.2 + 5.0);
175
176 next.hand_r.orientation =
177 Quaternion::rotation_x(move1abs * 4.0 + move2abs * -0.7)
178 * Quaternion::rotation_y(0.0 + move1abs * -0.7);
179 next.hand_l.orientation =
180 Quaternion::rotation_x(move1abs * 4.0 + move2abs * -0.7);
181 next.hand_r.orientation =
182 Quaternion::rotation_x(move1abs * 4.0 + move2abs * -0.7);
183
184 next.shoulder_l.orientation =
185 Quaternion::rotation_x(move1abs * 4.0 + move2abs * -0.7);
186 next.shoulder_r.orientation =
187 Quaternion::rotation_x(move1abs * 4.0 + move2abs * -0.7);
188 next.head.orientation =
189 Quaternion::rotation_x(move1abs * 0.4 + move2abs * -0.2);
190 },
191 _ => {},
192 },
193 Some(ToolKind::Hammer) => match ability_id {
194 Some("common.abilities.custom.cyclops.optic_blast") => {
195 let (move1base, _move1shake, move2base, move3) = match stage_section {
196 Some(StageSection::Buildup) => {
197 (anim_time, (anim_time * 10.0 + PI).sin(), 0.0, 0.0)
198 },
199 Some(StageSection::Action) => (1.0, 1.0, anim_time.powf(0.25), 0.0),
200 Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
201 _ => (0.0, 0.0, 0.0, 0.0),
202 };
203 let pullback = 1.0 - move3;
204 let move1 = move1base * pullback;
205 let move2 = move2base * pullback;
206 next.head.orientation = Quaternion::rotation_x(move1 * 0.25 + move2 * -0.25)
207 * Quaternion::rotation_z(move1 * 0.25);
208 next.torso.orientation = Quaternion::rotation_x(move1 * -0.25 + move2 * 0.25);
209 next.upper_torso.orientation =
210 Quaternion::rotation_x(move1 * -0.1 + move2 * 0.1)
211 * Quaternion::rotation_z(move1 * -0.1 + move2 * 0.1);
212 next.foot_l.orientation = Quaternion::rotation_x(move1 * 0.3 + move2 * -0.3);
213 next.foot_r.orientation = Quaternion::rotation_x(move1 * 0.3 + move2 * -0.3);
214 next.main.position = Vec3::new(0.0, -10.0, 3.0);
215 next.main.orientation = Quaternion::rotation_x(PI / -2.0);
216 next.weapon_l.position = Vec3::new(
217 -s_a.hand.0 - 3.0 * move1,
218 s_a.hand.1 + 4.0 + 8.0 * move1,
219 -15.0 + 2.0 * move1,
220 );
221 next.weapon_l.orientation = Quaternion::rotation_x(move1 * 0.6);
222 next.hand_r.position = Vec3::new(
223 s_a.hand.0 + 6.0 * move1,
224 s_a.hand.1 + 4.0,
225 s_a.hand.2 + 6.0 * move1,
226 );
227 next.hand_r.orientation =
228 Quaternion::rotation_x(move1 * 1.0) * Quaternion::rotation_y(move1 * -1.4);
229
230 next.shoulder_l.orientation =
231 Quaternion::rotation_x(move1 * 0.6) * Quaternion::rotation_y(move1 * 0.5);
232 next.shoulder_r.orientation =
233 Quaternion::rotation_x(move1 * 1.4) * Quaternion::rotation_y(move1 * -0.5);
234 },
235 Some(
236 "common.abilities.custom.dwarves.forgemaster.lava_mortar"
237 | "common.abilities.custom.dwarves.forgemaster.mines",
238 ) => {
239 let (move1base, move2shake, move2base, move3) = match stage_section {
240 Some(StageSection::Buildup) => {
241 ((anim_time.powf(0.25)).min(1.0), 0.0, 0.0, 0.0)
242 },
243 Some(StageSection::Action) => (
244 1.0,
245 (anim_time * 15.0 + PI).sin(),
246 (anim_time.powf(0.1)).min(1.0),
247 0.0,
248 ),
249 Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
250 _ => (0.0, 0.0, 0.0, 0.0),
251 };
252 let pullback = 1.0 - move3;
253 let move1 = move1base * pullback;
254 let _move2 = move2base * pullback;
255 next.control_l.position = Vec3::new(-1.0, 3.0, 6.0);
256 next.control_r.position =
257 Vec3::new(-1.0 + move1 * 5.0, 2.0 + move1 * 1.0, 2.0 + move1 * 8.0);
258
259 next.control.position = Vec3::new(
260 -3.0 + move1 * -5.0,
261 -2.0 + s_a.grip.0 / 1.2 + move1 * 3.0 + move2shake * 1.0,
262 8.0 + -s_a.grip.0 / 2.0 + move1 * -2.0,
263 );
264 next.head.orientation =
265 Quaternion::rotation_x(move1 * -0.2) * Quaternion::rotation_y(move1 * 0.2);
266 next.jaw.orientation = Quaternion::rotation_x(0.0);
267
268 next.control_l.orientation =
269 Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.5);
270 next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.4)
271 * Quaternion::rotation_y(1.0)
272 * Quaternion::rotation_z(move1 * 1.2 + move2shake * 0.5);
273
274 next.control.orientation = Quaternion::rotation_x(-0.2 + move1 * -0.1)
275 * Quaternion::rotation_y(-0.1 + move1 * 0.3);
276 next.shoulder_l.position = Vec3::new(
277 -s_a.shoulder.0,
278 s_a.shoulder.1,
279 s_a.shoulder.2 - foothorir * 1.0,
280 );
281 next.shoulder_l.orientation = Quaternion::rotation_x(
282 move1 * 0.2 + 0.3 + 0.8 * speednorm + (footrotr * -0.2),
283 );
284 next.shoulder_r.position = Vec3::new(
285 s_a.shoulder.0,
286 s_a.shoulder.1,
287 s_a.shoulder.2 - foothoril * 1.0,
288 );
289 next.shoulder_r.orientation = Quaternion::rotation_x(
290 move1 * 0.2 + 1.1 + 0.6 * speednorm + (footrotl * -0.2),
291 );
292 },
293 _ => {},
294 },
295 Some(ToolKind::Sceptre) => {
296 let (move1base, move1shake, move2base, move3) = match stage_section {
297 Some(StageSection::Buildup) => {
298 (anim_time, (anim_time * 10.0 + PI).sin(), 0.0, 0.0)
299 },
300 Some(StageSection::Action) => (1.0, 1.0, anim_time.powf(0.25), 0.0),
301 Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
302 _ => (0.0, 0.0, 0.0, 0.0),
303 };
304 let pullback = 1.0 - move3;
305 let move1 = move1base * pullback;
306 let move2 = move2base * pullback;
307 next.control_l.position = Vec3::new(-1.0, 3.0, 12.0);
308 next.control_r.position = Vec3::new(1.0, 2.0, 2.0);
309
310 next.control.position = Vec3::new(
311 -3.0,
312 3.0 + s_a.grip.0 / 1.2 + move1 * 4.0 + move2 + move1shake * 2.0 + move2 * -2.0,
313 -11.0 + -s_a.grip.0 / 2.0 + move1 * 3.0,
314 );
315 next.head.orientation = Quaternion::rotation_x(move1 * -0.15)
316 * Quaternion::rotation_y(move1 * 0.25)
317 * Quaternion::rotation_z(move1 * 0.25);
318 next.jaw.orientation = Quaternion::rotation_x(move1 * -0.5);
319
320 next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 + move1 * 0.5)
321 * Quaternion::rotation_y(move1 * -0.4);
322 next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.5)
323 * Quaternion::rotation_y(0.5)
324 * Quaternion::rotation_z(0.0);
325
326 next.control.orientation =
327 Quaternion::rotation_x(-0.2 + move1 * -0.2 + move1shake * 0.1)
328 * Quaternion::rotation_y(-0.1 + move1 * 0.8 + move2 * -0.3);
329 next.shoulder_l.position = Vec3::new(
330 -s_a.shoulder.0,
331 s_a.shoulder.1,
332 s_a.shoulder.2 - foothorir * 1.0,
333 );
334 next.shoulder_l.orientation = Quaternion::rotation_x(
335 move1 * 0.8 + 0.8 * speednorm + (footrotr * -0.2) * speednorm,
336 );
337
338 next.shoulder_r.position = Vec3::new(
339 s_a.shoulder.0,
340 s_a.shoulder.1,
341 s_a.shoulder.2 - foothoril * 1.0,
342 );
343 next.shoulder_r.orientation =
344 Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotl * -0.2));
345 },
346 Some(ToolKind::Staff) => match ability_id {
347 Some("common.abilities.custom.mindflayer.necroticsphere_multiblast") => {
348 let (move1base, move1shake, move2base, move3) = match stage_section {
349 Some(StageSection::Buildup) => {
350 (anim_time, (anim_time * 10.0 + PI).sin(), 0.0, 0.0)
351 },
352 Some(StageSection::Action) => (1.0, 1.0, anim_time.powf(0.25), 0.0),
353 Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
354 _ => (0.0, 0.0, 0.0, 0.0),
355 };
356 let pullback = 1.0 - move3;
357 let move1 = move1base * pullback;
358 let move2 = move2base * pullback;
359 let rotate = move1 * 2.0 * PI + move2 * 2.0 * PI;
360 let rise = move1 * 20.0 - move2 * 20.0;
361
362 next.control_l.position = Vec3::new(-1.0, 3.0, 12.0);
363 next.control_r.position = Vec3::new(1.0, 2.0, 2.0);
364
365 next.control.position = Vec3::new(
366 -3.0,
367 3.0 + s_a.grip.0 / 1.2
368 + move1 * 4.0
369 + move2
370 + move1shake * 2.0
371 + move2 * -2.0,
372 -11.0 + -s_a.grip.0 / 2.0 + move1 * 3.0,
373 );
374 next.head.orientation = Quaternion::rotation_x(move1 * -0.15)
375 * Quaternion::rotation_y(move1 * 0.25)
376 * Quaternion::rotation_z(move1 * 0.25);
377 next.jaw.orientation = Quaternion::rotation_x(move1 * -0.5);
378
379 next.upper_torso.orientation = Quaternion::rotation_z(rotate);
380 next.upper_torso.position = Vec3::new(0.0, 0.0, s_a.upper_torso.1 + rise);
381
382 next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 + move1 * 0.5)
383 * Quaternion::rotation_y(move1 * -0.4);
384 next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.5)
385 * Quaternion::rotation_y(0.5)
386 * Quaternion::rotation_z(0.0);
387
388 next.control.orientation =
389 Quaternion::rotation_x(-0.2 + move1 * -0.2 + move1shake * 0.1)
390 * Quaternion::rotation_y(-0.1 + move1 * 0.8 + move2 * -0.3);
391 next.shoulder_l.position = Vec3::new(
392 -s_a.shoulder.0,
393 s_a.shoulder.1,
394 s_a.shoulder.2 - foothorir * 1.0,
395 );
396 next.shoulder_l.orientation = Quaternion::rotation_x(
397 move1 * 0.8 + 0.8 * speednorm + (footrotr * -0.2) * speednorm,
398 );
399
400 next.shoulder_r.position = Vec3::new(
401 s_a.shoulder.0,
402 s_a.shoulder.1,
403 s_a.shoulder.2 - foothoril * 1.0,
404 );
405 next.shoulder_r.orientation =
406 Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotl * -0.2));
407 },
408 _ => {
409 let (move1base, move1shake, move2base, move3) = match stage_section {
410 Some(StageSection::Buildup) => {
411 (anim_time, (anim_time * 10.0 + PI).sin(), 0.0, 0.0)
412 },
413 Some(StageSection::Action) => (1.0, 1.0, anim_time.powf(0.25), 0.0),
414 Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
415 _ => (0.0, 0.0, 0.0, 0.0),
416 };
417 let pullback = 1.0 - move3;
418 let move1 = move1base * pullback;
419 let move2 = move2base * pullback;
420 next.control_l.position = Vec3::new(-1.0, 3.0, 12.0);
421 next.control_r.position = Vec3::new(1.0, 2.0, 2.0);
422
423 next.control.position = Vec3::new(
424 -3.0,
425 3.0 + s_a.grip.0 / 1.2
426 + move1 * 4.0
427 + move2
428 + move1shake * 2.0
429 + move2 * -2.0,
430 -11.0 + -s_a.grip.0 / 2.0 + move1 * 3.0,
431 );
432 next.head.orientation = Quaternion::rotation_x(move1 * -0.15)
433 * Quaternion::rotation_y(move1 * 0.25)
434 * Quaternion::rotation_z(move1 * 0.25);
435 next.jaw.orientation = Quaternion::rotation_x(move1 * -0.5);
436
437 next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 + move1 * 0.5)
438 * Quaternion::rotation_y(move1 * -0.4);
439 next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.5)
440 * Quaternion::rotation_y(0.5)
441 * Quaternion::rotation_z(0.0);
442
443 next.control.orientation =
444 Quaternion::rotation_x(-0.2 + move1 * -0.2 + move1shake * 0.1)
445 * Quaternion::rotation_y(-0.1 + move1 * 0.8 + move2 * -0.3);
446 next.shoulder_l.position = Vec3::new(
447 -s_a.shoulder.0,
448 s_a.shoulder.1,
449 s_a.shoulder.2 - foothorir * 1.0,
450 );
451 next.shoulder_l.orientation = Quaternion::rotation_x(
452 move1 * 0.8 + 0.8 * speednorm + (footrotr * -0.2) * speednorm,
453 );
454
455 next.shoulder_r.position = Vec3::new(
456 s_a.shoulder.0,
457 s_a.shoulder.1,
458 s_a.shoulder.2 - foothoril * 1.0,
459 );
460 next.shoulder_r.orientation =
461 Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotl * -0.2));
462 },
463 },
464 Some(ToolKind::Bow) => match ability_id {
465 Some("common.abilities.custom.terracotta_besieger.multishot") => {
466 let (move1base, move2base, move3) = match stage_section {
467 Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
468 Some(StageSection::Action) => (1.0, anim_time, 0.0),
469 Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
470 _ => (0.0, 0.0, 0.0),
471 };
472 let pullback = 1.0 - move3;
473 let move1 = move1base * pullback;
474 let move2 = move2base * pullback;
475 next.control_l.position = Vec3::new(-5.0, -2.0 + move2 * -7.0, -3.0);
476 next.control_r.position = Vec3::new(4.0, 4.0, 1.0);
477
478 next.control.position = Vec3::new(
479 -1.0 + move1 * 2.0,
480 6.0 + s_a.grip.0 / 1.2 + move1 * 7.0,
481 -5.0 + -s_a.grip.0 / 2.0 + move1 * s_a.height * 1.5,
482 );
483
484 next.control_l.orientation =
485 Quaternion::rotation_x(move1 * 0.2 + PI / 2.0 + move2 * 0.4)
486 * Quaternion::rotation_y(-0.2);
487 next.control_r.orientation = Quaternion::rotation_x(PI / 2.2 + move1 * 0.4)
488 * Quaternion::rotation_y(0.4)
489 * Quaternion::rotation_z(0.0);
490
491 next.control.orientation = Quaternion::rotation_x(-0.2)
492 * Quaternion::rotation_y(2.0 + move1 * -0.4)
493 * Quaternion::rotation_z(0.1);
494 next.head.orientation = Quaternion::rotation_z(move1 * 0.25);
495 next.shoulder_l.position = Vec3::new(
496 -s_a.shoulder.0,
497 s_a.shoulder.1,
498 s_a.shoulder.2 - foothorir * 1.0,
499 );
500 next.shoulder_l.orientation =
501 Quaternion::rotation_x(move1 * 1.2 + 1.2 * speednorm + (footrotr * -0.2));
502
503 next.shoulder_r.position = Vec3::new(
504 s_a.shoulder.0,
505 s_a.shoulder.1,
506 s_a.shoulder.2 - foothoril * 1.0,
507 );
508 next.shoulder_r.orientation =
509 Quaternion::rotation_x(move1 * 0.8 + 1.2 * speednorm + (footrotl * -0.2));
510 },
511 _ => {
512 let (move1base, move2base, move3) = match stage_section {
513 Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
514 Some(StageSection::Action) => (1.0, anim_time, 0.0),
515 Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
516 _ => (0.0, 0.0, 0.0),
517 };
518 let pullback = 1.0 - move3;
519 let move1 = move1base * pullback;
520 let move2 = move2base * pullback;
521 next.control_l.position = Vec3::new(-1.0, -2.0 + move2 * -7.0, -3.0);
522 next.control_r.position = Vec3::new(0.0, 4.0, 1.0);
523
524 next.control.position = Vec3::new(
525 -1.0 + move1 * 2.0,
526 6.0 + s_a.grip.0 / 1.2 + move1 * 7.0,
527 -5.0 + -s_a.grip.0 / 2.0 + move1 * s_a.height * 3.4,
528 );
529
530 next.control_l.orientation =
531 Quaternion::rotation_x(move1 * 0.2 + PI / 2.0 + move2 * 0.4)
532 * Quaternion::rotation_y(-0.2);
533 next.control_r.orientation = Quaternion::rotation_x(PI / 2.2 + move1 * 0.4)
534 * Quaternion::rotation_y(0.4)
535 * Quaternion::rotation_z(0.0);
536
537 next.control.orientation = Quaternion::rotation_x(-0.2)
538 * Quaternion::rotation_y(1.0 + move1 * -0.4)
539 * Quaternion::rotation_z(-0.1);
540 next.head.orientation = Quaternion::rotation_z(move1 * 0.25);
541 next.shoulder_l.position = Vec3::new(
542 -s_a.shoulder.0,
543 s_a.shoulder.1,
544 s_a.shoulder.2 - foothorir * 1.0,
545 );
546 next.shoulder_l.orientation =
547 Quaternion::rotation_x(move1 * 1.2 + 1.2 * speednorm + (footrotr * -0.2));
548
549 next.shoulder_r.position = Vec3::new(
550 s_a.shoulder.0,
551 s_a.shoulder.1,
552 s_a.shoulder.2 - foothoril * 1.0,
553 );
554 next.shoulder_r.orientation =
555 Quaternion::rotation_x(move1 * 0.8 + 1.2 * speednorm + (footrotl * -0.2));
556 },
557 },
558 Some(ToolKind::Axe) => {
559 let (move1base, move2, move3) = match stage_section {
560 Some(StageSection::Buildup) => ((anim_time.powf(0.25)), 0.0, 0.0),
561 Some(StageSection::Action) => (1.0, (anim_time), 0.0),
562 Some(StageSection::Recover) => (1.0, 1.0, anim_time),
563 _ => (0.0, 0.0, 0.0),
564 };
565 let pullback = 1.0 - move3;
566 let move1 = move1base * pullback;
567 let move2 = move2 * pullback;
568
569 next.shoulder_r.orientation =
570 Quaternion::rotation_y(move1 * -0.5) * Quaternion::rotation_x(move1 * -0.5);
571 next.head.orientation = Quaternion::rotation_x(0.0)
572 * Quaternion::rotation_y(move1 * 0.3)
573 * Quaternion::rotation_z(move1 * -0.2 + move2 * 0.5);
574
575 next.main.position = Vec3::new(0.0, 0.0, 0.0);
576 next.main.orientation = Quaternion::rotation_z(move1 * 5.0);
577
578 next.hand_l.position = Vec3::new(s_a.grip.1, 0.0, s_a.grip.0);
579 next.hand_r.position = Vec3::new(-s_a.grip.1, 0.0, s_a.grip.0);
580
581 next.hand_l.orientation = Quaternion::rotation_x(0.0);
582 next.hand_r.orientation = Quaternion::rotation_x(0.0);
583
584 next.control_l.position = Vec3::new(-1.0, 2.0, 12.0);
585 next.control_r.position = Vec3::new(1.0 + move1 * 40.0, 2.0, -2.0 + move1 * 10.0);
586
587 next.control.position = Vec3::new(
588 4.0 + move1 * -25.0,
589 0.0 + s_a.grip.0 / 1.0 + move1 * -6.0,
590 -s_a.grip.0 / 0.8 + move1 * 10.0,
591 );
592
593 next.control_l.orientation =
594 Quaternion::rotation_x(PI / 2.0 + move1 * 0.3) * Quaternion::rotation_y(-0.0);
595 next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2 + move1 * 1.0)
596 * Quaternion::rotation_y(0.0)
597 * Quaternion::rotation_z(0.0);
598 next.control.orientation = Quaternion::rotation_x(-1.0 + move1 * 0.0)
599 * Quaternion::rotation_y(-1.8 + move1 * 2.0)
600 * Quaternion::rotation_z(0.0 + move1 * -0.0);
601 next.upper_torso.orientation = Quaternion::rotation_y(move1 * 0.3);
602
603 next.lower_torso.orientation = Quaternion::rotation_y(move1 * -0.3);
604 next.torso.position = Vec3::new(move1, 0.0, 0.0);
605 },
606 Some(ToolKind::Natural) => match ability_id {
607 Some("common.abilities.custom.minotaur.axethrow") => {
608 let (move1base, move2base, move3) = match stage_section {
609 Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
610 Some(StageSection::Action) => (1.0, anim_time.powf(0.25), 0.0),
611 Some(StageSection::Recover) => (1.0, 1.0, anim_time),
612 _ => (0.0, 0.0, 0.0),
613 };
614 let pullback = 1.0 - move3;
615 let move1abs = move1base * pullback;
616 let move2abs = move2base * pullback;
617 next.second.scale = Vec3::one() * 1.0;
618 next.main.position = Vec3::new(-12.0, -4.0, -20.0);
619 next.second.position = Vec3::new(12.0, -4.0, -20.0);
620 next.main.orientation =
621 Quaternion::rotation_x(move1abs * -1.5 + move2abs * -3.5);
622
623 next.second.orientation =
624 Quaternion::rotation_x(move1abs * -1.5 + move2abs * -3.5);
625
626 if matches!(stage_section, Some(StageSection::Recover)) {
627 next.main.position += Vec3::new(0.0, 10000000.0, 0.0);
628 next.second.position += Vec3::new(0.0, 10000000.0, 0.0);
629 }
630
631 next.hand_l.position =
632 Vec3::new(-s_a.hand.0, s_a.hand.1 - 2.0, s_a.hand.2 + 0.0);
633 next.hand_r.position =
634 Vec3::new(s_a.hand.0, s_a.hand.1 - 2.0, s_a.hand.2 + 0.0);
635 next.control.orientation =
636 Quaternion::rotation_x(move1abs * 3.0 + move2abs * -3.0);
637
638 next.shoulder_l.orientation =
639 Quaternion::rotation_x(move1abs * 3.0 + move2abs * -3.0);
640 next.shoulder_r.orientation =
641 Quaternion::rotation_x(move1abs * 3.0 + move2abs * -3.0);
642 next.head.orientation =
643 Quaternion::rotation_x(move1abs * 0.4 + move2abs * -0.2);
644 },
645 Some("common.abilities.custom.wendigomagic.frostbomb") => {
646 let (move1base, _move2base, move3) = match stage_section {
647 Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
648 Some(StageSection::Action) => (1.0, anim_time, 0.0),
649 Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
650 _ => (0.0, 0.0, 0.0),
651 };
652 let pullback = 1.0 - move3;
653 let move1 = move1base * pullback;
654 next.control_l.position =
655 Vec3::new(-9.0 + move1 * 6.0, 19.0 + move1 * 6.0, -13.0 + move1 * 10.5);
656 next.control_r.position =
657 Vec3::new(9.0 + move1 * -6.0, 19.0 + move1 * 6.0, -13.0 + move1 * 14.5);
658
659 next.control_l.orientation = Quaternion::rotation_x(PI / 3.0 + move1 * 0.5)
660 * Quaternion::rotation_y(-0.15)
661 * Quaternion::rotation_z(move1 * 0.5);
662 next.control_r.orientation = Quaternion::rotation_x(PI / 3.0 + move1 * 0.5)
663 * Quaternion::rotation_y(0.15)
664 * Quaternion::rotation_z(move1 * -0.5);
665 next.head.orientation = Quaternion::rotation_x(move1 * -0.3);
666 },
667 Some("common.abilities.custom.yeti.snowball") => {
668 let (move1, move2, move3) = match stage_section {
669 Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
670 Some(StageSection::Action) => (1.0, anim_time, 0.0),
671 Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
672 _ => (0.0, 0.0, 0.0),
673 };
674 next.second.scale = Vec3::one() * 0.0;
675
676 next.head.orientation = Quaternion::rotation_x(move1 * 0.4);
677 next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
678 next.jaw.orientation = Quaternion::rotation_x(move2 * -0.3);
679 next.control_l.position = Vec3::new(-0.5, 4.0, 1.0);
680 next.control_r.position = Vec3::new(-0.5, 4.0, 1.0);
681 next.control_l.orientation = Quaternion::rotation_x(PI / 2.0);
682 next.control_r.orientation = Quaternion::rotation_x(PI / 2.0);
683 next.weapon_l.position = Vec3::new(-12.0, -1.0, -15.0);
684 next.weapon_r.position = Vec3::new(12.0, -1.0, -15.0);
685
686 next.weapon_l.orientation = Quaternion::rotation_x(-PI / 2.0 - 0.1);
687 next.weapon_r.orientation = Quaternion::rotation_x(-PI / 2.0 - 0.1);
688
689 let twist = move1 * 0.8 + move3 * -0.8;
690 next.upper_torso.position =
691 Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
692 next.upper_torso.orientation =
693 Quaternion::rotation_x(move1 * 0.8 + move2 * -1.1)
694 * Quaternion::rotation_z(twist * -0.2 + move1 * -0.1 + move2 * 0.3);
695
696 next.lower_torso.orientation =
697 Quaternion::rotation_x(move1 * -0.8 + move2 * 1.1)
698 * Quaternion::rotation_z(twist);
699
700 next.arm_control_r.orientation = Quaternion::rotation_x(move1 * PI / 2.0)
701 * Quaternion::rotation_y(move1 * -PI / 2.0 + move2 * 2.5);
702 next.arm_control_r.position = Vec3::new(0.0, move1 * 10.0 + move2 * -10.0, 0.0);
705 },
706 Some("common.abilities.custom.terracotta_demolisher.throw") => {
707 let (move1, move2, move3) = match stage_section {
708 Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
709 Some(StageSection::Action) => (1.0, anim_time, 0.0),
710 Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
711 _ => (0.0, 0.0, 0.0),
712 };
713 next.head.orientation = Quaternion::rotation_x(move1 * 0.4);
714 next.control_l.position = Vec3::new(-0.5, 4.0, 1.0);
715 next.control_r.position = Vec3::new(-0.5, 4.0, 1.0);
716 next.control_l.orientation = Quaternion::rotation_x(PI / 1.5);
717 next.control_r.orientation = Quaternion::rotation_x(PI / 1.5);
718 next.weapon_l.position = Vec3::new(-9.0, 5.0, 0.0);
719 next.weapon_r.position = Vec3::new(9.0, 5.0, 0.0);
720
721 next.weapon_l.orientation = Quaternion::rotation_x(-PI / 2.0 - 0.1);
722 next.weapon_r.orientation = Quaternion::rotation_x(-PI / 2.0 - 0.1);
723
724 let twist = move1 * 0.8 + move3 * -0.8;
725 next.upper_torso.position =
726 Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
727 next.upper_torso.orientation =
728 Quaternion::rotation_x(move1 * 0.8 + move2 * -1.1)
729 * Quaternion::rotation_z(twist * -0.2 + move1 * -0.1 + move2 * 0.3);
730
731 next.lower_torso.orientation =
732 Quaternion::rotation_x(move1 * -0.8 + move2 * 1.1)
733 * Quaternion::rotation_z(twist);
734
735 next.arm_control_r.orientation = Quaternion::rotation_x(move1 * PI / 2.0)
736 * Quaternion::rotation_y(move1 * -PI / 3.0 + move2 * 1.5);
737 next.arm_control_r.position = Vec3::new(0.0, move1 * 1.0 + move2 * -1.0, 0.0);
738 },
739 Some("common.abilities.custom.terracotta_demolisher.drop") => {
740 let (move1base, move2base, move3) = match stage_section {
741 Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
742 Some(StageSection::Action) => (1.0, anim_time, 0.0),
743 Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
744 _ => (0.0, 0.0, 0.0),
745 };
746 let pullback = 1.0 - move3;
747 let move1 = move1base * pullback;
748 let move2 = move2base * pullback;
749 next.main.position = Vec3::new(-10.0, -8.0, 12.0);
750 next.main.orientation =
751 Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
752 next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1 + 4.0, s_a.hand.2);
753 next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1 + 4.0, s_a.hand.2);
754 next.hand_l.orientation = Quaternion::rotation_x(move1 * 1.5)
755 * Quaternion::rotation_y(move1 * -1.0 + move2 * 1.5);
756 next.hand_r.orientation = Quaternion::rotation_x(move1 * 1.5)
757 * Quaternion::rotation_y(move1 * 1.0 + move2 * -1.5);
758 next.upper_torso.orientation =
759 Quaternion::rotation_y(move1 * -0.1 + move2 * 0.1)
760 * Quaternion::rotation_z(move1 * -0.1 + move2 * 0.1);
761 next.foot_l.orientation = Quaternion::rotation_y(move1 * 0.3 + move2 * -0.3);
762 next.foot_r.orientation = Quaternion::rotation_y(move1 * 0.3 + move2 * -0.3);
763 },
764 Some("common.abilities.custom.harvester.explodingpumpkin") => {
765 let (move1, move2, move3) = match stage_section {
766 Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
767 Some(StageSection::Action) => (1.0, anim_time, 0.0),
768 Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
769 _ => (0.0, 0.0, 0.0),
770 };
771 next.control_l.position = Vec3::new(1.0, 2.0, 8.0);
772 next.control_r.position = Vec3::new(1.0, 1.0, -2.0);
773
774 next.control.position =
775 Vec3::new(-7.0, 0.0 + s_a.grip.0 / 1.0, -s_a.grip.0 / 0.8);
776
777 next.control_l.orientation =
778 Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_z(PI);
779 next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2)
780 * Quaternion::rotation_y(-1.0)
781 * Quaternion::rotation_z(0.0);
782
783 next.control.orientation =
784 Quaternion::rotation_x(-1.4) * Quaternion::rotation_y(-2.8);
785
786 next.head.orientation = Quaternion::rotation_x(move1 * 0.2);
787 next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
788 next.jaw.orientation = Quaternion::rotation_x(move2 * -0.3);
789
790 let twist = move1 * 0.8 + move3 * -0.8;
791 next.upper_torso.position = Vec3::new(
792 0.0,
793 s_a.upper_torso.0,
794 s_a.upper_torso.1 + move1 * 1.0 + move2 * -1.0,
795 );
796 next.upper_torso.orientation =
797 Quaternion::rotation_x(move1 * 0.8 + move2 * -1.1)
798 * Quaternion::rotation_z(twist * -0.2 + move1 * -0.1 + move2 * 0.3);
799
800 next.lower_torso.orientation =
801 Quaternion::rotation_x(move1 * -0.8 + move2 * 1.1)
802 * Quaternion::rotation_z(-twist + move1 * 0.4);
803
804 next.shoulder_l.position = Vec3::new(
805 -s_a.shoulder.0,
806 s_a.shoulder.1,
807 s_a.shoulder.2 - foothorir * 1.0,
808 );
809 next.shoulder_l.orientation = Quaternion::rotation_x(-0.4);
810
811 next.shoulder_r.position = Vec3::new(
812 s_a.shoulder.0 + move2 * -2.0,
813 s_a.shoulder.1,
814 s_a.shoulder.2,
815 );
816 next.shoulder_r.orientation = Quaternion::rotation_y(move1 * -PI / 2.0)
817 * Quaternion::rotation_x(move2 * 2.0)
818 * Quaternion::rotation_z(move1 * -PI / 2.0);
819
820 next.hand_r.position = Vec3::new(
821 -s_a.grip.1 + move1 * -2.0 + move2 * 8.0,
822 0.0 + move1 * 6.0,
823 s_a.grip.0 + move1 * 18.0 + move2 * -19.0,
824 );
825 next.hand_r.orientation = Quaternion::rotation_x(move1 * -3.0 + move2 * 3.0)
826 * Quaternion::rotation_y(move1 * 0.5 + move2 * -1.5)
827 * Quaternion::rotation_z(move1 * -1.5);
828
829 if speed == 0.0 {
830 next.leg_l.orientation = Quaternion::rotation_x(move1 * 0.8 + move2 * -0.8);
831
832 next.foot_l.position = Vec3::new(
833 -s_a.foot.0,
834 s_a.foot.1,
835 s_a.foot.2 + move1 * 4.0 + move2 * -4.0,
836 );
837 next.foot_l.orientation =
838 Quaternion::rotation_x(move1 * -0.6 + move2 * 0.6);
839 }
840 },
841 Some("common.abilities.vampire.strigoi.projectiles") => {
842 let (move1, move2, move3) = match stage_section {
843 Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
844 Some(StageSection::Action) => (1.0, anim_time, 0.0),
845 Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
846 _ => (0.0, 0.0, 0.0),
847 };
848 next.control_l.position = Vec3::new(1.0, 2.0, 8.0);
849 next.control_r.position = Vec3::new(1.0, 1.0, -2.0);
850
851 next.control.position =
852 Vec3::new(-7.0, 0.0 + s_a.grip.0 / 1.0, -s_a.grip.0 / 0.8);
853
854 next.control_l.orientation =
855 Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_z(PI);
856 next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2)
857 * Quaternion::rotation_y(-1.0)
858 * Quaternion::rotation_z(0.0);
859
860 next.control.orientation =
861 Quaternion::rotation_x(-1.4) * Quaternion::rotation_y(-2.8);
862
863 next.head.orientation = Quaternion::rotation_x(move1 * 0.2);
864 next.head.position = Vec3::new(
865 0.0 + move1 * 32.0 - move2 * 32.0,
866 s_a.head.0 - move1 * 2.0 + move2 * 2.0,
867 s_a.head.1 - move1 * 8.0 + move2 * 8.0,
868 );
869
870 next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
871 next.jaw.orientation = Quaternion::rotation_x(move2 * -0.3);
872
873 let twist = move1 * 0.8 + move3 * -0.8;
874 next.upper_torso.position = Vec3::new(
875 0.0,
876 s_a.upper_torso.0,
877 s_a.upper_torso.1 + move1 * 1.0 + move2 * -1.0,
878 );
879 next.upper_torso.orientation =
880 Quaternion::rotation_x(move1 * 0.8 + move2 * -1.1)
881 * Quaternion::rotation_z(twist * -0.2 + move1 * -0.1 + move2 * 0.3);
882
883 next.lower_torso.orientation =
884 Quaternion::rotation_x(move1 * -0.8 + move2 * 1.1)
885 * Quaternion::rotation_z(-twist + move1 * 0.4);
886
887 next.shoulder_l.position = Vec3::new(
888 -s_a.shoulder.0,
889 s_a.shoulder.1,
890 s_a.shoulder.2 - foothorir * 1.0,
891 );
892 next.shoulder_l.orientation = Quaternion::rotation_x(-0.4);
893
894 next.shoulder_r.position = Vec3::new(
895 s_a.shoulder.0 + move2 * -2.0,
896 s_a.shoulder.1,
897 s_a.shoulder.2,
898 );
899 next.shoulder_r.orientation = Quaternion::rotation_y(move1 * -PI / 2.0)
900 * Quaternion::rotation_x(move2 * 2.0)
901 * Quaternion::rotation_z(move1 * -PI / 2.0);
902
903 next.hand_r.position = Vec3::new(
904 -s_a.grip.1 + move1 * -2.0 + move2 * 8.0,
905 0.0 + move1 * 6.0,
906 s_a.grip.0 + move1 * 18.0 + move2 * -19.0,
907 );
908 next.hand_r.orientation = Quaternion::rotation_x(move1 * -3.0 + move2 * 3.0)
909 * Quaternion::rotation_y(move1 * 0.5 + move2 * -1.5)
910 * Quaternion::rotation_z(move1 * -1.5);
911
912 if speed == 0.0 {
913 next.leg_l.orientation = Quaternion::rotation_x(move1 * 0.8 + move2 * -0.8);
914
915 next.foot_l.position = Vec3::new(
916 -s_a.foot.0,
917 s_a.foot.1,
918 s_a.foot.2 + move1 * 4.0 + move2 * -4.0,
919 );
920 next.foot_l.orientation =
921 Quaternion::rotation_x(move1 * -0.6 + move2 * 0.6);
922 }
923 },
924 _ => {},
925 },
926 _ => {},
927 }
928
929 next
930 }
931}