Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
lakilester.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects.h"
3#include "battle/battle.h"
4#include "script_api/battle.h"
5#include "sprite/npc/BattleLakilester.h"
9#include "hud_element.h"
10#include "sprite/player.h"
11
12#define NAMESPACE battle_partner_lakilester
13
14extern EvtScript N(EVS_HandleEvent);
15extern EvtScript N(EVS_Idle);
16extern EvtScript N(EVS_HandlePhase);
17extern EvtScript N(EVS_TakeTurn);
18extern EvtScript N(EVS_Init);
19extern EvtScript N(EVS_ExecuteAction);
20extern EvtScript N(EVS_Celebrate);
21extern EvtScript N(EVS_RunAway);
23extern EvtScript N(EVS_Move_SpinyFlip);
24extern EvtScript N(EVS_Move_SpinySurge);
25extern EvtScript N(EVS_Move_CloudNine);
26extern EvtScript N(EVS_Move_Hurricane);
27
32
33static s32 sSavedHurricaneIntensity;
34static s32 sBreathSizeIncrease;
35static s32 sMaxPower;
36static s32 HID_AimReticle;
37static s32 HID_AimTarget;
38static s32 TargetMarkRotation;
39static s32 D_8023D294;
40static s32 AimingTime;
41static s32 D_8023D29C;
42static f32 D_8023D2A0;
43static f32 D_8023D2A4;
44static f32 D_8023D2A8;
45static f32 D_8023D2AC;
46static f32 D_8023D2B0;
47static f32 AimMoveAngle;
48static s32 hudAim[1];
49static s32 HID_AnalogStick;
50static s32 HudStickPosX;
51static s32 HudStickPosY;
52static b32 SpinyFlipTargetingDone;
53static s32 D_8023D2CC;
54static s32 sTargetStates[24];
55static s32 sNumEnemiesBeingBlown;
56static s32 sIsHurricaneActive;
57static s32 D_8023D338;
58
59enum N(ActorPartIDs) {
60 PRT_MAIN = 1,
61 PRT_2 = 2,
62};
63
64enum N(ActorVars) {
65 AVAR_Unk_0 = 0,
66};
67
68enum N(ActorParams) {
69 DMG_UNK = 0,
70};
71
72typedef struct HurricaneState {
73 /* 0x00 */ char unk_00[0x44];
74 /* 0x44 */ s16 breathSizeIncrease;
75 /* 0x46 */ s16 unk_46;
76 /* 0x48 */ char unk_48[0xC];
77 /* 0x54 */ s16 unk_54;
78 /* 0x56 */ char unk_56[0x4];
79 /* 0x5A */ s16 startingTotalPower;
80 /* 0x5C */ s8 state;
81 /* 0x5D */ s8 unk_5D;
82 /* 0x5E */ char unk_5E[0x12];
83 /* 0x70 */ s16 intensity;
84 /* 0x72 */ s16 totalPower;
85 /* 0x74 */ char unk_74[0x10];
87
88s32 N(DefaultAnims)[] = {
89 STATUS_KEY_NORMAL, ANIM_BattleLakilester_Walk,
90 STATUS_KEY_DAZE, ANIM_BattleLakilester_Injured,
91 STATUS_KEY_INACTIVE, ANIM_BattleLakilester_Still,
93};
94
95s32 N(IdleAnimations_spiny)[] = {
96 STATUS_KEY_NORMAL, ANIM_BattleLakilester_Spiny,
98};
99
100s32 N(DefenseTable)[] = {
103};
104
105s32 N(StatusTable)[] = {
108 STATUS_KEY_SLEEP, 100,
111 STATUS_KEY_DIZZY, 100,
112 STATUS_KEY_FEAR, 100,
116 STATUS_KEY_STOP, 100,
128};
129
130ActorPartBlueprint N(ActorParts)[] = {
131 {
132 .flags = 0,
133 .index = PRT_MAIN,
134 .posOffset = { 0, 0, 0 },
135 .targetOffset = { 12, 30 },
136 .opacity = 255,
137 .idleAnimations = N(DefaultAnims),
138 .defenseTable = N(DefenseTable),
139 .eventFlags = 0,
140 .elementImmunityFlags = 0,
141 .projectileTargetOffset = { 0, 0 },
142 },
143 {
145 .index = PRT_2,
146 .posOffset = { 0, 0, 0 },
147 .targetOffset = { 0, 0 },
148 .opacity = 255,
149 .idleAnimations = N(IdleAnimations_spiny),
150 .defenseTable = N(DefenseTable),
151 .eventFlags = 0,
152 .elementImmunityFlags = 0,
153 .projectileTargetOffset = { 0, 0 },
154 },
155};
156
157ActorBlueprint NAMESPACE = {
158 .flags = ACTOR_FLAG_FLYING,
159 .type = ACTOR_TYPE_LAKILESTER,
160 .level = ACTOR_LEVEL_LAKILESTER,
161 .maxHP = 99,
162 .partCount = ARRAY_COUNT(N(ActorParts)),
163 .partsData = N(ActorParts),
164 .initScript = &N(EVS_Init),
165 .statusTable = N(StatusTable),
166 .escapeChance = 0,
167 .airLiftChance = 0,
168 .hurricaneChance = 0,
169 .spookChance = 0,
170 .upAndAwayChance = 0,
171 .spinSmashReq = 4,
172 .powerBounceChance = 80,
173 .coinReward = 0,
174 .size = { 44, 40 },
175 .healthBarOffset = { 0, 0 },
176 .statusIconOffset = { -10, 30 },
177 .statusTextOffset = { 13, 31 },
178};
179
180EvtScript N(EVS_Init) = {
181 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
182 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
183 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
184 Call(BindHandlePhase, ACTOR_SELF, Ref(N(EVS_HandlePhase)))
185 Return
186 End
187};
188
189EvtScript N(EVS_Idle) = {
190 Return
191 End
192};
193
194EvtScript N(EVS_HandleEvent) = {
195 Call(UseIdleAnimation, ACTOR_PARTNER, FALSE)
196 Call(CloseActionCommandInfo)
197 Call(GetLastEvent, ACTOR_PARTNER, LVar0)
201 SetConst(LVar1, ANIM_BattleLakilester_Hurt)
202 SetConst(LVar2, ANIM_BattleLakilester_Hurt)
204 SetConst(LVar1, ANIM_BattleLakilester_Hurt)
209 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_NO_DAMGE)
210 SetConst(LVar0, PRT_MAIN)
211 SetConst(LVar1, ANIM_BattleLakilester_Hurt)
215 SetConst(LVar1, ANIM_BattleLakilester_Hurt)
216 SetConst(LVar2, 20)
218 SetConst(LVar1, ANIM_BattleLakilester_Hurt)
221 SetConst(LVar1, ANIM_BattleLakilester_BurnHurt)
222 Set(LVar2, 20)
223 SetConst(LVar3, ANIM_BattleLakilester_BurnStill)
225 SetConst(LVar1, ANIM_BattleLakilester_Hurt)
228 SetConst(LVar1, ANIM_BattleLakilester_BurnHurt)
229 SetConst(LVar2, ANIM_BattleLakilester_BurnStill)
231 SetConst(LVar1, ANIM_BattleLakilester_Hurt)
234 SetConst(LVar1, ANIM_BattleLakilester_Hurt)
235 Set(LVar2, 20)
238 SetConst(LVar1, ANIM_BattleLakilester_Hurt)
241 SetConst(LVar0, PRT_MAIN)
242 SetConst(LVar1, ANIM_BattleLakilester_Walk)
243 SetConst(LVar2, ANIM_BattleLakilester_Run)
244 Set(LVar3, 10)
248 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_NO_DAMGE)
249 SetConst(LVar0, PRT_MAIN)
250 SetConst(LVar1, ANIM_BattleLakilester_Block)
252 Wait(10)
256 Call(UseIdleAnimation, ACTOR_PARTNER, TRUE)
257 Return
258 End
259};
260
261EvtScript N(EVS_TakeTurn) = {
262 Call(GetBattlePhase, LVar0)
265 ExecWait(N(EVS_ExecuteAction))
267 ExecWait(N(EVS_Celebrate))
269 ExecWait(N(EVS_RunAway))
273 Return
274 End
275};
276
277EvtScript N(EVS_Celebrate) = {
278 SetConst(LVar0, PRT_MAIN)
279 SetConst(LVar1, ANIM_BattleLakilester_Celebrate)
280 SetConst(LVar2, ANIM_BattleLakilester_Walk)
281 SetConst(LVar3, ANIM_BattleLakilester_Walk)
283 Return
284 End
285};
286
287EvtScript N(EVS_RunAway) = {
288 SetConst(LVar0, PRT_MAIN)
289 SetConst(LVar1, ANIM_BattleLakilester_Run)
291 Return
292 End
293};
294
296 Call(UseIdleAnimation, ACTOR_PARTNER, FALSE)
297 Call(SetGoalToHome, ACTOR_PARTNER)
298 Call(SetActorSpeed, ACTOR_PARTNER, Float(6.0))
299 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Run)
300 Call(SetActorYaw, ACTOR_PARTNER, 0)
301 Call(RunToGoal, ACTOR_PARTNER, 0)
302 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Walk)
303 Call(UseIdleAnimation, ACTOR_PARTNER, TRUE)
304 Return
305 End
306};
307
308EvtScript N(EVS_HandlePhase) = {
309 Return
310 End
311};
312
313EvtScript N(EVS_ExecuteAction) = {
314 Call(GetMenuSelection, LVar0, LVar1, LVar2)
315 Call(ShowActionHud, TRUE)
318 Call(LoadStarPowerScript)
320 Return
322 Call(GetMenuSelection, LVar0, LVar1, LVar2)
324 CaseEq(MOVE_SPINY_FLIP1)
325 Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE)
326 ExecWait(N(EVS_Move_SpinyFlip))
327 CaseEq(MOVE_SPINY_FLIP2)
328 Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE)
329 ExecWait(N(EVS_Move_SpinyFlip))
330 CaseEq(MOVE_SPINY_FLIP3)
331 Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE)
332 ExecWait(N(EVS_Move_SpinyFlip))
333 CaseEq(MOVE_SPINY_SURGE)
334 ExecWait(N(EVS_Move_SpinySurge))
335 CaseEq(MOVE_CLOUD_NINE)
336 Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE)
337 ExecWait(N(EVS_Move_CloudNine))
338 CaseEq(MOVE_HURRICANE)
339 ExecWait(N(EVS_Move_Hurricane))
341 Return
342 End
343};
344
345EvtScript N(EVS_ReturnHome_Success) = {
346 Call(PartnerYieldTurn)
347 Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME)
348 Call(SetGoalToHome, ACTOR_PARTNER)
349 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Run)
350 Call(FlyToGoal, ACTOR_PARTNER, 15, 0, EASING_COS_IN_OUT)
351 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Walk)
352 Return
353 End
354};
355
356EvtScript N(EVS_ReturnHome_Miss) = {
357 Call(PartnerYieldTurn)
358 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MISTAKE)
359 Call(SetGoalToHome, ACTOR_PARTNER)
360 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Run)
361 Call(FlyToGoal, ACTOR_PARTNER, 15, 0, EASING_COS_IN_OUT)
362 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Walk)
363 Return
364 End
365};
366
367HudScript* N(AimDotHudScripts)[] = {
369};
370
371API_CALLABLE(N(SpinyFlipUpdatePopup)) {
372 if (isInitialCall) {
373 SpinyFlipTargetingDone = FALSE;
374 }
375
376 if (!SpinyFlipTargetingDone) {
378 return ApiStatus_BLOCK;
379 } else {
380 return ApiStatus_DONE2;
381 }
382}
383
384API_CALLABLE(N(SpinyFlipActionCommand)) {
385 BattleStatus* battleStatus = &gBattleStatus;
386 s32 screenX, screenY, screenZ;
387 Actor* partner = battleStatus->partnerActor;
388 Actor* target;
389 ActorPart* part;
390 ActorState* playerState;
391 ActorState* partnerState;
392 f32 speed;
393 f32 stickAngle;
394 s32 stickMagnitude;
395 s32 id;
396 s32 i;
397
398 f32 temp_f0_5;
399 f32 theta;
400 f32 sinTheta;
401 f32 cosTheta;
402 f32 temp_f2;
403 f32 temp_f2_2;
404 f32 temp_f8;
405 s32 (**var_s3)[0];
406 s32 (*temp_a0)[0];
407 s32 temp_a0_2;
408 s32 temp_f10;
409 s32 idAim;
410 s32 temp_v1_2;
411 s32* var_s0;
412
413 enum SpinyFlipState {
414 SPINY_FLIP_INIT = 0,
415 SPINY_FLIP_DELAY = 1, // give player time to start aiming
416 SPINY_FLIP_AIMING = 2, // player is aiming
417 };
418
419 partnerState = &partner->state;
420 playerState = &battleStatus->playerActor->state;
421
422 if (isInitialCall) {
423 script->functionTemp[0] = SPINY_FLIP_INIT;
424 }
425
426 switch (script->functionTemp[0]) {
427 case SPINY_FLIP_INIT:
428 HID_AimReticle = hud_element_create(&HES_AimReticle);
429 hud_element_set_render_depth(HID_AimReticle, 10);
430 HID_AimTarget = hud_element_create(&HES_AimTarget);
431 hud_element_set_render_depth(HID_AimTarget, 10);
432 hud_element_create_transform_A(HID_AimTarget);
433 HudStickPosX = -48;
434 HudStickPosY = 70;
435 HID_AnalogStick = id = hud_element_create(&HES_StickNeutral);
436 hud_element_set_render_pos(id, HudStickPosX, HudStickPosY);
438 for (i = 0; i < ARRAY_COUNT(N(AimDotHudScripts)); i++) {
439 hudAim[i] = idAim = hud_element_create(N(AimDotHudScripts)[i]);
441 }
442 partnerState->curPos.x = partner->curPos.x + 33.0f;
443 partnerState->curPos.y = partner->curPos.y + 34.0f;
444 partnerState->curPos.z = partner->curPos.z + 15.0f;
445 partnerState->unk_18.x = partner->curPos.x + 33.0f;
446 partnerState->unk_18.y = partner->curPos.y + 34.0f;
447 partnerState->unk_18.z = partner->curPos.z + 15.0f;
448 set_goal_pos_to_part(partnerState, partner->targetActorID, partner->targetPartID);
449 target = get_actor(partner->targetActorID);
450 part = get_actor_part(target, partner->targetPartID);
451 partnerState->goalPos.x += part->projectileTargetOffset.x;
452 partnerState->goalPos.y += part->projectileTargetOffset.y;
453 partnerState->goalPos.z = partnerState->goalPos.z; // required to match
454 partnerState->dist = dist2D(partnerState->curPos.x,
455 partnerState->curPos.y,
456 partnerState->goalPos.x,
457 partnerState->goalPos.y);
458 partnerState->speed = 0.0f;
459 partnerState->velStep.x = 0.0f;
460 partnerState->velStep.y = 0.0f;
461 TargetMarkRotation = 0;
462 D_8023D294 = 0;
463 AimingTime = 30;
464 D_8023D2A0 = 0.0f;
465 D_8023D2A4 = 0.0f;
466 D_8023D2A8 = 0.0f;
467 D_8023D2AC = 0.0f;
468 D_8023D29C = 0;
469 D_8023D2B0 = 3.0f;
470 AimMoveAngle = -1.0f;
471 partnerState->unk_24 = ((part->size.y + part->size.x) / 2) / 24.0;
472 hud_element_set_scale(HID_AimTarget, partnerState->unk_24 * target->scalingFactor);
473 SpinyFlipTargetingDone = TRUE;
474 script->functionTemp[0] = SPINY_FLIP_DELAY;
475 break;
476 case SPINY_FLIP_DELAY:
477 if (battleStatus->stickX != 0 || battleStatus->stickY != 0) {
478 AimingTime = 0;
479 }
480 if (AimingTime != 0) {
481 AimingTime--;
482 } else {
483 AimingTime = (s32)(80 * DT);
484 hud_element_set_script(HID_AnalogStick, &HES_StickTapRight);
486 script->functionTemp[0] = SPINY_FLIP_AIMING;
487 }
488 break;
489 case SPINY_FLIP_AIMING:
490 stickMagnitude = battleStatus->stickMagnitude;
491 if (stickMagnitude > 80) {
492 stickMagnitude = 80;
493 }
494 stickAngle = battleStatus->stickAngle;
495 if (stickMagnitude < 35) {
496 f32 temp = stickMagnitude;
497 stickMagnitude = temp * sin_rad(DEG_TO_RAD(stickMagnitude * 2));
498 }
499 temp_f8 = D_8023D2A0;
500 temp_f2 = temp_f8 + D_8023D2A4 + D_8023D2A8;
501 D_8023D2A0 = stickMagnitude;
502 D_8023D2A8 = D_8023D2A4;
503 temp_f10 = D_8023D2A0 - (temp_f2 / 3.0f);
504 D_8023D2A4 = temp_f8;
505 if (temp_f10 > 0) {
506 D_8023D2AC = temp_f10;
507 if (partner->state.speed != 0.0f) {
508 partner->state.speed += (D_8023D2AC / 8.5) / 3.0;
509 } else {
510 partner->state.speed += (D_8023D2AC / 8.5) / 2.0;
511 }
512 AimMoveAngle = stickAngle;
513 } else {
514 D_8023D2AC = temp_f10;
515 }
516 if (!(stickMagnitude < 31)) {
517 AimMoveAngle = stickAngle;
518 }
519 if (partnerState->speed > 6.7) {
520 partnerState->speed = 6.7;
521 }
522 partnerState->speed -= (f32) ((2.0 * (40 - stickMagnitude)) / 40.0);
523 if (partnerState->speed <= 0.0f) {
524 partnerState->speed = 0.0f;
525 D_8023D2AC = 0.0f;
526 }
527 if (AimMoveAngle >= 0.0f) {
528 theta = DEG_TO_RAD(AimMoveAngle);
529 sinTheta = sin_rad(theta);
530 cosTheta = cos_rad(theta);
531 speed = partnerState->speed;
532 partnerState->curPos.x += speed * sinTheta;
533 partnerState->curPos.y += speed * cosTheta;
534 }
535 if (partnerState->curPos.x < -30.0f) {
536 partnerState->curPos.x = -30.0f;
537 }
538 if (partnerState->curPos.x > 170.0f) {
539 partnerState->curPos.x = 170.0f;
540 }
541 if (partnerState->curPos.y > 130.0f) {
542 partnerState->curPos.y = 130.0f;
543 }
544 if (partnerState->curPos.y < 0.0f) {
545 partnerState->curPos.y = 0.0f;
546 }
547 if (battleStatus->curButtonsPressed & BUTTON_A) {
548 AimingTime = 0;
549 }
550 if (AimingTime == 60) {
551 set_actor_anim(ACTOR_PARTNER, 0, ANIM_BattleLakilester_HoldSpiny);
552 }
553 if (AimingTime == 30) {
554 set_actor_anim(ACTOR_PARTNER, 0, ANIM_BattleLakilester_StrainHoldSpiny);
555 }
556 if (AimingTime != 0) {
557 AimingTime--;
558 break;
559 }
560 script->varTable[14] = 0;
561 script->varTable[15] = 0;
562 script->varTable[7] = partnerState->curPos.x;
563 script->varTable[8] = partnerState->curPos.y;
564 script->varTable[9] = partnerState->curPos.z;
565 partnerState->dist = dist2D(partnerState->curPos.x, partnerState->curPos.y, partnerState->goalPos.x, partnerState->goalPos.y) / partnerState->unk_24;
566 if (partnerState->dist <= 12.0) {
567 script->varTable[15] = 1;
568 }
569 hud_element_free(HID_AimTarget);
570 hud_element_free(HID_AimReticle);
571 hud_element_free(HID_AnalogStick);
572 for (i = 0; i < ARRAY_COUNT(N(AimDotHudScripts)); i++) {
573 id = hudAim[i];
575 }
578 return ApiStatus_DONE2;
579 }
580
582 partnerState->goalPos.x, partnerState->goalPos.y, partnerState->goalPos.z,
583 &screenX, &screenY, &screenZ);
584 id = HID_AimTarget;
585 hud_element_set_render_pos(id, screenX, screenY);
586 hud_element_set_transform_rotation(id, 0.0f, 0.0f, TargetMarkRotation);
587 TargetMarkRotation -= 10;
588 TargetMarkRotation = clamp_angle(TargetMarkRotation);
590 partnerState->curPos.x, partnerState->curPos.y, partnerState->curPos.z,
591 &screenX, &screenY, &screenZ);
592 hud_element_set_render_pos(HID_AimReticle, screenX, screenY);
593
594 // show analog stick hud element
595 switch (script->functionTemp[0]) {
596 case SPINY_FLIP_DELAY:
597 case SPINY_FLIP_AIMING:
598 HudStickPosX += 20;
599 if (HudStickPosX > 50) {
600 HudStickPosX = 50;
601 }
602 hud_element_set_render_pos(HID_AnalogStick, HudStickPosX, HudStickPosY);
603 break;
604 }
605
606 // show aim dot hud element in center of
607 switch (script->functionTemp[0]) {
608 case SPINY_FLIP_DELAY:
609 case SPINY_FLIP_AIMING:
610 playerState->curPos.x = partnerState->curPos.x;
611 playerState->curPos.y = partnerState->curPos.y;
612 playerState->curPos.z = partnerState->curPos.z;
613 for (i = 0; i < ARRAY_COUNT(N(AimDotHudScripts)); i++) {
614 get_screen_coords(gCurrentCameraID, playerState->curPos.x, playerState->curPos.y, playerState->curPos.z, &screenX, &screenY, &screenZ);
615 id = hudAim[i];
616 hud_element_set_render_pos(id, screenX, screenY);
617 }
618 break;
619 }
620
622 return ApiStatus_BLOCK;
623}
624
625API_CALLABLE(N(ThrowSpinyFX)) {
626 BattleStatus* battleStatus = &gBattleStatus;
627 Actor* partnerActor = battleStatus->partnerActor;
628 f32 xPos = partnerActor->curPos.x + 5;
629 f32 yPos = partnerActor->curPos.y + partnerActor->size.y + 20;
630 f32 zPos = partnerActor->curPos.z;
631 f32 var = rand_int(140) + 10;
632 f32 var2 = rand_int(80) + 10;
633
634 fx_throw_spiny(0, xPos, yPos, zPos, var, var2, 20, 1.5f, 30);
635
636 return ApiStatus_DONE2;
637}
638
639API_CALLABLE(N(GetSpinySurgeDamage)) {
640 s32 partnerLevel = gBattleStatus.partnerActor->actorBlueprint->level;
641 s32 actionCommandResult = script->varTable[10];
642 s32 damage = 0;
643
644 switch (partnerLevel) {
646 if (actionCommandResult <= 99) {
647 damage = 1;
648 } else {
649 damage = 2;
650 }
651 break;
653 if (actionCommandResult <= 70) {
654 damage = 1;
655 } else if (actionCommandResult <= 99) {
656 damage = 2;
657 } else {
658 damage = 3;
659 }
660 break;
662 if (actionCommandResult <= 40) {
663 damage = 1;
664 } else if (actionCommandResult <= 70) {
665 damage = 2;
666 } else if (actionCommandResult <= 99) {
667 damage = 3;
668 } else {
669 damage = 4;
670 }
671 break;
672 }
673
674 if (actionCommandResult >= 100) {
675 script->varTable[0] = TRUE;
676 } else {
677 script->varTable[0] = FALSE;
678 }
679
680 script->varTable[15] = damage;
681 return ApiStatus_DONE2;
682}
683
684API_CALLABLE(N(RemoveCloudNineFX)) {
686
687 if (effect != NULL) {
688 remove_effect(effect);
691 return ApiStatus_DONE2;
692 }
693
694 return ApiStatus_DONE2;
695}
696
697API_CALLABLE(N(SpawnCloudNineFX)) {
698 BattleStatus* battleStatus = &gBattleStatus;
699 Actor* actor = battleStatus->playerActor;
700
701 static f32 sCounter;
702
703 if (isInitialCall) {
704 script->functionTemp[0] = 0;
705 }
706
707 switch (script->functionTemp[0]) {
708 case 0:
709 sCounter = 0.1f;
710 fx_ending_decals(0, actor->curPos.x, actor->curPos.y, actor->curPos.z, 0.1f, &battleStatus->cloudNineEffect);
711 script->functionTemp[0] = 1;
712 break;
713 case 1:
714 if (sCounter >= 1.0) {
715 return ApiStatus_DONE2;
716 }
717 battleStatus->cloudNineEffect->data.endingDecals->scale += 0.2;
718 sCounter += 0.2;
719 break;
720 }
721 return ApiStatus_BLOCK;
722}
723
724API_CALLABLE(N(ApplyCloudNine)) {
725 if (gBattleStatus.cloudNineTurnsLeft < script->varTable[10]) {
726 gBattleStatus.cloudNineTurnsLeft = script->varTable[10];
729 }
730
731 return ApiStatus_DONE2;
732}
733
734API_CALLABLE(N(InitHurricane)) {
736 s32 totalChance;
737 s32 affectedTargets;
738 s32 targetIdx;
739 SelectableTarget* target;
740 Actor* actor;
741 ActorPart* part;
742 s32 hpMissingPercent;
743 s32 hurricaneChance;
744 s32 avgHurricaneChance;
745 s32 i;
746
747 sNumEnemiesBeingBlown = 0;
748 sIsHurricaneActive = FALSE;
749
750 for (i = 0; i < partner->targetListLength; i++) {
751 sTargetStates[i] = 0;
752 }
753
754 totalChance = 0;
755 affectedTargets = 0;
756
757 for (i = 0; i < partner->targetListLength; i++) {
758 targetIdx = partner->targetIndexList[i];
759 target = &partner->targetData[targetIdx];
760 actor = get_actor(target->actorID);
761 part = get_actor_part(actor, target->partID);
762 hpMissingPercent = 100 - ((actor->curHP * 100) / actor->maxHP);
763 hurricaneChance = actor->actorBlueprint->hurricaneChance;
764 if (hurricaneChance > 0) {
765 hurricaneChance += hurricaneChance * hpMissingPercent / 100;
766 if (hurricaneChance > 100) {
767 hurricaneChance = 100;
768 }
769 if (actor->debuff != 0) {
770 hurricaneChance = hurricaneChance * 150 / 100;
771 if (hurricaneChance > 150) {
772 hurricaneChance = 150;
773 }
774 }
776 hurricaneChance = 0;
777 }
779 hurricaneChance = 0;
780 }
781 affectedTargets++;
782 }
783 sTargetStates[targetIdx] = hurricaneChance;
784 totalChance += hurricaneChance;
785 }
786
787 if (affectedTargets != 0) {
788 avgHurricaneChance = totalChance / affectedTargets;
789 } else {
790 avgHurricaneChance = 0;
791 }
792 script->varTable[0] = avgHurricaneChance;
793
794 for (i = 0; i < partner->targetListLength; i++) {
795 targetIdx = partner->targetIndexList[i];
796 target = &partner->targetData[targetIdx];
797 actor = get_actor(target->actorID);
798 part = get_actor_part(actor, target->partID);
800 sTargetStates[targetIdx] = -1;
801 } else if (sTargetStates[targetIdx] != 0) {
802 sTargetStates[targetIdx] = avgHurricaneChance;
803 }
804 }
805 return ApiStatus_DONE2;
806}
807
808API_CALLABLE(N(CanTargetBeBlown)) {
809 BattleStatus* battleStatus = &gBattleStatus;
810 Actor* partner = battleStatus->partnerActor;
811 s32 targetIdx = partner->targetIndexList[partner->selectedTargetIndex];
812 s32* hurricaneChance = &sTargetStates[targetIdx];
813 SelectableTarget* target = &partner->targetData[targetIdx];
814
815 script->varTable[0] = *hurricaneChance;
816
817 if (*hurricaneChance == -1) {
818 return ApiStatus_DONE2;
819 }
820
821 if (*hurricaneChance == 0) {
822 return ApiStatus_DONE2;
823 }
824
825 get_actor(target->actorID);
826 if (rand_int(99) < battleStatus->actionSuccess) {
827 *hurricaneChance = -1;
828 script->varTable[0] = target->actorID;
829 } else {
830 *hurricaneChance = 0;
831 script->varTable[0] = ACTOR_PLAYER;
832 }
833 return ApiStatus_DONE2;
834}
835
836EvtScript N(EVS_Move_SpinyFlip) = {
837 Thread
838 Call(N(SpinyFlipUpdatePopup))
840 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Run)
841 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
842 Add(LVar0, 40)
843 Add(LVar1, 20)
844 Call(SetGoalPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
845 Call(FlyToGoal, ACTOR_PARTNER, 30, 0, EASING_COS_IN_OUT)
846 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Idle)
847 Call(InitTargetIterator)
848 Call(SetGoalToTarget, ACTOR_PARTNER)
849 Call(UseBattleCamPreset, BTL_CAM_REPOSITION)
850 Call(SetBattleCamTarget, 47, 46, 12)
851 Call(SetBattleCamOffsetY, 7)
852 Call(SetBattleCamDist, 416)
853 Call(MoveBattleCamOver, 30)
854 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
855 Add(LVar0, 3)
856 Add(LVar1, 10)
857 Add(LVar2, 5)
858 Call(SetPartPos, ACTOR_PARTNER, 2, LVar0, LVar1, LVar2)
859 Wait(1)
860 Call(SetPartFlagBits, ACTOR_PARTNER, 2, ACTOR_PART_FLAG_INVISIBLE, FALSE)
861 Call(SetAnimation, ACTOR_SELF, PRT_2, ANIM_BattleLakilester_Spiny)
862 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_LiftSpiny)
863 Loop(4)
864 Add(LVar1, 6)
865 Call(SetPartPos, ACTOR_PARTNER, 2, LVar0, LVar1, LVar2)
866 Wait(1)
867 EndLoop
868 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
869 Add(LVar0, 8)
870 Add(LVar1, 40)
871 Add(LVar2, 5)
872 PlayEffect(EFFECT_ENERGY_IN_OUT, 0, LVar0, LVar1, LVar2, Float(1.0), 80 * DT, 0)
873 Call(SetActorVar, ACTOR_PARTNER, AVAR_Unk_0, 1)
874 Thread
875 Loop(40 * DT)
876 Call(SetActorDispOffset, ACTOR_PARTNER, 1, 0, 0)
877 Call(SetPartDispOffset, ACTOR_PARTNER, 2, 1, 0, 0)
878 Wait(1)
879 Call(SetActorDispOffset, ACTOR_PARTNER, -1, 0, 0)
880 Call(SetPartDispOffset, ACTOR_PARTNER, 2, -1, 0, 0)
881 Wait(1)
882 Call(GetActorVar, ACTOR_PARTNER, AVAR_Unk_0, LVar0)
883 IfEq(LVar0, 0)
885 EndIf
886 EndLoop
887 Call(SetActorDispOffset, ACTOR_PARTNER, 0, 0, 0)
888 Call(SetPartDispOffset, ACTOR_PARTNER, 2, 0, 0, 0)
890 Call(SetGoalToTarget, ACTOR_PARTNER)
891 Call(N(SpinyFlipActionCommand))
892 Call(SetActorVar, ACTOR_PARTNER, AVAR_Unk_0, 0)
893 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_ThrowSpiny)
894 Wait(3)
897 Set(LVarF, -1)
898 EndIf
901 CaseEq(-1)
902 Call(SetAnimation, ACTOR_SELF, PRT_2, ANIM_BattleLakilester_SpinySpin)
903 Call(SetPartJumpGravity, ACTOR_PARTNER, 2, Float(1.5))
904 Set(LVar0, LVar7)
905 Set(LVar1, LVar8)
906 Set(LVar2, LVar9)
907 Call(JumpPartTo, ACTOR_PARTNER, 2, LVar7, LVar8, LVar9, 20)
908 Call(LandJumpPart, ACTOR_PARTNER, 2)
909 CaseEq(0)
910 Call(SetAnimation, ACTOR_SELF, PRT_2, ANIM_BattleLakilester_SpinySpin)
911 Call(SetPartJumpGravity, ACTOR_PARTNER, 2, Float(1.5))
912 Set(LVar0, LVar7)
913 Set(LVar1, LVar8)
914 Set(LVar2, LVar9)
915 Call(JumpPartTo, ACTOR_PARTNER, 2, LVar7, LVar8, LVar9, 20)
916 Call(LandJumpPart, ACTOR_PARTNER, 2)
918 Call(SetAnimation, ACTOR_SELF, PRT_2, ANIM_BattleLakilester_SpinySpin)
919 Call(GetGoalPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
920 Call(SetPartJumpGravity, ACTOR_PARTNER, 2, Float(1.5))
921 Call(JumpPartTo, ACTOR_PARTNER, 2, LVar0, LVar1, LVar2, 20)
923 Thread
924 Add(LVar0, 50)
925 Set(LVar1, 0)
926 Call(SetPartJumpGravity, ACTOR_PARTNER, 2, Float(1.5))
927 Call(JumpPartTo, ACTOR_PARTNER, 2, LVar0, LVar1, LVar2, 15)
928 Call(SetPartFlagBits, ACTOR_PARTNER, 2, ACTOR_PART_FLAG_INVISIBLE, TRUE)
930 Call(GetMenuSelection, LVar0, LVar1, LVar2)
932 CaseEq(MOVE_SPINY_FLIP1)
933 Set(LVarE, 3)
934 CaseEq(MOVE_SPINY_FLIP2)
935 Set(LVarE, 4)
936 CaseEq(MOVE_SPINY_FLIP3)
937 Set(LVarE, 5)
940 CaseGt(0)
946 CaseEq(1)
947 Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME)
949 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MISTAKE)
951 Wait(15)
955 ExecWait(N(EVS_ReturnHome_Success))
959 ExecWait(N(EVS_ReturnHome_Miss))
962 Return
963 End
964};
965
966EvtScript N(EVS_Move_SpinySurge) = {
967 Call(LoadActionCommand, ACTION_COMMAND_SPINY_SURGE)
968 Call(action_command_spiny_surge_init)
969 Call(GetActorLevel, ACTOR_PARTNER, LVar0)
971 CaseEq(0)
972 Call(SetupMashMeter, 2, 99, 100, 0, 0, 0)
973 CaseEq(1)
974 Call(SetupMashMeter, 3, 70, 99, 100, 0, 0)
975 CaseEq(2)
976 Call(SetupMashMeter, 4, 40, 70, 99, 100, 0)
978 Call(SetActionHudPrepareTime, 10)
979 Call(UseBattleCamPreset, BTL_CAM_REPOSITION)
980 Call(SetBattleCamTarget, 45, 60, 0)
981 Call(SetBattleCamOffsetY, 0)
982 Call(SetBattleCamDist, 400)
983 Call(MoveBattleCamOver, 30)
984 Call(InitTargetIterator)
985 Call(SetGoalToHome, ACTOR_PARTNER)
986 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Run)
987 Call(AddGoalPos, ACTOR_PARTNER, 60, 20, 0)
988 Call(FlyToGoal, ACTOR_PARTNER, 30, 0, EASING_COS_IN_OUT)
989 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Idle)
990 Wait(10)
991 Call(GetActorLevel, ACTOR_PARTNER, LVar0)
993 CaseEq(0)
994 Set(LVarA, 60 * DT)
995 CaseEq(1)
996 Set(LVarA, 60 * DT)
997 CaseEq(2)
998 Set(LVarA, 60 * DT)
1000 Set(LVarB, LVarA)
1001 Add(LVarB, -3)
1002 Call(action_command_spiny_surge_start, 0, LVarB, 3)
1003 Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE)
1004 Call(InitTargetIterator)
1005 Call(SetActorVar, ACTOR_PARTNER, AVAR_Unk_0, 0)
1006 Set(LVar9, 0)
1007 Set(LFlag2, FALSE)
1008 Set(LFlag3, FALSE)
1009 Loop(LVarA)
1010 Call(GetActionQuality, LVar0)
1011 IfEq(LVar9, 2)
1012 Set(LVar0, 3)
1013 EndIf
1014 Switch(LVar0)
1015 CaseEq(-1)
1016 Set(LVar9, 0)
1017 Call(SetPartFlagBits, ACTOR_PARTNER, 2, ACTOR_PART_FLAG_INVISIBLE, TRUE)
1018 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Idle)
1019 CaseEq(1)
1020 IfEq(LVar9, 1)
1022 EndIf
1023 Call(SetPartFlagBits, ACTOR_PARTNER, 2, ACTOR_PART_FLAG_INVISIBLE, FALSE)
1024 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1025 Add(LVar0, 3)
1026 Add(LVar1, 34)
1027 Add(LVar2, 5)
1028 Call(SetPartPos, ACTOR_PARTNER, 2, LVar0, LVar1, LVar2)
1029 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_LiftSpiny)
1030 Set(LVar9, 1)
1031 CaseEq(2)
1032 IfEq(LVar9, 0)
1034 EndIf
1035 IfEq(LFlag2, FALSE)
1037 Set(LFlag2, TRUE)
1038 Else
1040 Set(LFlag2, FALSE)
1041 EndIf
1042 Call(N(ThrowSpinyFX))
1043 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_ThrowSpinyAlt)
1044 Call(SetPartFlagBits, ACTOR_PARTNER, 2, ACTOR_PART_FLAG_INVISIBLE, TRUE)
1046 Call(GetActorVar, ACTOR_PARTNER, AVAR_Unk_0, LVar0)
1047 Add(LVar0, 1)
1048 Call(SetActorVar, ACTOR_PARTNER, AVAR_Unk_0, LVar0)
1049 Wait(15)
1050 Call(GetActorVar, ACTOR_PARTNER, AVAR_Unk_0, LVar0)
1051 Sub(LVar0, 1)
1052 Call(SetActorVar, ACTOR_PARTNER, AVAR_Unk_0, LVar0)
1054 Set(LFlag3, TRUE)
1055 Set(LVar9, 0)
1056 EndSwitch
1057 Wait(1)
1058 EndLoop
1059 Call(SetPartFlagBits, ACTOR_PARTNER, 2, ACTOR_PART_FLAG_INVISIBLE, TRUE)
1060 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Idle)
1061 Loop(0)
1062 Call(GetActorVar, ACTOR_PARTNER, AVAR_Unk_0, LVar0)
1063 IfEq(LVar0, 0)
1064 BreakLoop
1065 EndIf
1066 Wait(1)
1067 EndLoop
1068 Wait(10)
1069 IfEq(LFlag3, FALSE)
1070 Set(LVar0, 0)
1071 Set(LVarF, 0)
1072 Wait(15)
1073 Goto(13)
1074 EndIf
1075 Call(InitTargetIterator)
1076 Label(0)
1077 Call(SetGoalToTarget, ACTOR_PARTNER)
1080 Goto(12)
1081 EndIf
1082 Call(GetPartnerActionSuccess, LVarA)
1083 Call(N(GetSpinySurgeDamage))
1084 Switch(LVar0)
1085 CaseGt(0)
1089 EndSwitch
1090 Switch(LVar0)
1091 CaseGt(0)
1092 Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME)
1094 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MISTAKE)
1095 EndSwitch
1096 Wait(6)
1097 Label(12)
1098 Call(ChooseNextTarget, ITER_NEXT, LVar1)
1100 Goto(0)
1101 EndIf
1102 Wait(30)
1103 Label(13)
1104 Switch(LVar0)
1107 ExecWait(N(EVS_ReturnHome_Success))
1111 ExecWait(N(EVS_ReturnHome_Miss))
1113 EndSwitch
1114 Return
1115 End
1116};
1117
1118EvtScript N(EVS_CloudNine_PlayerOK) = {
1119 Call(UseIdleAnimation, ACTOR_PLAYER, FALSE)
1120 Call(SetBattleFlagBits, BS_FLAGS1_SHOW_PLAYER_DECORATIONS, FALSE)
1121 Call(SetActorFlagBits, ACTOR_PLAYER, ACTOR_FLAG_NO_INACTIVE_ANIM, TRUE)
1122 Call(LoadActionCommand, ACTION_COMMAND_WATER_BLOCK)
1123 Call(action_command_water_block_init, 2)
1124 Call(SetActionHudPrepareTime, 50)
1125 Call(InitTargetIterator)
1126 Call(SetGoalToHome, ACTOR_PARTNER)
1127 Call(UseBattleCamPreset, BTL_CAM_MIDPOINT_CLOSE)
1128 Call(BattleCamTargetActor, ACTOR_SELF)
1129 Call(SetBattleCamOffsetY, 17)
1130 Call(SetBattleCamDist, 300)
1131 Call(MoveBattleCamOver, 30)
1132 Call(DisableBattleCamClampX)
1133 Wait(10)
1134 Thread
1135 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1136 Add(LVar1, 40)
1137 Call(SetGoalPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1138 Call(FlyToGoal, ACTOR_PARTNER, 30, 0, EASING_COS_IN_OUT)
1139 EndThread
1140 Wait(15)
1141 Set(LVar0, 0)
1142 Loop(10)
1143 Add(LVar0, 18)
1144 Call(SetActorYaw, ACTOR_PARTNER, LVar0)
1145 Wait(1)
1146 EndLoop
1147 Wait(10)
1148 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_CloudNineBegin)
1149 Wait(5)
1150 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_CloudNineIdle)
1151 Wait(15)
1152 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1153 Add(LVar0, -12)
1154 Add(LVar1, 13)
1155 Add(LVar2, -5)
1156 Call(SetActorSpeed, ACTOR_PLAYER, Float(4.0))
1157 Call(SetActorJumpGravity, ACTOR_PLAYER, Float(1.0))
1158 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_FightingStance)
1159 Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
1160 Call(PlayerHopToGoal, 18, 0, 0)
1161 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_FightingStance)
1162 Wait(3)
1163 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
1164 Call(action_command_water_block_start, 0, 97, 3)
1165 Call(AddBattleCamDist, -75)
1166 Call(MoveBattleCamOver, 100)
1167 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_NONE, BTL_CAM_XADJ_NONE, TRUE)
1168 Wait(100)
1169 Wait(3)
1170 Call(AddBattleCamDist, 50)
1171 Call(MoveBattleCamOver, 5)
1172 Call(GetPartnerActionSuccess, LVarA)
1173 IfGt(LVarA, 0)
1174 Call(N(RemoveCloudNineFX))
1176 Call(N(SpawnCloudNineFX))
1177 Call(N(ApplyCloudNine))
1178 Call(SetActorFlagBits, ACTOR_PLAYER, ACTOR_FLAG_SHOW_STATUS_ICONS, TRUE)
1179 EndIf
1180 Call(UseIdleAnimation, ACTOR_PLAYER, TRUE)
1181 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_CloudNineEnd)
1182 Thread
1183 Call(GetActorPos, ACTOR_PLAYER, LVar3, LVar4, LVar5)
1184 Loop(10)
1185 Set(LVar0, LVar3)
1186 Set(LVar1, LVar4)
1187 Set(LVar2, LVar5)
1188 Call(RandInt, 40, LVar6)
1189 Sub(LVar6, 20)
1190 Add(LVar0, LVar6)
1191 Call(RandInt, 30, LVar6)
1192 Sub(LVar6, 15)
1193 Add(LVar1, LVar6)
1194 PlayEffect(EFFECT_FLOATING_CLOUD_PUFF, 0, LVar0, LVar1, LVar2, Float(1.0), 20, 0)
1195 Wait(1)
1196 EndLoop
1197 EndThread
1198 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_FightingStance)
1199 Set(LVar1, 0)
1200 Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
1201 Call(PlayerFallToGoal, 10)
1202 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Walk)
1203 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_FightingStance)
1204 Wait(7)
1205 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
1206 Thread
1207 Call(SetGoalToHome, ACTOR_PLAYER)
1208 Call(SetActorSpeed, ACTOR_PLAYER, Float(8.0))
1209 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Run)
1210 Call(PlayerRunToGoal, 0)
1211 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
1212 Call(SetActorFlagBits, ACTOR_PLAYER, ACTOR_FLAG_NO_INACTIVE_ANIM, FALSE)
1213 EndThread
1214 Thread
1215 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1216 Sub(LVar1, 40)
1217 Call(SetGoalPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1218 Call(FlyToGoal, ACTOR_PARTNER, 30, 0, EASING_COS_IN_OUT)
1219 EndThread
1220 Wait(15)
1221 Set(LVar0, 180)
1222 Loop(10)
1223 Sub(LVar0, 18)
1224 Call(SetActorYaw, ACTOR_PARTNER, LVar0)
1225 Wait(1)
1226 EndLoop
1227 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1228 Call(MoveBattleCamOver, 30)
1229 Wait(10)
1230 IfGt(LVarA, 0)
1231 Call(ShowMessageBox, BTL_MSG_CLOUD_NINE_BEGIN, 60)
1232 Call(WaitForMessageBoxDone)
1233 EndIf
1234 Call(SetBattleFlagBits, BS_FLAGS1_SHOW_PLAYER_DECORATIONS, TRUE)
1235 Return
1236 End
1237};
1238
1239EvtScript N(EVS_CloudNine_PlayerImmobile) = {
1240 Call(UseIdleAnimation, ACTOR_PLAYER, FALSE)
1241 Call(LoadActionCommand, ACTION_COMMAND_WATER_BLOCK)
1242 Call(action_command_water_block_init, 2)
1243 Call(SetActionHudPrepareTime, 50)
1244 Call(N(RemoveCloudNineFX))
1245 Call(InitTargetIterator)
1246 Call(SetGoalToHome, ACTOR_PARTNER)
1247 Call(UseBattleCamPreset, BTL_CAM_MIDPOINT_CLOSE)
1248 Call(BattleCamTargetActor, ACTOR_SELF)
1249 Call(SetBattleCamOffsetY, 0)
1250 Call(SetBattleCamDist, 300)
1251 Call(MoveBattleCamOver, 30)
1252 Call(DisableBattleCamClampX)
1253 Wait(10)
1254 Set(LVar0, 0)
1255 Loop(10)
1256 Add(LVar0, 18)
1257 Call(SetActorYaw, ACTOR_PARTNER, LVar0)
1258 Wait(1)
1259 EndLoop
1260 Wait(10)
1261 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_CloudNineBegin)
1262 Wait(20)
1263 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
1264 Add(LVar0, 12)
1265 Add(LVar1, -7)
1266 Add(LVar2, 5)
1267 Call(SetGoalPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1268 Call(FlyToGoal, ACTOR_PARTNER, 20, -10, EASING_COS_IN_OUT)
1269 Thread
1270 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
1271 Add(LVar1, 40)
1272 Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
1273 Call(FlyToGoal, ACTOR_PLAYER, 20, 0, EASING_COS_IN_OUT)
1274 EndThread
1275 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1276 Add(LVar1, 40)
1277 Call(SetGoalPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1278 Call(FlyToGoal, ACTOR_PARTNER, 20, 0, EASING_COS_IN_OUT)
1279 Call(action_command_water_block_start, 0, 97, 3)
1280 Call(AddBattleCamDist, -75)
1281 Call(MoveBattleCamOver, 100)
1282 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_NONE, BTL_CAM_XADJ_NONE, TRUE)
1283 Wait(100)
1284 Wait(3)
1285 Call(AddBattleCamDist, 50)
1286 Call(MoveBattleCamOver, 5)
1287 Call(GetPartnerActionSuccess, LVarA)
1288 IfGt(LVarA, 0)
1290 Call(N(SpawnCloudNineFX))
1291 Call(N(ApplyCloudNine))
1292 EndIf
1293 Call(UseIdleAnimation, ACTOR_PLAYER, TRUE)
1294 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_CloudNineEnd)
1295 Thread
1296 Call(GetActorPos, ACTOR_PLAYER, LVar3, LVar4, LVar5)
1297 Loop(10)
1298 Set(LVar0, LVar3)
1299 Set(LVar1, LVar4)
1300 Set(LVar2, LVar5)
1301 Call(RandInt, 40, LVar6)
1302 Sub(LVar6, 20)
1303 Add(LVar0, LVar6)
1304 Call(RandInt, 30, LVar6)
1305 Sub(LVar6, 15)
1306 Add(LVar1, LVar6)
1307 PlayEffect(EFFECT_FLOATING_CLOUD_PUFF, 0, LVar0, LVar1, LVar2, Float(1.0), 20, 0)
1308 Wait(1)
1309 EndLoop
1310 EndThread
1311 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
1312 Set(LVar1, 0)
1313 Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
1314 Call(FallToGoal, ACTOR_PLAYER, 10)
1315 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Walk)
1316 Thread
1317 Call(SetGoalToHome, ACTOR_PLAYER)
1318 Call(SetActorSpeed, ACTOR_PLAYER, Float(8.0))
1319 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Run)
1320 Call(PlayerRunToGoal, 0)
1321 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
1322 EndThread
1323 Thread
1324 Call(SetGoalToHome, ACTOR_PARTNER)
1325 Call(FlyToGoal, ACTOR_PARTNER, 20, 0, EASING_COS_IN_OUT)
1326 EndThread
1327 Set(LVar0, 180)
1328 Loop(10)
1329 Sub(LVar0, 18)
1330 Call(SetActorYaw, ACTOR_PARTNER, LVar0)
1331 Wait(1)
1332 EndLoop
1333 Call(PartnerYieldTurn)
1334 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1335 Call(MoveBattleCamOver, 30)
1336 Wait(10)
1337 IfGt(LVarA, 0)
1338 Call(ShowMessageBox, BTL_MSG_CLOUD_NINE_BEGIN, 60)
1339 Call(WaitForMessageBoxDone)
1340 EndIf
1341 Return
1342 End
1343};
1344
1345EvtScript N(EVS_Move_CloudNine) = {
1346 Call(GetStatusFlags, ACTOR_PLAYER, LVar0)
1348 ExecWait(N(EVS_CloudNine_PlayerImmobile))
1349 Else
1350 ExecWait(N(EVS_CloudNine_PlayerOK))
1351 EndIf
1352 Return
1353 End
1354};
1355
1356enum {
1360};
1361
1362#if VERSION_PAL
1363#define HURRICANE_PARTNER_MOVE_TIME 140
1364#define HURRICANE_UNUSED_TIME 152
1365#else
1366#define HURRICANE_PARTNER_MOVE_TIME 165
1367#define HURRICANE_UNUSED_TIME 177
1368#endif
1369
1370API_CALLABLE(N(ProcessHurricane)) {
1371 BattleStatus* battleStatus = &gBattleStatus;
1372 Actor* partner = battleStatus->partnerActor;
1373 ActorState* partnerState = &partner->state;
1374 EffectInstance* effect;
1375 Actor* targetActor;
1376 SelectableTarget* target;
1377 s32 targetIndex;
1378 s32 temp;
1379 s32 i;
1380 f32 x, y, z;
1381 f32 x2, y2, z2;
1382 f32 tempF1, tempF2;
1383 f32 totalPower;
1384 f64 tempF64;
1385
1386 static EffectInstance* sHuffPuffBreathEffect;
1387 static HurricaneState sHurricaneState;
1388 static s32 sUnusedAngle;
1389 static s32 sHurricaneIntensity;
1390 static s32 sHuffPuffBreathState;
1391 static s32 D_8023D278;
1392 static HurricaneState* hurricaneState = &sHurricaneState;
1393
1394 if (isInitialCall) {
1395 script->functionTemp[0] = 0;
1396 }
1397
1398 switch (script->functionTemp[0]) {
1399 case 0:
1400 partner->state.angle = 0.0f;
1402 partner->state.moveArcAmplitude = 0;
1403 sIsHurricaneActive = TRUE;
1404 D_8023D338 = 255;
1405 sHuffPuffBreathEffect = effect = fx_huff_puff_breath(0, NPC_DISPOSE_LOCATION, 0.0f, -2.0f, 0.6f, 0);
1406
1407 effect->data.huffPuffBreath->primCol.r = 20;
1408 effect->data.huffPuffBreath->primCol.g = 80;
1409 effect->data.huffPuffBreath->primCol.b = 255;
1410
1411 effect->data.huffPuffBreath->envCol.r = 200;
1412 effect->data.huffPuffBreath->envCol.g = 240;
1413 effect->data.huffPuffBreath->envCol.b = 240;
1414
1415 hurricaneState->unk_54 = HURRICANE_UNUSED_TIME;
1416 hurricaneState->breathSizeIncrease = 0;
1417 hurricaneState->unk_46 = 0;
1418 hurricaneState->state = 0;
1419 hurricaneState->totalPower = 5000;
1420 hurricaneState->intensity = 0;
1421 hurricaneState->startingTotalPower = -1;
1422
1423
1424 sSavedHurricaneIntensity = 0;
1425 D_8023D278 = (1.0 - sin_rad(hurricaneState->intensity * PI_S * 0.5f / 750.0f)) * 8.0 + 13.0;
1426 sHuffPuffBreathState = -1;
1427
1428 sUnusedAngle = 0;
1429 sHurricaneIntensity = 0;
1430 sBreathSizeIncrease = 0;
1431
1432 sMaxPower = 2000;
1433 script->functionTemp[1] = rand_int(10) + 11;
1434 script->functionTemp[2] = 0;
1435 script->functionTemp[0] = 1;
1436 break;
1437 case 1:
1438 partner->state.angle = sUnusedAngle * 150 / 100 - 75; // angle is not used
1439
1440 for (i = 0; i < partner->targetListLength; i++) {
1441 targetIndex = partner->targetIndexList[i];
1442 temp = sTargetStates[targetIndex];
1443 if (temp != -1) {
1444 if (temp != 0) {
1445 target = &partner->targetData[targetIndex];
1446 targetActor = get_actor(target->actorID);
1447 targetActor->yaw = clamp_angle(targetActor->yaw + 13.0f + sHurricaneIntensity * 4);
1448 }
1449 }
1450 }
1451
1452 if (partnerState->moveTime != 0) {
1453 partnerState->moveTime--;
1454 break;
1455 }
1456
1457 for (i = 0; i < partner->targetListLength; i++) {
1458 targetIndex = partner->targetIndexList[i];
1459 temp = sTargetStates[targetIndex];
1460 if (temp != -1) {
1461 if (temp != 0) {
1462 target = &partner->targetData[targetIndex];
1463 targetActor = get_actor(target->actorID);
1464 targetActor->yaw = 0.0f;
1465 }
1466 }
1467 }
1468
1469 sIsHurricaneActive = FALSE;
1470 remove_effect(sHuffPuffBreathEffect);
1471 return ApiStatus_DONE2;
1472 }
1473
1474 sHuffPuffBreathEffect->data.huffPuffBreath->scale = sBreathSizeIncrease / 50.0 + 1.0;
1475 x = partner->curPos.x;
1476 y = partner->curPos.y;
1477 rand_int(1000);
1478 tempF1 = 5.0f;
1479 switch (sHuffPuffBreathState) {
1480 case STATE_INHALE:
1481 x = partner->curPos.x;
1482 y = partner->curPos.y + 15.0f;
1483 z = partner->curPos.z + tempF1;
1484 add_vec2D_polar(&x, &y, 12.0f, 90.0f);
1485 sHuffPuffBreathEffect->data.huffPuffBreath->pos.x = x;
1486 sHuffPuffBreathEffect->data.huffPuffBreath->pos.y = y;
1487 sHuffPuffBreathEffect->data.huffPuffBreath->pos.z = z;
1488 sHuffPuffBreathEffect->data.huffPuffBreath->speedX = -2.0f;
1489
1490 // looks like this was breath inhale phase, but then the devs removed it
1491 sHuffPuffBreathEffect->data.huffPuffBreath->pos.x = NPC_DISPOSE_POS_X;
1492 sHuffPuffBreathEffect->data.huffPuffBreath->pos.y = NPC_DISPOSE_POS_Y;
1493 sHuffPuffBreathEffect->data.huffPuffBreath->pos.z = NPC_DISPOSE_POS_Z;
1494
1495 if (script->functionTemp[2] != 0) {
1497 }
1498 script->functionTemp[2] = 0;
1499
1500 partnerState->moveArcAmplitude = 0;
1501 set_actor_anim(ACTOR_PARTNER, -1, ANIM_BattleLakilester_HurricaneInhale);
1502 break;
1503 case STATE_DISABLED:
1504 sHuffPuffBreathEffect->data.huffPuffBreath->pos.x = NPC_DISPOSE_POS_X;
1505 sHuffPuffBreathEffect->data.huffPuffBreath->pos.y = NPC_DISPOSE_POS_Y;
1506 sHuffPuffBreathEffect->data.huffPuffBreath->pos.z = NPC_DISPOSE_POS_Z;
1507 break;
1508 case STATE_EXHALE:
1509 x = partner->curPos.x;
1510 y = partner->curPos.y + 15.0f;
1511 z = partner->curPos.z + tempF1;
1512 add_vec2D_polar(&x, &y, 12.0f, 90.0f);
1513 sHuffPuffBreathEffect->data.huffPuffBreath->pos.x = x;
1514 sHuffPuffBreathEffect->data.huffPuffBreath->pos.y = y;
1515 sHuffPuffBreathEffect->data.huffPuffBreath->pos.z = z;
1516 sHuffPuffBreathEffect->data.huffPuffBreath->speedX = 2.0f;
1517
1518 if (script->functionTemp[2] == 0) {
1520 }
1521 script->functionTemp[2] = 1;
1522
1523 if (partnerState->moveArcAmplitude == 0) {
1524 script->functionTemp[1] = 1;
1525 }
1526 partnerState->moveArcAmplitude = 1;
1527
1528 set_actor_anim(ACTOR_PARTNER, -1, ANIM_BattleLakilester_HurricaneExhale);
1529 break;
1530 }
1531
1532
1533 if (gGameStatusPtr->frameCounter % (7 - sHurricaneIntensity / 2) == 0) {
1534 x = -220.0f;
1535 y = 176 - rand_int(100);
1536 z = 50.0f;
1537 x2 = 220.0f;
1538 y2 = y - (rand_int(100) + 100);
1539 z2 = 50.0f;
1540 tempF1 = rand_int(1000);
1541 tempF1 = tempF1 / 3000.0f + 0.5;
1542 tempF2 = rand_int(1000);
1543 tempF2 = tempF2 / 300.0f + 5.75 + sHurricaneIntensity;
1544 fx_moving_cloud(1, x, y, z, x2, y2, z2, tempF2, tempF1);
1545 }
1546
1547 if (gGameStatusPtr->frameCounter % (7 - sHurricaneIntensity / 2) == 0) {
1548 x = -220.0f;
1549 y = 176 - rand_int(100);
1550 z = -50.0f;
1551 x2 = 220.0f;
1552 y2 = y - (rand_int(100) + 100);
1553 z2 = -50.0f;
1554 tempF1 = rand_int(1000);
1555 tempF1 = tempF1 / 4000.0f + 0.1;
1556 tempF2 = rand_int(1000);
1557 tempF2 = tempF2 / 300.0f + 2.75 + sHurricaneIntensity / 2;
1558 fx_moving_cloud(1, x, y, z, x2, y2, z2, tempF2, tempF1);
1559 }
1560
1561RESTART:
1562 switch (hurricaneState->state) {
1563 case 0:
1564 sHuffPuffBreathState = STATE_EXHALE;
1565 if (hurricaneState->startingTotalPower < 0) {
1566 hurricaneState->startingTotalPower = hurricaneState->totalPower;
1567 }
1568
1569 totalPower = hurricaneState->totalPower;
1570 if (totalPower > 5000.0f) {
1571 totalPower = 5000.0f;
1572 }
1573
1574 tempF64 = D_8023D278;
1575 tempF1 = tempF64 + tempF64 * (1.0 - sin_rad(totalPower * PI_S * 0.5f / 5000.0f + PI_S / 2)) * 1.5;
1576 hurricaneState->intensity += tempF1;
1577 sSavedHurricaneIntensity += D_8023D278;
1578
1579 if (hurricaneState->totalPower > 9000) {
1580 hurricaneState->intensity -= hurricaneState->intensity / 2;
1581 }
1582
1583 if (hurricaneState->intensity < 0) {
1584 hurricaneState->intensity = 0;
1585 }
1586
1587 hurricaneState->intensity += tempF1;
1588 if (hurricaneState->intensity > 750) {
1589 hurricaneState->intensity = 750;
1590 }
1591
1592 if (sSavedHurricaneIntensity > 1000) {
1593 sSavedHurricaneIntensity = 1000;
1594 }
1595
1596 hurricaneState->totalPower += hurricaneState->intensity;
1597
1598 if (hurricaneState->totalPower > sMaxPower + 5000) {
1599 hurricaneState->totalPower = sMaxPower + 5000;
1600 hurricaneState->state = 1;
1601 hurricaneState->unk_5D = 5;
1602 hurricaneState->intensity = sSavedHurricaneIntensity;
1603 }
1604 break;
1605 case 1:
1606 sHuffPuffBreathState = STATE_DISABLED;
1607 hurricaneState->state = 10;
1608 break;
1609 }
1610
1611 switch (hurricaneState->state) {
1612 case 10:
1613 sHuffPuffBreathState = STATE_INHALE;
1614 tempF1 = hurricaneState->intensity + hurricaneState->intensity / 3;
1615 if (tempF1 < 200.0f) {
1616 tempF1 = 200.0f;
1617 }
1618 hurricaneState->totalPower -= tempF1;
1619 if (hurricaneState->totalPower < 5000 - sMaxPower) {
1620 hurricaneState->totalPower = 5000 - sMaxPower;
1621 hurricaneState->state = 11;
1622 hurricaneState->unk_5D = 5;
1623 hurricaneState->startingTotalPower = -1;
1624 sMaxPower += 1000;
1625 if (sMaxPower > 5000) {
1626 sMaxPower = 5000;
1627 }
1628 }
1629 break;
1630 case 11:
1631 sHuffPuffBreathState = STATE_DISABLED;
1632 hurricaneState->state = 0;
1633 hurricaneState->intensity -= hurricaneState->intensity / 2.8;
1634 sSavedHurricaneIntensity = hurricaneState->intensity;
1635 D_8023D278 = (1.0 - sin_rad(hurricaneState->intensity * PI_S * 0.5f / 750.0f)) * 8.0 + 13.0;
1636 goto RESTART;
1637 }
1638
1639 if (hurricaneState->state == 0) {
1640 hurricaneState->breathSizeIncrease += hurricaneState->intensity / 4;
1641 }
1642
1643 if (hurricaneState->breathSizeIncrease > 10000) {
1644 hurricaneState->breathSizeIncrease = 10000;
1645 }
1646
1647 sUnusedAngle = hurricaneState->totalPower / 100;
1648 sHurricaneIntensity = hurricaneState->intensity / 100;
1649 if (sHurricaneIntensity > 10) {
1650 sHurricaneIntensity = 10;
1651 }
1652 sBreathSizeIncrease = hurricaneState->breathSizeIncrease / 100;
1653
1654 return ApiStatus_BLOCK;
1655}
1656
1657API_CALLABLE(N(BlowTargetAway)) {
1658 BattleStatus* battleStatus = &gBattleStatus;
1659 Actor* target;
1660 ActorState* state;
1661 f64 temp_f20;
1662
1663 if (isInitialCall) {
1664 script->functionTempPtr[1] = get_actor(script->varTable[10]);
1665 script->functionTemp[0] = 0;
1666 }
1667
1668 target = script->functionTempPtr[1];
1669 state = &target->state;
1670 switch (script->functionTemp[0]) {
1671 case 0:
1672 target->state.moveTime = 0;
1673 target->state.curPos.x = target->curPos.x;
1674 target->state.curPos.y = target->curPos.y;
1675 target->state.curPos.z = target->curPos.z;
1676 target->state.speed = 5.5f;
1677 sNumEnemiesBeingBlown += 1;
1678 battleStatus->curAttackElement = 0;
1680 script->functionTemp[0] = 1;
1681 break;
1682 case 1:
1683 target->state.curPos.x += target->state.speed;
1684 temp_f20 = target->state.curPos.y;
1685 target->state.curPos.y =
1686 temp_f20 + ((sin_rad(2.0f * sin_rad(DEG_TO_RAD(target->state.moveTime)) * PI_S) * 1.4) + 0.5);
1687 target->state.moveTime += 6;
1688 target->state.moveTime = clamp_angle(target->state.moveTime);
1689 target->yaw += 33.0f;
1690 target->yaw = clamp_angle(target->yaw);
1691 if (target->state.curPos.x > 240.0f) {
1692 sNumEnemiesBeingBlown -= 1;
1693 return ApiStatus_DONE2;
1694 }
1695 break;
1696 }
1697 target->curPos.x = state->curPos.x;
1698 target->curPos.y = state->curPos.y;
1699 target->curPos.z = state->curPos.z;
1700 return ApiStatus_BLOCK;
1701}
1702
1703API_CALLABLE(N(AllEnemiesBlownAway)) {
1704 if (sNumEnemiesBeingBlown == 0) {
1705 return ApiStatus_DONE2;
1706 }
1707 return ApiStatus_BLOCK;
1708}
1709
1710API_CALLABLE(N(IsHurricaneActive)) {
1711 script->varTable[0] = sIsHurricaneActive;
1712 return ApiStatus_DONE2;
1713}
1714
1715EvtScript N(EVS_Move_Hurricane) = {
1716 Call(LoadActionCommand, ACTION_COMMAND_HURRICANE)
1717 Call(action_command_hurricane_init)
1718 Call(SetupMashMeter, 1, 100, 0, 0, 0, 0)
1719 Call(SetActionHudPrepareTime, 15)
1720 Call(SetDamageSource, DMG_SRC_HURRICANE)
1721 Call(UseBattleCamPreset, BTL_CAM_REPOSITION)
1722 Call(SetBattleCamTarget, -45, 54, 0)
1723 Call(SetBattleCamOffsetY, 0)
1724 Call(SetBattleCamDist, 280)
1725 Call(MoveBattleCamOver, 40)
1726 Call(InitTargetIterator)
1727 Call(SetGoalToHome, ACTOR_PARTNER)
1728 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Run)
1729 Call(AddGoalPos, ACTOR_PARTNER, 40, 20, 0)
1730 Call(FlyToGoal, ACTOR_PARTNER, 30, 0, EASING_COS_IN_OUT)
1731 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Idle)
1732 Wait(15)
1733 Call(N(InitHurricane))
1734 Call(action_command_hurricane_start, 0, 147 * DT, 3, LVar0)
1735 Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE)
1736 Call(SetActorRotationOffset, ACTOR_PARTNER, 0, 20, 0)
1737 Call(UseBattleCamPreset, BTL_CAM_REPOSITION)
1738 Call(SetBattleCamTarget, 35, 54, 0)
1739 Call(SetBattleCamOffsetY, 0)
1740 Call(SetBattleCamDist, 430)
1741 Call(MoveBattleCamOver, 150 * DT)
1742 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_NONE, BTL_CAM_XADJ_NONE, TRUE)
1744 Thread
1745 Call(N(ProcessHurricane))
1746 EndThread
1747 Wait(2)
1748 Loop(150 * DT)
1749 Call(N(IsHurricaneActive))
1750 IfEq(LVar0, 0)
1751 BreakLoop
1752 EndIf
1753 Call(GetActionSuccessCopy, LVar0)
1754 IfEq(LVar0, 100)
1755 BreakLoop
1756 EndIf
1757 Wait(1)
1758 EndLoop
1759 Wait(15)
1760 Call(GetActionSuccessCopy, LVar0)
1761 Switch(LVar0)
1762 CaseGt(99)
1763 Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME)
1765 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MISTAKE)
1766 EndSwitch
1767 Call(InitTargetIterator)
1768 Label(10)
1769 Call(SetGoalToTarget, ACTOR_SELF)
1770 Call(N(CanTargetBeBlown))
1771 IfGt(LVar0, 0)
1772 Set(LVarA, LVar0)
1773 Thread
1774 Call(N(BlowTargetAway))
1775 Call(SetBattleFlagBits, BS_FLAGS1_STAR_POINTS_DROPPED, TRUE)
1776 Call(RemoveActor, LVarA)
1777 EndThread
1778 Else
1779 IfEq(LVar0, 0)
1781 EndIf
1782 EndIf
1783 Label(11)
1784 Call(ChooseNextTarget, ITER_NEXT, LVar0)
1786 Goto(10)
1787 EndIf
1788 Wait(34)
1789 Call(SetActorRotation, ACTOR_PARTNER, 0, 0, 0)
1790 Call(SetActorRotationOffset, ACTOR_PARTNER, 0, 0, 0)
1791 ExecWait(N(EVS_ReturnHome_Miss))
1792 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Walk)
1793 Call(N(AllEnemiesBlownAway))
1794 Call(PartnerYieldTurn)
1795 Return
1796 End
1797};
HudScript HES_StickNeutral
HudScript HES_AimBlinkA
char unk_74[0x10]
Definition lakilester.c:85
#define HURRICANE_UNUSED_TIME
char unk_00[0x44]
Definition lakilester.c:73
char unk_5E[0x12]
Definition lakilester.c:82
HudScript HES_StickTapRight
#define HURRICANE_PARTNER_MOVE_TIME
@ STATE_EXHALE
@ STATE_DISABLED
@ STATE_INHALE
s16 breathSizeIncrease
Definition lakilester.c:74
char unk_48[0xC]
Definition lakilester.c:76
s16 startingTotalPower
Definition lakilester.c:79
HudScript HES_AimTarget
char unk_56[0x4]
Definition lakilester.c:78
HudScript HES_AimReticle
s8 transparentStatus
struct ActorBlueprint * actorBlueprint
Vec2b projectileTargetOffset
s8 selectedTargetIndex
f32 scalingFactor
ActorState state
struct SelectableTarget targetData[24]
s16 targetActorID
s32 b32
Vec2bu size
Vec3f curPos
s8 targetIndexList[24]
Bytecode EvtScript[]
s8 targetListLength
#define sfx_play_sound_at_position
#define remove_effect
#define rand_int
#define clamp_angle
s16 turnsLeft
Definition effects.h:2326
struct PartnerBuffFXData * partnerBuff
Definition effects.h:2591
struct HuffPuffBreathFXData * huffPuffBreath
Definition effects.h:2574
BuffData unk_0C[3]
Definition effects.h:2336
struct EndingDecalsFXData * endingDecals
Definition effects.h:2516
@ FX_BUFF_DATA_CLOUD_NINE
Definition effects.h:2319
EffectData data
Definition effects.h:2605
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2834
@ BTL_CAM_XADJ_NONE
Definition enums.h:4899
@ ACTION_COMMAND_WATER_BLOCK
Definition enums.h:3494
@ ACTION_COMMAND_HURRICANE
Definition enums.h:3492
@ ACTION_COMMAND_SPINY_SURGE
Definition enums.h:3491
@ BUTTON_A
Definition enums.h:2790
@ BS_FLAGS1_STAR_POINTS_DROPPED
Definition enums.h:3593
@ BS_FLAGS1_FORCE_IMMUNE_HIT
Definition enums.h:3580
@ BS_FLAGS1_NICE_HIT
Definition enums.h:3576
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3575
@ BS_FLAGS1_SHOW_PLAYER_DECORATIONS
Definition enums.h:3568
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3571
@ BS_FLAGS1_4000
Definition enums.h:3583
@ BTL_MSG_CLOUD_NINE_BEGIN
Definition enums.h:4098
@ 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_ILLUSORY
Player attacks pass through and miss.
Definition enums.h:3374
@ PHASE_RUN_AWAY_START
Definition enums.h:2060
@ PHASE_EXECUTE_ACTION
Definition enums.h:2058
@ PHASE_CELEBRATE
Definition enums.h:2062
@ PHASE_RUN_AWAY_FAIL
Definition enums.h:2064
@ BTL_MENU_TYPE_STAR_POWERS
Definition enums.h:4235
@ 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_TRANSPARENT
Definition enums.h:2210
@ 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_STOP
Definition enums.h:2204
@ STATUS_KEY_INACTIVE
Definition enums.h:2214
@ 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_DAZE
Definition enums.h:2209
@ STATUS_KEY_DEFAULT
Definition enums.h:2198
@ HIT_RESULT_NO_DAMAGE
Definition enums.h:1952
@ HIT_RESULT_HIT
Definition enums.h:1950
@ HIT_RESULT_NICE_NO_DAMAGE
Definition enums.h:1953
@ HIT_RESULT_NICE
Definition enums.h:1951
@ HIT_RESULT_MISS
Definition enums.h:1956
@ BTL_CAM_MIDPOINT_CLOSE
Definition enums.h:4832
@ BTL_CAM_RETURN_HOME
Definition enums.h:4826
@ BTL_CAM_DEFAULT
Definition enums.h:4824
@ BTL_CAM_REPOSITION
Definition enums.h:4841
@ BTL_CAM_PARTNER_MISTAKE
Definition enums.h:4873
@ SUPPRESS_EVENT_SPIKY_FRONT
Definition enums.h:2902
@ SUPPRESS_EVENT_BURN_CONTACT
Definition enums.h:2904
@ EASING_COS_IN_OUT
Definition enums.h:520
@ PARTNER_RANK_NORMAL
Definition enums.h:2018
@ PARTNER_RANK_SUPER
Definition enums.h:2019
@ PARTNER_RANK_ULTRA
Definition enums.h:2020
@ DMG_SRC_HURRICANE
Definition enums.h:2008
@ SOUND_LAKILESTER_HURRICANE_WIND
Definition enums.h:999
@ SOUND_NO_DAMGE
Definition enums.h:1433
@ SOUND_LAKILESTER_HURRICANE_EXHALE
Definition enums.h:1340
@ SOUND_AIM_SPINY_FLIP
Definition enums.h:1105
@ SOUND_LAKILESTER_HURRICANE_INHALE
Definition enums.h:1339
@ SOUND_LAKILESTER_MAKE_CLOUD_NINE
Definition enums.h:1338
@ SOUND_LAKILESTER_THROW_SPINY_B
Definition enums.h:1337
@ SOUND_LAKILESTER_THROW_SPINY_A
Definition enums.h:1336
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_PARTNER
Definition enums.h:2086
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_FLYING
Quake Hammer can't hit.
Definition enums.h:3329
@ ACTOR_FLAG_NO_INACTIVE_ANIM
Definition enums.h:3345
@ ACTOR_FLAG_SHOW_STATUS_ICONS
Definition enums.h:3343
@ BTL_CAM_YADJ_NONE
Definition enums.h:4906
@ SOUND_SPACE_DEFAULT
Definition enums.h:1737
@ EVENT_HIT
Definition enums.h:2132
@ EVENT_33
Definition enums.h:2169
@ EVENT_BURN_HIT
Definition enums.h:2136
@ EVENT_SPIKE_CONTACT
Definition enums.h:2163
@ EVENT_IMMUNE
Definition enums.h:2146
@ EVENT_ZERO_DAMAGE
Definition enums.h:2144
@ EVENT_BLOCK
Definition enums.h:2147
@ EVENT_18
Definition enums.h:2145
@ EVENT_HIT_COMBO
Definition enums.h:2131
@ EVENT_RECOVER_FROM_KO
Definition enums.h:2170
@ EVENT_SHOCK_HIT
Definition enums.h:2165
@ EVENT_BURN_CONTACT
Definition enums.h:2164
@ EVENT_BLOW_AWAY
Definition enums.h:2143
@ ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION
Definition enums.h:3361
@ ACTOR_PART_FLAG_INVISIBLE
Definition enums.h:3350
@ DAMAGE_TYPE_SPINY_SURGE
Definition enums.h:2867
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2878
@ DAMAGE_TYPE_MULTIPLE_POPUPS
Definition enums.h:2879
#define ApiStatus_DONE2
Definition evt.h:118
#define ApiStatus_BLOCK
Definition evt.h:116
void btl_set_popup_duration(s32 duration)
void get_screen_coords(s32 camID, f32 x, f32 y, f32 z, s32 *screenX, s32 *screenY, s32 *screenZ)
Definition cam_main.c:410
void dispatch_event_actor(Actor *, s32)
Definition 1A5830.c:103
f32 cos_rad(f32 x)
Definition 43F0.c:717
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
Definition 43F0.c:670
ActorPart * get_actor_part(Actor *actor, s32 partID)
Definition 190B20.c:1191
void set_actor_anim(s32 actorID, s32 partID, AnimID animID)
Definition 190B20.c:1005
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
void set_goal_pos_to_part(ActorState *state, s32 actorID, s32 partID)
Definition actor_api.c:44
f32 sin_rad(f32 x)
Definition 43F0.c:713
void add_vec2D_polar(f32 *x, f32 *y, f32 r, f32 theta)
Definition 43F0.c:685
void hud_element_create_transform_A(s32 id)
void hud_element_set_scale(s32 index, f32 scale)
void hud_element_set_script(s32 id, HudScript *anim)
void hud_element_set_render_depth(s32 id, s32 z)
void hud_element_set_transform_rotation(s32 id, f32 x, f32 y, f32 z)
void hud_element_set_render_pos(s32 id, s32 x, s32 y)
s32 hud_element_create(HudScript *anim)
Creates a new HUD element and returns its ID.
void hud_element_free(s32 id)
s32 HudScript[]
Definition hud_element.h:9
EvtScript EVS_Partner_Recover
EvtScript EVS_Partner_BurnContact
EvtScript EVS_Partner_Drop
EvtScript EVS_Partner_NoDamageHit
EvtScript EVS_Partner_ShockHit
EvtScript EVS_Partner_BurnHit
EvtScript EVS_Partner_Celebrate
EvtScript EVS_RunAwayFail
EvtScript EVS_Partner_SpikeContact
EvtScript EVS_Partner_LakilesterHit
EvtScript EVS_Partner_RunAway
void sfx_stop_sound(s32 soundID)
Definition sfx.c:507
ApiStatus RandInt(Evt *script, b32 isInitialCall)
#define NPC_DISPOSE_POS_Z
Definition macros.h:161
#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 Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#define CaseEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR. It also marks the end of any pre...
Definition macros.h:319
#define EndChildThread
Marks the end of a child thread block.
Definition macros.h:563
#define Sub(VAR, INT_VALUE)
Definition macros.h:377
#define 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 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 NPC_DISPOSE_POS_X
Definition macros.h:159
#define Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define NPC_DISPOSE_POS_Y
Definition macros.h:160
#define IfGt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR <= RVAR.
Definition macros.h:278
#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 LVar7
Definition macros.h:155
#define BreakLoop
Breaks out of the innermost loop.
Definition macros.h:251
#define Thread
Marks the start of a thread block.
Definition macros.h:544
#define EndThread
Marks the end of a thread block.
Definition macros.h:547
#define IfFlag(LVAR, RVAR)
Marks the beginning of an if statement that only executes if the RVAR flag is set on LVAR,...
Definition macros.h:288
#define LVar8
Definition macros.h:156
#define LVar2
Definition macros.h:150
#define DEG_TO_RAD(deg)
Definition macros.h:134
#define DT
Definition macros.h:522
#define BreakSwitch
Marks the end of a switch case.
Definition macros.h:359
#define LVar1
Definition macros.h:149
#define PI_S
Definition macros.h:129
#define LVarA
Definition macros.h:158
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define LFlag2
Definition macros.h:169
#define LVar9
Definition macros.h:157
#define NPC_DISPOSE_LOCATION
Definition macros.h:158
#define PlayEffect(args...)
Definition macros.h:807
#define EndSwitch
Marks the end of a switch statement and any case.
Definition macros.h:362
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
Definition macros.h:269
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define ChildThread
Marks the start of a child thread block.
Definition macros.h:560
#define CaseGt(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:328
#define LFlag3
Definition macros.h:170
#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 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
u8 hurricaneChance
Definition battle.h:142
struct EffectInstance * cloudNineEffect
struct Actor * partnerActor
struct Actor * playerActor
struct EffectInstance * buffEffect
GameStatus * gGameStatusPtr
Definition main_loop.c:32
BattleStatus gBattleStatus
Definition battle.c:11
s32 gCurrentCameraID
Definition cam_math.c:4