Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
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/Magikoopa.h"
4#include "sprite/npc/FlyingMagikoopa.h"
5#include "effects.h"
6
7#define NAMESPACE A(magikoopa)
8
9extern s32 N(GroundAnims)[];
10extern s32 N(FlyingAnims)[];
11extern s32 N(BroomAnims)[];
12
13extern EvtScript N(EVS_Init);
14extern EvtScript N(EVS_Idle);
15extern EvtScript N(EVS_TakeTurn);
16extern EvtScript N(EVS_HandleEvent);
17extern EvtScript N(EVS_Flying_Init);
18extern EvtScript N(EVS_Flying_HandleEvent);
19
20enum N(ActorPartIDs) {
21 PRT_GROUND = 1,
22 PRT_FLYING = 2,
23 PRT_BROOM = 3,
24};
25
26enum N(ActorVars) {
27 AVAR_HitTypeFlags = 0,
28 AVAL_HitType_Combo = 1,
29 AVAR_IsClone = 1,
30 AVAR_ShouldKnockDown = 2,
31 AVAR_HealAllCount = 3,
32 AVAR_HealOneCount = 4,
33 AVAR_AttackBoostCount = 5,
34 AVAR_DefenseBoostCount = 6,
35 AVAR_ElectrifyCount = 7,
36 AVAR_TransparifyCount = 8,
37 AVAR_CloneActorID = 9,
38 AVAR_MadeCloneLastTurn = 10,
39 AVAR_LastMove = 11,
40 AVAL_LastMove_None = -1,
41 AVAL_LastMove_HealOne = 0,
42 AVAL_LastMove_HealAll = 1,
43 AVAL_LastMove_MagicBlast = 2,
44 AVAL_LastMove_MakeClone = 3,
45 AVAL_LastMove_BoostAttack = 4,
46 AVAL_LastMove_BoostDefense = 5,
47 AVAL_LastMove_Electrify = 6,
48 AVAL_LastMove_Transparify = 7,
49};
50
51enum N(ActorParams) {
52 DMG_MAGIC_BLAST = 6,
53 HEAL_AMT_ONE = 5,
54 HEAL_AMT_ALL = 3,
55 ATTACK_BOOST_AMT = 1,
56 DEFENSE_BOOST_AMT = 1,
57 ELECTRIFY_TURNS = 3,
58 TRANSPARIFY_TURNS = 2,
59 MAX_HEAL_ONE = 2,
60 MAX_HEAL_ALL = 2,
61 MAX_ATTACK_BOOST = 3,
62 MAX_DEFENSE_BOOST = 3,
63 MAX_ELECTRIFY = 3,
64 MAX_TRANSPARIFY = 3,
65 HEAL_THRESHOLD_1 = 25,
66 HEAL_THRESHOLD_2 = 20,
67 HEAL_THRESHOLD_3 = 15,
68 HEAL_CHANCE_1 = 75,
69 HEAL_CHANCE_2 = 80,
70 HEAL_CHANCE_3 = 100,
71 HEAL_ONE_CHANCE = 500,
72 HEAL_ALL_CHANCE = 500,
73};
74
75s32 N(DefenseTable)[] = {
78};
79
80s32 N(FlyingDefense)[] = {
83};
84
85s32 N(StatusTable)[] = {
108};
109
110s32 N(FlyingStatusTable)[] = {
116 STATUS_KEY_DIZZY, 100,
121 STATUS_KEY_STOP, 80,
133};
134
135ActorPartBlueprint N(ActorParts)[] = {
136 {
138 .index = PRT_GROUND,
139 .posOffset = { 0, 0, 0 },
140 .targetOffset = { 2, 35 },
141 .opacity = 255,
142 .idleAnimations = N(GroundAnims),
143 .defenseTable = N(DefenseTable),
144 .eventFlags = 0,
145 .elementImmunityFlags = 0,
146 .projectileTargetOffset = { -5, -12 },
147 },
148};
149
150ActorPartBlueprint N(FlyingParts)[] = {
151 {
153 .index = PRT_GROUND,
154 .posOffset = { 0, 0, 0 },
155 .targetOffset = { 2, 35 },
156 .opacity = 255,
157 .idleAnimations = N(GroundAnims),
158 .defenseTable = N(FlyingDefense),
159 .eventFlags = 0,
160 .elementImmunityFlags = 0,
161 .projectileTargetOffset = { -5, -12 },
162 },
163 {
165 .index = PRT_FLYING,
166 .posOffset = { 0, 0, 0 },
167 .targetOffset = { -10, 35 },
168 .opacity = 255,
169 .idleAnimations = N(FlyingAnims),
170 .defenseTable = N(FlyingDefense),
172 .elementImmunityFlags = 0,
173 .projectileTargetOffset = { 0, -8 },
174 },
175 {
177 .index = PRT_BROOM,
178 .posOffset = { 0, 0, 0 },
179 .targetOffset = { 0, 0 },
180 .opacity = 255,
181 .idleAnimations = N(BroomAnims),
182 .defenseTable = N(FlyingDefense),
183 .eventFlags = 0,
184 .elementImmunityFlags = 0,
185 .projectileTargetOffset = { 0, 0 },
186 },
187};
188
189ActorBlueprint NAMESPACE = {
190 .flags = 0,
191 .type = ACTOR_TYPE_MAGIKOOPA,
192 .level = ACTOR_LEVEL_MAGIKOOPA,
193 .maxHP = 11,
194 .partCount = ARRAY_COUNT(N(ActorParts)),
195 .partsData = N(ActorParts),
196 .initScript = &N(EVS_Init),
197 .statusTable = N(StatusTable),
198 .escapeChance = 40,
199 .airLiftChance = 80,
200 .hurricaneChance = 70,
201 .spookChance = 40,
202 .upAndAwayChance = 95,
203 .spinSmashReq = 0,
204 .powerBounceChance = 80,
205 .coinReward = 2,
206 .size = { 36, 40 },
207 .healthBarOffset = { 0, 0 },
208 .statusIconOffset = { -10, 20 },
209 .statusTextOffset = { 10, 32 },
210};
211
212ActorBlueprint N(flying) = {
213 .flags = ACTOR_FLAG_FLYING,
214 .type = ACTOR_TYPE_FLYING_MAGIKOOPA,
215 .level = ACTOR_LEVEL_FLYING_MAGIKOOPA,
216 .maxHP = 11,
217 .partCount = ARRAY_COUNT(N(FlyingParts)),
218 .partsData = N(FlyingParts),
219 .initScript = &N(EVS_Flying_Init),
220 .statusTable = N(FlyingStatusTable),
221 .escapeChance = 40,
222 .airLiftChance = 85,
223 .hurricaneChance = 75,
224 .spookChance = 40,
225 .upAndAwayChance = 95,
226 .spinSmashReq = 0,
227 .powerBounceChance = 80,
228 .coinReward = 2,
229 .size = { 48, 40 },
230 .healthBarOffset = { 0, 0 },
231 .statusIconOffset = { -25, 20 },
232 .statusTextOffset = { 1, 34 },
233};
234
235s32 N(GroundAnims)[] = {
236 STATUS_KEY_NORMAL, ANIM_Magikoopa_Anim01,
237 STATUS_KEY_STONE, ANIM_Magikoopa_Anim00,
238 STATUS_KEY_SLEEP, ANIM_Magikoopa_Anim08,
239 STATUS_KEY_POISON, ANIM_Magikoopa_Anim01,
240 STATUS_KEY_STOP, ANIM_Magikoopa_Anim00,
241 STATUS_KEY_STATIC, ANIM_Magikoopa_Anim01,
242 STATUS_KEY_PARALYZE, ANIM_Magikoopa_Anim00,
243 STATUS_KEY_DIZZY, ANIM_Magikoopa_Anim07,
244 STATUS_KEY_FEAR, ANIM_Magikoopa_Anim07,
246};
247
248s32 N(FlyingAnims)[] = {
249 STATUS_KEY_NORMAL, ANIM_FlyingMagikoopa_Anim01,
250 STATUS_KEY_STONE, ANIM_FlyingMagikoopa_Anim00,
251 STATUS_KEY_SLEEP, ANIM_FlyingMagikoopa_Anim08,
252 STATUS_KEY_POISON, ANIM_FlyingMagikoopa_Anim01,
253 STATUS_KEY_STOP, ANIM_FlyingMagikoopa_Anim00,
254 STATUS_KEY_STATIC, ANIM_FlyingMagikoopa_Anim01,
255 STATUS_KEY_PARALYZE, ANIM_FlyingMagikoopa_Anim00,
256 STATUS_KEY_DIZZY, ANIM_FlyingMagikoopa_Anim07,
257 STATUS_KEY_FEAR, ANIM_FlyingMagikoopa_Anim07,
259};
260
261s32 N(BroomAnims)[] = {
262 STATUS_KEY_NORMAL, ANIM_FlyingMagikoopa_Anim0A,
264};
265
268
269EvtScript N(EVS_Idle) = {
270 Set(LVarF, 0)
271 Label(0)
272 Call(GetActorVar, ACTOR_SELF, AVAR_CloneActorID, LVar0)
273 Call(ActorExists, LVar0, LVar1)
274 IfEq(LVar1, 1)
275 Call(N(CosInterpMinMax), LVarF, LVar1, Float(254.0), Float(100.0), 20, 0, 0)
276 Add(LVarF, 1)
277 Call(GetActorFlags, ACTOR_SELF, LVar2)
279 Call(SetPartAlpha, ACTOR_SELF, PRT_FLYING, LVar1)
280 Call(SetPartAlpha, LVar0, 1, LVar1)
281 Else
282 Call(SetPartAlpha, ACTOR_SELF, PRT_GROUND, LVar1)
283 Call(SetPartAlpha, LVar0, 1, LVar1)
284 EndIf
285 Else
286 Set(LVarF, 0)
287 Call(GetActorFlags, ACTOR_SELF, LVar2)
289 Call(SetPartAlpha, ACTOR_SELF, PRT_FLYING, 255)
290 Else
291 Call(SetPartAlpha, ACTOR_SELF, PRT_GROUND, 255)
292 EndIf
293 EndIf
294 Wait(1)
295 Goto(0)
296 Return
297 End
298};
299
300#include "common/GetSelectedMoveID.inc.c"
301
302EvtScript N(EVS_KnockDownCheck) = {
303 Call(GetBattleFlags, LVar0)
306 Call(SetActorVar, ACTOR_SELF, AVAR_ShouldKnockDown, TRUE)
307 EndIf
308 Else
309 Call(N(GetSelectedMoveID), LVar0)
311 CaseOrEq(MOVE_HEADBONK1)
312 CaseOrEq(MOVE_HEADBONK2)
313 CaseOrEq(MOVE_HEADBONK3)
314 CaseOrEq(MOVE_MULTIBONK)
315 Call(GetBattleFlags, LVar0)
317 Call(SetActorVar, ACTOR_SELF, AVAR_ShouldKnockDown, TRUE)
318 EndIf
321 EndIf
322 Return
323 End
324};
325
328
329EvtScript N(EVS_KnockDown) = {
330 Call(GetActorVar, ACTOR_SELF, AVAR_ShouldKnockDown, LVar0)
331 IfEq(LVar0, 1)
332 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim04)
333 Goto(0)
334 EndIf
335 Call(GetLastElement, LVar0)
337 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim04)
338 Goto(0)
339 EndIf
340 Return
341 Label(0)
342 Call(HideHealthBar, ACTOR_SELF)
343 Call(GetStatusFlags, ACTOR_SELF, LVar0)
345 Call(SetPartScale, ACTOR_SELF, PRT_BROOM, Float(0.4), Float(0.4), Float(0.4))
346 EndIf
347 Call(SetPartFlagBits, ACTOR_SELF, PRT_GROUND, ACTOR_PART_FLAG_PRIMARY_TARGET, TRUE)
348 Call(SetPartFlagBits, ACTOR_SELF, PRT_GROUND, ACTOR_PART_FLAG_INVISIBLE | ACTOR_PART_FLAG_NO_TARGET, FALSE)
349 Call(SetPartFlagBits, ACTOR_SELF, PRT_FLYING, ACTOR_PART_FLAG_INVISIBLE | ACTOR_PART_FLAG_NO_TARGET, TRUE)
350 Call(SetPartFlagBits, ACTOR_SELF, PRT_FLYING, ACTOR_PART_FLAG_PRIMARY_TARGET, FALSE)
351 Call(SetPartFlagBits, ACTOR_SELF, PRT_BROOM, ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION, TRUE)
352 Call(SetPartFlagBits, ACTOR_SELF, PRT_BROOM, ACTOR_PART_FLAG_INVISIBLE, FALSE)
353 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
354 Sub(LVar2, 1)
355 Call(SetPartPos, ACTOR_SELF, PRT_BROOM, LVar0, LVar1, LVar2)
356 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_FALL_QUICK)
357 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
358 Set(LVar1, 0)
359 Call(SetActorJumpGravity, ACTOR_SELF, Float(0.8))
360 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
361 Call(JumpToGoal, ACTOR_SELF, 15, FALSE, TRUE, FALSE)
362 Call(N(StartRumbleWithParams), 150, 10)
363 Thread
364 Call(ShakeCam, CAM_BATTLE, 0, 5, Float(0.7))
366 Call(GetLastEvent, ACTOR_SELF, LVar3)
368 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim04)
369 Call(GetActorPos, ACTOR_SELF, LVar3, LVar4, LVar5)
370 Add(LVar4, 10)
371 Add(LVar5, 5)
372 PlayEffect(EFFECT_SMOKE_BURST, 0, LVar3, LVar4, LVar5, Float(1.0), 10, 0)
373 EndIf
374 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
375 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
376 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
377 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
378 Loop(20)
379 Call(SetPartFlagBits, ACTOR_SELF, PRT_BROOM, ACTOR_PART_FLAG_INVISIBLE, TRUE)
380 Wait(1)
381 Call(SetPartFlagBits, ACTOR_SELF, PRT_BROOM, ACTOR_PART_FLAG_INVISIBLE, FALSE)
382 Wait(1)
383 EndLoop
384 Call(SetPartFlagBits, ACTOR_SELF, PRT_BROOM, ACTOR_PART_FLAG_INVISIBLE, TRUE)
385 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim01)
386 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_FLYING, FALSE)
387 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
388 Call(SetActorType, ACTOR_SELF, ACTOR_TYPE_MAGIKOOPA)
389 Call(SetStatusTable, ACTOR_SELF, Ref(N(StatusTable)))
390 Call(N(SetAbsoluteStatusOffsets), -10, 20, 10, 32)
391 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_TYPE_CHANGED, TRUE)
392 Call(ResetAllActorSounds, ACTOR_SELF)
393 Call(GetIndexFromPos, ACTOR_SELF, LVar0)
394 Mod(LVar0, 4)
395 Call(SetGoalToIndex, ACTOR_SELF, LVar0)
396 Call(SetActorSpeed, ACTOR_SELF, Float(4.0))
397 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
398 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
399 Call(ForceHomePos, ACTOR_SELF, LVar0, LVar1, LVar2)
400 Call(HPBarToHome, ACTOR_SELF)
401 Return
402 End
403};
404
405EvtScript N(EVS_Flee) = {
406 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
407 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
408 Call(HideHealthBar, ACTOR_SELF)
409 Call(GetLastEvent, ACTOR_SELF, LVar0)
411 Call(UseBattleCamPreset, BTL_CAM_ACTOR)
412 Call(BattleCamTargetActor, ACTOR_SELF)
413 Call(MoveBattleCamOver, 15)
414 Wait(15)
415 Call(UseBattleCamPreset, BTL_CAM_INTERRUPT)
416 EndIf
417 Call(SetActorSpeed, ACTOR_SELF, Float(1.0))
418 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
419 Add(LVar0, 20)
420 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
421 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
422 Wait(10)
423 Call(SetActorYaw, ACTOR_SELF, 180)
424 Call(EnableActorBlur, ACTOR_SELF, ACTOR_BLUR_ENABLE)
425 Call(SetActorSpeed, ACTOR_SELF, Float(10.0))
426 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
427 Add(LVar0, 200)
428 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
429 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
430 Call(YieldTurn)
431 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
433 Call(HideHealthBar, ACTOR_SELF)
434 Call(RemoveActor, ACTOR_SELF)
435 Return
436 End
437};
438
439EvtScript N(EVS_HandlePhase) = {
440 Call(GetActorVar, ACTOR_SELF, AVAR_HitTypeFlags, LVar0)
441 BitwiseAndConst(LVar0, ~AVAL_HitType_Combo)
442 Call(SetActorVar, ACTOR_SELF, AVAR_HitTypeFlags, LVar0)
443 Return
444 End
445};
446
447EvtScript N(EVS_Init) = {
448 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
449 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
450 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
451 Call(BindHandlePhase, ACTOR_SELF, Ref(N(EVS_HandlePhase)))
453 IfEq(LVar0, 0)
455 EndIf
456 Call(SetActorVar, ACTOR_SELF, AVAR_HitTypeFlags, 0)
457 Call(SetActorVar, ACTOR_SELF, AVAR_IsClone, FALSE)
458 Call(SetActorVar, ACTOR_SELF, AVAR_ShouldKnockDown, FALSE)
459 Call(SetActorVar, ACTOR_SELF, AVAR_HealAllCount, 0)
460 Call(SetActorVar, ACTOR_SELF, AVAR_HealOneCount, 0)
461 Call(SetActorVar, ACTOR_SELF, AVAR_AttackBoostCount, 0)
462 Call(SetActorVar, ACTOR_SELF, AVAR_DefenseBoostCount, 0)
463 Call(SetActorVar, ACTOR_SELF, AVAR_ElectrifyCount, 0)
464 Call(SetActorVar, ACTOR_SELF, AVAR_TransparifyCount, 0)
465 Call(SetActorVar, ACTOR_SELF, AVAR_CloneActorID, -1)
466 Call(SetActorVar, ACTOR_SELF, AVAR_MadeCloneLastTurn, FALSE)
467 Call(SetActorVar, ACTOR_SELF, AVAR_LastMove, AVAL_LastMove_None)
468 Return
469 End
470};
471
472EvtScript N(EVS_Flying_Init) = {
473 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
474 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
475 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_Flying_HandleEvent)))
477 IfEq(LVar0, 0)
479 EndIf
480 Call(SetActorVar, ACTOR_SELF, AVAR_HitTypeFlags, 0)
481 Call(SetActorVar, ACTOR_SELF, AVAR_IsClone, FALSE)
482 Call(SetActorVar, ACTOR_SELF, AVAR_ShouldKnockDown, FALSE)
483 Call(SetActorVar, ACTOR_SELF, AVAR_HealAllCount, 0)
484 Call(SetActorVar, ACTOR_SELF, AVAR_HealOneCount, 0)
485 Call(SetActorVar, ACTOR_SELF, AVAR_AttackBoostCount, 0)
486 Call(SetActorVar, ACTOR_SELF, AVAR_DefenseBoostCount, 0)
487 Call(SetActorVar, ACTOR_SELF, AVAR_ElectrifyCount, 0)
488 Call(SetActorVar, ACTOR_SELF, AVAR_TransparifyCount, 0)
489 Call(SetActorVar, ACTOR_SELF, AVAR_CloneActorID, -1)
490 Call(SetActorVar, ACTOR_SELF, AVAR_MadeCloneLastTurn, FALSE)
491 Call(SetActorVar, ACTOR_SELF, AVAR_LastMove, AVAL_LastMove_None)
492 Return
493 End
494};
495
496EvtScript N(EVS_RemoveClone) = {
497 Call(GetActorVar, ACTOR_SELF, AVAR_IsClone, LVar0)
498 IfEq(LVar0, 1)
499 Return
500 EndIf
501 Call(GetActorVar, ACTOR_SELF, AVAR_CloneActorID, LVar0)
502 Call(ActorExists, LVar0, LVar1)
503 IfEq(LVar1, 0)
504 Return
505 EndIf
506 Call(SetActorVar, ACTOR_SELF, AVAR_MadeCloneLastTurn, FALSE)
507 Call(GetLastElement, LVarA)
509 Label(0)
510 Call(GetBattleFlags, LVarA)
512 Wait(1)
513 Goto(0)
514 EndIf
515 EndIf
516 Call(GetActorVar, ACTOR_SELF, AVAR_CloneActorID, LVar0)
517 Call(SetActorVar, ACTOR_SELF, AVAR_CloneActorID, -1)
518 Call(GetActorFlags, ACTOR_SELF, LVarA)
520 Call(SetPartEventBits, ACTOR_SELF, PRT_FLYING, ACTOR_EVENT_FLAG_ATTACK_CHARGED, FALSE)
521 Else
522 Call(SetPartEventBits, ACTOR_SELF, PRT_GROUND, ACTOR_EVENT_FLAG_ATTACK_CHARGED, FALSE)
523 EndIf
524 Call(GetActorPos, LVar0, LVar1, LVar2, LVar3)
525 Call(RemoveActor, LVar0)
526 Thread
527 Add(LVar3, 2)
528 Loop(2)
529 PlayEffect(EFFECT_BIG_SMOKE_PUFF, LVar1, LVar2, LVar3, 0, 0, 0, 0, 0)
530 Wait(2)
531 EndLoop
533 Return
534 End
535};
536
537EvtScript N(EVS_HandleEvent) = {
538 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
539 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
540 Call(SetPartAlpha, ACTOR_SELF, PRT_GROUND, 255)
541 Call(GetLastEvent, ACTOR_SELF, LVar0)
544 Call(GetActorVar, ACTOR_SELF, AVAR_HitTypeFlags, LVar0)
545 BitwiseOrConst(LVar0, AVAL_HitType_Combo)
546 Call(SetActorVar, ACTOR_SELF, AVAR_HitTypeFlags, LVar0)
547 SetConst(LVar0, PRT_GROUND)
548 SetConst(LVar1, ANIM_Magikoopa_Anim04)
552 SetConst(LVar0, PRT_GROUND)
553 SetConst(LVar1, ANIM_Magikoopa_Anim04)
555 ExecWait(N(EVS_RemoveClone))
558 SetConst(LVar0, PRT_GROUND)
559 SetConst(LVar1, ANIM_Magikoopa_Anim05)
560 SetConst(LVar2, ANIM_Magikoopa_Anim06)
562 ExecWait(N(EVS_RemoveClone))
564 SetConst(LVar0, PRT_GROUND)
565 SetConst(LVar1, ANIM_Magikoopa_Anim05)
566 SetConst(LVar2, ANIM_Magikoopa_Anim06)
568 ExecWait(N(EVS_RemoveClone))
569 SetConst(LVar0, PRT_GROUND)
570 SetConst(LVar1, ANIM_Magikoopa_Anim06)
572 Return
574 SetConst(LVar0, PRT_GROUND)
575 SetConst(LVar1, ANIM_Magikoopa_Anim04)
577 ExecWait(N(EVS_RemoveClone))
579 SetConst(LVar0, PRT_GROUND)
580 SetConst(LVar1, ANIM_Magikoopa_Anim04)
582 ExecWait(N(EVS_RemoveClone))
583 SetConst(LVar0, PRT_GROUND)
584 SetConst(LVar1, ANIM_Magikoopa_Anim04)
586 Return
588 SetConst(LVar0, PRT_GROUND)
589 SetConst(LVar1, ANIM_Magikoopa_Anim01)
592 SetConst(LVar0, PRT_GROUND)
593 SetConst(LVar1, ANIM_Magikoopa_Anim01)
595 Call(GetActorVar, ACTOR_SELF, AVAR_HitTypeFlags, LVar0)
596 IfFlag(LVar0, AVAL_HitType_Combo)
597 ExecWait(N(EVS_RemoveClone))
598 Return
599 EndIf
600 Call(GetStatusFlags, ACTOR_SELF, LVar0)
601 IfNe(LVar0, 0)
602 ExecWait(N(EVS_RemoveClone))
603 EndIf
605 SetConst(LVar0, PRT_GROUND)
606 SetConst(LVar1, ANIM_Magikoopa_Anim04)
608 ExecWait(N(EVS_RemoveClone))
609 Wait(10)
610 SetConst(LVar0, PRT_GROUND)
611 SetConst(LVar1, ANIM_Magikoopa_Anim04)
613 Return
615 SetConst(LVar0, PRT_GROUND)
616 SetConst(LVar1, ANIM_Magikoopa_Anim01)
619 ExecWait(N(EVS_RemoveClone))
620 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim04)
621 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.5))
622 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
623 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
624 Call(JumpToGoal, ACTOR_SELF, 15, FALSE, TRUE, FALSE)
625 Wait(15)
626 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim02)
627 ExecWait(N(EVS_Flee))
628 Return
630 SetConst(LVar0, PRT_GROUND)
631 SetConst(LVar1, ANIM_Magikoopa_Anim02)
634 ExecWait(N(EVS_RemoveClone))
635 Call(GetStatusFlags, ACTOR_SELF, LVar0)
638 Call(SetPartDispOffset, ACTOR_SELF, PRT_GROUND, 0, 2, 0)
639 Else
640 Call(SetPartDispOffset, ACTOR_SELF, PRT_GROUND, -4, 5, 0)
641 EndIf
642 EndIf
643 SetConst(LVar0, PRT_GROUND)
644 SetConst(LVar1, ANIM_Magikoopa_Anim04)
646 Return
648 SetConst(LVar0, PRT_GROUND)
649 SetConst(LVar1, ANIM_Magikoopa_Anim01)
652 SetConst(LVar0, PRT_GROUND)
653 SetConst(LVar1, ANIM_Magikoopa_Anim04)
655 ExecWait(N(EVS_RemoveClone))
658 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
659 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
660 Return
661 End
662};
663
664EvtScript N(EVS_Flying_HandleEvent) = {
665 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
666 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
667 Call(SetPartAlpha, ACTOR_SELF, PRT_FLYING, 255)
668 Call(GetLastEvent, ACTOR_SELF, LVar0)
671 Call(GetActorVar, ACTOR_SELF, AVAR_HitTypeFlags, LVar0)
672 BitwiseOrConst(LVar0, AVAL_HitType_Combo)
673 Call(SetActorVar, ACTOR_SELF, AVAR_HitTypeFlags, LVar0)
674 ExecWait(N(EVS_KnockDownCheck))
675 SetConst(LVar0, PRT_FLYING)
676 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim04)
680 ExecWait(N(EVS_KnockDownCheck))
681 SetConst(LVar0, PRT_FLYING)
682 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim04)
684 ExecWait(N(EVS_RemoveClone))
685 ExecWait(N(EVS_KnockDown))
688 SetConst(LVar0, PRT_FLYING)
689 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim04)
691 ExecWait(N(EVS_RemoveClone))
694 ExecWait(N(EVS_KnockDownCheck))
695 SetConst(LVar0, PRT_FLYING)
696 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim05)
697 SetConst(LVar2, ANIM_FlyingMagikoopa_Anim06)
699 ExecWait(N(EVS_RemoveClone))
700 ExecWait(N(EVS_KnockDown))
703 SetConst(LVar0, PRT_FLYING)
704 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim05)
705 SetConst(LVar2, ANIM_FlyingMagikoopa_Anim06)
707 ExecWait(N(EVS_RemoveClone))
708 SetConst(LVar0, PRT_FLYING)
709 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim06)
711 Return
713 SetConst(LVar0, PRT_FLYING)
714 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim04)
716 ExecWait(N(EVS_RemoveClone))
718 SetConst(LVar0, PRT_FLYING)
719 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim04)
721 ExecWait(N(EVS_RemoveClone))
722 SetConst(LVar0, PRT_FLYING)
723 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim04)
725 Return
727 SetConst(LVar0, PRT_FLYING)
728 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim01)
731 SetConst(LVar0, PRT_FLYING)
732 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim01)
734 Call(GetActorVar, ACTOR_SELF, AVAR_HitTypeFlags, LVar0)
735 IfFlag(LVar0, AVAL_HitType_Combo)
736 ExecWait(N(EVS_RemoveClone))
737 Return
738 EndIf
739 Call(GetStatusFlags, ACTOR_SELF, LVar0)
740 IfNe(LVar0, 0)
741 ExecWait(N(EVS_RemoveClone))
742 EndIf
744 SetConst(LVar0, PRT_FLYING)
745 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim04)
747 ExecWait(N(EVS_RemoveClone))
748 Wait(10)
749 SetConst(LVar0, PRT_FLYING)
750 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim04)
752 Return
754 Call(SetActorPos, ACTOR_SELF, 20, 0, 0)
755 Call(HPBarToCurrent, ACTOR_SELF)
757 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim01)
758 Call(SetGoalToHome, ACTOR_SELF)
759 Call(SetActorSpeed, ACTOR_SELF, Float(4.0))
760 Call(FlyToGoal, ACTOR_SELF, 0, 1, EASING_LINEAR)
761 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim01)
762 Call(HPBarToHome, ACTOR_SELF)
764 SetConst(LVar0, PRT_FLYING)
765 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim01)
768 ExecWait(N(EVS_RemoveClone))
769 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim04)
770 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.5))
771 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
772 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
773 Call(JumpToGoal, ACTOR_SELF, 15, FALSE, TRUE, FALSE)
774 Wait(15)
775 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim02)
776 ExecWait(N(EVS_Flee))
777 Return
779 SetConst(LVar0, PRT_FLYING)
780 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim02)
783 ExecWait(N(EVS_RemoveClone))
784 Call(GetStatusFlags, ACTOR_SELF, LVar0)
787 Call(SetPartDispOffset, ACTOR_SELF, PRT_FLYING, -3, 0, 0)
788 Else
789 Call(SetPartDispOffset, ACTOR_SELF, PRT_FLYING, -15, 0, 0)
790 EndIf
791 EndIf
792 SetConst(LVar0, PRT_FLYING)
793 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim04)
795 Return
797 SetConst(LVar0, PRT_FLYING)
798 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim01)
801 SetConst(LVar0, PRT_FLYING)
802 SetConst(LVar1, ANIM_FlyingMagikoopa_Anim04)
804 ExecWait(N(EVS_RemoveClone))
807 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
808 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
809 Return
810 End
811};
812
813// (in) LVarB: actorID to heal
814EvtScript N(EVS_Move_HealOne) = {
815 Call(SetActorVar, ACTOR_SELF, AVAR_MadeCloneLastTurn, FALSE)
816 Call(SetActorVar, ACTOR_SELF, AVAR_LastMove, AVAL_LastMove_HealOne)
817 Call(AddActorVar, ACTOR_SELF, AVAR_HealOneCount, 1)
818 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
819 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
820 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
821 Call(UseBattleCamPreset, BTL_CAM_ACTOR)
822 Call(BattleCamTargetActor, ACTOR_SELF)
823 Call(MoveBattleCamOver, 15)
824 Wait(15)
825 Call(GetActorFlags, ACTOR_SELF, LVar0)
827 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim02)
828 Else
829 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim02)
830 EndIf
831 Wait(5)
832 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SPELL_CAST1)
833 Call(GetActorFlags, ACTOR_SELF, LVar0)
835 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
836 Call(GetStatusFlags, ACTOR_SELF, LVarA)
838 Sub(LVar0, 6)
839 Add(LVar1, 12)
840 Sub(LVar2, 2)
841 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
842 Else
843 Sub(LVar0, 16)
844 Add(LVar1, 31)
845 Sub(LVar2, 2)
846 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
847 EndIf
848 Else
849 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
850 Call(GetStatusFlags, ACTOR_SELF, LVarA)
852 Sub(LVar0, 12)
853 Add(LVar1, 14)
854 Sub(LVar2, 2)
855 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
856 Else
857 Sub(LVar0, 30)
858 Add(LVar1, 36)
859 Sub(LVar2, 2)
860 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
861 EndIf
862 EndIf
863 Wait(30)
864 Call(GetActorFlags, ACTOR_SELF, LVar0)
866 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim01)
867 Else
868 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim01)
869 EndIf
870 Wait(5)
871 Thread
872 Wait(5)
873 Call(PlaySoundAtActor, LVarB, SOUND_RECOVER_HEART)
874 Call(PlaySoundAtActor, LVarB, SOUND_HEART_BOUNCE)
875 Wait(30)
876 Call(PlaySoundAtActor, LVarB, SOUND_STAR_BOUNCE_A)
878 Thread
879 Call(FreezeBattleState, TRUE)
880 Call(HealActor, LVarB, HEAL_AMT_ONE, FALSE)
881 Call(FreezeBattleState, FALSE)
883 Call(WaitForBuffDone)
884 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
885 Call(MoveBattleCamOver, 10)
886 Wait(10)
887 Call(YieldTurn)
888 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
889 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
890 Return
891 End
892};
893
894EvtScript N(EVS_Move_HealAll) = {
895 Call(SetActorVar, ACTOR_SELF, AVAR_MadeCloneLastTurn, FALSE)
896 Call(SetActorVar, ACTOR_SELF, AVAR_LastMove, AVAL_LastMove_HealAll)
897 Call(AddActorVar, ACTOR_SELF, AVAR_HealAllCount, 1)
898 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
899 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
900 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
901 Call(UseBattleCamPreset, BTL_CAM_ACTOR)
902 Call(BattleCamTargetActor, ACTOR_SELF)
903 Call(MoveBattleCamOver, 15)
904 Wait(15)
905 Call(GetActorFlags, ACTOR_SELF, LVar0)
907 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim02)
908 Else
909 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim02)
910 EndIf
911 Wait(5)
912 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SPELL_CAST1)
913 Call(GetActorFlags, ACTOR_SELF, LVar0)
915 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
916 Call(GetStatusFlags, ACTOR_SELF, LVarA)
918 Sub(LVar0, 6)
919 Add(LVar1, 12)
920 Sub(LVar2, 2)
921 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
922 Else
923 Sub(LVar0, 16)
924 Add(LVar1, 31)
925 Sub(LVar2, 2)
926 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
927 EndIf
928 Else
929 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
930 Call(GetStatusFlags, ACTOR_SELF, LVarA)
932 Sub(LVar0, 12)
933 Add(LVar1, 14)
934 Sub(LVar2, 2)
935 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
936 Else
937 Sub(LVar0, 30)
938 Add(LVar1, 36)
939 Sub(LVar2, 2)
940 PlayEffect(EFFECT_RADIAL_SHIMMER, 7, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
941 EndIf
942 EndIf
943 Wait(30)
944 Call(GetActorFlags, ACTOR_SELF, LVar0)
946 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim01)
947 Else
948 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim01)
949 EndIf
950 Wait(5)
951 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
952 Call(InitTargetIterator)
953 Label(0)
954 Set(LFlag0, FALSE)
955 Call(GetOwnerTarget, LVar0, LVar1)
956 Call(GetOriginalActorType, LVar0, LVar1)
957 IfEq(LVar1, ACTOR_TYPE_DRY_BONES)
959 IfEq(LVar1, 1)
960 Set(LFlag0, TRUE)
961 EndIf
962 EndIf
963 IfEq(LFlag0, FALSE)
964 Thread
965 Wait(5)
966 Call(PlaySoundAtActor, LVar0, SOUND_RECOVER_HEART)
967 Call(PlaySoundAtActor, LVar0, SOUND_HEART_BOUNCE)
968 Wait(30)
969 Call(PlaySoundAtActor, LVar0, SOUND_STAR_BOUNCE_A)
971 Thread
972 Call(FreezeBattleState, TRUE)
973 Call(HealActor, LVar0, HEAL_AMT_ALL, TRUE)
974 Call(FreezeBattleState, FALSE)
976 EndIf
977 Call(ChooseNextTarget, ITER_NEXT, LVar0)
979 Goto(0)
980 EndIf
981 Call(WaitForBuffDone)
982 Wait(1)
983 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
984 Call(MoveBattleCamOver, 10)
985 Wait(10)
986 Call(YieldTurn)
987 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
988 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
989 Return
990 End
991};
992
993EvtScript N(EVS_Attack_MagicBlast) = {
994 Call(SetActorVar, ACTOR_SELF, AVAR_LastMove, AVAL_LastMove_MagicBlast)
995 Set(LFlag0, FALSE)
996 Set(LFlag1, FALSE)
997 Call(GetActorVar, ACTOR_SELF, AVAR_MadeCloneLastTurn, LVar0)
998 IfEq(LVar0, 1)
999 Set(LFlag0, TRUE)
1000 Call(GetActorVar, ACTOR_SELF, AVAR_CloneActorID, LVarA)
1001 EndIf
1002 Call(GetActorFlags, ACTOR_SELF, LVar0)
1004 Set(LFlag1, TRUE)
1005 EndIf
1006 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
1007 IfEq(LFlag0, TRUE)
1008 Call(UseIdleAnimation, LVarA, FALSE)
1009 EndIf
1010 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
1011 Call(GetBattlePhase, LVar0)
1013 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1014 Call(MoveBattleCamOver, 1)
1015 Else
1016 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1017 Call(MoveBattleCamOver, 10)
1018 EndIf
1019 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SPELL_CAST1)
1020 IfEq(LFlag1, FALSE)
1021 IfEq(LFlag0, TRUE)
1022 Call(SetAnimation, LVarA, 1, ANIM_Magikoopa_Anim02)
1023 Call(GetActorPos, LVarA, LVar0, LVar1, LVar2)
1024 Sub(LVar0, 17)
1025 Add(LVar1, 33)
1026 PlayEffect(EFFECT_GATHER_MAGIC, 0, LVar0, LVar1, LVar2, Float(0.5), 30, 0)
1027 EndIf
1028 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim02)
1029 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1030 Call(GetStatusFlags, ACTOR_SELF, LVar3)
1032 Sub(LVar0, 6)
1033 Add(LVar1, 13)
1034 Else
1035 Sub(LVar0, 17)
1036 Add(LVar1, 33)
1037 EndIf
1038 PlayEffect(EFFECT_GATHER_MAGIC, 0, LVar0, LVar1, LVar2, Float(0.5), 30, 0)
1039 Else
1040 IfEq(LFlag0, TRUE)
1041 Call(SetAnimation, LVarA, 1, ANIM_FlyingMagikoopa_Anim02)
1042 Call(GetActorPos, LVarA, LVar0, LVar1, LVar2)
1043 Sub(LVar0, 30)
1044 Add(LVar1, 36)
1045 PlayEffect(EFFECT_GATHER_MAGIC, 0, LVar0, LVar1, LVar2, Float(0.5), 30, 0)
1046 EndIf
1047 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim02)
1048 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1049 Call(GetStatusFlags, ACTOR_SELF, LVar3)
1051 Sub(LVar0, 12)
1052 Add(LVar1, 14)
1053 Else
1054 Sub(LVar0, 30)
1055 Add(LVar1, 36)
1056 EndIf
1057 PlayEffect(EFFECT_GATHER_MAGIC, 0, LVar0, LVar1, LVar2, Float(0.5), 30, 0)
1058 EndIf
1059 Wait(30)
1060 Call(EnemyTestTarget, ACTOR_SELF, LVar9, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS)
1061 Switch(LVar9)
1064 IfEq(LFlag0, TRUE)
1065 Call(PlaySoundAtActor, LVarA, SOUND_SPELL_CAST2)
1066 EndIf
1067 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SPELL_CAST2)
1068 IfEq(LFlag1, FALSE)
1069 IfEq(LFlag0, TRUE)
1070 Call(SetAnimation, LVarA, 1, ANIM_Magikoopa_Anim03)
1071 EndIf
1072 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim03)
1073 Else
1074 IfEq(LFlag0, TRUE)
1075 Call(SetAnimation, LVarA, 1, ANIM_FlyingMagikoopa_Anim03)
1076 EndIf
1077 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim03)
1078 EndIf
1079 Wait(5)
1080 Call(SetGoalToTarget, ACTOR_SELF)
1081 Call(GetGoalPos, ACTOR_SELF, LVar4, LVar5, LVar6)
1082 Sub(LVar4, 50)
1083 Set(LVar5, 0)
1084 IfEq(LFlag1, FALSE)
1085 IfEq(LFlag0, TRUE)
1086 Call(GetActorPos, LVarA, LVar0, LVar1, LVar2)
1087 Sub(LVar0, 20)
1088 Add(LVar1, 20)
1089 Call(N(ShrinkActor), LVar0, LVar1, LVar6, LVar4, LVar5, LVar6, 30)
1090 EndIf
1091 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1092 Call(GetStatusFlags, ACTOR_SELF, LVar3)
1094 Sub(LVar0, 8)
1095 Add(LVar1, 8)
1096 Else
1097 Sub(LVar0, 20)
1098 Add(LVar1, 20)
1099 EndIf
1100 Call(N(ShrinkActor), LVar0, LVar1, LVar6, LVar4, LVar5, LVar6, 30)
1101 Else
1102 IfEq(LFlag0, TRUE)
1103 Call(GetActorPos, LVarA, LVar0, LVar1, LVar2)
1104 Sub(LVar0, 20)
1105 Add(LVar1, 20)
1106 Call(N(ShrinkActor), LVar0, LVar1, LVar6, LVar4, LVar5, LVar6, 30)
1107 EndIf
1108 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1109 Call(GetStatusFlags, ACTOR_SELF, LVar3)
1111 Sub(LVar0, 8)
1112 Add(LVar1, 8)
1113 Else
1114 Sub(LVar0, 20)
1115 Add(LVar1, 20)
1116 EndIf
1117 Call(N(ShrinkActor), LVar0, LVar1, LVar6, LVar4, LVar5, LVar6, 30)
1118 EndIf
1119 Wait(50)
1121 Call(EnemyTestTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
1122 EndIf
1123 Wait(15)
1124 Call(YieldTurn)
1125 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
1126 IfEq(LFlag0, TRUE)
1127 Call(UseIdleAnimation, LVarA, TRUE)
1128 EndIf
1129 Return
1131 EndSwitch
1132 IfEq(LFlag0, TRUE)
1133 Call(PlaySoundAtActor, LVarA, SOUND_SPELL_CAST2)
1134 EndIf
1135 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SPELL_CAST2)
1136 IfEq(LFlag1, FALSE)
1137 IfEq(LFlag0, TRUE)
1138 Call(SetAnimation, LVarA, 1, ANIM_Magikoopa_Anim03)
1139 EndIf
1140 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim03)
1141 Else
1142 IfEq(LFlag0, TRUE)
1143 Call(SetAnimation, LVarA, 1, ANIM_FlyingMagikoopa_Anim03)
1144 EndIf
1145 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim03)
1146 EndIf
1147 Wait(5)
1148 Call(SetGoalToTarget, ACTOR_SELF)
1149 Call(GetGoalPos, ACTOR_SELF, LVar4, LVar5, LVar6)
1150 IfEq(LFlag1, FALSE)
1151 IfEq(LFlag0, TRUE)
1152 Call(GetActorPos, LVarA, LVar0, LVar1, LVar2)
1153 Sub(LVar0, 20)
1154 Add(LVar1, 20)
1155 Call(N(ShrinkActor), LVar0, LVar1, LVar6, LVar4, LVar5, LVar6, 20)
1156 EndIf
1157 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1158 Call(GetStatusFlags, ACTOR_SELF, LVar3)
1160 Sub(LVar0, 8)
1161 Add(LVar1, 8)
1162 Else
1163 Sub(LVar0, 20)
1164 Add(LVar1, 20)
1165 EndIf
1166 Call(N(ShrinkActor), LVar0, LVar1, LVar6, LVar4, LVar5, LVar6, 20)
1167 Else
1168 IfEq(LFlag0, TRUE)
1169 Call(GetActorPos, LVarA, LVar0, LVar1, LVar2)
1170 Sub(LVar0, 20)
1171 Add(LVar1, 20)
1172 Call(N(ShrinkActor), LVar0, LVar1, LVar6, LVar4, LVar5, LVar6, 20)
1173 EndIf
1174 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1175 Call(GetStatusFlags, ACTOR_SELF, LVar3)
1177 Sub(LVar0, 8)
1178 Add(LVar1, 8)
1179 Else
1180 Sub(LVar0, 20)
1181 Add(LVar1, 20)
1182 EndIf
1183 Call(N(ShrinkActor), LVar0, LVar1, LVar6, LVar4, LVar5, LVar6, 20)
1184 EndIf
1185 Wait(18)
1186 IfEq(LFlag0, TRUE)
1187 Wait(2)
1188 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_MAGIC | DAMAGE_TYPE_NO_CONTACT, 0, 0, DMG_MAGIC_BLAST, BS_FLAGS1_TRIGGER_EVENTS)
1189 Else
1190 Wait(2)
1191 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_MAGIC | DAMAGE_TYPE_NO_CONTACT, 0, 0, DMG_MAGIC_BLAST, BS_FLAGS1_TRIGGER_EVENTS)
1192 EndIf
1193 Switch(LVar0)
1196 Wait(20)
1197 Call(YieldTurn)
1199 EndSwitch
1200 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
1201 IfEq(LFlag0, TRUE)
1202 Call(UseIdleAnimation, LVarA, TRUE)
1203 EndIf
1204 Return
1205 End
1206};
1207
1208EvtScript N(EVS_GetAvailableColumn) = {
1209 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
1210 Call(InitTargetIterator)
1211 Label(0)
1212 Call(GetOwnerTarget, LVar0, LVar1)
1213 Call(GetIndexFromHome, LVar0, LVar1)
1214 Mod(LVar1, 4)
1215 Switch(LVar1)
1216 CaseEq(0)
1217 Set(LFlagB, TRUE)
1218 CaseEq(1)
1219 Set(LFlagC, TRUE)
1220 CaseEq(2)
1221 Set(LFlagD, TRUE)
1222 CaseEq(3)
1223 Set(LFlagE, TRUE)
1224 EndSwitch
1225 Call(ChooseNextTarget, ITER_NEXT, LVar0)
1227 Goto(0)
1228 EndIf
1229 Set(LVar0, -1)
1230 Call(GetIndexFromHome, ACTOR_SELF, LVar1)
1231 Mod(LVar1, 4)
1232 Switch(LVar1)
1233 CaseEq(0)
1234 IfEq(LFlagC, FALSE)
1235 Set(LVar0, 1)
1236 EndIf
1237 CaseEq(1)
1238 IfEq(LFlagB, FALSE)
1239 Set(LVar0, 0)
1240 EndIf
1241 IfEq(LFlagD, FALSE)
1242 Set(LVar0, 2)
1243 EndIf
1244 CaseEq(2)
1245 IfEq(LFlagC, FALSE)
1246 Set(LVar0, 1)
1247 EndIf
1248 IfEq(LFlagE, FALSE)
1249 Set(LVar0, 3)
1250 EndIf
1251 CaseEq(3)
1252 IfEq(LFlagD, FALSE)
1253 Set(LVar0, 2)
1254 EndIf
1255 EndSwitch
1256 IfNe(LVar0, -1)
1257 Call(GetActorFlags, ACTOR_SELF, LVar1)
1259 Add(LVar0, 4)
1260 EndIf
1261 EndIf
1262 Return
1263 End
1264};
1265
1266EvtScript N(EVS_Clone_HandleEvent) = {
1267 Return
1268 End
1269};
1270
1271EvtScript N(EVS_Clone_Init) = {
1272 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_Clone_HandleEvent)))
1273 Call(SetActorVar, ACTOR_SELF, AVAR_IsClone, TRUE)
1274 Return
1275 End
1276};
1277
1278EvtScript N(EVS_FlyingClone_Init) = {
1279 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_Clone_HandleEvent)))
1280 Call(SetActorVar, ACTOR_SELF, AVAR_IsClone, TRUE)
1281 Return
1282 End
1283};
1284
1285s32 N(CloneDefense)[] = {
1286 ELEMENT_NORMAL, 0,
1288};
1289
1290s32 N(FlyingCloneDefense)[] = {
1291 ELEMENT_NORMAL, 0,
1293};
1294
1295s32 N(CloneStatusTable)[] = {
1302 STATUS_KEY_FEAR, 0,
1306 STATUS_KEY_STOP, 0,
1317 STATUS_END,
1318};
1319
1320s32 N(FlyingCloneStatusTable)[] = {
1327 STATUS_KEY_FEAR, 0,
1331 STATUS_KEY_STOP, 0,
1342 STATUS_END,
1343};
1344
1345ActorPartBlueprint N(CloneParts)[] = {
1346 {
1348 .index = PRT_GROUND,
1349 .posOffset = { 0, 0, 0 },
1350 .targetOffset = { 2, 35 },
1351 .opacity = 255,
1352 .idleAnimations = N(GroundAnims),
1353 .defenseTable = N(CloneDefense),
1354 .eventFlags = ACTOR_EVENT_FLAG_ILLUSORY,
1355 .elementImmunityFlags = 0,
1356 .projectileTargetOffset = { -5, -12 },
1357 },
1358};
1359
1360ActorPartBlueprint N(FlyingCloneParts)[] = {
1361 {
1363 .index = PRT_GROUND,
1364 .posOffset = { 0, 0, 0 },
1365 .targetOffset = { -10, 35 },
1366 .opacity = 255,
1367 .idleAnimations = N(FlyingAnims),
1368 .defenseTable = N(FlyingCloneDefense),
1369 .eventFlags = ACTOR_EVENT_FLAG_ILLUSORY,
1370 .elementImmunityFlags = 0,
1371 .projectileTargetOffset = { 0, -8 },
1372 },
1373};
1374
1375ActorBlueprint N(clone) = {
1376 .flags = ACTOR_FLAG_NO_ATTACK,
1377 .type = ACTOR_TYPE_MAGICLONE,
1378 .level = ACTOR_LEVEL_MAGICLONE,
1379 .maxHP = 11,
1380 .partCount = ARRAY_COUNT(N(CloneParts)),
1381 .partsData = N(CloneParts),
1382 .initScript = &N(EVS_Clone_Init),
1383 .statusTable = N(CloneStatusTable),
1384 .escapeChance = 40,
1385 .airLiftChance = 0,
1386 .hurricaneChance = 0,
1387 .spookChance = 0,
1388 .upAndAwayChance = 0,
1389 .spinSmashReq = 0,
1390 .powerBounceChance = 75,
1391 .coinReward = 0,
1392 .size = { 36, 40 },
1393 .healthBarOffset = { 0, 0 },
1394 .statusIconOffset = { -10, 20 },
1395 .statusTextOffset = { 10, 32 },
1396};
1397
1398ActorBlueprint N(clone_flying) = {
1400 .type = ACTOR_TYPE_FLYING_MAGICLONE,
1401 .level = ACTOR_LEVEL_FLYING_MAGICLONE,
1402 .maxHP = 11,
1403 .partCount = ARRAY_COUNT(N(FlyingCloneParts)),
1404 .partsData = N(FlyingCloneParts),
1405 .initScript = &N(EVS_FlyingClone_Init),
1406 .statusTable = N(FlyingCloneStatusTable),
1407 .escapeChance = 40,
1408 .airLiftChance = 0,
1409 .hurricaneChance = 0,
1410 .spookChance = 0,
1411 .upAndAwayChance = 0,
1412 .spinSmashReq = 0,
1413 .powerBounceChance = 75,
1414 .coinReward = 2,
1415 .size = { 48, 40 },
1416 .healthBarOffset = { 0, 0 },
1417 .statusIconOffset = { -25, 20 },
1418 .statusTextOffset = { 1, 34 },
1419};
1420
1421Vec3i N(SummonPos) = { NPC_DISPOSE_LOCATION };
1422
1423Formation N(CloneFormation) = {
1424 ACTOR_BY_POS(N(clone), N(SummonPos), 0),
1425};
1426
1427Formation N(FlyingCloneFormation) = {
1428 ACTOR_BY_POS(N(clone_flying), N(SummonPos), 0),
1429};
1430
1431EvtScript N(EVS_Move_MakeClone) = {
1433 IfEq(LVar0, 1)
1434 ExecWait(N(EVS_Flee))
1435 Return
1436 EndIf
1437 Call(SetActorVar, ACTOR_SELF, AVAR_MadeCloneLastTurn, TRUE)
1438 Call(SetActorVar, ACTOR_SELF, AVAR_LastMove, AVAL_LastMove_MakeClone)
1439 Set(LFlag0, FALSE)
1440 Call(GetActorFlags, ACTOR_SELF, LVar0)
1442 Set(LFlag0, TRUE)
1443 EndIf
1444 IfEq(LFlag0, FALSE)
1445 Call(SummonEnemy, Ref(N(CloneFormation)), FALSE)
1446 Else
1447 Call(SummonEnemy, Ref(N(FlyingCloneFormation)), FALSE)
1448 EndIf
1449 Call(SetActorVar, ACTOR_SELF, AVAR_CloneActorID, LVar0)
1450 Set(LVarA, LVar0)
1451 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
1452 Call(EnableIdleScript, LVarA, IDLE_SCRIPT_DISABLE)
1453 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
1454 Call(UseIdleAnimation, LVarA, FALSE)
1455 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
1456 Call(UseBattleCamPreset, BTL_CAM_ACTOR)
1457 Call(BattleCamTargetActor, ACTOR_SELF)
1458 Call(MoveBattleCamOver, 25)
1459 Wait(25)
1460 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SPELL_CAST3)
1461 IfEq(LFlag0, FALSE)
1462 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim02)
1463 Call(SetAnimation, LVarA, 1, ANIM_Magikoopa_Anim02)
1464 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1465 Add(LVar1, 23)
1466 Else
1467 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim02)
1468 Call(SetAnimation, LVarA, 1, ANIM_FlyingMagikoopa_Anim02)
1469 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1470 Add(LVar1, 23)
1471 EndIf
1472 PlayEffect(EFFECT_ENERGY_IN_OUT, 1, LVar0, LVar1, LVar2, Float(1.0), 30, 0)
1473 Wait(10)
1474 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
1475 Call(EnableIdleScript, LVar9, IDLE_SCRIPT_ENABLE)
1476 Wait(30)
1477 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1478 Add(LVar2, -3)
1479 Call(SetActorPos, LVarA, LVar0, LVar1, LVar2)
1480 Set(LVar9, LVarA)
1481 Wait(15)
1482 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1483 Call(MoveBattleCamOver, 30)
1484 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SPELL_CAST4)
1485 Call(PlaySoundAtActor, LVar9, SOUND_SPELL_CAST4)
1486 Call(SetPartFlagBits, LVar9, 1, ACTOR_PART_FLAG_PRIMARY_TARGET, FALSE)
1487 Call(RandInt, 1000, LVar0)
1488 IfLt(LVar0, 500)
1489 Call(SetActorSpeed, ACTOR_SELF, Float(2.0))
1490 ExecWait(N(EVS_GetAvailableColumn))
1491 Call(SetGoalToIndex, ACTOR_SELF, LVar0)
1492 Call(FlyToGoal, ACTOR_SELF, 0, 0, EASING_LINEAR)
1493 Else
1494 Call(SetActorSpeed, LVar9, Float(2.0))
1495 ExecWait(N(EVS_GetAvailableColumn))
1496 Call(SetGoalToIndex, LVar9, LVar0)
1497 Call(FlyToGoal, LVar9, 0, 0, EASING_LINEAR)
1498 EndIf
1499 Call(SetPartFlagBits, LVar9, 1, ACTOR_PART_FLAG_PRIMARY_TARGET, TRUE)
1500 Call(GetActorHP, ACTOR_SELF, LVar0)
1501 Call(SetEnemyHP, LVar9, LVar0)
1502 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1503 Call(ForceHomePos, ACTOR_SELF, LVar0, LVar1, LVar2)
1504 Call(HPBarToHome, ACTOR_SELF)
1505 Call(GetActorPos, LVar9, LVar0, LVar1, LVar2)
1506 Call(ForceHomePos, LVar9, LVar0, LVar1, LVar2)
1507 Call(HPBarToHome, LVar9)
1508 IfEq(LFlag0, FALSE)
1509 Call(SetPartEventBits, ACTOR_SELF, PRT_GROUND, ACTOR_EVENT_FLAG_ATTACK_CHARGED, TRUE)
1510 Else
1511 Call(SetPartEventBits, ACTOR_SELF, PRT_FLYING, ACTOR_EVENT_FLAG_ATTACK_CHARGED, TRUE)
1512 EndIf
1513 IfEq(LFlag0, FALSE)
1514 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim01)
1515 Call(SetAnimation, LVar9, 1, ANIM_Magikoopa_Anim01)
1516 Else
1517 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim01)
1518 Call(SetAnimation, LVar9, 1, ANIM_FlyingMagikoopa_Anim01)
1519 EndIf
1520 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
1521 Call(UseIdleAnimation, LVar9, TRUE)
1522 Return
1523 End
1524};
1525
1526#include "common/battle/CheckMagikoopaCastTarget.inc.c"
1527
1528EvtScript N(EVS_Move_TryBoostAttack) = {
1529 Set(LFlag0, FALSE)
1530 Label(10)
1531 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
1532 Call(InitTargetIterator)
1533 Label(0)
1534 Call(GetOwnerTarget, LVar0, LVar1)
1535 Call(GetIndexFromHome, LVar0, LVar1)
1537 IfGt(LVar1, LVar2)
1538 Call(N(CheckMagikoopaCastTarget), LVar0, LVar3)
1539 IfEq(LVar3, 0)
1540 Call(GetActorAttackBoost, LVar0, LVar4)
1541 IfLt(LVar4, MAX_ATTACK_BOOST)
1542 Set(LVar8, LVar0)
1544 Goto(100)
1545 EndIf
1546 EndIf
1547 EndIf
1548 Call(ChooseNextTarget, ITER_NEXT, LVar0)
1550 Goto(0)
1551 EndIf
1552 IfEq(LFlag0, FALSE)
1553 Set(LFlag0, TRUE)
1554 Call(SetBattleVar, BTL_VAR_Magikoopa_LastIndexBoosted, -1)
1555 Goto(10)
1556 EndIf
1558 IfEq(LVar0, 1)
1559 ExecWait(N(EVS_Flee))
1560 Return
1561 EndIf
1562 ExecWait(N(EVS_Attack_MagicBlast))
1563 Return
1564 // found target
1565 Label(100)
1566 Call(SetActorVar, ACTOR_SELF, AVAR_MadeCloneLastTurn, FALSE)
1567 Call(SetActorVar, ACTOR_SELF, AVAR_LastMove, AVAL_LastMove_BoostAttack)
1568 Call(AddActorVar, ACTOR_SELF, AVAR_AttackBoostCount, 1)
1569 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
1570 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
1571 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
1572 Call(UseBattleCamPreset, BTL_CAM_ACTOR)
1573 Call(BattleCamTargetActor, ACTOR_SELF)
1574 Call(MoveBattleCamOver, 15)
1575 Wait(15)
1576 Call(GetActorFlags, ACTOR_SELF, LVar0)
1578 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim02)
1579 Else
1580 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim02)
1581 EndIf
1582 Wait(5)
1583 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SPELL_CAST1)
1584 Call(GetActorFlags, ACTOR_SELF, LVar0)
1586 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1587 Call(GetStatusFlags, ACTOR_SELF, LVarA)
1589 Sub(LVar0, 6)
1590 Add(LVar1, 12)
1591 Sub(LVar2, 2)
1592 PlayEffect(EFFECT_RADIAL_SHIMMER, 5, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
1593 Else
1594 Sub(LVar0, 16)
1595 Add(LVar1, 31)
1596 Sub(LVar2, 2)
1597 PlayEffect(EFFECT_RADIAL_SHIMMER, 5, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
1598 EndIf
1599 Else
1600 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1601 Call(GetStatusFlags, ACTOR_SELF, LVarA)
1603 Sub(LVar0, 12)
1604 Add(LVar1, 14)
1605 Sub(LVar2, 2)
1606 PlayEffect(EFFECT_RADIAL_SHIMMER, 5, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
1607 Else
1608 Sub(LVar0, 30)
1609 Add(LVar1, 36)
1610 Sub(LVar2, 2)
1611 PlayEffect(EFFECT_RADIAL_SHIMMER, 5, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
1612 EndIf
1613 EndIf
1614 Wait(30)
1615 Call(GetActorFlags, ACTOR_SELF, LVar0)
1617 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim01)
1618 Else
1619 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim01)
1620 EndIf
1621 Wait(5)
1622 Thread
1623 Wait(10)
1624 Call(PlaySoundAtActor, LVar8, SOUND_MAGIKOOPA_POWER_UP)
1625 EndThread
1626 Thread
1627 Call(FreezeBattleState, TRUE)
1628 Call(BoostAttack, LVar8, ATTACK_BOOST_AMT)
1629 Call(FreezeBattleState, FALSE)
1630 EndThread
1631 Call(WaitForBuffDone)
1632 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1633 Wait(10)
1634 Call(YieldTurn)
1635 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
1636 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
1637 Return
1638 End
1639};
1640
1641EvtScript N(EVS_Move_TryBoostDefense) = {
1642 Set(LFlag0, FALSE)
1643 Label(10)
1644 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
1645 Call(InitTargetIterator)
1646 Label(0)
1647 Call(GetOwnerTarget, LVar0, LVar1)
1648 Call(GetIndexFromHome, LVar0, LVar1)
1650 IfGt(LVar1, LVar2)
1651 Call(N(CheckMagikoopaCastTarget), LVar0, LVar3)
1652 IfEq(LVar3, 0)
1653 Call(GetActorDefenseBoost, LVar0, LVar4)
1654 IfLt(LVar4, MAX_DEFENSE_BOOST)
1655 Set(LVar8, LVar0)
1657 Goto(100)
1658 EndIf
1659 EndIf
1660 EndIf
1661 Call(ChooseNextTarget, ITER_NEXT, LVar0)
1663 Goto(0)
1664 EndIf
1665 IfEq(LFlag0, FALSE)
1666 Set(LFlag0, TRUE)
1667 Call(SetBattleVar, BTL_VAR_Magikoopa_LastIndexBoosted, -1)
1668 Goto(10)
1669 EndIf
1671 IfEq(LVar0, 1)
1672 ExecWait(N(EVS_Flee))
1673 Return
1674 EndIf
1675 ExecWait(N(EVS_Attack_MagicBlast))
1676 Return
1677 // found target
1678 Label(100)
1679 Call(SetActorVar, ACTOR_SELF, AVAR_MadeCloneLastTurn, FALSE)
1680 Call(SetActorVar, ACTOR_SELF, AVAR_LastMove, AVAL_LastMove_BoostDefense)
1681 Call(AddActorVar, ACTOR_SELF, AVAR_DefenseBoostCount, 1)
1682 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
1683 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
1684 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
1685 Call(UseBattleCamPreset, BTL_CAM_ACTOR)
1686 Call(BattleCamTargetActor, ACTOR_SELF)
1687 Call(MoveBattleCamOver, 15)
1688 Wait(15)
1689 Call(GetActorFlags, ACTOR_SELF, LVar0)
1691 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim02)
1692 Else
1693 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim02)
1694 EndIf
1695 Wait(5)
1696 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SPELL_CAST1)
1697 Call(GetActorFlags, ACTOR_SELF, LVar0)
1699 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1700 Call(GetStatusFlags, ACTOR_SELF, LVarA)
1702 Sub(LVar0, 6)
1703 Add(LVar1, 12)
1704 Sub(LVar2, 2)
1705 PlayEffect(EFFECT_RADIAL_SHIMMER, 5, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
1706 Else
1707 Sub(LVar0, 16)
1708 Add(LVar1, 31)
1709 Sub(LVar2, 2)
1710 PlayEffect(EFFECT_RADIAL_SHIMMER, 5, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
1711 EndIf
1712 Else
1713 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1714 Call(GetStatusFlags, ACTOR_SELF, LVarA)
1716 Sub(LVar0, 12)
1717 Add(LVar1, 14)
1718 Sub(LVar2, 2)
1719 PlayEffect(EFFECT_RADIAL_SHIMMER, 5, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
1720 Else
1721 Sub(LVar0, 30)
1722 Add(LVar1, 36)
1723 Sub(LVar2, 2)
1724 PlayEffect(EFFECT_RADIAL_SHIMMER, 5, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
1725 EndIf
1726 EndIf
1727 Wait(30)
1728 Call(GetActorFlags, ACTOR_SELF, LVar0)
1730 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim01)
1731 Else
1732 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim01)
1733 EndIf
1734 Wait(5)
1735 Thread
1736 Wait(10)
1737 Call(PlaySoundAtActor, LVar8, SOUND_MAGIKOOPA_POWER_UP)
1738 EndThread
1739 Thread
1740 Call(FreezeBattleState, TRUE)
1741 Call(BoostDefense, LVar8, DEFENSE_BOOST_AMT)
1742 Call(FreezeBattleState, FALSE)
1743 EndThread
1744 Call(WaitForBuffDone)
1745 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1746 Wait(10)
1747 Call(YieldTurn)
1748 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
1749 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
1750 Return
1751 End
1752};
1753
1754EvtScript N(EVS_Move_TryElectrify) = {
1755 Set(LFlag0, FALSE)
1756 Label(10)
1757 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
1758 Call(InitTargetIterator)
1759 Label(0)
1760 Call(GetOwnerTarget, LVar0, LVar1)
1761 Call(GetIndexFromHome, LVar0, LVar1)
1763 IfGt(LVar1, LVar2)
1764 Call(N(CheckMagikoopaCastTarget), LVar0, LVar3)
1765 IfEq(LVar3, 0)
1766 Call(GetStatusFlags, LVar0, LVar4)
1768 Set(LVar8, LVar0)
1770 Goto(100)
1771 EndIf
1772 EndIf
1773 EndIf
1774 Call(ChooseNextTarget, ITER_NEXT, LVar0)
1776 Goto(0)
1777 EndIf
1778 IfEq(LFlag0, FALSE)
1779 Set(LFlag0, TRUE)
1780 Call(SetBattleVar, BTL_VAR_Magikoopa_LastIndexBoosted, -1)
1781 Goto(10)
1782 EndIf
1784 IfEq(LVar0, 1)
1785 ExecWait(N(EVS_Flee))
1786 Return
1787 EndIf
1788 ExecWait(N(EVS_Attack_MagicBlast))
1789 Return
1790 // found target
1791 Label(100)
1792 Call(SetActorVar, ACTOR_SELF, AVAR_MadeCloneLastTurn, FALSE)
1793 Call(SetActorVar, ACTOR_SELF, AVAR_LastMove, AVAL_LastMove_Electrify)
1794 Call(AddActorVar, ACTOR_SELF, AVAR_ElectrifyCount, 1)
1795 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
1796 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
1797 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
1798 Call(UseBattleCamPreset, BTL_CAM_ACTOR)
1799 Call(BattleCamTargetActor, ACTOR_SELF)
1800 Call(MoveBattleCamOver, 15)
1801 Wait(15)
1802 Call(GetActorFlags, ACTOR_SELF, LVar0)
1804 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim02)
1805 Else
1806 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim02)
1807 EndIf
1808 Wait(5)
1809 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_MAGIKOOPA_ELECTRIFY)
1810 Call(GetActorFlags, ACTOR_SELF, LVar0)
1812 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1813 Call(GetStatusFlags, ACTOR_SELF, LVarA)
1815 Sub(LVar0, 6)
1816 Add(LVar1, 12)
1817 Sub(LVar2, 2)
1818 PlayEffect(EFFECT_SNAKING_STATIC, 0, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
1819 Else
1820 Sub(LVar0, 16)
1821 Add(LVar1, 31)
1822 Sub(LVar2, 2)
1823 PlayEffect(EFFECT_SNAKING_STATIC, 0, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
1824 EndIf
1825 Else
1826 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1827 Call(GetStatusFlags, ACTOR_SELF, LVarA)
1829 Sub(LVar0, 12)
1830 Add(LVar1, 14)
1831 Sub(LVar2, 2)
1832 PlayEffect(EFFECT_SNAKING_STATIC, 0, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
1833 Else
1834 Sub(LVar0, 30)
1835 Add(LVar1, 36)
1836 Sub(LVar2, 2)
1837 PlayEffect(EFFECT_SNAKING_STATIC, 0, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
1838 EndIf
1839 EndIf
1840 Wait(30)
1841 Call(GetActorFlags, ACTOR_SELF, LVar0)
1843 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim01)
1844 Else
1845 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim01)
1846 EndIf
1847 Wait(5)
1848 Thread
1849 Wait(10)
1850 Loop(4)
1851 Call(PlaySoundAtActor, LVar8, SOUND_ELECTRIC_BUZZ)
1852 Call(RandInt, 3, LVar0)
1853 Add(LVar0, 3)
1854 Wait(LVar0)
1855 EndLoop
1856 EndThread
1857 Thread
1858 Call(FreezeBattleState, TRUE)
1859 Call(ElectrifyActor, LVar8, ELECTRIFY_TURNS)
1860 Call(FreezeBattleState, FALSE)
1861 EndThread
1862 Call(WaitForBuffDone)
1863 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1864 Wait(10)
1865 Call(YieldTurn)
1866 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
1867 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
1868 Return
1869 End
1870};
1871
1872EvtScript N(EVS_Move_TryTransparent) = {
1873 Set(LFlag0, FALSE)
1874 Label(10)
1875 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
1876 Call(InitTargetIterator)
1877 Label(0)
1878 Call(GetOwnerTarget, LVar0, LVar1)
1879 Call(GetIndexFromHome, LVar0, LVar1)
1881 IfGt(LVar1, LVar2)
1882 Call(N(CheckMagikoopaCastTarget), LVar0, LVar3)
1883 IfEq(LVar3, 0)
1884 Call(GetStatusFlags, LVar0, LVar4)
1886 Set(LVar8, LVar0)
1888 Goto(100)
1889 EndIf
1890 EndIf
1891 EndIf
1892 Call(ChooseNextTarget, ITER_NEXT, LVar0)
1894 Goto(0)
1895 EndIf
1896 IfEq(LFlag0, FALSE)
1897 Set(LFlag0, TRUE)
1898 Call(SetBattleVar, BTL_VAR_Magikoopa_LastIndexBoosted, -1)
1899 Goto(10)
1900 EndIf
1902 IfEq(LVar0, 1)
1903 ExecWait(N(EVS_Flee))
1904 Return
1905 EndIf
1906 ExecWait(N(EVS_Attack_MagicBlast))
1907 Return
1908 // found target
1909 Label(100)
1910 Call(SetActorVar, ACTOR_SELF, AVAR_MadeCloneLastTurn, FALSE)
1911 Call(SetActorVar, ACTOR_SELF, AVAR_LastMove, AVAL_LastMove_Transparify)
1912 Call(AddActorVar, ACTOR_SELF, AVAR_TransparifyCount, 1)
1913 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
1914 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
1915 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
1916 Call(UseBattleCamPreset, BTL_CAM_ACTOR)
1917 Call(BattleCamTargetActor, ACTOR_SELF)
1918 Call(MoveBattleCamOver, 15)
1919 Wait(15)
1920 Call(GetActorFlags, ACTOR_SELF, LVar0)
1922 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim02)
1923 Else
1924 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim02)
1925 EndIf
1926 Wait(5)
1927 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SPELL_CAST1)
1928 Call(GetActorFlags, ACTOR_SELF, LVar0)
1930 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1931 Call(GetStatusFlags, ACTOR_SELF, LVarA)
1933 Sub(LVar0, 6)
1934 Add(LVar1, 12)
1935 Sub(LVar2, 2)
1936 PlayEffect(EFFECT_RADIAL_SHIMMER, 6, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
1937 Else
1938 Sub(LVar0, 16)
1939 Add(LVar1, 31)
1940 Sub(LVar2, 2)
1941 PlayEffect(EFFECT_RADIAL_SHIMMER, 6, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
1942 EndIf
1943 Else
1944 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
1945 Call(GetStatusFlags, ACTOR_SELF, LVarA)
1947 Sub(LVar0, 12)
1948 Add(LVar1, 14)
1949 Sub(LVar2, 2)
1950 PlayEffect(EFFECT_RADIAL_SHIMMER, 6, LVar0, LVar1, LVar2, Float(0.12), 30, 0)
1951 Else
1952 Sub(LVar0, 30)
1953 Add(LVar1, 36)
1954 Sub(LVar2, 2)
1955 PlayEffect(EFFECT_RADIAL_SHIMMER, 6, LVar0, LVar1, LVar2, Float(0.3), 30, 0)
1956 EndIf
1957 EndIf
1958 Wait(30)
1959 Call(GetActorFlags, ACTOR_SELF, LVar0)
1961 Call(SetAnimation, ACTOR_SELF, PRT_GROUND, ANIM_Magikoopa_Anim01)
1962 Else
1963 Call(SetAnimation, ACTOR_SELF, PRT_FLYING, ANIM_FlyingMagikoopa_Anim01)
1964 EndIf
1965 Wait(5)
1966 Thread
1967 Wait(10)
1968 Call(PlaySoundAtActor, LVar8, SOUND_MAGIKOOPA_VANISH)
1969 EndThread
1970 Thread
1971 Call(FreezeBattleState, TRUE)
1972 Call(VanishActor, LVar8, TRANSPARIFY_TURNS)
1973 Call(FreezeBattleState, FALSE)
1974 EndThread
1975 Call(WaitForBuffDone)
1976 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1977 Wait(10)
1978 Call(YieldTurn)
1979 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
1980 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
1981 Return
1982 End
1983};
1984
1985EvtScript N(EVS_TakeTurn) = {
1986 #define LBL_LOOP_COUNT_INJURED_1 0
1987 #define LBL_LOOP_COUNT_INJURED_2 1
1988 #define LBL_LOOP_COUNT_INJURED_3 2
1989 #define LBL_TRY_HEALING 10
1990 #define LBL_LOOP_CHOOSE_BEST_HEAL 11
1991 #define LBL_TRY_MOVES 20
1992 #define LBL_CHOOSE_MOVE 123
1993 Call(GetBattlePhase, LVar0)
1995 ExecWait(N(EVS_Attack_MagicBlast))
1996 Return
1997 EndIf
1998 Call(GetActorVar, ACTOR_SELF, AVAR_MadeCloneLastTurn, LVar0)
1999 IfEq(LVar0, 1)
2001 EndIf
2002 // first heal check: count ~75% of actors with less than 25% HP
2003 Set(LVarA, 0)
2004 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
2005 Call(InitTargetIterator)
2007 Set(LFlag0, FALSE)
2008 Call(GetOwnerTarget, LVar0, LVar1)
2009 Call(GetOriginalActorType, LVar0, LVar1)
2010 IfEq(LVar1, ACTOR_TYPE_DRY_BONES)
2011 Call(GetActorVar, LVar0, AVAR_DryBones_Collapsed, LVar1)
2012 IfEq(LVar1, 1)
2013 Set(LFlag0, TRUE)
2014 EndIf
2015 EndIf
2016 Call(GetActorHP, LVar0, LVar2)
2017 Call(GetEnemyMaxHP, LVar0, LVar3)
2018 MulF(LVar2, Float(100.0))
2019 DivF(LVar2, LVar3)
2020 IfEq(LFlag0, FALSE) // collapsed dry bones check
2021 IfLe(LVar2, HEAL_THRESHOLD_1) // HP% check
2022 Call(RandInt, 99, LVar4)
2023 Add(LVar4, 1)
2024 IfLt(LVar4, HEAL_CHANCE_1) // chance to ignore actor
2025 Add(LVarA, 1)
2026 Set(LVarB, LVar0)
2027 EndIf
2028 EndIf
2029 EndIf
2030 Call(ChooseNextTarget, ITER_NEXT, LVar0)
2033 EndIf
2034 IfGt(LVarA, 0)
2036 EndIf
2037 // second heal check: count ~80% of actors with less than 20% HP
2038 Set(LVarA, 0)
2039 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
2040 Call(InitTargetIterator)
2042 Set(LFlag0, FALSE)
2043 Call(GetOwnerTarget, LVar0, LVar1)
2044 Call(GetOriginalActorType, LVar0, LVar1)
2045 IfEq(LVar1, ACTOR_TYPE_DRY_BONES)
2046 Call(GetActorVar, LVar0, AVAR_DryBones_Collapsed, LVar1)
2047 IfEq(LVar1, 1)
2048 Set(LFlag0, TRUE)
2049 EndIf
2050 EndIf
2051 Call(GetActorHP, LVar0, LVar2)
2052 Call(GetEnemyMaxHP, LVar0, LVar3)
2053 MulF(LVar2, Float(100.0))
2054 DivF(LVar2, LVar3)
2055 IfEq(LFlag0, FALSE) // collapsed dry bones check
2056 IfLe(LVar2, HEAL_THRESHOLD_2) // HP% check
2057 Call(RandInt, 99, LVar4)
2058 Add(LVar4, 1)
2059 IfLt(LVar4, HEAL_CHANCE_2) // chance to ignore actor
2060 Add(LVarA, 1)
2061 Set(LVarB, LVar0)
2062 EndIf
2063 EndIf
2064 EndIf
2065 Call(ChooseNextTarget, ITER_NEXT, LVar0)
2068 EndIf
2069 IfGt(LVarA, 0)
2071 EndIf
2072 // third heal check: count ~99% of actors with less than 15% HP
2073 Set(LVarA, 0)
2074 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
2075 Call(InitTargetIterator)
2077 Set(LFlag0, FALSE)
2078 Call(GetOwnerTarget, LVar0, LVar1)
2079 Call(GetOriginalActorType, LVar0, LVar1)
2080 IfEq(LVar1, ACTOR_TYPE_DRY_BONES)
2081 Call(GetActorVar, LVar0, AVAR_DryBones_Collapsed, LVar1)
2082 IfEq(LVar1, 1)
2083 Set(LFlag0, TRUE)
2084 EndIf
2085 EndIf
2086 Call(GetActorHP, LVar0, LVar2)
2087 Call(GetEnemyMaxHP, LVar0, LVar3)
2088 MulF(LVar2, Float(100.0))
2089 DivF(LVar2, LVar3)
2090 IfEq(LFlag0, FALSE) // collapsed dry bones check
2091 IfLe(LVar2, HEAL_THRESHOLD_3) // HP% check
2092 Call(RandInt, 99, LVar4)
2093 Add(LVar4, 1)
2094 IfLt(LVar4, HEAL_CHANCE_3) // chance to ignore actor
2095 Add(LVarA, 1)
2096 Set(LVarB, LVar0)
2097 EndIf
2098 EndIf
2099 EndIf
2100 Call(ChooseNextTarget, ITER_NEXT, LVar0)
2103 EndIf
2104 IfGt(LVarA, 0)
2106 EndIf
2108 // try healing spells
2111 IfEq(LVar0, 1)
2112 ExecWait(N(EVS_Flee))
2113 Return
2114 EndIf
2115 // single healing target available
2116 IfEq(LVarA, 1)
2117 Call(GetActorVar, ACTOR_SELF, AVAR_HealOneCount, LVar0)
2118 IfLt(LVar0, MAX_HEAL_ONE)
2119 Call(RandInt, 1000, LVar0)
2120 IfLt(LVar0, HEAL_ONE_CHANCE)
2121 ExecWait(N(EVS_Move_HealOne))
2122 Return
2123 EndIf
2124 Else
2125 Call(GetActorVar, ACTOR_SELF, AVAR_HealAllCount, LVar0)
2126 IfLt(LVar0, MAX_HEAL_ALL)
2127 Call(RandInt, 1000, LVar0)
2128 IfLt(LVar0, HEAL_ALL_CHANCE)
2129 ExecWait(N(EVS_Move_HealAll))
2130 Return
2131 EndIf
2132 EndIf
2133 EndIf
2134 Else
2135 // multiple injured actors were found
2136 Call(GetActorVar, ACTOR_SELF, AVAR_HealAllCount, LVar0)
2137 IfLt(LVar0, MAX_HEAL_ALL)
2138 Call(RandInt, 1000, LVar0)
2139 IfLt(LVar0, HEAL_ALL_CHANCE)
2140 ExecWait(N(EVS_Move_HealAll))
2141 Return
2142 EndIf
2143 Else
2144 // choose actor with least HP%
2145 Call(GetActorVar, ACTOR_SELF, AVAR_HealOneCount, LVar0)
2146 IfLt(LVar0, MAX_HEAL_ONE)
2147 SetF(LVar9, Float(100.0))
2148 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
2149 Call(InitTargetIterator)
2151 Set(LFlag0, FALSE)
2152 Call(GetOwnerTarget, LVar0, LVar1)
2153 Call(GetOriginalActorType, LVar0, LVar1)
2154 IfEq(LVar1, ACTOR_TYPE_DRY_BONES)
2155 Call(GetActorVar, LVar0, AVAR_DryBones_Collapsed, LVar1)
2156 IfEq(LVar1, 1)
2157 Set(LFlag0, TRUE)
2158 EndIf
2159 EndIf
2160 Call(GetActorHP, LVar0, LVar2)
2161 Call(GetEnemyMaxHP, LVar0, LVar3)
2162 MulF(LVar2, Float(100.0))
2163 DivF(LVar2, LVar3)
2164 IfEq(LFlag0, FALSE)
2165 IfLe(LVar2, LVar9)
2166 SetF(LVar9, LVar2)
2167 Set(LVarB, LVar0)
2168 EndIf
2169 EndIf
2170 Call(ChooseNextTarget, ITER_NEXT, LVar0)
2173 EndIf
2174 Call(RandInt, 1000, LVar0)
2175 IfLt(LVar0, HEAL_ONE_CHANCE)
2176 ExecWait(N(EVS_Move_HealOne))
2177 Return
2178 EndIf
2179 EndIf
2180 EndIf
2181 EndIf
2182 // check various buffs and attacks
2184 Set(LVarA, 10)
2185 Set(LVarB, 10)
2186 Set(LVarC, 10)
2187 Set(LVarD, 10)
2188 Set(LVarE, 10)
2189 Set(LVarF, 10)
2190 Call(GetActorVar, ACTOR_SELF, AVAR_MadeCloneLastTurn, LVar0)
2191 IfEq(LVar0, 1)
2192 Set(LVarA, 100) // only magic blast
2193 Set(LVarB, 0)
2194 Set(LVarC, 0)
2195 Set(LVarD, 0)
2196 Set(LVarE, 0)
2197 Set(LVarF, 0)
2199 Else
2200 ExecWait(N(EVS_GetAvailableColumn))
2201 IfEq(LVar0, -1)
2202 Set(LVarB, 0)
2203 EndIf
2204 EndIf
2205 Call(GetStatusFlags, ACTOR_SELF, LVar0)
2206 IfNe(LVar0, 0)
2207 Set(LVarB, 0)
2208 EndIf
2209 Call(GetActorVar, ACTOR_SELF, AVAR_LastMove, LVar0)
2210 Switch(LVar0)
2211 CaseEq(AVAL_LastMove_BoostAttack)
2212 Call(GetActorVar, ACTOR_SELF, AVAR_AttackBoostCount, LVar1)
2213 IfLt(LVar1, MAX_ATTACK_BOOST)
2214 Call(RandInt, 99, LVar0)
2215 Add(LVar0, 1)
2216 IfLe(LVar0, 50)
2217 Set(LVarA, 0)
2218 Set(LVarB, 0)
2219 Set(LVarC, 100) // only boost attack
2220 Set(LVarD, 0)
2221 Set(LVarE, 0)
2222 Set(LVarF, 0)
2223 EndIf
2224 EndIf
2225 CaseEq(AVAL_LastMove_BoostDefense)
2226 Call(GetActorVar, ACTOR_SELF, AVAR_DefenseBoostCount, LVar1)
2227 IfLt(LVar1, MAX_DEFENSE_BOOST)
2228 Call(RandInt, 99, LVar0)
2229 Add(LVar0, 1)
2230 IfLe(LVar0, 50)
2231 Set(LVarA, 0)
2232 Set(LVarB, 0)
2233 Set(LVarC, 0)
2234 Set(LVarD, 100) // only boost defense
2235 Set(LVarE, 0)
2236 Set(LVarF, 0)
2237 EndIf
2238 EndIf
2239 EndSwitch
2240 // set weights to zero for anything we cant cast anymore
2241 Call(GetActorVar, ACTOR_SELF, AVAR_AttackBoostCount, LVar0)
2242 IfGe(LVar0, MAX_ATTACK_BOOST)
2243 Set(LVarC, 0)
2244 EndIf
2245 Call(GetActorVar, ACTOR_SELF, AVAR_DefenseBoostCount, LVar0)
2246 IfGe(LVar0, MAX_DEFENSE_BOOST)
2247 Set(LVarD, 0)
2248 EndIf
2249 Call(GetActorVar, ACTOR_SELF, AVAR_ElectrifyCount, LVar0)
2250 IfGe(LVar0, MAX_ELECTRIFY)
2251 Set(LVarE, 0)
2252 EndIf
2253 Call(GetActorVar, ACTOR_SELF, AVAR_TransparifyCount, LVar0)
2254 IfGe(LVar0, MAX_TRANSPARIFY)
2255 Set(LVarF, 0)
2256 EndIf
2257 // make a weighted choice
2259 Set(LVar9, 0)
2260 Add(LVar9, LVarA)
2261 Add(LVar9, LVarB)
2262 Add(LVar9, LVarC)
2263 Add(LVar9, LVarD)
2264 Add(LVar9, LVarE)
2265 Add(LVar9, LVarF)
2266 Sub(LVar9, 1)
2268 Add(LVar0, 1)
2269 IfLe(LVar0, LVarA)
2270 ExecWait(N(EVS_Attack_MagicBlast))
2271 Return
2272 EndIf
2273 Add(LVarA, LVarB)
2274 IfLe(LVar0, LVarA)
2275 ExecWait(N(EVS_Move_MakeClone))
2276 Return
2277 EndIf
2278 Add(LVarA, LVarC)
2279 IfLe(LVar0, LVarA)
2280 ExecWait(N(EVS_Move_TryBoostAttack))
2281 Return
2282 EndIf
2283 Add(LVarA, LVarD)
2284 IfLe(LVar0, LVarA)
2285 ExecWait(N(EVS_Move_TryBoostDefense))
2286 Return
2287 EndIf
2288 Add(LVarA, LVarE)
2289 IfLe(LVar0, LVarA)
2290 ExecWait(N(EVS_Move_TryElectrify))
2291 Return
2292 EndIf
2293 ExecWait(N(EVS_Move_TryTransparent))
2294 Return
2295 End
2296};
Bytecode EvtScript[]
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2834
@ 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
@ BS_FLAGS1_EXECUTING_MOVE
Definition enums.h:3578
@ 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_FLAG_ATTACK_CHARGED
Actor has charged an attack that can be removed with Star Beam.
Definition enums.h:3389
@ ACTOR_EVENT_FLAG_ILLUSORY
Player attacks pass through and miss.
Definition enums.h:3374
@ 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
@ TARGET_FLAG_PRIMARY_ONLY
Definition enums.h:1863
@ TARGET_FLAG_2
Definition enums.h:1850
@ EASING_LINEAR
Definition enums.h:510
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6408
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6407
@ STATUS_FLAG_STATIC
Definition enums.h:2813
@ STATUS_FLAG_SHRINK
Definition enums.h:2819
@ STATUS_FLAG_TRANSPARENT
Definition enums.h:2825
@ SOUND_SPELL_CAST4
Definition enums.h:1501
@ 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_ELECTRIFY
Definition enums.h:1074
@ SOUND_MAGIKOOPA_VANISH
Definition enums.h:1053
@ SOUND_SPELL_CAST3
Definition enums.h:1500
@ SOUND_HEART_BOUNCE
Definition enums.h:925
@ SOUND_FALL_QUICK
Definition enums.h:1090
@ SOUND_MAGIKOOPA_POWER_UP
Definition enums.h:1055
@ SOUND_ELECTRIC_BUZZ
Definition enums.h:1278
@ 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_NO_ATTACK
Skip attack turn.
Definition enums.h:3339
@ ACTOR_BLUR_ENABLE
Definition enums.h:6414
@ EVENT_HIT
Definition enums.h:2132
@ EVENT_UP_AND_AWAY
Definition enums.h:2176
@ EVENT_SCARE_AWAY
Definition enums.h:2174
@ EVENT_BURN_HIT
Definition enums.h:2136
@ EVENT_BEGIN_FIRST_STRIKE
Definition enums.h:2173
@ EVENT_STAR_BEAM
Definition enums.h:2140
@ 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
@ DAMAGE_TYPE_MULTIPLE_POPUPS
Definition enums.h:2879
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
#define LBL_CHOOSE_MOVE
#define LBL_TRY_HEALING
#define LBL_TRY_MOVES
#define LBL_LOOP_COUNT_INJURED_1
#define LBL_LOOP_CHOOSE_BEST_HEAL
#define LBL_LOOP_COUNT_INJURED_2
#define LBL_LOOP_COUNT_INJURED_3
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 LFlagE
Definition macros.h:181
#define Ref(sym)
Address/pointer constant.
Definition macros.h:60
#define DivF(VAR, FLOAT_VALUE)
Definition macros.h:386
#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 Sub(VAR, INT_VALUE)
Definition macros.h:377
#define LVarF
Definition macros.h:163
#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 Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define LVarC
Definition macros.h:160
#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 LFlag1
Definition macros.h:168
#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 LFlagD
Definition macros.h:180
#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 IfLe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR > RVAR.
Definition macros.h:281
#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 SetF(VAR, FLOAT_VALUE)
Sets the given variable to a given value, but supports Floats.
Definition macros.h:373
#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 BitwiseAndConst(VAR, CONST)
VAR &= CONST, but CONST is treated as-is rather than dereferenced with evt_get_variable.
Definition macros.h:439
#define LVar8
Definition macros.h:156
#define LVar2
Definition macros.h:150
#define MulF(VAR, FLOAT_VALUE)
Definition macros.h:385
#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 LVarD
Definition macros.h:161
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define LVar9
Definition macros.h:157
#define NPC_DISPOSE_LOCATION
Definition macros.h:158
#define LFlagB
Definition macros.h:178
#define PlayEffect(args...)
Definition macros.h:807
#define LFlagC
Definition macros.h:179
#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 BitwiseOrConst(VAR, CONST)
VAR |= CONST, but CONST is treated as-is rather than dereferenced with evt_get_variable.
Definition macros.h:445
#define LVar4
Definition macros.h:152
#define LVar3
Definition macros.h:151
#define LVarE
Definition macros.h:162
#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
#define ACTOR_BY_POS(_name, _pos, _priority, args...)
Definition battle.h:230
@ AVAR_DryBones_Collapsed
Definition battle.h:100
@ BTL_VAR_Magikoopa_LastIndexBoosted
Definition battle.h:90
FormationRow Formation[]
Definition battle.h:167