Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
watt.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"
9#include "sprite/npc/BattleWatt.h"
10#include "sprite/player.h"
11
12#define NAMESPACE battle_partner_watt
13
14extern EvtScript N(EVS_Init);
15extern EvtScript N(EVS_Idle);
16extern EvtScript N(EVS_HandleEvent);
17extern EvtScript N(EVS_HandlePhase);
18extern EvtScript N(EVS_TakeTurn);
19extern EvtScript N(EVS_ExecuteAction);
20extern EvtScript N(EVS_Celebrate);
21extern EvtScript N(EVS_RunAway);
23extern EvtScript N(EVS_Attack_ElectroDash);
24extern EvtScript N(EVS_Attack_PowerShock);
25extern EvtScript N(EVS_Attack_MegaShock);
26extern EvtScript N(EVS_Move_TurboCharge);
27
28extern EffectInstance* N(radialShimmer);
29extern s32 D_8023B948_707438[];
30
31static EffectInstance* N(bulbGlow);
32static EffectInstance* N(thunderboltRing);
33
34// surprisingly this can't be replaced by 'static WattEffectData sWattEffectData;'
35static s32 sWattEffectData_initialized;
36static s32 sWattEffectData_isBouncing;
37static s32 sWattEffectData_bouncePhase;
38static s32 sWattEffectData_isActive;
39static s32 sWattEffectData_currentEffectIndex;
40static EffectInstance* sWattEffectData_effect1;
41static EffectInstance* sWattEffectData_effect2;
42
43enum N(ActorPartIDs) {
44 PRT_MAIN = 1,
45 PRT_2 = 2,
46};
47
48API_CALLABLE(N(WattFXUpdate)) {
50 f32 x, y, z;
51
52 if (isInitialCall) {
53 sWattEffectData_isBouncing = TRUE;
54 sWattEffectData_bouncePhase = 0;
55 sWattEffectData_isActive = TRUE;
56 sWattEffectData_currentEffectIndex = 0;
57 sWattEffectData_effect1 = fx_static_status(0, partner->curPos.x, partner->curPos.y, partner->curPos.z, 1.0f, 5, 0);
58 sWattEffectData_effect2 = fx_static_status(1, partner->curPos.x, NPC_DISPOSE_POS_Y, partner->curPos.z, 1.0f, 5, 0);
59 sWattEffectData_initialized = TRUE;
60 }
61
62 if (!sWattEffectData_initialized) {
63 return ApiStatus_DONE2;
64 }
65
66 if (sWattEffectData_isBouncing) {
67 sWattEffectData_bouncePhase += 15;
68 sWattEffectData_bouncePhase = clamp_angle(sWattEffectData_bouncePhase);
69 }
70
71 partner->verticalRenderOffset = sin_rad(DEG_TO_RAD(sWattEffectData_bouncePhase)) * 3.0f;
72 x = partner->curPos.x + partner->headOffset.x;
73 y = partner->curPos.y + partner->headOffset.y + partner->verticalRenderOffset + 12.0f;
74 z = partner->curPos.z + partner->headOffset.z;
77 }
78
79 if (sWattEffectData_isActive) {
80 switch (sWattEffectData_currentEffectIndex) {
81 case 0:
82 if (sWattEffectData_effect1 == NULL) {
83 sWattEffectData_effect1 = fx_static_status(0, x, y, z, 1.0f, 5, 0);
84 }
85 if (sWattEffectData_effect2 != NULL) {
86 sWattEffectData_effect2->flags |= FX_INSTANCE_FLAG_DISMISS;
87 sWattEffectData_effect2 = NULL;
88 }
89 sWattEffectData_effect1->data.staticStatus->pos.x = x;
90 sWattEffectData_effect1->data.staticStatus->pos.y = y;
91 sWattEffectData_effect1->data.staticStatus->pos.z = z;
92 break;
93 case 1:
94 if (sWattEffectData_effect1 != NULL) {
95 sWattEffectData_effect1->flags |= FX_INSTANCE_FLAG_DISMISS;
96 sWattEffectData_effect1 = NULL;
97 }
98 if (sWattEffectData_effect2 == NULL) {
99 sWattEffectData_effect2 = fx_static_status(1, x, y, z, 1.0f, 5, 0);
100 }
101 sWattEffectData_effect2->data.staticStatus->pos.x = x;
102 sWattEffectData_effect2->data.staticStatus->pos.y = y;
103 sWattEffectData_effect2->data.staticStatus->pos.z = z;
104 break;
105 }
106 } else {
107 if (sWattEffectData_effect1 != NULL) {
108 sWattEffectData_effect1->flags |= FX_INSTANCE_FLAG_DISMISS;
109 sWattEffectData_effect1 = NULL;
110 }
111 if (sWattEffectData_effect2 != NULL) {
112 sWattEffectData_effect2->flags |= FX_INSTANCE_FLAG_DISMISS;
113 sWattEffectData_effect2 = NULL;
114 }
115 }
116
117 return ApiStatus_BLOCK;
118}
119
120API_CALLABLE(N(WattFXRemove)) {
121 sWattEffectData_initialized = FALSE;
122 if (sWattEffectData_effect1 != NULL) {
123 remove_effect(sWattEffectData_effect1);
124 }
125 if (sWattEffectData_effect2 != NULL) {
126 remove_effect(sWattEffectData_effect2);
127 }
128
129 return ApiStatus_DONE2;
130}
131
132API_CALLABLE(N(WattFXBounce)) {
133 sWattEffectData_isBouncing = 1;
134 return ApiStatus_DONE2;
135}
136
137API_CALLABLE(N(WattFXDisableBounce)) {
138 sWattEffectData_isBouncing = 0;
139 return ApiStatus_DONE2;
140}
141
142API_CALLABLE(N(WattFXEnable)) {
143 sWattEffectData_isActive = 1;
144 return ApiStatus_DONE2;
145}
146
147API_CALLABLE(N(WattFXDisable)) {
148 sWattEffectData_isActive = 0;
149 return ApiStatus_DONE2;
150}
151
152API_CALLABLE(N(WattFXSetEffect)) {
153 sWattEffectData_currentEffectIndex = evt_get_variable(script, *script->ptrReadPos);
154 return ApiStatus_DONE2;
155}
156
158
160
161API_CALLABLE(N(ElectroDashFX)) {
162 Bytecode* args = script->ptrReadPos;
163 s32 x = evt_get_variable(script, *args++);
164 s32 y = evt_get_variable(script, *args++);
165 s32 z = evt_get_variable(script, *args++);
166
167 N(radialShimmer) = fx_radial_shimmer(8, x, y, z, 1.3f, 55);
168
169 return ApiStatus_DONE2;
170}
171
172API_CALLABLE(N(ElectroDashFXDisable)) {
173 EffectInstance* effect = N(radialShimmer);
174
175 if (effect != NULL) {
177 }
178 N(radialShimmer) = NULL;
179
180 return ApiStatus_DONE2;
181}
182
183API_CALLABLE(N(PowerShockFX)) {
184 Bytecode* args = script->ptrReadPos;
185 s32 x = evt_get_variable(script, *args++);
186 s32 y = evt_get_variable(script, *args++);
187 s32 z = evt_get_variable(script, *args++);
189
190 N(thunderboltRing) = fx_thunderbolt_ring(0, x, y, z, 1.0f, 10);
191 data = N(thunderboltRing)->data.thunderboltRing;
192 data->unk_30 = 3;
193
194 return ApiStatus_DONE2;
195}
196
197API_CALLABLE(N(PowerShockDischargeFX)) {
198 Bytecode* args = script->ptrReadPos;
200 f32 x = partner->curPos.x + partner->headOffset.x;
201 f32 y = partner->curPos.y + partner->headOffset.y + partner->verticalRenderOffset + 12.0f;
202 f32 z = partner->curPos.z + partner->headOffset.z;
203
204 if (isInitialCall) {
205 script->functionTemp[0] = evt_get_variable(script, *args++);
206 fx_bulb_glow(0, x, y, z, 1.0f, &N(bulbGlow));
207 }
208
209 script->functionTemp[0]--;
210 if (script->functionTemp[0] == 0) {
211 N(bulbGlow)->data.bulbGlow->timeLeft = 5;
212 return ApiStatus_DONE2;
213 }
214
215 return ApiStatus_BLOCK;
216}
217
218API_CALLABLE(N(TargetParalyzeChance)) {
219 BattleStatus* battleStatus = &gBattleStatus;
220 Actor* partnerActor = battleStatus->partnerActor;
221 Actor* targetActor = get_actor(partnerActor->targetActorID);
222 ActorPart* targetActorPart = get_actor_part(targetActor, partnerActor->targetPartID);
223 s32 statusChance = lookup_status_chance(targetActor->statusTable, STATUS_KEY_PARALYZE);
224
225 if (targetActor->transparentStatus == STATUS_KEY_TRANSPARENT) {
226 statusChance = 0;
227 }
228 if (targetActorPart->eventFlags & ACTOR_EVENT_FLAG_ILLUSORY) {
229 statusChance = 0;
230 }
231
232 script->varTable[0] = statusChance;
233
234 return ApiStatus_DONE2;
235}
236
237API_CALLABLE(N(TurboChargeUnwindWatt)) {
238 Bytecode* args = script->ptrReadPos;
241 ActorState* partnerState = &partner->state;
242 f32 theta;
243 f32 sinTheta;
244 f32 cosTheta;
245 f32 distance;
246 f32 angle;
247 f32 deltaX;
248 f32 deltaY;
249
250 if (isInitialCall) {
251 script->functionTemp[0] = 0;
252 }
253
254 switch (script->functionTemp[0]) {
255 case 0:
256 script->functionTemp[2] = evt_get_variable(script, *args++);
257 partner->state.dist = dist2D(player->curPos.x, player->curPos.y, partner->curPos.x, partner->curPos.y);
258
259 partner->state.goalPos.x = player->curPos.x;
260 partner->state.goalPos.y = player->curPos.y + 36.0f;
261 partner->state.goalPos.z = player->curPos.z;
262
263 partner->state.curPos.x = partner->curPos.x;
264 partner->state.curPos.y = partner->curPos.y;
265 partner->state.curPos.z = partner->curPos.z;
266
267 partner->state.angle = 90.0f;
268 partner->state.vel = 5.0f;
269 partner->state.acceleration = 0.5f;
270 partner->state.moveTime = 90;
271 script->functionTemp[1] = 10;
272 script->functionTemp[0] = 1;
273 break;
274 case 1:
275 theta = DEG_TO_RAD(partner->state.angle);
276 sinTheta = sin_rad(theta);
277 cosTheta = cos_rad(theta);
278 partner->state.vel += partner->state.acceleration;
279 angle = partner->state.angle;
280 angle += partner->state.vel;
281 deltaX = partner->state.dist * sinTheta;
282 deltaY = -partner->state.dist * cosTheta;
283 partner->state.curPos.x = partner->state.goalPos.x + deltaX;
284 partner->state.curPos.y = partner->state.goalPos.y + deltaY;
285 partner->state.angle = angle;
286 partner->state.angle = clamp_angle(angle);
287
288 partner->state.moveTime--;
289 if (partner->state.moveTime == 0) {
290 script->functionTemp[0] = 2;
291 }
292 break;
293 case 2:
294 theta = DEG_TO_RAD(partner->state.angle);
295 sinTheta = sin_rad(theta);
296 cosTheta = cos_rad(theta);
297 distance = partner->state.dist;
298 angle = partner->state.angle;
299 angle += partner->state.vel;
300 deltaX = partner->state.dist * sinTheta;
301 deltaY = -partner->state.dist * cosTheta;
302 partner->state.curPos.x = partner->state.goalPos.x + deltaX;
303 partner->state.curPos.y = partner->state.goalPos.y + deltaY;
304 partner->state.angle = angle;
305 partner->state.angle = clamp_angle(angle);
306 if (partner->state.angle < 45.0f) {
307 script->functionTemp[0] = 3;
308 break;
309 }
310 case 3:
311 player->yaw = 0.0f;
312 partner->yaw = 0.0f;
313 return ApiStatus_DONE2;
314 }
315
316 if (partnerState->angle > 180.0f) {
317 partner->yaw = 0.0f;
318 } else {
319 partner->yaw = 180.0f;
320 }
321
322 partner->curPos.x = partnerState->curPos.x;
323 partner->curPos.y = partnerState->curPos.y;
324 partner->curPos.z = partnerState->curPos.z;
325 if (script->functionTemp[2] == 0) {
326 player->yaw += script->functionTemp[1];
327 script->functionTemp[1]++;
328 }
329 return ApiStatus_BLOCK;
330}
331
332API_CALLABLE(N(TurboChargeFX)) {
333 Bytecode* args = script->ptrReadPos;
334 s32 x = evt_get_variable(script, *args++);
335 s32 y = evt_get_variable(script, *args++);
336 s32 z = evt_get_variable(script, *args++);
338
339 N(thunderboltRing) = fx_thunderbolt_ring(0, x, y, z, 1.0f, 60);
340 data = N(thunderboltRing)->data.thunderboltRing;
341 data->unk_30 = 2;
342
343 return ApiStatus_DONE2;
344}
345
346API_CALLABLE(N(ApplyTurboCharge)) {
347 BattleStatus* battleStatus = &gBattleStatus;
348 s32 actionCommandResult = script->varTable[0];
349
350 if (actionCommandResult > 0) {
351 script->varTable[0] = 1;
352 } else {
353 script->varTable[0] = 0;
354 }
355
356 script->varTable[15] = 0;
357 script->varTable[10] = actionCommandResult;
358 if (battleStatus->turboChargeTurnsLeft < actionCommandResult) {
359 battleStatus->turboChargeTurnsLeft = actionCommandResult;
360 battleStatus->turboChargeAmount = 1;
362 }
363
366 }
367
368 return ApiStatus_DONE2;
369}
370
371API_CALLABLE(N(MegaShockFX)) {
372 Bytecode* args = script->ptrReadPos;
373 s32 x;
374 s32 y;
375 s32 z;
376
377 if (isInitialCall) {
378 script->functionTemp[0] = 0;
379 }
380
381 switch (script->functionTemp[0]) {
382 case 0:
383 script->functionTemp[1] = evt_get_variable(script, *args++);
384 x = evt_get_variable(script, *args++);
385 y = evt_get_variable(script, *args++);
386 z = evt_get_variable(script, *args++);
387 script->functionTemp[2] = 20;
388 script->functionTemp[3] = 10;
389 N(thunderboltRing) = fx_thunderbolt_ring(0, x, y, z, 1.0f, script->functionTemp[2] + 10);
390 N(thunderboltRing)->data.thunderboltRing->unk_30 = 3;
391 script->functionTemp[1] = D_8023B948_707438[script->functionTemp[1] / 16];
392 script->functionTemp[0] = 1;
393 break;
394 case 1:
395 N(thunderboltRing)->data.thunderboltRing->unk_30 =
396 ((script->functionTemp[3] * 3) + (script->functionTemp[1] * (10 - script->functionTemp[3]))) / 10;
397 if (script->functionTemp[3] != 0) {
398 script->functionTemp[3]--;
399 }
400 if (script->functionTemp[2] == 0) {
401 N(thunderboltRing)->flags |= FX_INSTANCE_FLAG_DISMISS;
402 return ApiStatus_DONE2;
403 }
404 script->functionTemp[2]--;
405 break;
406 }
407 return ApiStatus_BLOCK;
408}
409
410API_CALLABLE(N(AverageTargetParalyzeChance)) {
411 BattleStatus* battleStatus = &gBattleStatus;
412 Actor* partnerActor = battleStatus->partnerActor;
413 Actor* targetActor;
414 ActorPart* targetActorPart;
415 s32 targetActorBlueprintBaseStatusChance;
416 s32 chanceTotal = 0;
417 s32 nTargets = 0;
418 s32 i;
419
420 for (i = 0; i < partnerActor->targetListLength; i++) {
421 targetActor = get_actor(partnerActor->targetData[i].actorID);
422 targetActorPart = get_actor_part(targetActor, partnerActor->targetData[i].partID);
423 targetActorBlueprintBaseStatusChance = lookup_status_chance(targetActor->statusTable, STATUS_KEY_PARALYZE);
424
425 if (targetActor->transparentStatus == STATUS_KEY_TRANSPARENT) {
426 targetActorBlueprintBaseStatusChance = 0;
427 }
428
429 if (targetActorPart->eventFlags & ACTOR_EVENT_FLAG_ILLUSORY) {
430 targetActorBlueprintBaseStatusChance = 0;
431 }
432
433 if (targetActorBlueprintBaseStatusChance > 0) {
434 chanceTotal += targetActorBlueprintBaseStatusChance;
435 nTargets++;
436 }
437 }
438
439 if (nTargets > 0) {
440 script->varTable[0] = chanceTotal / nTargets;
441 } else {
442 script->varTable[0] = 0;
443 }
444
445 return ApiStatus_DONE2;
446}
447
448s32 N(DefaultAnims)[] = {
449 STATUS_KEY_NORMAL, ANIM_BattleWatt_Walk,
450 STATUS_KEY_STONE, ANIM_BattleWatt_Still,
451 STATUS_KEY_SLEEP, ANIM_BattleWatt_Sleep,
452 STATUS_KEY_POISON, ANIM_BattleWatt_Still,
453 STATUS_KEY_STOP, ANIM_BattleWatt_Still,
454 STATUS_KEY_DAZE, ANIM_BattleWatt_Injured,
455 STATUS_KEY_INACTIVE, ANIM_BattleWatt_Still,
457};
458
459s32 N(DefenseTable)[] = {
461 ELEMENT_SHOCK, 99,
463};
464
465s32 N(StatusTable)[] = {
468 STATUS_KEY_SLEEP, 100,
471 STATUS_KEY_DIZZY, 100,
472 STATUS_KEY_FEAR, 100,
476 STATUS_KEY_STOP, 100,
488};
489
490ActorPartBlueprint N(ActorParts)[] = {
491 {
493 .index = PRT_MAIN,
494 .posOffset = { 0, 0, 0 },
495 .targetOffset = { 10, 22 },
496 .opacity = 255,
497 .idleAnimations = N(DefaultAnims),
498 .defenseTable = N(DefenseTable),
499 .eventFlags = ACTOR_EVENT_FLAG_ELECTRIFIED,
500 .elementImmunityFlags = 0,
501 .projectileTargetOffset = { 0, 0 },
502 },
503};
504
505ActorBlueprint NAMESPACE = {
506 .flags = ACTOR_FLAG_FLYING,
507 .type = ACTOR_TYPE_WATT,
508 .level = ACTOR_LEVEL_WATT,
509 .maxHP = 99,
510 .partCount = ARRAY_COUNT(N(ActorParts)),
511 .partsData = N(ActorParts),
512 .initScript = &N(EVS_Init),
513 .statusTable = N(StatusTable),
514 .escapeChance = 0,
515 .airLiftChance = 0,
516 .hurricaneChance = 0,
517 .spookChance = 0,
518 .upAndAwayChance = 0,
519 .spinSmashReq = 4,
520 .powerBounceChance = 80,
521 .coinReward = 0,
522 .size = { 34, 28 },
523 .healthBarOffset = { 0, 0 },
524 .statusIconOffset = { -10, 20 },
525 .statusTextOffset = { 10, 20 },
526};
527
528EvtScript N(EVS_Init) = {
529 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
530 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
531 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
532 Call(BindHandlePhase, ACTOR_SELF, Ref(N(EVS_HandlePhase)))
533 Return
534 End
535};
536
537EvtScript N(EVS_Idle) = {
538 SetPriority(99)
539 Call(N(WattFXUpdate))
540 Return
541 End
542};
543
544EvtScript N(EVS_HandleEvent) = {
545 Call(UseIdleAnimation, ACTOR_PARTNER, FALSE)
546 Call(CloseActionCommandInfo)
547 Call(N(WattFXDisableBounce))
548 Call(N(WattFXEnable))
549 Call(N(WattFXSetEffect), 0)
550 Call(GetLastEvent, ACTOR_PARTNER, LVar0)
554 SetConst(LVar1, ANIM_BattleWatt_Hurt)
555 SetConst(LVar2, ANIM_BattleWatt_Hurt)
557 SetConst(LVar1, ANIM_BattleWatt_Hurt)
562 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_NO_DAMGE)
563 SetConst(LVar0, PRT_MAIN)
564 SetConst(LVar1, ANIM_BattleWatt_Hurt)
566 Call(N(WattFXBounce))
569 SetConst(LVar1, ANIM_BattleWatt_Hurt)
570 SetConst(LVar2, 12)
572 SetConst(LVar1, ANIM_BattleWatt_Hurt)
575 Call(N(WattFXDisable))
576 SetConst(LVar1, ANIM_BattleWatt_BurnHurt)
577 Set(LVar2, 12)
578 SetConst(LVar3, ANIM_BattleWatt_BurnStill)
580 Call(N(WattFXEnable))
581 SetConst(LVar1, ANIM_BattleWatt_Hurt)
584 SetConst(LVar1, ANIM_BattleWatt_BurnHurt)
585 SetConst(LVar2, ANIM_BattleWatt_BurnStill)
587 SetConst(LVar1, ANIM_BattleWatt_Hurt)
590 SetConst(LVar1, ANIM_BattleWatt_Hurt)
591 Set(LVar2, 12)
594 SetConst(LVar1, ANIM_BattleWatt_Hurt)
597 Call(N(WattFXBounce))
598 SetConst(LVar0, PRT_MAIN)
599 SetConst(LVar1, ANIM_BattleWatt_Idle)
600 SetConst(LVar2, ANIM_BattleWatt_Run)
601 Set(LVar3, 20)
603 Call(N(WattFXBounce))
605 Call(N(WattFXRemove))
608 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_NO_DAMGE)
609 SetConst(LVar0, PRT_MAIN)
610 SetConst(LVar1, ANIM_BattleWatt_Block)
612 Wait(10)
615 Call(N(WattFXDisable))
617 Call(N(WattFXEnable))
620 Call(UseIdleAnimation, ACTOR_PARTNER, TRUE)
621 Return
622 End
623};
624
625EvtScript N(EVS_TakeTurn) = {
626 Call(GetBattlePhase, LVar0)
629 ExecWait(N(EVS_ExecuteAction))
631 ExecWait(N(EVS_Celebrate))
633 ExecWait(N(EVS_RunAway))
637 Return
638 End
639};
640
641EvtScript N(EVS_Celebrate) = {
642 Call(N(WattFXEnable))
643 Call(N(WattFXSetEffect), 1)
644 SetConst(LVar0, PRT_MAIN)
645 SetConst(LVar1, ANIM_BattleWatt_Celebrate)
646 SetConst(LVar2, ANIM_BattleWatt_Walk)
647 SetConst(LVar3, ANIM_BattleWatt_Idle)
649 Return
650 End
651};
652
653EvtScript N(EVS_RunAway) = {
654 Call(N(WattFXEnable))
655 Call(N(WattFXSetEffect), 1)
656 SetConst(LVar0, PRT_MAIN)
657 SetConst(LVar1, ANIM_BattleWatt_Run)
659 Return
660 End
661};
662
664 Call(N(WattFXEnable))
665 Call(N(WattFXSetEffect), 1)
666 Call(UseIdleAnimation, ACTOR_PARTNER, FALSE)
667 Call(SetGoalToHome, ACTOR_PARTNER)
668 Call(SetActorSpeed, ACTOR_PARTNER, Float(6.0))
669 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Run)
670 Call(SetActorYaw, ACTOR_PARTNER, 0)
671 Call(RunToGoal, ACTOR_PARTNER, 0)
672 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Idle)
673 Call(UseIdleAnimation, ACTOR_PARTNER, TRUE)
674 Call(N(WattFXSetEffect), 0)
675 Return
676 End
677};
678
679EvtScript N(EVS_HandlePhase) = {
680 Return
681 End
682};
683
684EvtScript N(EVS_ExecuteAction) = {
685 Call(ShowActionHud, TRUE)
686 Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE)
687 Call(GetMenuSelection, LVar0, LVar1, LVar2)
690 Call(LoadStarPowerScript)
692 Return
694 Call(GetMenuSelection, LVar0, LVar1, LVar2)
696 CaseEq(MOVE_ELECTRO_DASH1)
697 ExecWait(N(EVS_Attack_ElectroDash))
698 CaseEq(MOVE_ELECTRO_DASH2)
699 ExecWait(N(EVS_Attack_ElectroDash))
700 CaseEq(MOVE_ELECTRO_DASH3)
701 ExecWait(N(EVS_Attack_ElectroDash))
702 CaseEq(MOVE_POWER_SHOCK)
703 ExecWait(N(EVS_Attack_PowerShock))
704 CaseEq(MOVE_TURBO_CHARGE)
705 ExecWait(N(EVS_Move_TurboCharge))
706 CaseEq(MOVE_MEGA_SHOCK)
707 ExecWait(N(EVS_Attack_MegaShock))
709 Return
710 End
711};
712
713EvtScript N(EVS_ReturnHome_Success) = {
714 Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME)
715 Call(SetGoalToHome, ACTOR_PARTNER)
716 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Run)
717 Call(FlyToGoal, ACTOR_PARTNER, 30, 0, EASING_COS_IN_OUT)
718 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Idle)
719 Return
720 End
721};
722
723EvtScript N(EVS_ReturnHome_Miss) = {
724 Call(UseBattleCamPreset, BTL_CAM_PARTNER_MISTAKE)
725 Call(SetGoalToHome, ACTOR_PARTNER)
726 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Run)
727 Call(FlyToGoal, ACTOR_PARTNER, 30, 0, EASING_COS_IN_OUT)
728 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Idle)
729 Return
730 End
731};
732
733EffectInstance* N(radialShimmer) = NULL;
734
735EvtScript N(dashToTarget) = {
736 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Run)
737 Call(FlyToGoal, ACTOR_PARTNER, 20, 0, EASING_LINEAR)
738 Return
739 End
740};
741
742EvtScript N(charge) = {
743 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Strain)
744 Call(N(WattFXDisable))
745 Call(PlayLoopingSoundAtActor, ACTOR_PARTNER, 0, SOUND_WATT_CHARGE)
746 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
747 Add(LVar1, 12)
748 Call(N(ElectroDashFX), LVar0, LVar1, LVar2)
749 Call(N(UnkBackgroundFunc3))
750 Set(LVar9, 0)
751 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_StrainBigger)
752 Loop(55)
753 Add(LVar9, 30)
754 IfGt(LVar9, 200)
755 Set(LVar9, 200)
756 EndIf
757 Call(N(SetBackgroundAlpha), LVar9)
758 Wait(1)
759 EndLoop
760 Call(SetActorPaletteEffect, ACTOR_SELF, PRT_MAIN, ACTOR_PAL_ADJUST_WATT_IDLE)
761 Return
762 End
763};
764
765EvtScript N(EVS_ElectroDashDelay) = {
766 Loop(30)
767 Wait(1)
768 EndLoop
769 Return
770 End
771};
772
773EvtScript N(EVS_Attack_ElectroDash) = {
774 Call(LoadActionCommand, ACTION_COMMAND_BODY_SLAM)
775 Call(action_command_body_slam_init)
776 Call(SetupMashMeter, 1, 100, 0, 0, 0, 0)
777 Wait(10)
778 Call(UseBattleCamPreset, BTL_CAM_CLOSER_PARTNER_APPROACH)
779 Call(InitTargetIterator)
780 Call(SetGoalToTarget, ACTOR_PARTNER)
781 Call(AddGoalPos, ACTOR_PARTNER, -20, 0, 0)
782 Set(LFlag2, FALSE)
783 Loop(60)
784 Call(CheckButtonDown, BUTTON_A, LVar0)
785 IfNe(LVar0, 0)
786 Set(LFlag2, TRUE)
788 EndIf
789 Wait(1)
790 EndLoop
791 Call(MoveBattleCamOver, 75)
792 IfEq(LFlag2, TRUE)
793 Call(action_command_body_slam_start, 0, 102, 3, 1)
794 Set(LFlag0, FALSE)
795 ExecGetTID(N(dashToTarget), LVarA)
796 Loop(20)
797 Call(CheckButtonDown, BUTTON_A, LVar0)
798 IfEq(LVar0, 0)
799 Set(LFlag0, TRUE)
801 EndIf
802 Wait(1)
803 EndLoop
804 IfEq(LFlag0, TRUE)
806 Goto(10)
807 EndIf
809 Set(LFlag0, FALSE)
810 ExecGetTID(N(charge), LVarA)
811 Loop(55)
812 Call(CheckButtonDown, BUTTON_A, LVar0)
813 IfEq(LVar0, 0)
814 Set(LFlag0, TRUE)
816 EndIf
817 Wait(1)
818 EndLoop
819 IfEq(LFlag0, TRUE)
821 Goto(10)
822 EndIf
823 IfEq(LFlag0, FALSE)
824 ExecGetTID(N(EVS_ElectroDashDelay), LVarA)
825 Loop(30)
826 Call(CheckButtonDown, BUTTON_A, LVar0)
827 IfEq(LVar0, 0)
828 Set(LFlag0, TRUE)
830 EndIf
831 Wait(1)
832 EndLoop
833 IfEq(LFlag0, TRUE)
835 Goto(10)
836 EndIf
837 EndIf
838 Else
839 Set(LFlag0, FALSE)
840 ExecGetTID(N(dashToTarget), LVarA)
841 Loop(20)
842 Call(CheckButtonDown, BUTTON_A, LVar0)
843 IfNe(LVar0, 0)
844 IfEq(LFlag2, FALSE)
845 Call(action_command_body_slam_start, 0, 92, 3, 1)
846 Set(LFlag2, TRUE)
847 EndIf
848 EndIf
849 IfEq(LFlag2, TRUE)
850 IfEq(LVar0, 0)
851 Set(LFlag0, TRUE)
853 EndIf
854 EndIf
855 Wait(1)
856 EndLoop
857 IfEq(LFlag0, TRUE)
859 Goto(10)
860 EndIf
862 Set(LFlag0, FALSE)
863 ExecGetTID(N(charge), LVarA)
864 Loop(55)
865 Call(CheckButtonDown, BUTTON_A, LVar0)
866 IfNe(LVar0, 0)
867 IfEq(LFlag2, FALSE)
868 Call(action_command_body_slam_start, 0, 92, 3, 1)
869 Set(LFlag2, TRUE)
870 EndIf
871 EndIf
872 IfEq(LFlag2, TRUE)
873 IfEq(LVar0, 0)
874 Set(LFlag0, TRUE)
876 EndIf
877 EndIf
878 Wait(1)
879 EndLoop
880 IfEq(LFlag0, TRUE)
882 Goto(10)
883 EndIf
884 IfEq(LFlag0, FALSE)
885 ExecGetTID(N(EVS_ElectroDashDelay), LVarA)
886 Loop(30)
887 Call(CheckButtonDown, BUTTON_A, LVar0)
888 IfEq(LVar0, 0)
889 Set(LFlag0, TRUE)
891 EndIf
892 Wait(1)
893 EndLoop
894 IfEq(LFlag0, TRUE)
896 Goto(10)
897 EndIf
898 EndIf
899 EndIf
900 Label(10)
901 Wait(2)
902 Call(CloseActionCommandInfo)
903 Call(N(ElectroDashFXDisable))
904 Call(StopLoopingSoundAtActor, ACTOR_PARTNER, 0)
905 Call(SetDamageSource, DMG_SRC_ELECTRO_DASH)
906 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Strain)
907 Call(SetActorPaletteEffect, ACTOR_SELF, PRT_MAIN, ACTOR_PAL_ADJUST_WATT_ATTACK)
908 Call(SetGoalToTarget, ACTOR_PARTNER)
909 Call(AddGoalPos, ACTOR_PARTNER, -5, 0, 0)
910 Call(FlyToGoal, ACTOR_PARTNER, 5, 0, EASING_LINEAR)
911 Thread
912 Wait(2)
913 Call(N(SetBackgroundAlpha), 0)
917 Thread
918 Wait(5)
919 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Idle)
921 Call(SetGoalToTarget, ACTOR_PARTNER)
922 Call(AddGoalPos, ACTOR_PARTNER, 40, 10, 0)
923 Call(FlyToGoal, ACTOR_PARTNER, 10, -20, EASING_QUADRATIC_OUT)
924 Wait(20)
925 Call(SetGoalToHome, ACTOR_PARTNER)
926 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Run)
927 Call(FlyToGoal, ACTOR_PARTNER, 30, 0, EASING_COS_IN_OUT)
928 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Idle)
929 Return
930 EndIf
931 Call(N(WattFXEnable))
932 Call(N(WattFXBounce))
933 Call(GetMenuSelection, LVar0, LVar1, LVar2)
935 CaseEq(MOVE_ELECTRO_DASH1)
936 Set(LVarE, 1)
937 Set(LVarF, 3)
938 CaseEq(MOVE_ELECTRO_DASH2)
939 Set(LVarE, 1)
940 Set(LVarF, 4)
941 CaseEq(MOVE_ELECTRO_DASH3)
942 Set(LVarE, 1)
943 Set(LVarF, 5)
945 Call(GetPartnerActionSuccess, LVar0)
947 CaseGt(0)
952 Call(PartnerYieldTurn)
956 ExecWait(N(EVS_ReturnHome_Success))
960 ExecWait(N(EVS_ReturnHome_Miss))
963 Return
964 End
965};
966
967EvtScript N(EVS_Attack_PowerShock) = {
968 Call(LoadActionCommand, ACTION_COMMAND_POWER_SHOCK)
969 Call(action_command_power_shock_init)
970 Call(SetupMashMeter, 1, 100, 0, 0, 0, 0)
971 Call(SetActionHudPrepareTime, 0)
972 Set(LFlagF, FALSE)
973 Call(GetOwnerTarget, LVarA, LVarB)
974 Call(GetActorFlags, LVarA, LVar0)
976 Set(LFlagF, TRUE)
977 EndIf
978 Call(UseBattleCamPreset, BTL_CAM_PARTNER_APPROACH)
979 Call(MoveBattleCamOver, 40)
980 Call(InitTargetIterator)
981 Call(SetGoalToTarget, ACTOR_PARTNER)
982 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Run)
983 Call(N(WattFXSetEffect), 1)
984 Call(AddGoalPos, ACTOR_PARTNER, -15, -10, 0)
985 Call(FlyToGoal, ACTOR_PARTNER, 30, 0, EASING_COS_IN_OUT)
986 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Idle)
988 Call(AddBattleCamDist, -100)
989 Call(MoveBattleCamOver, 80)
990 Call(N(WattFXDisable))
991 Call(N(TargetParalyzeChance))
992 Call(action_command_power_shock_start, 0, 75 * DT - 3, 3, LVar0)
993 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
994 Add(LVar1, 15)
995 Add(LVar2, 5)
996 PlayEffect(EFFECT_SNAKING_STATIC, 0, LVar0, LVar1, LVar2, Float(1.0), 75 * DT, 0)
997 Call(N(UnkBackgroundFunc3))
998 Set(LVar9, 0)
999 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_StrainBigger)
1000 Call(SetActorPaletteEffect, ACTOR_SELF, PRT_MAIN, ACTOR_PAL_ADJUST_WATT_ATTACK)
1001 Thread
1002 Loop(75 * DT)
1003 Add(LVar9, 3)
1004 Call(N(SetBackgroundAlpha), LVar9)
1005 Wait(1)
1006 EndLoop
1007 EndThread
1008 Wait(75 * DT)
1009 Call(SetActorPaletteEffect, ACTOR_SELF, PRT_MAIN, ACTOR_PAL_ADJUST_WATT_IDLE)
1010 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_WATT_POWER_SHOCK)
1011 Thread
1012 SetF(LVar0, Float(1.0))
1013 Loop(3)
1014 AddF(LVar0, Float(0.4))
1015 Call(SetActorScale, ACTOR_PARTNER, LVar0, LVar0, LVar0)
1016 Wait(1)
1017 EndLoop
1018 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1019 Add(LVar1, 8)
1020 PlayEffect(EFFECT_ENERGY_IN_OUT, 6, LVar0, LVar1, LVar2, Float(1.8), 30, 0)
1021 EndThread
1022 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1023 Add(LVar1, 20)
1024 Add(LVar2, 5)
1025 Call(N(PowerShockFX), LVar0, LVar1, LVar2)
1026 Call(UseBattleCamPreset, BTL_CAM_PARTNER_APPROACH)
1027 Call(AddBattleCamDist, 100)
1028 Call(MoveBattleCamOver, 5)
1029 Thread
1030 Call(N(PowerShockDischargeFX), 20)
1031 EndThread
1032 Loop(3)
1033 Call(N(SetBackgroundAlpha), 0)
1034 Wait(1)
1035 Call(N(SetBackgroundAlpha), 200)
1036 Wait(1)
1037 EndLoop
1038 Call(N(SetBackgroundAlpha), 0)
1039 Wait(10)
1040 Call(N(WattFXEnable))
1041 Call(N(WattFXSetEffect), 0)
1042 Thread
1043 Call(SetActorRotationOffset, ACTOR_SELF, 0, 20, 0)
1044 SetF(LVar0, Float(2.2))
1045 Loop(12)
1046 SubF(LVar0, Float(0.1))
1047 Call(SetActorScale, ACTOR_PARTNER, LVar0, LVar0, LVar0)
1048 Wait(1)
1049 EndLoop
1050 Call(SetActorRotationOffset, ACTOR_SELF, 0, 0, 0)
1051 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Idle)
1052 EndThread
1055 Wait(15)
1056 ExecWait(N(EVS_ReturnHome_Miss))
1057 Return
1058 EndIf
1059 Call(GetActionQuality, LVarF)
1060 Call(GetPartnerActionSuccess, LVar0)
1061 Switch(LVar0)
1062 CaseGt(0)
1066 EndSwitch
1067 Call(PartnerYieldTurn)
1068 IfNe(LFlagF, TRUE)
1069 Call(AddGoalPos, ACTOR_PARTNER, -25, 10, 0)
1070 Call(FlyToGoal, ACTOR_PARTNER, 15, -10, EASING_COS_IN_OUT)
1071 Else
1072 Call(AddGoalPos, ACTOR_PARTNER, -25, -10, 0)
1073 Call(FlyToGoal, ACTOR_PARTNER, 15, -10, EASING_COS_IN_OUT)
1074 EndIf
1075 Wait(30)
1076 Switch(LVar0)
1079 ExecWait(N(EVS_ReturnHome_Success))
1083 ExecWait(N(EVS_ReturnHome_Miss))
1085 EndSwitch
1086 Return
1087 End
1088};
1089
1090EvtScript N(EVS_TurboCharge_HealthyPlayer) = {
1091 Call(LoadActionCommand, ACTION_COMMAND_WATER_BLOCK)
1092 Call(action_command_water_block_init, 1)
1093 Call(SetActionHudPrepareTime, 0)
1094 Call(SetActorFlagBits, ACTOR_PLAYER, ACTOR_FLAG_NO_INACTIVE_ANIM, TRUE)
1095 Call(UseIdleAnimation, ACTOR_PLAYER, FALSE)
1096 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_UsePower)
1097 Wait(5)
1098 Call(UseBattleCamPreset, BTL_CAM_REPOSITION)
1099 Call(SetBattleCamTarget, -125, 42, 0)
1100 Call(SetBattleCamOffsetY, 0)
1101 Call(SetBattleCamDist, 340)
1102 Call(MoveBattleCamOver, 30)
1103 Call(SetActorYaw, ACTOR_PARTNER, 30)
1104 Wait(1)
1105 Call(SetActorYaw, ACTOR_PARTNER, 60)
1106 Wait(1)
1107 Call(SetActorYaw, ACTOR_PARTNER, 90)
1108 Wait(1)
1109 Call(SetActorYaw, ACTOR_PARTNER, 120)
1110 Wait(1)
1111 Call(SetActorYaw, ACTOR_PARTNER, 150)
1112 Wait(1)
1113 Call(SetActorYaw, ACTOR_PARTNER, 180)
1114 Wait(10)
1115 Call(action_command_water_block_start, 0, 100 * DT, 3)
1116 Call(AddBattleCamDist, -75)
1117 Call(MoveBattleCamOver, 100 * DT)
1118 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_NONE, BTL_CAM_XADJ_NONE, TRUE)
1119 Thread
1120 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_ENABLE)
1121 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Strain)
1122 Call(N(TurboChargeUnwindWatt), 0)
1123 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Run)
1124 Call(SetGoalToHome, ACTOR_PARTNER)
1125 Call(FlyToGoal, ACTOR_PARTNER, 10, -10, EASING_CUBIC_OUT)
1126 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Idle)
1127 Wait(10)
1128 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_DISABLE)
1129 EndThread
1130 Wait(30)
1131 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_WATT_TURBO_CHARGE)
1132 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
1133 Add(LVar1, 42)
1134 Call(N(TurboChargeFX), LVar0, LVar1, LVar2)
1135 Wait(59)
1136 Call(AddBattleCamDist, 100)
1137 Call(MoveBattleCamOver, 5)
1138 Thread
1139 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_LONG_PLAYER_JUMP)
1140 Call(SetActorJumpGravity, ACTOR_PLAYER, Float(1.0))
1141 Call(SetActorSpeed, ACTOR_PLAYER, Float(1.0))
1142 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
1143 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_Land)
1144 Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
1145 Call(PlayerHopToGoal, 20, 0, 0)
1146 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Land)
1147 Wait(4)
1148 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
1149 EndThread
1150 Wait(30)
1151 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1152 Call(MoveBattleCamOver, 10)
1153 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_GROW)
1154 Call(GetPartnerActionSuccess, LVar0)
1155 Call(N(ApplyTurboCharge))
1156 Set(LVarE, LVarF)
1157 IfGt(LVarA, 0)
1158 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
1159 Add(LVar0, 15)
1160 Add(LVar1, 35)
1161 Add(LVarF, 0)
1162 PlayEffect(EFFECT_STAT_CHANGE, LVarF, LVar0, LVar1, LVar2, Float(1.5), 60, 0)
1163 Wait(4)
1164 EndIf
1165 IfEq(LVar0, 0)
1166 Else
1167 Call(ShowVariableMessageBox, BTL_MSG_TURBO_CHARGE_BEGIN, 60, LVarA)
1168 EndIf
1169 Call(WaitForMessageBoxDone)
1170 Call(SetActorFlagBits, ACTOR_PLAYER, ACTOR_FLAG_NO_INACTIVE_ANIM, FALSE)
1171 Return
1172 End
1173};
1174
1175EvtScript N(EVS_TurboCharge_ImmobilePlayer) = {
1176 Call(LoadActionCommand, ACTION_COMMAND_WATER_BLOCK)
1177 Call(action_command_water_block_init, 1)
1178 Call(SetActionHudPrepareTime, 0)
1179 Call(UseIdleAnimation, ACTOR_PLAYER, FALSE)
1180 Wait(5)
1181 Call(UseBattleCamPreset, BTL_CAM_REPOSITION)
1182 Call(SetBattleCamTarget, -125, 42, 0)
1183 Call(SetBattleCamOffsetY, 0)
1184 Call(SetBattleCamDist, 340)
1185 Call(MoveBattleCamOver, 30)
1186 Call(SetActorYaw, ACTOR_PARTNER, 30)
1187 Wait(1)
1188 Call(SetActorYaw, ACTOR_PARTNER, 60)
1189 Wait(1)
1190 Call(SetActorYaw, ACTOR_PARTNER, 90)
1191 Wait(1)
1192 Call(SetActorYaw, ACTOR_PARTNER, 120)
1193 Wait(1)
1194 Call(SetActorYaw, ACTOR_PARTNER, 150)
1195 Wait(1)
1196 Call(SetActorYaw, ACTOR_PARTNER, 180)
1197 Wait(10)
1198 Call(action_command_water_block_start, 0, 100 * DT, 3)
1199 Call(AddBattleCamDist, -100)
1200 Call(MoveBattleCamOver, 100 * DT)
1201 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_NONE, BTL_CAM_XADJ_NONE, TRUE)
1202 Thread
1203 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_ENABLE)
1204 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Strain)
1205 Call(N(TurboChargeUnwindWatt), 1)
1206 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Run)
1207 Call(SetGoalToHome, ACTOR_PARTNER)
1208 Call(FlyToGoal, ACTOR_PARTNER, 10, -10, EASING_CUBIC_OUT)
1209 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Idle)
1210 Wait(10)
1211 Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_DISABLE)
1212 EndThread
1213 Wait(30)
1214 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_WATT_TURBO_CHARGE)
1215 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
1216 Add(LVar1, 42)
1217 Call(N(TurboChargeFX), LVar0, LVar1, LVar2)
1218 Wait(59)
1219 Call(AddBattleCamDist, 100)
1220 Call(MoveBattleCamOver, 5)
1221 Wait(30)
1222 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1223 Call(MoveBattleCamOver, 10)
1224 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_GROW)
1225 Call(GetPartnerActionSuccess, LVar0)
1226 Call(N(ApplyTurboCharge))
1227 Set(LVarE, LVarF)
1228 IfGt(LVarA, 0)
1229 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
1230 Add(LVar0, 15)
1231 Add(LVar1, 35)
1232 Add(LVarF, 0)
1233 PlayEffect(EFFECT_STAT_CHANGE, LVarF, LVar0, LVar1, LVar2, Float(1.5), 60, 0)
1234 Wait(4)
1235 EndIf
1236 IfEq(LVar0, 0)
1237 Else
1238 Call(ShowVariableMessageBox, BTL_MSG_TURBO_CHARGE_BEGIN, 60, LVarA)
1239 EndIf
1240 Call(WaitForMessageBoxDone)
1241 Call(SetActorFlagBits, ACTOR_PLAYER, ACTOR_FLAG_NO_INACTIVE_ANIM, FALSE)
1242 Return
1243 End
1244};
1245
1246EvtScript N(EVS_Move_TurboCharge) = {
1247 Call(GetStatusFlags, ACTOR_PLAYER, LVar0)
1249 ExecWait(N(EVS_TurboCharge_ImmobilePlayer))
1250 Else
1251 ExecWait(N(EVS_TurboCharge_HealthyPlayer))
1252 EndIf
1253 Return
1254 End
1255};
1256
1257s32 D_8023B948_707438[] = { 3, 3, 4, 7, 10, 13, 16, 16, 16, 16 };
1258
1259EvtScript N(EVS_Attack_MegaShock) = {
1260 Call(LoadActionCommand, ACTION_COMMAND_MEGA_SHOCK)
1261 Call(action_command_mega_shock_init)
1262 Call(SetupMashMeter, 1, 100, 0, 0, 0, 0)
1263 Call(SetActionHudPrepareTime, 0)
1264 Call(UseBattleCamPreset, BTL_CAM_REPOSITION)
1265 Call(SetBattleCamTarget, -54, 63, 10)
1266 Call(SetBattleCamOffsetY, 15)
1267 Call(SetBattleCamDist, 314)
1268 Call(MoveBattleCamOver, 30)
1269 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1270 Add(LVar0, 40)
1271 Add(LVar1, 30)
1272 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Run)
1273 Call(SetGoalPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1274 Call(FlyToGoal, ACTOR_PARTNER, 20, 0, EASING_COS_IN_OUT)
1275 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Idle)
1276 Call(N(UnkBackgroundFunc3))
1277 Set(LVar9, 0)
1278 Thread
1279 Loop(75 * DT)
1280 Add(LVar9, 3)
1281 Call(N(SetBackgroundAlpha), LVar9)
1282 Wait(1)
1283 EndLoop
1284 EndThread
1285 Call(N(AverageTargetParalyzeChance))
1286 Call(action_command_mega_shock_start, 0, 87 * DT, 3, LVar0)
1287 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1288 Add(LVar1, 15)
1289 Add(LVar2, 5)
1290 PlayEffect(EFFECT_SNAKING_STATIC, 0, LVar0, LVar1, LVar2, Float(1.0), 90 * DT, 0)
1291 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1292 Add(LVar1, 12)
1293 PlayEffect(EFFECT_RADIAL_SHIMMER, 8, LVar0, LVar1, LVar2, Float(1.3), 90 * DT, 0)
1294 Call(AddBattleCamDist, -100)
1295 Call(MoveBattleCamOver, 90 * DT)
1296 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_NONE, BTL_CAM_XADJ_NONE, TRUE)
1297 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_StrainBigger)
1298 Call(SetActorPaletteEffect, ACTOR_SELF, PRT_MAIN, ACTOR_PAL_ADJUST_WATT_ATTACK)
1299 Call(N(WattFXDisable))
1300 Call(GetActionQuality, LVar1)
1301 Wait(90 * DT)
1302 Call(N(SetBackgroundAlpha), 0)
1303 Thread
1304 Set(LVar9, 60)
1305 Loop(20)
1306 Sub(LVar9, 3)
1307 Call(N(SetBackgroundAlpha), LVar9)
1308 Wait(1)
1309 EndLoop
1310 EndThread
1311 Call(SetActorPaletteEffect, ACTOR_SELF, PRT_MAIN, ACTOR_PAL_ADJUST_WATT_IDLE)
1312 Call(InitTargetIterator)
1313 Thread
1314 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
1315 Add(LVar1, 12)
1316 Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_WATT_MEGA_DISCHARGE)
1317 PlayEffect(EFFECT_FLASHING_BOX_SHOCKWAVE, FX_SHOCK_OVERLAY_MEGA_SHOCK, LVar0, LVar1, LVar2, 0, 0, 0)
1318 Wait(10)
1320 PlayEffect(EFFECT_FLASHING_BOX_SHOCKWAVE, FX_SHOCK_OVERLAY_MEGA_SHOCK, LVar0, LVar1, LVar2, 0, 0, 0)
1321 EndThread
1322 Thread
1323 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_StrainBiggest)
1324 Wait(5)
1325 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Strain)
1326 Wait(30)
1327 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_Idle)
1328 EndThread
1329 Thread
1330 Call(SetBattleCamDist, 420)
1331 Call(SetBattleCamTarget, 6, 63, 10)
1332 Call(MoveBattleCamOver, 15)
1333 Wait(4)
1334 Set(LVar0, 6)
1335 Loop(30)
1336 Add(LVar0, 1)
1337 Call(SetBattleCamTarget, LVar0, 63, 10)
1338 Wait(1)
1339 EndLoop
1340 EndThread
1341 Thread
1342 Call(N(PowerShockDischargeFX), 10)
1343 EndThread
1344 Call(GetActionQuality, LVar0)
1345 Call(GetActorPos, ACTOR_PARTNER, LVar1, LVar2, LVar3)
1346 Add(LVar2, 12)
1347 Call(N(MegaShockFX), LVar0, LVar1, LVar2, LVar3)
1348 Loop(0)
1349 Call(SetGoalToTarget, ACTOR_SELF)
1350 Call(GetPartnerActionSuccess, LVarF)
1353 Goto(11)
1354 EndIf
1355 IfEq(LVarF, 100)
1357 Else
1359 EndIf
1360 Label(11)
1361 Call(ChooseNextTarget, ITER_NEXT, LVar0)
1363 BreakLoop
1364 EndIf
1365 Wait(5)
1366 EndLoop
1367 Call(N(WattFXEnable))
1368 Call(PartnerYieldTurn)
1369 Wait(30)
1370 Call(GetPartnerActionSuccess, LVar0)
1371 Switch(LVar0)
1372 CaseGt(99)
1373 ExecWait(N(EVS_ReturnHome_Success))
1375 ExecWait(N(EVS_ReturnHome_Miss))
1376 EndSwitch
1377 Return
1378 End
1379};
s32 D_8023B948_707438[]
Definition watt.c:1257
s8 transparentStatus
s8 verticalRenderOffset
Vec3s headOffset
ActorState state
struct SelectableTarget targetData[24]
s16 targetActorID
Vec3f curPos
Bytecode EvtScript[]
s8 targetListLength
s32 * statusTable
#define remove_effect
#define clamp_angle
s16 turnsLeft
Definition effects.h:2326
@ FX_SHOCK_OVERLAY_MEGA_SHOCK
Definition effects.h:1265
struct PartnerBuffFXData * partnerBuff
Definition effects.h:2591
BuffData unk_0C[3]
Definition effects.h:2336
struct StaticStatusFXData * staticStatus
Definition effects.h:2579
@ FX_BUFF_DATA_TURBO_CHARGE
Definition effects.h:2320
EffectData data
Definition effects.h:2605
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2834
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517
@ BTL_CAM_XADJ_NONE
Definition enums.h:4899
@ ACTION_COMMAND_WATER_BLOCK
Definition enums.h:3494
@ ACTION_COMMAND_MEGA_SHOCK
Definition enums.h:3489
@ ACTION_COMMAND_BODY_SLAM
Definition enums.h:3484
@ ACTION_COMMAND_POWER_SHOCK
Definition enums.h:3488
@ BUTTON_A
Definition enums.h:2790
@ 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_4000
Definition enums.h:3583
@ BTL_MSG_TURBO_CHARGE_BEGIN
Definition enums.h:4100
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_SHOCK
Definition enums.h:2125
@ ELEMENT_NORMAL
Definition enums.h:2115
@ ITER_NO_MORE
Definition enums.h:2030
@ ITER_NEXT
Definition enums.h:2025
@ ACTOR_PAL_ADJUST_WATT_IDLE
Definition enums.h:2248
@ ACTOR_PAL_ADJUST_WATT_ATTACK
Definition enums.h:2249
@ ACTOR_EVENT_FLAG_ELECTRIFIED
Player takes shock damage upon contact.
Definition enums.h:3375
@ 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
@ BS_FLAGS2_OVERRIDE_INACTIVE_PARTNER
Definition enums.h:3608
@ BS_FLAGS2_STORED_TURBO_CHARGE_TURN
Definition enums.h:3611
@ BS_FLAGS2_PLAYER_TURN_USED
Definition enums.h:3605
@ BS_FLAGS2_PARTNER_TURN_USED
Definition enums.h:3606
@ 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_STONE
Definition enums.h:2208
@ 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_RETURN_HOME
Definition enums.h:4826
@ BTL_CAM_CLOSER_PARTNER_APPROACH
Definition enums.h:4870
@ BTL_CAM_DEFAULT
Definition enums.h:4824
@ BTL_CAM_REPOSITION
Definition enums.h:4841
@ BTL_CAM_PARTNER_MISTAKE
Definition enums.h:4873
@ BTL_CAM_PARTNER_APPROACH
Definition enums.h:4869
@ SUPPRESS_EVENT_SPIKY_TOP
Definition enums.h:2900
@ SUPPRESS_EVENT_ALT_SPIKY
Definition enums.h:2905
@ SUPPRESS_EVENT_SHOCK_CONTACT
Definition enums.h:2903
@ SUPPRESS_EVENT_SPIKY_FRONT
Definition enums.h:2902
@ SUPPRESS_EVENT_BURN_CONTACT
Definition enums.h:2904
@ EASING_CUBIC_OUT
Definition enums.h:515
@ EASING_COS_IN_OUT
Definition enums.h:520
@ EASING_QUADRATIC_OUT
Definition enums.h:514
@ EASING_LINEAR
Definition enums.h:510
@ STATUS_FLAG_PARALYZE
Definition enums.h:2816
@ DMG_SRC_ELECTRO_DASH
Definition enums.h:2007
@ SOUND_WATT_MEGA_DISCHARGE
Definition enums.h:1003
@ SOUND_WATT_POWER_SHOCK
Definition enums.h:1001
@ SOUND_WATT_MEGA_CHARGE_WAVE
Definition enums.h:1345
@ SOUND_NO_DAMGE
Definition enums.h:1433
@ SOUND_GROW
Definition enums.h:1435
@ SOUND_WATT_CHARGE
Definition enums.h:1000
@ SOUND_WATT_TURBO_CHARGE
Definition enums.h:1002
@ SOUND_LONG_PLAYER_JUMP
Definition enums.h:782
@ 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_UPSIDE_DOWN
HP bar offset below actor (e.g. Swooper when upside-down).
Definition enums.h:3331
@ BTL_CAM_YADJ_NONE
Definition enums.h:4906
@ ACTOR_BLUR_ENABLE
Definition enums.h:6414
@ ACTOR_BLUR_DISABLE
Definition enums.h:6413
@ 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_PUT_PARTNER_AWAY
Definition enums.h:2177
@ EVENT_BLOCK
Definition enums.h:2147
@ EVENT_REVIVE
Definition enums.h:2180
@ EVENT_18
Definition enums.h:2145
@ EVENT_HIT_COMBO
Definition enums.h:2131
@ EVENT_RECOVER_FROM_KO
Definition enums.h:2170
@ EVENT_LIFE_SHROOM_PROC
Definition enums.h:2179
@ EVENT_SHOCK_HIT
Definition enums.h:2165
@ EVENT_BURN_CONTACT
Definition enums.h:2164
@ ACTOR_PART_FLAG_PRIMARY_TARGET
Definition enums.h:3362
@ DAMAGE_TYPE_STATUS_ALWAYS_HITS
Definition enums.h:2880
@ DAMAGE_TYPE_IGNORE_DEFENSE
Definition enums.h:2877
@ DAMAGE_TYPE_SHOCK
Definition enums.h:2856
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2878
@ DAMAGE_TYPE_MULTIPLE_POPUPS
Definition enums.h:2879
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
#define ApiStatus_BLOCK
Definition evt.h:116
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1690
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
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
s32 lookup_status_chance(s32 *, s32)
Definition 190B20.c:2046
f32 sin_rad(f32 x)
Definition 43F0.c:713
EvtScript EVS_Partner_Hit
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_RunAway
#define Else
Marks the end of an if statement and the start of the else block.
Definition macros.h:295
#define Switch(LVAR)
Marks the start of a switch statement.
Definition macros.h:311
#define Ref(sym)
Address/pointer constant.
Definition macros.h:60
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#define AddF(VAR, FLOAT_VALUE)
Definition macros.h:383
#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 SetPriority(PRIORITY)
Sets the current thread's priority. Higher-priority threads execute before lower-priority threads on ...
Definition macros.h:513
#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 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 DMG_STATUS_ALWAYS(typeFlag, duration)
Definition macros.h:225
#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 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 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 KillThread(TID)
Kills a thread by its thread ID.
Definition macros.h:510
#define SetF(VAR, FLOAT_VALUE)
Sets the given variable to a given value, but supports Floats.
Definition macros.h:373
#define LFlagF
Definition macros.h:182
#define IfFlag(LVAR, RVAR)
Marks the beginning of an if statement that only executes if the RVAR flag is set on LVAR,...
Definition macros.h:288
#define LVar2
Definition macros.h:150
#define DEG_TO_RAD(deg)
Definition macros.h:134
#define DT
Definition macros.h:522
#define LVar1
Definition macros.h:149
#define LFlag0
Definition macros.h:167
#define LVarA
Definition macros.h:158
#define ExecGetTID(EVT_SOURCE, OUTVAR)
Identical to Exec, but the newly-launched thread ID is stored in OUTVAR.
Definition macros.h:460
#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 SubF(VAR, FLOAT_VALUE)
Definition macros.h:384
#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 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 Loop(TIMES)
Marks the beginning of a loop.
Definition macros.h:245
#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
struct Actor * partnerActor
struct Actor * playerActor
struct EffectInstance * buffEffect
BattleStatus gBattleStatus
Definition battle.c:11