Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
paratroopa.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects.h"
3#include "battle/battle.h"
4#include "script_api/battle.h"
5#include "sprite/npc/KoopaTroopa.h"
6#include "sprite/npc/ParaTroopa.h"
7
8#define NAMESPACE A(paratroopa)
9
10extern s32 N(DownedAnims)[];
11extern s32 N(FlyingAnims)[];
12extern s32 N(WingAnims)[];
13extern EvtScript N(EVS_Flying_Init);
14extern EvtScript N(EVS_Flying_Idle);
15extern EvtScript N(EVS_Flying_TakeTurn);
16extern EvtScript N(EVS_Flying_HandleEvent);
17extern EvtScript N(EVS_KnockDown);
18
19extern EvtScript N(EVS_Downed_Init);
20extern EvtScript N(EVS_Downed_Idle);
21extern EvtScript N(EVS_Downed_TakeTurn);
22extern EvtScript N(EVS_Downed_HandleEvent);
23
26
27enum N(ActorPartIDs) {
28 PRT_DOWNED = 1,
29 PRT_FLYING = 2,
30 PRT_DUMMY_WINGS = 3,
31};
32
33enum N(ActorVars) {
34 AVAR_AerialFlip = 0, // TRUE if current hit should trigger a flip event when KnockDown is done
35 AVAR_IsFlipped = 8,
36 AVAR_FlippedTurns = 9,
37};
38
39enum N(ActorParams) {
40 DMG_AIR_TACKLE = 1,
41 DMG_SHELL_TOSS = 1,
42};
43
44s32 N(DownedDefense)[] = {
47 ELEMENT_JUMP, 1,
51};
52
53s32 N(FlyingDefense)[] = {
56};
57
58s32 N(FlippedDefense)[] = {
61};
62
63s32 N(DownedStatusTable)[] = {
74 STATUS_KEY_STOP, 100,
86};
87
88s32 N(FlyingStatusTable)[] = {
99 STATUS_KEY_STOP, 100,
111};
112
113ActorPartBlueprint N(ActorParts)[] = {
114 {
116 .index = PRT_DOWNED,
117 .posOffset = { 0, 0, 0 },
118 .targetOffset = { -2, 36 },
119 .opacity = 255,
120 .idleAnimations = N(DownedAnims),
121 .defenseTable = N(DownedDefense),
122 .eventFlags = ACTOR_EVENT_FLAG_FLIPABLE,
123 .elementImmunityFlags = 0,
124 .projectileTargetOffset = { 0, -7 },
125 },
126 {
128 .index = PRT_FLYING,
129 .posOffset = { 0, 0, 0 },
130 .targetOffset = { -4, 36 },
131 .opacity = 255,
132 .idleAnimations = N(FlyingAnims),
133 .defenseTable = N(FlyingDefense),
134 .eventFlags = ACTOR_EVENT_FLAG_GROUNDABLE,
135 .elementImmunityFlags = 0,
136 .projectileTargetOffset = { 2, -14 },
137 },
138 {
140 .index = PRT_DUMMY_WINGS,
141 .posOffset = { 0, 0, 0 },
142 .targetOffset = { 0, 32 },
143 .opacity = 255,
144 .idleAnimations = N(WingAnims),
145 .defenseTable = N(DownedDefense),
146 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
147 .elementImmunityFlags = 0,
148 .projectileTargetOffset = { 0, -10 },
149 },
150};
151
152ActorBlueprint NAMESPACE = {
153 .flags = ACTOR_FLAG_FLYING,
154 .type = ACTOR_TYPE_PARATROOPA,
155 .level = ACTOR_LEVEL_PARATROOPA,
156 .maxHP = 4,
157 .partCount = ARRAY_COUNT(N(ActorParts)),
158 .partsData = N(ActorParts),
159 .initScript = &N(EVS_Flying_Init),
160 .statusTable = N(FlyingStatusTable),
161 .escapeChance = 60,
162 .airLiftChance = 95,
163 .hurricaneChance = 100,
164 .spookChance = 90,
165 .upAndAwayChance = 95,
166 .spinSmashReq = 0,
167 .powerBounceChance = 90,
168 .coinReward = 1,
169 .size = { 50, 38 },
170 .healthBarOffset = { 0, 0 },
171 .statusIconOffset = { -10, 29 },
172 .statusTextOffset = { 8, 30 },
173};
174
175s32 N(FlyingAnims)[] = {
176 STATUS_KEY_NORMAL, ANIM_ParaTroopa_Idle,
177 STATUS_KEY_STONE, ANIM_ParaTroopa_Still,
178 STATUS_KEY_SLEEP, ANIM_ParaTroopa_Sleep,
179 STATUS_KEY_POISON, ANIM_ParaTroopa_Still,
180 STATUS_KEY_STOP, ANIM_ParaTroopa_Still,
181 STATUS_KEY_STATIC, ANIM_ParaTroopa_Idle,
182 STATUS_KEY_PARALYZE, ANIM_ParaTroopa_Still,
183 STATUS_KEY_DIZZY, ANIM_ParaTroopa_Stunned,
184 STATUS_KEY_FEAR, ANIM_ParaTroopa_Stunned,
186};
187
188s32 N(FlyingShuffleAnims)[] = {
189 STATUS_KEY_NORMAL, ANIM_ParaTroopa_Idle,
190 STATUS_KEY_STONE, ANIM_ParaTroopa_Still,
191 STATUS_KEY_SLEEP, ANIM_ParaTroopa_Sleep,
192 STATUS_KEY_POISON, ANIM_ParaTroopa_Still,
193 STATUS_KEY_STOP, ANIM_ParaTroopa_Still,
194 STATUS_KEY_STATIC, ANIM_ParaTroopa_Idle,
195 STATUS_KEY_PARALYZE, ANIM_ParaTroopa_Still,
196 STATUS_KEY_DIZZY, ANIM_ParaTroopa_Stunned,
197 STATUS_KEY_FEAR, ANIM_ParaTroopa_Stunned,
199};
200
201s32 N(WingAnims)[] = {
202 STATUS_KEY_NORMAL, ANIM_ParaTroopa_WingsStill,
203 STATUS_KEY_STONE, ANIM_ParaTroopa_Still,
204 STATUS_KEY_SLEEP, ANIM_ParaTroopa_Sleep,
205 STATUS_KEY_POISON, ANIM_ParaTroopa_Still,
206 STATUS_KEY_STOP, ANIM_ParaTroopa_Still,
207 STATUS_KEY_STATIC, ANIM_ParaTroopa_WingsStill,
208 STATUS_KEY_PARALYZE, ANIM_ParaTroopa_Still,
209 STATUS_KEY_DIZZY, ANIM_ParaTroopa_Stunned,
210 STATUS_KEY_FEAR, ANIM_ParaTroopa_Stunned,
212};
213
214EvtScript N(EVS_Flying_HandlePhase) = {
215 Call(SetActorVar, ACTOR_SELF, AVAR_AerialFlip, FALSE)
216 Return
217 End
218};
219
220EvtScript N(EVS_Flying_Init) = {
221 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_Flying_TakeTurn)))
222 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Flying_Idle)))
223 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_Flying_HandleEvent)))
224 Call(BindHandlePhase, ACTOR_SELF, Ref(N(EVS_Flying_HandlePhase)))
225 Call(SetActorVar, ACTOR_SELF, AVAR_AerialFlip, FALSE)
226 Return
227 End
228};
229
230EvtScript N(EVS_Flying_UpdateTargetOffsets) = {
232 Call(SetTargetOffset, ACTOR_SELF, PRT_FLYING, 0, 25)
233 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_FLYING, 3, -6)
234 Call(N(SetAbsoluteStatusOffsets), -19, 25, 4, 28)
235 Else
236 Call(SetTargetOffset, ACTOR_SELF, PRT_FLYING, -2, 36)
237 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_FLYING, 0, -7)
238 Call(N(SetAbsoluteStatusOffsets), -10, 29, 8, 30)
239 EndIf
240 Return
241 End
242};
243
244EvtScript N(EVS_Flying_Idle) = {
245 Label(10)
246 Call(RandInt, 80, LVar0)
247 Add(LVar0, 80)
248 Loop(LVar0)
249 Label(0)
250 Call(GetStatusFlags, ACTOR_SELF, LVar1)
251 ExecWait(N(EVS_Flying_UpdateTargetOffsets))
253 Wait(1)
254 Goto(0)
255 EndIf
256 Wait(1)
257 EndLoop
258 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
259 Add(LVar0, 5)
260 Call(SetActorIdleSpeed, ACTOR_SELF, Float(0.6))
261 Call(SetIdleAnimations, ACTOR_SELF, PRT_FLYING, Ref(N(FlyingShuffleAnims)))
262 Call(SetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
263 Call(IdleFlyToGoal, ACTOR_SELF, 0, -5, EASING_LINEAR)
264 Call(SetIdleAnimations, ACTOR_SELF, PRT_DOWNED, Ref(N(FlyingAnims)))
265 Loop(20)
266 Label(1)
267 Call(GetStatusFlags, ACTOR_SELF, LVar1)
268 ExecWait(N(EVS_Flying_UpdateTargetOffsets))
270 Wait(1)
271 Goto(1)
272 EndIf
273 Wait(1)
274 EndLoop
275 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
276 Sub(LVar0, 5)
277 Call(SetActorIdleSpeed, ACTOR_SELF, Float(0.6))
278 Call(SetIdleAnimations, ACTOR_SELF, PRT_FLYING, Ref(N(FlyingShuffleAnims)))
279 Call(SetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
280 Call(IdleFlyToGoal, ACTOR_SELF, 0, -5, EASING_LINEAR)
281 Call(SetIdleAnimations, ACTOR_SELF, PRT_FLYING, Ref(N(FlyingAnims)))
282 Loop(40)
283 Label(2)
284 Call(GetStatusFlags, ACTOR_SELF, LVar1)
285 ExecWait(N(EVS_Flying_UpdateTargetOffsets))
287 Wait(1)
288 Goto(2)
289 EndIf
290 Wait(1)
291 EndLoop
292 Goto(10)
293 Return
294 End
295};
296
297EvtScript N(EVS_FlyHome) = {
298 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_ParaTroopa_Run)
299 Call(SetGoalToHome, ACTOR_SELF)
300 Call(SetActorSpeed, ACTOR_SELF, Float(8.0))
301 Call(FlyToGoal, ACTOR_SELF, 0, 1, EASING_SIN_OUT)
302 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_ParaTroopa_Idle)
303 Return
304 End
305};
306
307EvtScript N(EVS_Flying_HandleEvent) = {
308 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
309 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
310 Call(GetLastEvent, ACTOR_SELF, LVar0)
313 Call(SetActorVar, ACTOR_SELF, AVAR_AerialFlip, TRUE)
314 SetConst(LVar0, PRT_FLYING)
315 SetConst(LVar1, ANIM_ParaTroopa_Hurt)
318 SetConst(LVar0, PRT_FLYING)
319 SetConst(LVar1, ANIM_ParaTroopa_Hurt)
321 Call(GetBattlePhase, LVar0)
323 Call(GetEncounterTrigger, LVar0)
325 ExecWait(N(EVS_KnockDown))
326 EndIf
327 EndIf
329 SetConst(LVar0, PRT_FLYING)
330 SetConst(LVar1, ANIM_ParaTroopa_Hurt)
333 SetConst(LVar0, PRT_FLYING)
334 SetConst(LVar1, ANIM_ParaTroopa_Hurt)
336 SetConst(LVar0, PRT_FLYING)
337 SetConst(LVar1, ANIM_ParaTroopa_HurtStill)
339 Return
341 SetConst(LVar0, PRT_FLYING)
342 SetConst(LVar1, ANIM_ParaTroopa_BurnHurt)
343 SetConst(LVar2, ANIM_ParaTroopa_BurnStill)
346 SetConst(LVar0, PRT_FLYING)
347 SetConst(LVar1, ANIM_ParaTroopa_BurnHurt)
348 SetConst(LVar2, ANIM_ParaTroopa_BurnStill)
350 SetConst(LVar0, PRT_FLYING)
351 SetConst(LVar1, ANIM_ParaTroopa_BurnStill)
353 Return
355 SetConst(LVar0, PRT_FLYING)
356 SetConst(LVar1, ANIM_ParaTroopa_Hurt)
358 ExecWait(N(EVS_KnockDown))
360 SetConst(LVar0, PRT_DOWNED)
361 SetConst(LVar1, ANIM_ParaTroopa_BurnHurt)
362 SetConst(LVar1, ANIM_ParaTroopa_BurnStill)
364 ExecWait(N(EVS_KnockDown))
366 SetConst(LVar0, PRT_DOWNED)
367 SetConst(LVar1, ANIM_ParaTroopa_Hurt)
369 SetConst(LVar0, PRT_DOWNED)
370 SetConst(LVar1, ANIM_ParaTroopa_HurtStill)
372 ExecWait(N(EVS_FlyHome))
374 SetConst(LVar0, PRT_FLYING)
375 SetConst(LVar1, ANIM_ParaTroopa_Hurt)
377 SetConst(LVar0, PRT_FLYING)
378 SetConst(LVar1, ANIM_ParaTroopa_HurtStill)
380 Return
382 Call(SetActorVar, ACTOR_SELF, AVAR_AerialFlip, TRUE)
383 SetConst(LVar0, PRT_FLYING)
384 SetConst(LVar1, ANIM_ParaTroopa_ShellEnter)
388 SetConst(LVar0, PRT_FLYING)
389 SetConst(LVar1, ANIM_ParaTroopa_ShellEnter)
391 Call(GetBattlePhase, LVar0)
393 Call(GetEncounterTrigger, LVar0)
395 ExecWait(N(EVS_KnockDown))
396 EndIf
397 EndIf
400 SetConst(LVar0, PRT_FLYING)
401 SetConst(LVar1, ANIM_ParaTroopa_Hurt)
403 Wait(10)
404 SetConst(LVar0, PRT_FLYING)
405 SetConst(LVar1, ANIM_ParaTroopa_HurtStill)
407 Return
409 Call(SetActorPos, ACTOR_SELF, 20, 0, 0)
410 Call(HPBarToCurrent, ACTOR_SELF)
412 ExecWait(N(EVS_FlyHome))
413 Call(HPBarToHome, ACTOR_SELF)
415 SetConst(LVar0, PRT_FLYING)
416 SetConst(LVar1, ANIM_ParaTroopa_Idle)
419 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_FLYING, FALSE)
420 SetConst(LVar0, PRT_FLYING)
421 SetConst(LVar1, ANIM_ParaTroopa_Run)
422 SetConst(LVar2, ANIM_ParaTroopa_Hurt)
424 Return
426 SetConst(LVar0, PRT_FLYING)
427 SetConst(LVar1, ANIM_ParaTroopa_Run)
430 SetConst(LVar0, PRT_FLYING)
431 SetConst(LVar1, ANIM_ParaTroopa_Hurt)
433 Return
436 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_RESTART)
437 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
438 Return
439 End
440};
441
442EvtScript N(EVS_Flying_TakeTurn) = {
443 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
444 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
445 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
446 Call(SetGoalToTarget, ACTOR_SELF)
447 Call(UseBattleCamPreset, BTL_CAM_ACTOR_TARGET_MIDPOINT)
448 Call(BattleCamTargetActor, ACTOR_SELF)
449 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
450 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_ParaTroopa_Run)
451 Call(SetGoalToTarget, ACTOR_SELF)
452 Call(AddGoalPos, ACTOR_SELF, 40, 30, 0)
453 Call(SetActorSpeed, ACTOR_SELF, Float(7.0))
454 Call(FlyToGoal, ACTOR_SELF, 0, -16, EASING_LINEAR)
455 Call(UseBattleCamPresetImmediately, BTL_CAM_INTERRUPT)
456 Wait(5)
457 Call(EnemyTestTarget, ACTOR_SELF, LVar0, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS)
461 Set(LVarA, LVar0)
462 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_PARAGOOMBA_PREDIVE)
464 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_ParaTroopa_Windup)
465 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
466 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
467 Call(AddGoalPos, ACTOR_SELF, 6, 6, 0)
468 Call(SetActorSpeed, ACTOR_SELF, Float(2.0))
469 Call(FlyToGoal, ACTOR_SELF, 0, 0, EASING_LINEAR)
470 Wait(6)
471 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_PARAGOOMBA_DIVE)
473 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
474 Sub(LVar0, 25)
475 Set(LVar1, 0)
476 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
477 Call(SetActorSpeed, ACTOR_SELF, Float(10.0))
478 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_ParaTroopa_ShellDive)
479 Call(FlyToGoal, ACTOR_SELF, 0, 0, EASING_LINEAR)
480 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
481 Sub(LVar0, 30)
482 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
483 Call(SetActorJumpGravity, ACTOR_SELF, Float(4.0))
484 Thread
485 Call(SetActorRotationOffset, ACTOR_SELF, 0, 10, 0)
486 Set(LVar0, 0)
487 Loop(8)
488 Add(LVar0, 90)
489 IfGe(LVar0, 360)
490 Sub(LVar0, 360)
491 EndIf
492 Call(SetActorRotation, ACTOR_SELF, 0, 0, LVar0)
493 Wait(1)
494 EndLoop
495 Call(SetActorRotation, ACTOR_SELF, 0, 0, 0)
496 Call(SetActorRotationOffset, ACTOR_SELF, 0, -10, 0)
498 Call(JumpToGoal, ACTOR_SELF, 6, FALSE, TRUE, FALSE)
499 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
500 Sub(LVar0, 30)
501 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
502 Call(SetActorJumpGravity, ACTOR_SELF, Float(4.0))
503 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_ParaTroopa_Hurt)
504 Call(JumpToGoal, ACTOR_SELF, 6, FALSE, TRUE, FALSE)
505 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
506 Sub(LVar0, 30)
507 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
508 Call(SetActorJumpGravity, ACTOR_SELF, Float(4.0))
509 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_ParaTroopa_Hurt)
510 Call(JumpToGoal, ACTOR_SELF, 6, FALSE, TRUE, FALSE)
512 Call(EnemyTestTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
513 EndIf
514 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
515 Add(LVar1, 30)
516 Call(SetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
517 Wait(20)
518 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
519 Call(YieldTurn)
520 Call(ResetAllActorSounds, ACTOR_SELF)
521 Call(AddActorDecoration, ACTOR_SELF, PRT_FLYING, 0, ACTOR_DECORATION_SWEAT)
522 Call(SetActorYaw, ACTOR_SELF, 180)
523 ExecWait(N(EVS_FlyHome))
524 Call(SetActorYaw, ACTOR_SELF, 0)
525 Call(RemoveActorDecoration, ACTOR_SELF, PRT_FLYING, 0)
526 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_RESTART)
527 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
528 Return
531 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_PARAGOOMBA_PREDIVE)
533 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_ParaTroopa_Windup)
534 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
535 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
536 Call(AddGoalPos, ACTOR_SELF, 6, 6, 0)
537 Call(SetActorSpeed, ACTOR_SELF, Float(2.0))
538 Call(FlyToGoal, ACTOR_SELF, 0, 0, EASING_LINEAR)
539 Wait(6)
540 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_PARAGOOMBA_DIVE)
542 Call(SetGoalToTarget, ACTOR_SELF)
543 Call(SetActorSpeed, ACTOR_SELF, Float(10.0))
544 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_ParaTroopa_ShellDive)
545 Call(FlyToGoal, ACTOR_SELF, 0, 0, EASING_LINEAR)
546 Wait(2)
547 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, 0, SUPPRESS_EVENT_ALL, 0, DMG_AIR_TACKLE, BS_FLAGS1_TRIGGER_EVENTS)
551 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
552 Call(SetGoalToTarget, ACTOR_SELF)
553 Call(AddGoalPos, ACTOR_SELF, 40, 30, 0)
554 Call(SetActorSpeed, ACTOR_SELF, Float(6.0))
555 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_ParaTroopa_ShellHit)
556 Thread
557 Call(SetActorRotationOffset, ACTOR_SELF, 0, 10, 0)
558 Set(LVar0, 0)
559 Loop(12)
560 Sub(LVar0, 90)
561 IfLt(LVar0, 0)
562 Add(LVar0, 360)
563 EndIf
564 Call(SetActorRotation, ACTOR_SELF, 0, 0, LVar0)
565 Wait(1)
566 EndLoop
567 Call(SetActorRotation, ACTOR_SELF, 0, 0, 0)
568 Call(SetActorRotationOffset, ACTOR_SELF, 0, -10, 0)
569 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_ParaTroopa_Idle)
571 Call(FlyToGoal, ACTOR_SELF, 0, 30, EASING_LINEAR)
572 Wait(10)
573 Call(YieldTurn)
574 Call(ResetAllActorSounds, ACTOR_SELF)
575 ExecWait(N(EVS_FlyHome))
578 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_RESTART)
579 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
580 Return
581 End
582};
583
584EvtScript N(EVS_KnockDown) = {
585 Call(SetPartDispOffset, ACTOR_SELF, PRT_FLYING, 0, 0, 0)
586 Call(HideHealthBar, ACTOR_SELF)
590 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
591 Add(LVar1, 8)
592 Sub(LVar2, 2)
593 Call(SetPartPos, ACTOR_SELF, PRT_DUMMY_WINGS, LVar0, LVar1, LVar2)
594 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_Hurt)
596 Call(GetActorVar, ACTOR_SELF, AVAR_AerialFlip, LVarA)
598 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
599 Set(LVar1, 0)
600 Call(SetActorJumpGravity, ACTOR_SELF, Float(0.8))
601 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
602 Call(JumpToGoal, ACTOR_SELF, 15, FALSE, TRUE, FALSE)
603 Call(N(StartRumbleWithParams), 128, 7)
604 Thread
605 Call(ShakeCam, CAM_BATTLE, 0, 5, Float(0.3))
607 Call(ResetActorSounds, ACTOR_SELF, ACTOR_SOUND_JUMP)
608 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
609 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
610 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
611 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
612 Loop(10)
613 Call(SetPartFlagBits, ACTOR_SELF, PRT_DUMMY_WINGS, ACTOR_PART_FLAG_INVISIBLE, TRUE)
614 Wait(1)
615 Call(SetPartFlagBits, ACTOR_SELF, PRT_DUMMY_WINGS, ACTOR_PART_FLAG_INVISIBLE, FALSE)
616 Wait(1)
617 EndLoop
618 Call(SetPartFlagBits, ACTOR_SELF, PRT_DUMMY_WINGS, ACTOR_PART_FLAG_INVISIBLE, TRUE)
619 Else
620 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
621 Set(LVar1, 0)
622 Call(SetActorJumpGravity, ACTOR_SELF, Float(0.8))
623 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
624 Call(JumpToGoal, ACTOR_SELF, 15, FALSE, TRUE, FALSE)
625 Thread
626 Loop(10)
627 Call(SetPartFlagBits, ACTOR_SELF, PRT_DUMMY_WINGS, ACTOR_PART_FLAG_INVISIBLE, TRUE)
628 Wait(1)
629 Call(SetPartFlagBits, ACTOR_SELF, PRT_DUMMY_WINGS, ACTOR_PART_FLAG_INVISIBLE, FALSE)
630 Wait(1)
631 EndLoop
632 Call(SetPartFlagBits, ACTOR_SELF, PRT_DUMMY_WINGS, ACTOR_PART_FLAG_INVISIBLE, TRUE)
634 Call(N(StartRumbleWithParams), 150, 7)
635 Thread
636 Call(ShakeCam, CAM_BATTLE, 0, 5, Float(0.3))
638 Call(ResetActorSounds, ACTOR_SELF, ACTOR_SOUND_JUMP)
639 EndIf
640 Call(GetIndexFromHome, ACTOR_SELF, LVar0)
641 Mod(LVar0, 4)
642 Call(SetGoalToIndex, ACTOR_SELF, LVar0)
643 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
644 Call(SetHomePos, ACTOR_SELF, LVar0, LVar1, LVar2)
645 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_Idle)
646 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_FLYING, FALSE)
647 Call(SetStatusTable, ACTOR_SELF, Ref(N(DownedStatusTable)))
648 Call(BindHandlePhase, ACTOR_SELF, 0)
649 ExecWait(N(EVS_Downed_Init))
650 Call(SetActorType, ACTOR_SELF, ACTOR_TYPE_KOOPA_TROOPA)
651 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_TYPE_CHANGED, TRUE)
652 Call(HPBarToHome, ACTOR_SELF)
653 Call(ResetAllActorSounds, ACTOR_SELF)
655 Call(DispatchEvent, ACTOR_SELF, EVENT_FLIP_TRIGGER)
656 EndIf
657 Return
658 End
659};
660
661// everything below this point is shared with Koopa Troopa, but not in a manner
662// that can be cleanly separated
663
664s32 N(DownedAnims)[] = {
665 STATUS_KEY_NORMAL, ANIM_KoopaTroopa_Idle,
666 STATUS_KEY_STONE, ANIM_KoopaTroopa_Still,
667 STATUS_KEY_SLEEP, ANIM_KoopaTroopa_Sleep,
668 STATUS_KEY_POISON, ANIM_KoopaTroopa_Idle,
669 STATUS_KEY_STOP, ANIM_KoopaTroopa_Still,
670 STATUS_KEY_STATIC, ANIM_KoopaTroopa_Idle,
671 STATUS_KEY_PARALYZE, ANIM_KoopaTroopa_Still,
672 STATUS_KEY_DIZZY, ANIM_KoopaTroopa_Stunned,
673 STATUS_KEY_FEAR, ANIM_KoopaTroopa_Stunned,
675};
676
677s32 N(DownedShuffleAnims)[] = {
678 STATUS_KEY_NORMAL, ANIM_KoopaTroopa_Walk,
679 STATUS_KEY_STONE, ANIM_KoopaTroopa_Still,
680 STATUS_KEY_SLEEP, ANIM_KoopaTroopa_Sleep,
681 STATUS_KEY_POISON, ANIM_KoopaTroopa_Walk,
682 STATUS_KEY_STOP, ANIM_KoopaTroopa_Still,
683 STATUS_KEY_STATIC, ANIM_KoopaTroopa_Walk,
684 STATUS_KEY_PARALYZE, ANIM_KoopaTroopa_Still,
685 STATUS_KEY_DIZZY, ANIM_KoopaTroopa_Stunned,
686 STATUS_KEY_FEAR, ANIM_KoopaTroopa_Stunned,
688};
689
690s32 N(DownedFlippedAnims)[] = {
691 STATUS_KEY_NORMAL, ANIM_KoopaTroopa_ToppleStruggle,
692 STATUS_KEY_STONE, ANIM_KoopaTroopa_ToppleStill,
693 STATUS_KEY_SLEEP, ANIM_KoopaTroopa_ToppleSleep,
694 STATUS_KEY_POISON, ANIM_KoopaTroopa_ToppleStruggle,
695 STATUS_KEY_STOP, ANIM_KoopaTroopa_ToppleStill,
696 STATUS_KEY_STATIC, ANIM_KoopaTroopa_ToppleStruggle,
697 STATUS_KEY_PARALYZE, ANIM_KoopaTroopa_ToppleStill,
698 STATUS_KEY_DIZZY, ANIM_KoopaTroopa_ToppleStunned,
699 STATUS_KEY_FEAR, ANIM_KoopaTroopa_ToppleStunned,
701};
702
703EvtScript N(EVS_Downed_Init) = {
704 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_Downed_TakeTurn)))
705 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Downed_Idle)))
706 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_Downed_HandleEvent)))
707 Call(SetActorVar, ACTOR_SELF, AVAR_IsFlipped, FALSE)
708 Return
709 End
710};
711
712EvtScript N(EVS_Downed_UpdateTargetOffsets) = {
714 CaseEq(0)
716 Call(SetTargetOffset, ACTOR_SELF, PRT_DOWNED, -5, 15)
717 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_DOWNED, 0, 0)
718 Call(N(SetAbsoluteStatusOffsets), -10, 20, 10, 20)
719 Else
720 Call(SetTargetOffset, ACTOR_SELF, PRT_DOWNED, -4, 32)
721 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_DOWNED, -1, -4)
722 Call(N(SetAbsoluteStatusOffsets), -15, 32, 5, 32)
723 EndIf
724 CaseEq(1)
725 Call(SetTargetOffset, ACTOR_SELF, PRT_DOWNED, -5, 15)
726 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_DOWNED, 0, 0)
727 Call(N(SetAbsoluteStatusOffsets), -10, 20, 10, 20)
729 Return
730 End
731};
732
733EvtScript N(EVS_Downed_Idle) = {
734 Label(0)
735 Call(RandInt, 80, LVarA)
736 Add(LVarA, 80)
737 Loop(LVarA)
738 Label(1)
739 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
740 Call(GetStatusFlags, ACTOR_SELF, LVar1)
741 ExecWait(N(EVS_Downed_UpdateTargetOffsets))
742 IfEq(LVar0, 1)
743 Wait(1)
744 Goto(1)
745 EndIf
747 Wait(1)
748 Goto(1)
749 EndIf
750 Wait(1)
751 EndLoop
752 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
753 Add(LVar0, 5)
754 Call(SetActorIdleSpeed, ACTOR_SELF, Float(1.0))
755 Call(SetIdleAnimations, ACTOR_SELF, PRT_DOWNED, Ref(N(DownedShuffleAnims)))
756 Call(SetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
757 Call(IdleRunToGoal, ACTOR_SELF, 0)
758 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
760 CaseEq(0)
761 Call(SetIdleAnimations, ACTOR_SELF, PRT_DOWNED, Ref(N(DownedAnims)))
762 CaseEq(1)
763 Call(SetIdleAnimations, ACTOR_SELF, PRT_DOWNED, Ref(N(DownedFlippedAnims)))
765 Loop(20)
766 Label(2)
767 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
768 Call(GetStatusFlags, ACTOR_SELF, LVar1)
769 ExecWait(N(EVS_Downed_UpdateTargetOffsets))
770 IfEq(LVar0, 1)
771 Wait(1)
772 Goto(2)
773 EndIf
775 Wait(1)
776 Goto(2)
777 EndIf
778 Wait(1)
779 EndLoop
780 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
781 Sub(LVar0, 5)
782 Call(SetActorIdleSpeed, ACTOR_SELF, Float(1.0))
783 Call(SetIdleAnimations, ACTOR_SELF, PRT_DOWNED, Ref(N(DownedShuffleAnims)))
784 Call(SetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
785 Call(IdleRunToGoal, ACTOR_SELF, 0)
786 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
788 CaseEq(0)
789 Call(SetIdleAnimations, ACTOR_SELF, PRT_DOWNED, Ref(N(DownedAnims)))
790 CaseEq(1)
791 Call(SetIdleAnimations, ACTOR_SELF, PRT_DOWNED, Ref(N(DownedFlippedAnims)))
793 Loop(80)
794 Label(3)
795 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
796 Call(GetStatusFlags, ACTOR_SELF, LVar1)
797 ExecWait(N(EVS_Downed_UpdateTargetOffsets))
798 IfEq(LVar0, 1)
799 Wait(1)
800 Goto(3)
801 EndIf
803 Wait(1)
804 Goto(3)
805 EndIf
806 Wait(1)
807 EndLoop
808 Goto(0)
809 Return
810 End
811};
812
813s32 N(FlipPosOffsets)[] = { 9, 16, 22, 26, 30, 32, 33, 32, 30, 26, 22, 16, 9, 0, 4, 6, 7, 6, 4, 0, 2, 0 };
814
815EvtScript N(EVS_Downed_HandleEvent) = {
816 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
817 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
818 Call(SetActorYaw, ACTOR_SELF, 0)
819 Call(GetLastEvent, ACTOR_SELF, LVar0)
823 SetConst(LVar0, PRT_DOWNED)
824 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
828 SetConst(LVar0, PRT_DOWNED)
829 SetConst(LVar1, ANIM_KoopaTroopa_BurnHurt)
830 SetConst(LVar2, ANIM_KoopaTroopa_BurnStill)
833 SetConst(LVar0, PRT_DOWNED)
834 SetConst(LVar1, ANIM_KoopaTroopa_BurnHurt)
835 SetConst(LVar2, ANIM_KoopaTroopa_BurnStill)
837 SetConst(LVar0, PRT_DOWNED)
838 SetConst(LVar1, ANIM_KoopaTroopa_BurnStill)
840 Return
842 SetConst(LVar0, PRT_DOWNED)
843 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
846 SetConst(LVar0, PRT_DOWNED)
847 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
849 SetConst(LVar0, PRT_DOWNED)
850 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
852 Return
854 Call(SetActorVar, ACTOR_SELF, AVAR_IsFlipped, TRUE)
855 Call(SetActorVar, ACTOR_SELF, AVAR_FlippedTurns, 2)
856 Call(SetDefenseTable, ACTOR_SELF, PRT_DOWNED, Ref(N(FlippedDefense)))
857 Call(SetIdleAnimations, ACTOR_SELF, PRT_DOWNED, Ref(N(DownedFlippedAnims)))
858 Call(SetTargetOffset, ACTOR_SELF, PRT_DOWNED, -5, 15)
859 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_DOWNED, 0, 0)
860 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_FLIPPED, TRUE)
861 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_Hurt)
862 Call(GetStatusFlags, ACTOR_SELF, LVarA)
863 Call(SetActorRotationOffset, ACTOR_SELF, 0, 12, 0)
865 Wait(4)
866 Call(SetActorRotation, ACTOR_SELF, 0, 0, 30)
867 Wait(1)
868 Call(SetActorRotation, ACTOR_SELF, 0, 0, 0)
869 Wait(1)
870 Call(SetActorRotation, ACTOR_SELF, 0, 0, -30)
871 Wait(1)
872 Call(SetActorRotation, ACTOR_SELF, 0, 0, -60)
873 Wait(1)
874 Call(SetActorRotation, ACTOR_SELF, 0, 0, -75)
875 Wait(1)
877 UseBuf(Ref(N(FlipPosOffsets)))
878 Loop(ARRAY_COUNT(N(FlipPosOffsets)))
880 Call(SetActorDispOffset, ACTOR_SELF, 0, LVar0, 0)
881 Wait(1)
882 EndLoop
883 Call(SetActorRotationOffset, ACTOR_SELF, 0, 0, 0)
884 Call(SetActorRotation, ACTOR_SELF, 0, 0, 0)
885 Call(SetActorDispOffset, ACTOR_SELF, 0, 0, 0)
886 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_ToppleStruggle)
888 SetConst(LVar0, PRT_DOWNED)
889 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
891 SetConst(LVar0, PRT_DOWNED)
892 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
894 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
895 SetConst(LVar0, PRT_DOWNED)
896 SetConst(LVar1, ANIM_KoopaTroopa_Run)
898 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.6))
899 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
901 SetConst(LVar0, PRT_DOWNED)
902 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
904 SetConst(LVar0, PRT_DOWNED)
905 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
907 Return
910 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
911 IfEq(LVar0, 0)
912 SetConst(LVar0, PRT_DOWNED)
913 SetConst(LVar1, ANIM_KoopaTroopa_ShellEnter)
915 Call(GetStatusFlags, ACTOR_SELF, LVar0)
917 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_ShellExit)
918 Wait(10)
919 EndIf
920 Else
921 SetConst(LVar0, PRT_DOWNED)
922 SetConst(LVar1, ANIM_KoopaTroopa_ToppleStruggle)
924 EndIf
927 SetConst(LVar0, PRT_DOWNED)
928 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
930 Wait(10)
931 SetConst(LVar0, PRT_DOWNED)
932 SetConst(LVar1, ANIM_KoopaTroopa_Hurt)
934 Return
936 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
937 IfEq(LVar0, 0)
938 SetConst(LVar0, PRT_DOWNED)
939 SetConst(LVar1, ANIM_KoopaTroopa_Run)
941 EndIf
942 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
943 Call(SetHomePos, ACTOR_SELF, LVar0, LVar1, LVar2)
944 Call(HPBarToHome, ACTOR_SELF)
946 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
947 IfEq(LVar0, 0)
948 SetConst(LVar0, PRT_DOWNED)
949 SetConst(LVar1, ANIM_KoopaTroopa_Idle)
951 Else
952 SetConst(LVar0, PRT_DOWNED)
953 SetConst(LVar1, ANIM_KoopaTroopa_ToppleStruggle)
955 EndIf
957 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
958 IfEq(LVar0, 0)
959 SetConst(LVar0, PRT_DOWNED)
960 SetConst(LVar1, ANIM_KoopaTroopa_Run)
961 SetConst(LVar2, ANIM_KoopaTroopa_Hurt)
963 Return
964 Else
965 SetConst(LVar0, PRT_DOWNED)
966 SetConst(LVar1, ANIM_KoopaTroopa_ToppleStruggle)
968 EndIf
970 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
971 IfEq(LVar0, 0)
972 SetConst(LVar0, PRT_DOWNED)
973 SetConst(LVar1, ANIM_KoopaTroopa_Panic)
974 Else
975 SetConst(LVar0, PRT_DOWNED)
976 SetConst(LVar1, ANIM_KoopaTroopa_ToppleStruggle)
977 EndIf
980 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
981 IfEq(LVar0, 0)
982 SetConst(LVar0, PRT_DOWNED)
983 SetConst(LVar1, ANIM_KoopaTroopa_Panic)
984 Else
985 SetConst(LVar0, PRT_DOWNED)
986 SetConst(LVar1, ANIM_KoopaTroopa_ToppleStruggle)
987 EndIf
989 Return
991 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
992 IfEq(LVar0, 0)
993 SetConst(LVar0, PRT_DOWNED)
994 SetConst(LVar1, ANIM_KoopaTroopa_Idle)
996 Else
997 SetConst(LVar0, PRT_DOWNED)
998 SetConst(LVar1, ANIM_KoopaTroopa_ToppleStruggle)
1000 EndIf
1001 EndSwitch
1002 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_RESTART)
1003 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
1004 Return
1005 End
1006};
1007
1008EvtScript N(EVS_Downed_TakeTurn) = {
1009 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
1010 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
1011 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
1012 Call(GetBattlePhase, LVar0)
1014 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_ShellSpin)
1015 Else
1016 Call(GetActorVar, ACTOR_SELF, AVAR_IsFlipped, LVar0)
1017 IfEq(LVar0, 1)
1018 Call(GetActorVar, ACTOR_SELF, AVAR_FlippedTurns, LVar0)
1019 Sub(LVar0, 1)
1020 IfGt(LVar0, 0)
1021 Call(SetActorVar, ACTOR_SELF, AVAR_FlippedTurns, LVar0)
1022 Call(AddActorDecoration, ACTOR_SELF, PRT_DOWNED, 0, ACTOR_DECORATION_SWEAT)
1023 Call(SetAnimationRate, ACTOR_SELF, PRT_DOWNED, Float(3.0))
1024 Wait(30)
1025 Call(SetAnimationRate, ACTOR_SELF, PRT_DOWNED, Float(1.0))
1026 Call(RemoveActorDecoration, ACTOR_SELF, PRT_DOWNED, 0)
1027 Else
1028 Call(AddActorDecoration, ACTOR_SELF, PRT_DOWNED, 0, ACTOR_DECORATION_SWEAT)
1029 Call(SetAnimationRate, ACTOR_SELF, PRT_DOWNED, Float(3.0))
1030 Wait(20)
1031 Call(SetAnimationRate, ACTOR_SELF, PRT_DOWNED, Float(1.0))
1032 Call(RemoveActorDecoration, ACTOR_SELF, PRT_DOWNED, 0)
1033 Call(SetActorSounds, ACTOR_SELF, ACTOR_SOUND_JUMP, SOUND_NONE, 0)
1034 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_ACTOR_JUMP)
1035 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_ToppleStruggle)
1036 Set(LVar0, 0)
1037 Call(SetActorRotationOffset, ACTOR_SELF, 0, 12, 0)
1039 Loop(5)
1040 Add(LVar0, 15)
1041 Call(SetActorRotation, ACTOR_SELF, 0, 0, LVar0)
1042 Wait(1)
1043 EndLoop
1045 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1046 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1047 Call(SetActorJumpGravity, ACTOR_SELF, Float(3.0))
1048 Call(JumpToGoal, ACTOR_SELF, 8, FALSE, TRUE, FALSE)
1049 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_ACTOR_STEP_A)
1050 Call(SetActorRotationOffset, ACTOR_SELF, 0, 0, 0)
1051 Call(SetActorRotation, ACTOR_SELF, 0, 0, 0)
1052 Call(SetActorDispOffset, ACTOR_SELF, 0, 0, 0)
1053 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_Idle)
1054 Call(SetActorVar, ACTOR_SELF, AVAR_IsFlipped, FALSE)
1055 Call(SetIdleAnimations, ACTOR_SELF, PRT_DOWNED, Ref(N(DownedAnims)))
1056 Call(SetDefenseTable, ACTOR_SELF, PRT_DOWNED, Ref(N(DownedDefense)))
1057 Call(SetTargetOffset, ACTOR_SELF, PRT_DOWNED, -4, 32)
1058 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_DOWNED, -1, -4)
1059 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_FLIPPED, FALSE)
1060 Call(ResetActorSounds, ACTOR_SELF, ACTOR_SOUND_JUMP)
1061 EndIf
1062 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
1063 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
1064 Return
1065 EndIf
1066 Call(UseBattleCamPreset, BTL_CAM_ENEMY_APPROACH)
1067 Call(BattleCamTargetActor, ACTOR_SELF)
1068 Wait(10)
1069 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_ShellEnter)
1070 Wait(10)
1072 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1073 Add(LVar1, 4)
1074 PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar0, LVar1, LVar2, 32, 4, 0, 10, 0)
1075 Wait(3)
1076 PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar0, LVar1, LVar2, 32, 4, 0, 10, 0)
1077 Wait(2)
1078 PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar0, LVar1, LVar2, 32, 4, 0, 10, 0)
1080 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SHELL_SPIN)
1081 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_ShellSpin)
1082 Wait(10)
1083 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
1084 EndIf
1085 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SHELL_TOSS)
1087 Call(EnemyTestTarget, ACTOR_SELF, LVar0, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS)
1088 Switch(LVar0)
1091 Set(LVarA, LVar0)
1092 Call(SetGoalToTarget, ACTOR_SELF)
1093 Call(AddGoalPos, ACTOR_SELF, -40, 0, 0)
1094 Call(SetActorSpeed, ACTOR_SELF, Float(16.0))
1095 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
1096 Call(GetBattlePhase, LVar0)
1098 Call(UseBattleCamPreset, BTL_CAM_ACTOR_TARGET_MIDPOINT)
1099 Call(SetBattleCamDist, 300)
1100 Call(SetBattleCamOffsetY, 20)
1101 Call(MoveBattleCamOver, 10)
1102 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
1103 EndIf
1104 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_ShellExit)
1105 Wait(8)
1106 Call(ResetAllActorSounds, ACTOR_SELF)
1107 Call(SetActorYaw, ACTOR_SELF, 180)
1108 Wait(4)
1110 Call(EnemyTestTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
1111 EndIf
1112 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_BeginPanic1)
1113 Wait(1)
1114 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_BeginPanic2)
1115 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1116 Add(LVar1, 20)
1117 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1118 Call(SetActorJumpGravity, ACTOR_SELF, Float(2.0))
1119 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
1120 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_Panic)
1121 Wait(6)
1122 Sub(LVar1, 20)
1123 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1124 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
1125 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1126 Call(YieldTurn)
1127 Call(SetActorYaw, ACTOR_SELF, 180)
1128 Call(AddActorDecoration, ACTOR_SELF, PRT_DOWNED, 0, ACTOR_DECORATION_SWEAT)
1129 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_Panic)
1130 Call(SetGoalToHome, ACTOR_SELF)
1131 Call(SetActorSpeed, ACTOR_SELF, Float(8.0))
1132 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
1133 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_Idle)
1134 Call(RemoveActorDecoration, ACTOR_SELF, PRT_DOWNED, 0)
1135 Call(SetPartYaw, ACTOR_SELF, PRT_DOWNED, 0)
1136 Call(SetActorYaw, ACTOR_SELF, 0)
1137 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
1138 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
1139 Return
1141 EndSwitch
1142 Call(SetGoalToTarget, ACTOR_SELF)
1143 Call(SetActorSpeed, ACTOR_SELF, Float(16.0))
1144 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
1145 Call(ResetAllActorSounds, ACTOR_SELF)
1146 Wait(2)
1147 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, 0, SUPPRESS_EVENT_ALL, 0, DMG_SHELL_TOSS, BS_FLAGS1_TRIGGER_EVENTS)
1148 Switch(LVar0)
1151 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1152 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1153 Add(LVar0, 40)
1154 Set(LVar1, 0)
1155 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.8))
1156 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1157 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
1158 Add(LVar0, 30)
1159 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1160 Call(JumpToGoal, ACTOR_SELF, 8, FALSE, TRUE, FALSE)
1161 Add(LVar0, 20)
1162 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1163 Call(JumpToGoal, ACTOR_SELF, 6, FALSE, TRUE, FALSE)
1164 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_ShellExit)
1165 Wait(8)
1166 Call(YieldTurn)
1167 SetConst(LVar0, PRT_DOWNED)
1168 SetConst(LVar1, ANIM_KoopaTroopa_Run)
1170 Call(SetAnimation, ACTOR_SELF, PRT_DOWNED, ANIM_KoopaTroopa_Idle)
1172 EndSwitch
1173 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
1174 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
1175 Return
1176 End
1177};
Bytecode EvtScript[]
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2834
@ BTL_CAM_XADJ_AVG
Definition enums.h:4900
@ ACTOR_SOUND_WALK
Definition enums.h:2034
@ ACTOR_SOUND_FLY
Definition enums.h:2035
@ ACTOR_SOUND_JUMP
Definition enums.h:2036
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3575
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3571
@ ELEMENT_JUMP
Definition enums.h:2122
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_BLAST
Definition enums.h:2124
@ ELEMENT_SMASH
Definition enums.h:2121
@ ELEMENT_WATER
Definition enums.h:2117
@ ELEMENT_NORMAL
Definition enums.h:2115
@ ACTOR_EVENT_FLAG_GROUNDABLE
Actor can be knocked down from flight; triggered by jump attacks.
Definition enums.h:3382
@ ACTOR_EVENT_FLAGS_NONE
Definition enums.h:3370
@ ACTOR_EVENT_FLAG_FLIPABLE
Actor can be flipped; triggered by jump and quake attacks.
Definition enums.h:3380
@ ACTOR_DECORATION_SWEAT
Definition enums.h:2045
@ PHASE_FIRST_STRIKE
Definition enums.h:2059
@ ENCOUNTER_TRIGGER_HAMMER
Definition enums.h:271
@ STATUS_KEY_PARALYZE
Definition enums.h:2201
@ STATUS_TURN_MOD_DEFAULT
Definition enums.h:2227
@ STATUS_TURN_MOD_PARALYZE
Definition enums.h:2234
@ STATUS_KEY_FROZEN
Definition enums.h:2203
@ STATUS_TURN_MOD_SLEEP
Definition enums.h:2228
@ STATUS_TURN_MOD_DIZZY
Definition enums.h:2232
@ STATUS_KEY_STATIC
Definition enums.h:2207
@ STATUS_END
Definition enums.h:2196
@ STATUS_TURN_MOD_POISON
Definition enums.h:2233
@ STATUS_KEY_FEAR
Definition enums.h:2199
@ STATUS_TURN_MOD_STOP
Definition enums.h:2237
@ STATUS_KEY_SLEEP
Definition enums.h:2202
@ STATUS_KEY_STONE
Definition enums.h:2208
@ STATUS_KEY_STOP
Definition enums.h:2204
@ STATUS_TURN_MOD_FROZEN
Definition enums.h:2230
@ STATUS_KEY_SHRINK
Definition enums.h:2206
@ STATUS_KEY_DIZZY
Definition enums.h:2200
@ STATUS_KEY_POISON
Definition enums.h:2205
@ STATUS_TURN_MOD_STATIC
Definition enums.h:2229
@ STATUS_TURN_MOD_FEAR
Definition enums.h:2231
@ STATUS_KEY_NORMAL
Definition enums.h:2197
@ STATUS_TURN_MOD_SHRINK
Definition enums.h:2235
@ STATUS_KEY_DEFAULT
Definition enums.h:2198
@ HIT_RESULT_NO_DAMAGE
Definition enums.h:1952
@ HIT_RESULT_HIT
Definition enums.h:1950
@ HIT_RESULT_LUCKY
Definition enums.h:1955
@ HIT_RESULT_MISS
Definition enums.h:1956
@ BTL_CAM_ACTOR_TARGET_MIDPOINT
Definition enums.h:4827
@ BTL_CAM_DEFAULT
Definition enums.h:4824
@ BTL_CAM_INTERRUPT
Definition enums.h:4823
@ BTL_CAM_ENEMY_APPROACH
Definition enums.h:4885
@ SUPPRESS_EVENT_ALL
Definition enums.h:2907
@ EASING_SIN_OUT
Definition enums.h:521
@ EASING_LINEAR
Definition enums.h:510
@ IDLE_SCRIPT_RESTART
Definition enums.h:6409
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6408
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6407
@ STATUS_FLAG_DIZZY
Definition enums.h:2818
@ STATUS_FLAG_SLEEP
Definition enums.h:2812
@ SOUND_NONE
Definition enums.h:547
@ SOUND_PARAGOOMBA_PREDIVE
Definition enums.h:1510
@ SOUND_ACTOR_STEP_A
Definition enums.h:1474
@ SOUND_SHELL_SPIN
Definition enums.h:1342
@ SOUND_FALL_QUICK
Definition enums.h:1090
@ SOUND_SHELL_TOSS
Definition enums.h:1497
@ SOUND_ACTOR_JUMP
Definition enums.h:1290
@ SOUND_PARAGOOMBA_DIVE
Definition enums.h:1029
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_FLYING
Quake Hammer can't hit.
Definition enums.h:3329
@ ACTOR_FLAG_TYPE_CHANGED
Indicates actors type has changed, triggers recheck for if HP bar should be shown based on tattle sta...
Definition enums.h:3332
@ ACTOR_FLAG_FLIPPED
Actor has been flipped over.
Definition enums.h:3330
@ BTL_CAM_YADJ_TARGET
Definition enums.h:4905
@ EVENT_HIT
Definition enums.h:2132
@ EVENT_SCARE_AWAY
Definition enums.h:2174
@ EVENT_BURN_HIT
Definition enums.h:2136
@ EVENT_BEGIN_FIRST_STRIKE
Definition enums.h:2173
@ EVENT_END_FIRST_STRIKE
Definition enums.h:2171
@ EVENT_IMMUNE
Definition enums.h:2146
@ EVENT_FALL_TRIGGER
Definition enums.h:2134
@ EVENT_BURN_DEATH
Definition enums.h:2157
@ EVENT_ZERO_DAMAGE
Definition enums.h:2144
@ EVENT_SHOCK_DEATH
Definition enums.h:2159
@ EVENT_SPIN_SMASH_HIT
Definition enums.h:2133
@ EVENT_SPIN_SMASH_DEATH
Definition enums.h:2154
@ EVENT_HIT_COMBO
Definition enums.h:2131
@ EVENT_15
Definition enums.h:2137
@ EVENT_AIR_LIFT_FAILED
Definition enums.h:2152
@ EVENT_BEGIN_AIR_LIFT
Definition enums.h:2175
@ EVENT_DEATH
Definition enums.h:2153
@ EVENT_FLIP_TRIGGER
Definition enums.h:2135
@ EVENT_SHOCK_HIT
Definition enums.h:2165
@ EVENT_RECOVER_STATUS
Definition enums.h:2167
@ EVENT_BLOW_AWAY
Definition enums.h:2143
@ ACTOR_PART_FLAG_PRIMARY_TARGET
Definition enums.h:3362
@ ACTOR_PART_FLAG_NO_SHADOW
Definition enums.h:3352
@ ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION
Definition enums.h:3361
@ ACTOR_PART_FLAG_NO_TARGET
Cannot be targeted.
Definition enums.h:3360
@ ACTOR_PART_FLAG_INVISIBLE
Definition enums.h:3350
@ CAM_BATTLE
Definition enums.h:1801
@ DAMAGE_TYPE_TRIGGER_LUCKY
Definition enums.h:2881
EvtScript EVS_Enemy_ReturnHome
EvtScript EVS_Enemy_Knockback
EvtScript EVS_Enemy_ScareAway
EvtScript EVS_Enemy_Hit
EvtScript EVS_Enemy_Death
EvtScript EVS_Enemy_SpinSmashHit
EvtScript EVS_Enemy_ShockHit
EvtScript EVS_Enemy_AirLift
EvtScript EVS_Enemy_BlowAway
EvtScript EVS_Enemy_Recover
EvtScript EVS_Enemy_BurnHit
EvtScript EVS_Enemy_NoDamageHit
ApiStatus RandInt(Evt *script, b32 isInitialCall)
ApiStatus ShakeCam(Evt *script, b32 isInitialCall)
#define Else
Marks the end of an if statement and the start of the else block.
Definition macros.h:295
#define Switch(LVAR)
Marks the start of a switch statement.
Definition macros.h:311
#define Ref(sym)
Address/pointer constant.
Definition macros.h:60
#define IfGe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR >= RVAR.
Definition macros.h:284
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#define CaseEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR. It also marks the end of any pre...
Definition macros.h:319
#define EndChildThread
Marks the end of a child thread block.
Definition macros.h:563
#define Sub(VAR, INT_VALUE)
Definition macros.h:377
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define UseBuf(INT_PTR)
Loads a s32 pointer for use with subsequent EVT_BUF_READ commands.
Definition macros.h:389
#define Mod(VAR, INT_VALUE)
Definition macros.h:380
#define Add(VAR, INT_VALUE)
Definition macros.h:376
#define IfFalse(b)
Definition macros.h:646
#define EndLoop
Marks the end of a loop.
Definition macros.h:248
#define EndCaseGroup
Marks the end of a switch case group (CaseOrEq and/or CaseAndEq), stopping fallthrough.
Definition macros.h:352
#define Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define BufRead1(VAR)
Consumes the next s32 from the buffer and stores it in the given variable.
Definition macros.h:392
#define IfGt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR <= RVAR.
Definition macros.h:278
#define IfLt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR < RVAR.
Definition macros.h:275
#define Float(DOUBLE)
Definition macros.h:51
#define Label(LABEL_ID)
Marks this point in the script as a Goto target.
Definition macros.h:227
#define CaseOrEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR.
Definition macros.h:341
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define IfTrue(b)
Definition macros.h:645
#define CaseDefault
Marks the start of a switch case that executes unconditionally. It also marks the end of any previous...
Definition macros.h:337
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:475
#define Thread
Marks the start of a thread block.
Definition macros.h:544
#define EndThread
Marks the end of a thread block.
Definition macros.h:547
#define IfFlag(LVAR, RVAR)
Marks the beginning of an if statement that only executes if the RVAR flag is set on LVAR,...
Definition macros.h:288
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#define LVarA
Definition macros.h:158
#define IfNotFlag(LVAR, RVAR)
Marks the beginning of an if statement that only executes if the RVAR flag is unset on LVAR,...
Definition macros.h:292
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define PlayEffect(args...)
Definition macros.h:807
#define EndSwitch
Marks the end of a switch statement and any case.
Definition macros.h:362
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
Definition macros.h:269
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define ChildThread
Marks the start of a child thread block.
Definition macros.h:560
#define Loop(TIMES)
Marks the beginning of a loop.
Definition macros.h:245
#define LVar0
Definition macros.h:148
#define SetConst(VAR, CONST)
Sets the given variable to a given value, skipping the evt_get_variable call.
Definition macros.h:370
#define Return
Kills the current EVT thread.
Definition macros.h:217