Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
white_magikoopa.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "sprite/npc/FlyingMagikoopa.h"
4#include "sprite/npc/Magikoopa.h"
5
6#define NAMESPACE A(white_magikoopa)
7
8extern s32 N(IdleAnimations_80223D70)[];
9extern s32 N(IdleAnimations_80223DBC)[];
10extern s32 N(IdleAnimations_80223E08)[];
11extern EvtScript N(EVS_Init_Ground);
12extern EvtScript N(EVS_Init_Flying);
13extern EvtScript N(EVS_TakeTurn);
14extern EvtScript N(EVS_Flee);
15
16enum N(ActorPartIDs) {
17 PRT_GROUND = 1,
18 PRT_FLYING = 2,
19 PRT_BROOM = 3,
20};
21
22enum N(ActorVars) {
23 AVAR_ShouldKnockDown = 0,
24};
25
26enum N(ActorParams) {
27 DMG_MAGIC_BLAST = 3,
28 DMG_WAND_STRIKE = 3,
29 HEAL_AMT_ONE = 5,
30 HEAL_AMT_ALL = 3,
31};
32
33s32 N(DefenseTable_80223B20)[] = {
36};
37
38s32 N(DefenseTable_80223B2C)[] = {
41};
42
43s32 N(StatusTable_Ground)[] = {
66};
67
68s32 N(StatusTable_Flying)[] = {
91};
92
93ActorPartBlueprint N(GroundParts)[] = {
94 {
96 .index = PRT_GROUND,
97 .posOffset = { 0, 0, 0 },
98 .targetOffset = { 2, 35 },
99 .opacity = 255,
100 .idleAnimations = N(IdleAnimations_80223D70),
101 .defenseTable = N(DefenseTable_80223B20),
102 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
103 .elementImmunityFlags = 0,
104 .projectileTargetOffset = { -5, -12 },
105 },
106};
107
108ActorPartBlueprint N(FlyingParts)[] = {
109 {
111 .index = PRT_GROUND,
112 .posOffset = { 0, 0, 0 },
113 .targetOffset = { 2, 35 },
114 .opacity = 255,
115 .idleAnimations = N(IdleAnimations_80223D70),
116 .defenseTable = N(DefenseTable_80223B2C),
117 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
118 .elementImmunityFlags = 0,
119 .projectileTargetOffset = { -5, -12 },
120 },
121 {
123 .index = PRT_FLYING,
124 .posOffset = { 0, 0, 0 },
125 .targetOffset = { -10, 35 },
126 .opacity = 255,
127 .idleAnimations = N(IdleAnimations_80223DBC),
128 .defenseTable = N(DefenseTable_80223B2C),
130 .elementImmunityFlags = 0,
131 .projectileTargetOffset = { 0, -8 },
132 },
133 {
135 .index = PRT_BROOM,
136 .posOffset = { 0, 0, 0 },
137 .targetOffset = { 0, 0 },
138 .opacity = 255,
139 .idleAnimations = N(IdleAnimations_80223E08),
140 .defenseTable = N(DefenseTable_80223B2C),
141 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
142 .elementImmunityFlags = 0,
143 .projectileTargetOffset = { 0, 0 },
144 },
145};
146
147ActorBlueprint NAMESPACE = {
148 .flags = 0,
149 .type = ACTOR_TYPE_WHITE_MAGIKOOPA,
150 .level = ACTOR_LEVEL_WHITE_MAGIKOOPA,
151 .maxHP = 11,
152 .partCount = ARRAY_COUNT(N(GroundParts)),
153 .partsData = N(GroundParts),
154 .initScript = &N(EVS_Init_Ground),
155 .statusTable = N(StatusTable_Ground),
156 .escapeChance = 40,
157 .airLiftChance = 80,
158 .hurricaneChance = 70,
159 .spookChance = 40,
160 .upAndAwayChance = 95,
161 .spinSmashReq = 0,
162 .powerBounceChance = 80,
163 .coinReward = 2,
164 .size = { 36, 40 },
165 .healthBarOffset = { 0, 0 },
166 .statusIconOffset = { -10, 20 },
167 .statusTextOffset = { 10, 32 },
168};
169
170ActorBlueprint N(flying) = {
171 .flags = ACTOR_FLAG_FLYING,
172 .type = ACTOR_TYPE_FLYING_WHITE_MAGIKOOPA,
173 .level = ACTOR_LEVEL_FLYING_WHITE_MAGIKOOPA,
174 .maxHP = 11,
175 .partCount = ARRAY_COUNT(N(FlyingParts)),
176 .partsData = N(FlyingParts),
177 .initScript = &N(EVS_Init_Flying),
178 .statusTable = N(StatusTable_Flying),
179 .escapeChance = 40,
180 .airLiftChance = 95,
181 .hurricaneChance = 75,
182 .spookChance = 40,
183 .upAndAwayChance = 95,
184 .spinSmashReq = 0,
185 .powerBounceChance = 80,
186 .coinReward = 2,
187 .size = { 48, 40 },
188 .healthBarOffset = { 0, 0 },
189 .statusIconOffset = { -25, 20 },
190 .statusTextOffset = { 1, 34 },
191};
192
193s32 N(IdleAnimations_80223D70)[] = {
194 STATUS_KEY_NORMAL, ANIM_Magikoopa_White_Anim01,
195 STATUS_KEY_STONE, ANIM_Magikoopa_White_Anim00,
196 STATUS_KEY_SLEEP, ANIM_Magikoopa_White_Anim08,
197 STATUS_KEY_POISON, ANIM_Magikoopa_White_Anim01,
198 STATUS_KEY_STOP, ANIM_Magikoopa_White_Anim00,
199 STATUS_KEY_STATIC, ANIM_Magikoopa_White_Anim01,
200 STATUS_KEY_PARALYZE, ANIM_Magikoopa_White_Anim00,
201 STATUS_KEY_DIZZY, ANIM_Magikoopa_White_Anim07,
202 STATUS_KEY_FEAR, ANIM_Magikoopa_White_Anim07,
204};
205
206s32 N(IdleAnimations_80223DBC)[] = {
207 STATUS_KEY_NORMAL, ANIM_FlyingMagikoopa_White_Anim01,
208 STATUS_KEY_STONE, ANIM_FlyingMagikoopa_White_Anim00,
209 STATUS_KEY_SLEEP, ANIM_FlyingMagikoopa_White_Anim08,
210 STATUS_KEY_POISON, ANIM_FlyingMagikoopa_White_Anim01,
211 STATUS_KEY_STOP, ANIM_FlyingMagikoopa_White_Anim00,
212 STATUS_KEY_STATIC, ANIM_FlyingMagikoopa_White_Anim01,
213 STATUS_KEY_PARALYZE, ANIM_FlyingMagikoopa_White_Anim00,
214 STATUS_KEY_DIZZY, ANIM_FlyingMagikoopa_White_Anim07,
215 STATUS_KEY_FEAR, ANIM_FlyingMagikoopa_White_Anim07,
217};
218
219s32 N(IdleAnimations_80223E08)[] = {
220 STATUS_KEY_NORMAL, ANIM_FlyingMagikoopa_White_Anim0A,
222};
223
225
227
229
231
233
234API_CALLABLE(N(GetBootsHammerLevel)) {
235 Bytecode* args = script->ptrReadPos;
236
237 evt_set_variable(script, *args++, gPlayerData.bootsLevel);
238 evt_set_variable(script, *args++, gPlayerData.hammerLevel);
239
240 return ApiStatus_DONE2;
241}
242
243API_CALLABLE(N(GetActorDefense)) {
244 Bytecode* args = script->ptrReadPos;
245 s32 actorID = evt_get_variable(script, *args++);
246 s32 partID = evt_get_variable(script, *args++);
247 Actor* actor;
248 ActorPart* part;
249 s32 defense;
250
251 if (actorID == ACTOR_SELF) {
252 actorID = script->owner1.actorID;
253 }
254
255 actor = get_actor(actorID);
256 part = get_actor_part(actor, partID);
258
259 evt_set_variable(script, *args++, defense);
260
261 return ApiStatus_DONE2;
262}
263
264EvtScript N(EVS_Idle) = {
265 Return
266 End
267};
268
269EvtScript N(EVS_HandleEvent_Ground) = {
270 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
271 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
272 Call(GetLastEvent, ACTOR_SELF, LVar0)
276 SetConst(LVar0, PRT_GROUND)
277 SetConst(LVar1, ANIM_Magikoopa_White_Anim04)
281 SetConst(LVar0, PRT_GROUND)
282 SetConst(LVar1, ANIM_Magikoopa_White_Anim05)
283 SetConst(LVar2, ANIM_Magikoopa_White_Anim06)
286 SetConst(LVar0, PRT_GROUND)
287 SetConst(LVar1, ANIM_Magikoopa_White_Anim05)
288 SetConst(LVar2, ANIM_Magikoopa_White_Anim06)
290 SetConst(LVar0, PRT_GROUND)
291 SetConst(LVar1, ANIM_Magikoopa_White_Anim06)
293 Return
295 SetConst(LVar0, PRT_GROUND)
296 SetConst(LVar1, ANIM_Magikoopa_White_Anim04)
299 SetConst(LVar0, PRT_GROUND)
300 SetConst(LVar1, ANIM_Magikoopa_White_Anim04)
302 SetConst(LVar0, PRT_GROUND)
303 SetConst(LVar1, ANIM_Magikoopa_White_Anim04)
305 Return
309 SetConst(LVar0, PRT_GROUND)
310 SetConst(LVar1, ANIM_Magikoopa_White_Anim01)
314 SetConst(LVar0, PRT_GROUND)
315 SetConst(LVar1, ANIM_Magikoopa_White_Anim04)
317 Wait(10)
318 SetConst(LVar0, PRT_GROUND)
319 SetConst(LVar1, ANIM_Magikoopa_White_Anim04)
321 Return
323 SetConst(LVar0, PRT_GROUND)
324 SetConst(LVar1, ANIM_Magikoopa_White_Anim01)
327 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_White_Anim04)
328 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.5))
329 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
330 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
331 Call(JumpToGoal, ACTOR_SELF, 15, FALSE, TRUE, FALSE)
332 Wait(15)
333 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_White_Anim02)
334 ExecWait(N(EVS_Flee))
335 Return
337 SetConst(LVar0, PRT_GROUND)
338 SetConst(LVar1, ANIM_Magikoopa_White_Anim02)
341 Call(GetStatusFlags, ACTOR_SELF, LVar0)
344 Call(SetPartDispOffset, ACTOR_SELF, PRT_GROUND, 0, 2, 0)
345 Else
346 Call(SetPartDispOffset, ACTOR_SELF, PRT_GROUND, -4, 5, 0)
347 EndIf
348 EndIf
349 SetConst(LVar0, PRT_GROUND)
350 SetConst(LVar1, ANIM_Magikoopa_White_Anim04)
352 Return
355 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
356 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
357 Return
358 End
359};
360
361EvtScript N(EVS_KnockDownCheck) = {
362 Call(GetBattleFlags, LVar0)
365 Call(SetActorVar, ACTOR_SELF, AVAR_ShouldKnockDown, TRUE)
366 EndIf
367 Else
368 Call(N(GetSelectedMoveID), LVar0)
370 CaseOrEq(MOVE_HEADBONK1)
371 CaseOrEq(MOVE_HEADBONK2)
372 CaseOrEq(MOVE_HEADBONK3)
373 CaseOrEq(MOVE_MULTIBONK)
374 Call(GetBattleFlags, LVar0)
376 Call(SetActorVar, ACTOR_SELF, AVAR_ShouldKnockDown, TRUE)
377 EndIf
380 EndIf
381 Return
382 End
383};
384
385EvtScript N(EVS_KnockDown) = {
386 Call(GetActorVar, ACTOR_SELF, AVAR_ShouldKnockDown, LVar0)
387 IfEq(LVar0, 1)
388 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_White_Anim04)
389 Goto(0)
390 EndIf
391 Call(GetLastElement, LVar0)
393 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_White_Anim04)
394 Goto(0)
395 EndIf
396 Return
397 Label(0)
398 Call(HideHealthBar, ACTOR_SELF)
399 Call(GetStatusFlags, ACTOR_SELF, LVar0)
401 Call(SetPartScale, ACTOR_SELF, PRT_BROOM, Float(0.4), Float(0.4), Float(0.4))
402 EndIf
403 Call(SetPartFlagBits, ACTOR_SELF, PRT_GROUND, ACTOR_PART_FLAG_PRIMARY_TARGET, TRUE)
404 Call(SetPartFlagBits, ACTOR_SELF, PRT_GROUND, ACTOR_PART_FLAG_INVISIBLE | ACTOR_PART_FLAG_NO_TARGET, FALSE)
405 Call(SetPartFlagBits, ACTOR_SELF, PRT_FLYING, ACTOR_PART_FLAG_INVISIBLE | ACTOR_PART_FLAG_NO_TARGET, TRUE)
406 Call(SetPartFlagBits, ACTOR_SELF, PRT_FLYING, ACTOR_PART_FLAG_PRIMARY_TARGET, FALSE)
407 Call(SetPartFlagBits, ACTOR_SELF, PRT_BROOM, ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION, TRUE)
408 Call(SetPartFlagBits, ACTOR_SELF, PRT_BROOM, ACTOR_PART_FLAG_INVISIBLE, FALSE)
409 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
410 Sub(LVar2, 1)
411 Call(SetPartPos, ACTOR_SELF, PRT_BROOM, LVar0, LVar1, LVar2)
412 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_FALL_QUICK)
413 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
414 Set(LVar1, 0)
415 Call(SetActorJumpGravity, ACTOR_SELF, Float(0.8))
416 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
417 Call(JumpToGoal, ACTOR_SELF, 15, FALSE, TRUE, FALSE)
418 Call(N(StartRumbleWithParams), 150, 10)
419 Thread
420 Call(ShakeCam, CAM_BATTLE, 0, 5, Float(0.7))
422 Call(GetLastEvent, ACTOR_SELF, LVar3)
424 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_White_Anim04)
425 Call(GetActorPos, ACTOR_SELF, LVar3, LVar4, LVar5)
426 Add(LVar4, 10)
427 Add(LVar5, 5)
428 PlayEffect(EFFECT_SMOKE_BURST, 0, LVar3, LVar4, LVar5, Float(1.0), 10, 0)
429 EndIf
430 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
431 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
432 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
433 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
434 Loop(20)
435 Call(SetPartFlagBits, ACTOR_SELF, PRT_BROOM, ACTOR_PART_FLAG_INVISIBLE, TRUE)
436 Wait(1)
437 Call(SetPartFlagBits, ACTOR_SELF, PRT_BROOM, ACTOR_PART_FLAG_INVISIBLE, FALSE)
438 Wait(1)
439 EndLoop
440 Call(SetPartFlagBits, ACTOR_SELF, PRT_BROOM, ACTOR_PART_FLAG_INVISIBLE, TRUE)
441 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_White_Anim01)
442 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_FLYING, FALSE)
443 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent_Ground)))
444 Call(SetActorType, ACTOR_SELF, ACTOR_TYPE_WHITE_MAGIKOOPA)
445 Call(SetStatusTable, ACTOR_SELF, Ref(N(StatusTable_Ground)))
446 Call(N(SetAbsoluteStatusOffsets), -10, 20, 10, 32)
447 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_TYPE_CHANGED, TRUE)
448 Call(ResetAllActorSounds, ACTOR_SELF)
449 Call(GetIndexFromPos, ACTOR_SELF, LVar0)
450 Mod(LVar0, 4)
451 Call(SetGoalToIndex, ACTOR_SELF, LVar0)
452 Call(SetActorSpeed, ACTOR_SELF, Float(4.0))
453 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
454 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
455 Call(ForceHomePos, ACTOR_SELF, LVar0, LVar1, LVar2)
456 Call(HPBarToHome, ACTOR_SELF)
457 Return
458 End
459};
460
461EvtScript N(EVS_HandleEvent_Flying) = {
462 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
463 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
464 Call(GetLastEvent, ACTOR_SELF, LVar0)
467 ExecWait(N(EVS_KnockDownCheck))
468 SetConst(LVar0, PRT_FLYING)
469 SetConst(LVar1, ANIM_FlyingMagikoopa_White_Anim04)
473 ExecWait(N(EVS_KnockDownCheck))
474 SetConst(LVar0, PRT_FLYING)
475 SetConst(LVar1, ANIM_FlyingMagikoopa_White_Anim04)
477 ExecWait(N(EVS_KnockDown))
481 ExecWait(N(EVS_KnockDownCheck))
482 SetConst(LVar0, PRT_FLYING)
483 SetConst(LVar1, ANIM_FlyingMagikoopa_White_Anim05)
484 SetConst(LVar2, ANIM_FlyingMagikoopa_White_Anim06)
486 ExecWait(N(EVS_KnockDown))
489 SetConst(LVar0, PRT_FLYING)
490 SetConst(LVar1, ANIM_FlyingMagikoopa_White_Anim05)
491 SetConst(LVar2, ANIM_FlyingMagikoopa_White_Anim06)
493 SetConst(LVar0, PRT_FLYING)
494 SetConst(LVar1, ANIM_FlyingMagikoopa_White_Anim06)
496 Return
498 SetConst(LVar0, PRT_FLYING)
499 SetConst(LVar1, ANIM_FlyingMagikoopa_White_Anim04)
502 SetConst(LVar0, PRT_FLYING)
503 SetConst(LVar1, ANIM_FlyingMagikoopa_White_Anim04)
505 SetConst(LVar0, PRT_FLYING)
506 SetConst(LVar1, ANIM_FlyingMagikoopa_White_Anim04)
508 Return
512 SetConst(LVar0, PRT_FLYING)
513 SetConst(LVar1, ANIM_FlyingMagikoopa_White_Anim01)
517 SetConst(LVar0, PRT_FLYING)
518 SetConst(LVar1, ANIM_FlyingMagikoopa_White_Anim04)
520 Wait(10)
521 SetConst(LVar0, PRT_FLYING)
522 SetConst(LVar1, ANIM_FlyingMagikoopa_White_Anim04)
524 Return
526 Call(SetActorPos, ACTOR_SELF, 20, 0, 0)
527 Call(HPBarToCurrent, ACTOR_SELF)
529 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_White_Anim01)
530 Call(SetGoalToHome, ACTOR_SELF)
531 Call(SetActorSpeed, ACTOR_SELF, Float(4.0))
532 Call(FlyToGoal, ACTOR_SELF, 0, 1, EASING_LINEAR)
533 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_White_Anim01)
534 Call(HPBarToHome, ACTOR_SELF)
536 SetConst(LVar0, PRT_FLYING)
537 SetConst(LVar1, ANIM_FlyingMagikoopa_White_Anim01)
540 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_White_Anim04)
541 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.5))
542 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
543 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
544 Call(JumpToGoal, ACTOR_SELF, 15, FALSE, TRUE, FALSE)
545 Wait(15)
546 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_White_Anim02)
547 ExecWait(N(EVS_Flee))
548 Return
550 SetConst(LVar0, PRT_FLYING)
551 SetConst(LVar1, ANIM_FlyingMagikoopa_White_Anim02)
554 Call(GetStatusFlags, ACTOR_SELF, LVar0)
557 Call(SetPartDispOffset, ACTOR_SELF, PRT_FLYING, -3, 0, 0)
558 Else
559 Call(SetPartDispOffset, ACTOR_SELF, PRT_FLYING, -15, 0, 0)
560 EndIf
561 EndIf
562 SetConst(LVar0, PRT_FLYING)
563 SetConst(LVar1, ANIM_FlyingMagikoopa_White_Anim04)
565 Return
568 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
569 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
570 Return
571 End
572};
573
574EvtScript N(EVS_Attack_MagicBlast) = {
575 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
576 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
577 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
578 Call(GetBattlePhase, LVar0)
580 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
581 Call(MoveBattleCamOver, 1)
582 Else
583 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
584 Call(MoveBattleCamOver, 10)
585 EndIf
586 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SPELL_CAST1)
587 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
588 Call(GetStatusFlags, ACTOR_SELF, LVarA)
590 Sub(LVar0, 12)
591 Add(LVar1, 14)
592 Else
593 Sub(LVar0, 30)
594 Add(LVar1, 36)
595 EndIf
596 PlayEffect(EFFECT_GATHER_MAGIC, 0, LVar0, LVar1, LVar2, Float(0.5), 30, 0)
597 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_White_Anim02)
598 Wait(30)
599 Call(EnemyTestTarget, ACTOR_SELF, LVar0, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS)
603 Set(LVarA, LVar0)
604 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SPELL_CAST2)
605 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_White_Anim03)
606 Wait(5)
607 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
608 Call(GetStatusFlags, ACTOR_SELF, LVar9)
610 Sub(LVar0, 8)
611 Add(LVar1, 8)
612 Else
613 Sub(LVar0, 20)
614 Add(LVar1, 20)
615 EndIf
616 Call(SetGoalToTarget, ACTOR_SELF)
617 Call(GetGoalPos, ACTOR_SELF, LVar3, LVar4, LVar5)
618 Sub(LVar3, 50)
619 Set(LVar4, 0)
620 Call(N(ShrinkActor), LVar0, LVar1, LVar5, LVar3, LVar4, LVar5, 25)
621 Wait(50)
623 Call(EnemyTestTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
624 EndIf
625 Wait(14)
626 Call(YieldTurn)
627 Call(AddActorDecoration, ACTOR_SELF, PRT_FLYING, 0, ACTOR_DECORATION_SWEAT)
628 Wait(30)
629 Call(RemoveActorDecoration, ACTOR_SELF, PRT_FLYING, 0)
630 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
631 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
632 Return
635 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SPELL_CAST2)
636 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_White_Anim03)
637 Wait(5)
638 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
639 Call(GetStatusFlags, ACTOR_SELF, LVarA)
641 Sub(LVar0, 8)
642 Add(LVar1, 8)
643 Else
644 Sub(LVar0, 20)
645 Add(LVar1, 20)
646 EndIf
647 Call(SetGoalToTarget, ACTOR_SELF)
648 Call(GetGoalPos, ACTOR_SELF, LVar3, LVar4, LVar5)
649 Sub(LVar3, 10)
650 Call(N(ShrinkActor), LVar0, LVar1, LVar5, LVar3, LVar4, LVar5, 20)
651 Wait(18)
652 Wait(2)
653 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_MAGIC | DAMAGE_TYPE_NO_CONTACT, 0, 0, DMG_MAGIC_BLAST, BS_FLAGS1_TRIGGER_EVENTS)
657 Wait(19)
658 Call(YieldTurn)
661 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
662 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
663 Return
664 End
665};
666
667EvtScript N(EVS_Attack_WandStrike) = {
668 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
669 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
670 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
671 Call(UseBattleCamPreset, BTL_CAM_ENEMY_APPROACH)
672 Call(BattleCamTargetActor, ACTOR_SELF)
673 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
674 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_MAGIKOOPA_VANISH)
675 Thread
676 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_White_Anim02)
677 Set(LVar0, 200)
678 Loop(20)
679 Sub(LVar0, 10)
680 Call(SetPartAlpha, ACTOR_SELF, PRT_GROUND, LVar0)
681 Wait(1)
682 EndLoop
684 Wait(10)
685 Call(SetGoalToTarget, ACTOR_SELF)
686 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
687 Call(GetStatusFlags, ACTOR_SELF, LVarA)
689 Add(LVar0, 5)
690 Else
691 Add(LVar0, 25)
692 EndIf
693 Set(LVar1, 0)
694 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
695 Call(FlyToGoal, ACTOR_SELF, 30, 0, EASING_COS_IN_OUT)
696 Set(LVar0, 55)
697 Loop(20)
698 Add(LVar0, 10)
699 Call(SetPartAlpha, ACTOR_SELF, PRT_GROUND, LVar0)
700 Wait(1)
701 EndLoop
702 Call(SetPartAlpha, ACTOR_SELF, PRT_GROUND, 255)
703 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_White_Anim03)
704 Wait(11)
706 Call(EnemyTestTarget, ACTOR_SELF, LVar0, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS)
710 Set(LVarA, LVar0)
711 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
713 Call(EnemyTestTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
714 EndIf
715 Wait(15)
716 Set(LVar0, 200)
717 Loop(20)
718 Sub(LVar0, 10)
719 Call(SetPartAlpha, ACTOR_SELF, PRT_GROUND, LVar0)
720 Wait(1)
721 EndLoop
722 Call(YieldTurn)
723 Call(SetGoalToHome, ACTOR_SELF)
724 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_White_Anim01)
725 Call(FlyToGoal, ACTOR_SELF, 30, 0, EASING_COS_IN_OUT)
726 Set(LVar0, 55)
727 Loop(20)
728 Add(LVar0, 10)
729 Call(SetPartAlpha, ACTOR_SELF, PRT_GROUND, LVar0)
730 Wait(1)
731 EndLoop
732 Call(SetPartAlpha, ACTOR_SELF, PRT_GROUND, 255)
733 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
734 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
735 Return
738 Call(SetGoalToTarget, ACTOR_SELF)
739 Wait(2)
740 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_NO_CONTACT, 0, 0, DMG_WAND_STRIKE, BS_FLAGS1_TRIGGER_EVENTS)
744 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
745 Wait(10)
746 Set(LVar0, 200)
747 Loop(20)
748 Sub(LVar0, 10)
749 Call(SetPartAlpha, ACTOR_SELF, PRT_GROUND, LVar0)
750 Wait(1)
751 EndLoop
752 Call(YieldTurn)
753 Call(SetGoalToHome, ACTOR_SELF)
754 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_White_Anim01)
755 Call(FlyToGoal, ACTOR_SELF, 20, 0, EASING_COS_IN_OUT)
756 Set(LVar0, 55)
757 Loop(20)
758 Add(LVar0, 10)
759 Call(SetPartAlpha, ACTOR_SELF, PRT_GROUND, LVar0)
760 Wait(1)
761 EndLoop
762 Call(SetPartAlpha, ACTOR_SELF, PRT_GROUND, 255)
765 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
766 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
767 Return
768 End
769};
770
771EvtScript N(EVS_Flee) = {
772 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
773 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
774 Call(HideHealthBar, ACTOR_SELF)
775 Call(GetLastEvent, ACTOR_SELF, LVar0)
777 Call(UseBattleCamPreset, BTL_CAM_ACTOR)
778 Call(BattleCamTargetActor, ACTOR_SELF)
779 Call(MoveBattleCamOver, 15)
780 Wait(15)
781 Call(UseBattleCamPreset, BTL_CAM_INTERRUPT)
782 EndIf
783 Call(SetActorSpeed, ACTOR_SELF, Float(1.0))
784 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
785 Add(LVar0, 20)
786 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
787 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
788 Wait(10)
789 Call(SetActorYaw, ACTOR_SELF, 180)
790 Call(EnableActorBlur, ACTOR_SELF, ACTOR_BLUR_ENABLE)
791 Call(SetActorSpeed, ACTOR_SELF, Float(10.0))
792 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
793 Add(LVar0, 200)
794 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
795 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
796 Call(YieldTurn)
797 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
799 Call(HideHealthBar, ACTOR_SELF)
800 Call(RemoveActor, ACTOR_SELF)
801 Return
802 End
803};
804
805EvtScript N(EVS_Init_Ground) = {
806 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
807 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
808 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent_Ground)))
809 Call(SetActorVar, ACTOR_SELF, AVAR_ShouldKnockDown, FALSE)
810 Return
811 End
812};
813
814EvtScript N(EVS_Init_Flying) = {
815 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
816 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
817 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent_Flying)))
818 Call(SetActorVar, ACTOR_SELF, AVAR_ShouldKnockDown, FALSE)
819 Return
820 End
821};
822
823EvtScript N(EVS_Move_HealOne) = {
824 #define LV_LowestActor LVar8
825 #define LV_LowestHP LVar9
826 // try to find a non-magikoopa actor in danger of being killed by the player
828 Set(LV_LowestHP, 9999)
829 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
830 Call(InitTargetIterator)
831 Label(0)
832 Call(GetOwnerTarget, LVar0, LVar1)
833 Call(GetActorHP, LVar0, LVar2)
834 Call(N(GetBootsHammerLevel), LVar3, LVar4)
836 Set(LVar3, LVar4)
837 EndIf
838 Call(N(GetActorDefense), LVar0, LVar1, LVar5)
839 Call(GetActorDefenseBoost, LVar0, LVar6)
840 Add(LVar5, LVar6)
841 Sub(LVar3, LVar5)
842 Sub(LVar2, LVar3)
843 Call(N(CheckMagikoopaCastTarget), LVar0, LVarA)
844 IfEq(LVarA, 0)
845 Call(GetEnemyMaxHP, LVar0, LVarA)
846 Call(GetActorHP, LVar0, LVarB)
851 Else
856 EndIf
857 EndIf
858 EndIf
859 EndIf
860 EndIf
861 Call(ChooseNextTarget, ITER_NEXT, LVar0)
863 Goto(0)
864 EndIf
866 Goto(100)
867 EndIf
868 // try to find any actor in danger of being killed by the player
870 Set(LV_LowestHP, 9999)
871 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
872 Call(InitTargetIterator)
873 Label(1)
874 Call(GetOwnerTarget, LVar0, LVar1)
875 Call(GetActorHP, LVar0, LVar2)
876 Call(N(GetBootsHammerLevel), LVar3, LVar4)
878 Set(LVar3, LVar4)
879 EndIf
880 Call(N(GetActorDefense), LVar0, LVar1, LVar5)
881 Call(GetActorDefenseBoost, LVar0, LVar6)
882 Add(LVar5, LVar6)
883 Sub(LVar3, LVar5)
884 Sub(LVar2, LVar4)
885 Set(LFlag0, FALSE)
886 Call(GetOriginalActorType, LVar0, LVarA)
887 IfEq(LVarA, ACTOR_TYPE_DRY_BONES)
889 IfEq(LVarA, 1)
890 Set(LFlag0, TRUE)
891 EndIf
892 EndIf
893 Call(GetOwnerID, LVarA)
895 IfEq(LFlag0, FALSE)
896 Call(GetEnemyMaxHP, LVar0, LVarA)
897 Call(GetActorHP, LVar0, LVarB)
902 Else
907 EndIf
908 EndIf
909 EndIf
910 EndIf
911 EndIf
912 EndIf
913 Call(ChooseNextTarget, ITER_NEXT, LVar0)
915 Goto(1)
916 EndIf
918 Goto(100)
919 EndIf
920 // try to find the actor with lowest HP%
921 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
922 Call(InitTargetIterator)
923 Label(2)
924 Call(GetOwnerTarget, LVar0, LVar1)
925 Set(LFlag0, FALSE)
926 Call(GetOriginalActorType, LVar0, LVarA)
927 IfEq(LVarA, ACTOR_TYPE_DRY_BONES)
929 IfEq(LVarA, 1)
930 Set(LFlag0, TRUE)
931 EndIf
932 EndIf
933 Call(GetOwnerID, LVarA)
935 IfEq(LFlag0, FALSE)
936 Call(GetEnemyMaxHP, LVar0, LVarA)
937 Call(GetActorHP, LVar0, LVarB)
940 Goto(100)
941 EndIf
942 EndIf
943 EndIf
944 Call(ChooseNextTarget, ITER_NEXT, LVar0)
946 Goto(2)
947 EndIf
948 Call(GetEnemyMaxHP, ACTOR_SELF, LVarA)
949 Call(GetActorHP, ACTOR_SELF, LVarB)
952 Goto(100)
953 EndIf
954 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
955 Call(InitTargetIterator)
956 Label(3)
957 Call(GetOwnerTarget, LVar0, LVar1)
958 Call(GetOwnerID, LVarA)
960 Call(GetActorFlags, ACTOR_SELF, LVar0)
962 ExecWait(N(EVS_Attack_MagicBlast))
963 Else
964 ExecWait(N(EVS_Attack_WandStrike))
965 EndIf
966 Return
967 EndIf
968 Call(ChooseNextTarget, ITER_NEXT, LVar0)
970 Goto(3)
971 EndIf
972 ExecWait(N(EVS_Flee))
973 Return
974 Label(100)
975 Call(RandInt, 1000, LVar0)
976 IfGt(LVar0, 750)
977 Call(GetActorFlags, ACTOR_SELF, LVar0)
979 ExecWait(N(EVS_Attack_MagicBlast))
980 Else
981 ExecWait(N(EVS_Attack_WandStrike))
982 EndIf
983 Return
984 EndIf
985 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
986 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
987 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
988 Call(UseBattleCamPreset, BTL_CAM_ACTOR)
989 Call(BattleCamTargetActor, ACTOR_SELF)
990 Call(MoveBattleCamOver, 15)
991 Wait(15)
992 Call(GetActorFlags, ACTOR_SELF, LVar0)
994 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_White_Anim02)
995 Else
996 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_White_Anim02)
997 EndIf
998 Wait(5)
999 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SPELL_CAST1)
1000 Call(GetActorFlags, ACTOR_SELF, LVar0)
1002 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1003 Call(GetStatusFlags, ACTOR_SELF, LVarA)
1005 Sub(LVar0, 6)
1006 Add(LVar1, 12)
1007 Sub(LVar2, 2)
1008 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
1009 Else
1010 Sub(LVar0, 16)
1011 Add(LVar1, 31)
1012 Sub(LVar2, 2)
1013 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
1014 EndIf
1015 Else
1016 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1017 Call(GetStatusFlags, ACTOR_SELF, LVarA)
1019 Sub(LVar0, 12)
1020 Add(LVar1, 14)
1021 Sub(LVar2, 2)
1022 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
1023 Else
1024 Sub(LVar0, 30)
1025 Add(LVar1, 36)
1026 Sub(LVar2, 2)
1027 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
1028 EndIf
1029 EndIf
1030 Wait(30)
1031 Call(GetActorFlags, ACTOR_SELF, LVar0)
1033 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_White_Anim01)
1034 Else
1035 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_White_Anim01)
1036 EndIf
1037 Wait(5)
1038 Thread
1039 Wait(5)
1040 Call(PlaySoundAtActor, LV_LowestActor, SOUND_RECOVER_HEART)
1041 Call(PlaySoundAtActor, LV_LowestActor, SOUND_HEART_BOUNCE)
1042 Wait(30)
1043 Call(PlaySoundAtActor, LV_LowestActor, SOUND_STAR_BOUNCE_A)
1044 EndThread
1045 Thread
1046 Call(FreezeBattleState, TRUE)
1047 Call(HealActor, LV_LowestActor, HEAL_AMT_ONE, FALSE)
1048 Call(FreezeBattleState, FALSE)
1049 EndThread
1050 Call(WaitForBuffDone)
1051 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1052 Wait(10)
1053 Call(YieldTurn)
1054 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
1055 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
1056 Return
1057 End
1058};
1059
1060EvtScript N(EVS_Move_HealAll) = {
1061 Call(RandInt, 1000, LVar0)
1062 IfGt(LVar0, 750)
1063 Call(GetActorFlags, ACTOR_SELF, LVar0)
1065 ExecWait(N(EVS_Attack_MagicBlast))
1066 Else
1067 ExecWait(N(EVS_Attack_WandStrike))
1068 EndIf
1069 Return
1070 EndIf
1071 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
1072 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
1073 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
1074 Call(UseBattleCamPreset, BTL_CAM_ACTOR)
1075 Call(BattleCamTargetActor, ACTOR_SELF)
1076 Call(MoveBattleCamOver, 15)
1077 Wait(15)
1078 Call(GetActorFlags, ACTOR_SELF, LVar0)
1080 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_White_Anim02)
1081 Else
1082 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_White_Anim02)
1083 EndIf
1084 Wait(5)
1085 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SPELL_CAST1)
1086 Call(GetActorFlags, ACTOR_SELF, LVar0)
1088 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1089 Call(GetStatusFlags, ACTOR_SELF, LVarA)
1091 Sub(LVar0, 6)
1092 Add(LVar1, 12)
1093 Sub(LVar2, 2)
1094 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
1095 Else
1096 Sub(LVar0, 16)
1097 Add(LVar1, 31)
1098 Sub(LVar2, 2)
1099 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
1100 EndIf
1101 Else
1102 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1103 Call(GetStatusFlags, ACTOR_SELF, LVarA)
1105 Sub(LVar0, 12)
1106 Add(LVar1, 14)
1107 Sub(LVar2, 2)
1108 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
1109 Else
1110 Sub(LVar0, 30)
1111 Add(LVar1, 36)
1112 Sub(LVar2, 2)
1113 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
1114 EndIf
1115 EndIf
1116 Wait(30)
1117 Call(GetActorFlags, ACTOR_SELF, LVar0)
1119 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_White_Anim01)
1120 Else
1121 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_White_Anim01)
1122 EndIf
1123 Wait(5)
1124 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
1125 Call(InitTargetIterator)
1126 Label(0)
1127 Set(LFlag0, FALSE)
1128 Call(GetOwnerTarget, LVar0, LVar1)
1129 Call(GetOriginalActorType, LVar0, LVar1)
1130 IfEq(LVar1, ACTOR_TYPE_DRY_BONES)
1131 Call(GetActorVar, LVar0, AVAR_DryBones_Collapsed, LVar1)
1132 IfEq(LVar1, 1)
1133 Set(LFlag0, TRUE)
1134 EndIf
1135 EndIf
1136 IfEq(LFlag0, FALSE)
1137 Thread
1138 Wait(5)
1139 Call(PlaySoundAtActor, LVar0, SOUND_RECOVER_HEART)
1140 Call(PlaySoundAtActor, LVar0, SOUND_HEART_BOUNCE)
1141 Wait(30)
1142 Call(PlaySoundAtActor, LVar0, SOUND_STAR_BOUNCE_A)
1143 EndThread
1144 Thread
1145 Call(FreezeBattleState, TRUE)
1146 Call(HealActor, LVar0, HEAL_AMT_ALL, TRUE)
1147 Call(FreezeBattleState, FALSE)
1148 EndThread
1149 EndIf
1150 Call(ChooseNextTarget, ITER_NEXT, LVar0)
1152 Goto(0)
1153 EndIf
1154 Call(WaitForBuffDone)
1155 Wait(1)
1156 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1157 Wait(10)
1158 Call(YieldTurn)
1159 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
1160 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
1161 Return
1162 End
1163};
1164
1165EvtScript N(EVS_TakeTurn) = {
1167 IfEq(LVar0, 1)
1168 ExecWait(N(EVS_Flee))
1169 Return
1170 EndIf
1171 Set(LVarA, 0)
1172 Set(LVarB, 0)
1173 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
1174 Call(InitTargetIterator)
1175 Label(0)
1176 Set(LFlag0, FALSE)
1177 Call(GetOwnerTarget, LVar0, LVar1)
1178 Call(GetOriginalActorType, LVar0, LVar1)
1179 IfEq(LVar1, ACTOR_TYPE_DRY_BONES)
1180 Call(GetActorVar, LVar0, AVAR_DryBones_Collapsed, LVar1)
1181 IfEq(LVar1, 1)
1182 Set(LFlag0, TRUE)
1183 EndIf
1184 EndIf
1185 IfEq(LFlag0, FALSE)
1186 Call(GetActorHP, LVar0, LVar2)
1187 Call(GetEnemyMaxHP, LVar0, LVar3)
1188 IfNe(LVar2, LVar3)
1189 Add(LVarA, 1)
1190 EndIf
1191 Add(LVarB, 1)
1192 EndIf
1193 Call(ChooseNextTarget, ITER_NEXT, LVar0)
1195 Goto(0)
1196 EndIf
1197 Mul(LVarA, 100)
1198 Div(LVarA, LVarB)
1199 Switch(LVarA)
1200 CaseGe(60)
1201 ExecWait(N(EVS_Move_HealAll))
1202 CaseEq(0)
1203 Call(GetActorFlags, ACTOR_SELF, LVar0)
1205 ExecWait(N(EVS_Attack_MagicBlast))
1206 Else
1207 ExecWait(N(EVS_Attack_WandStrike))
1208 EndIf
1210 ExecWait(N(EVS_Move_HealOne))
1211 EndSwitch
1212 Return
1213 End
1214};
Bytecode EvtScript[]
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2834
@ BTL_CAM_XADJ_AVG
Definition enums.h:4900
@ BS_FLAGS1_PARTNER_ACTING
Definition enums.h:3588
@ BS_FLAGS1_SUPER_HIT
Definition enums.h:3579
@ BS_FLAGS1_NICE_HIT
Definition enums.h:3576
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3575
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3571
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_NORMAL
Definition enums.h:2115
@ ITER_NO_MORE
Definition enums.h:2030
@ ITER_NEXT
Definition enums.h:2025
@ ACTOR_EVENT_FLAG_RIDING_BROOMSTICK
Actor is on Magikoopa Broomstick, effect seems to be redundant.
Definition enums.h:3390
@ ACTOR_EVENT_FLAGS_NONE
Definition enums.h:3370
@ ACTOR_DECORATION_SWEAT
Definition enums.h:2045
@ PHASE_FIRST_STRIKE
Definition enums.h:2059
@ 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_DEFAULT
Definition enums.h:4824
@ BTL_CAM_INTERRUPT
Definition enums.h:4823
@ BTL_CAM_ACTOR
Definition enums.h:4836
@ BTL_CAM_ENEMY_APPROACH
Definition enums.h:4885
@ TARGET_FLAG_PRIMARY_ONLY
Definition enums.h:1863
@ TARGET_FLAG_2
Definition enums.h:1850
@ EASING_COS_IN_OUT
Definition enums.h:520
@ EASING_LINEAR
Definition enums.h:510
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6408
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6407
@ STATUS_FLAG_SHRINK
Definition enums.h:2819
@ SOUND_MAGIKOOPA_WAND_STRIKE
Definition enums.h:1054
@ SOUND_STAR_BOUNCE_A
Definition enums.h:975
@ SOUND_SPELL_CAST1
Definition enums.h:1498
@ SOUND_SPELL_CAST2
Definition enums.h:1499
@ SOUND_RECOVER_HEART
Definition enums.h:1406
@ SOUND_MAGIKOOPA_VANISH
Definition enums.h:1053
@ SOUND_HEART_BOUNCE
Definition enums.h:925
@ SOUND_FALL_QUICK
Definition enums.h:1090
@ 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
@ BTL_CAM_YADJ_TARGET
Definition enums.h:4905
@ ACTOR_BLUR_ENABLE
Definition enums.h:6414
@ 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_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_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_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_POW
Definition enums.h:2861
@ DAMAGE_TYPE_MAGIC
Definition enums.h:2855
@ DAMAGE_TYPE_TRIGGER_LUCKY
Definition enums.h:2881
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2878
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1690
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
Definition evt.c:1847
ActorPart * get_actor_part(Actor *actor, s32 partID)
Definition 190B20.c:1191
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
s32 lookup_defense(s32 *, s32)
Definition 190B20.c:2027
EvtScript EVS_Enemy_Hit
EvtScript EVS_Enemy_Death
EvtScript EVS_Enemy_SpinSmashHit
EvtScript EVS_Enemy_AirLift
EvtScript EVS_ForceNextTarget
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 LVar6
Definition macros.h:154
#define Ref(sym)
Address/pointer constant.
Definition macros.h:60
#define Mul(VAR, INT_VALUE)
Definition macros.h:378
#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 Sub(VAR, INT_VALUE)
Definition macros.h:377
#define IfNe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR != RVAR.
Definition macros.h:272
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define Mod(VAR, INT_VALUE)
Definition macros.h:380
#define Add(VAR, INT_VALUE)
Definition macros.h:376
#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 CaseGe(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:334
#define Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define ARRAY_COUNT(arr)
Definition macros.h:40
#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 LVar5
Definition macros.h:153
#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 LVarB
Definition macros.h:159
#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 Div(VAR, INT_VALUE)
Definition macros.h:379
#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 LFlag0
Definition macros.h:167
#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 LVar9
Definition macros.h:157
#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 Loop(TIMES)
Marks the beginning of a loop.
Definition macros.h:245
#define LVar4
Definition macros.h:152
#define LVar3
Definition macros.h:151
#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
@ AVAR_DryBones_Collapsed
Definition battle.h:100
PlayerData gPlayerData
Definition 77480.c:40
#define LV_LowestHP
#define LV_LowestActor