Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
ember.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "sprite/npc/LavaBubble.h"
4
5#define NAMESPACE A(ember)
6
7extern s32 N(DefaultAnims)[];
8extern s32 N(ProjectileAnims)[];
9extern EvtScript N(EVS_Init);
10extern EvtScript N(EVS_Idle);
11extern EvtScript N(EVS_TakeTurn);
12extern EvtScript N(EVS_HandleEvent);
13
14enum N(ActorPartIDs) {
15 PRT_MAIN = 1,
16 PRT_FIRE_1 = 2,
17 PRT_FIRE_2 = 3,
18 PRT_FIRE_3 = 4,
19 PRT_FIRE_4 = 5,
20};
21
22enum N(ActorVars) {
23 AVAR_IN_Flying = 0,
24 AVAR_StayNearGound = 0,
25 AVAR_Generation = 1,
26 AVAR_PauseIdle = 2,
27};
28
29enum N(ActorParams) {
30 DMG_TACKLE = 4,
31 DMG_AIR_SWEEP = 4,
32 DMG_SHOOT = 3,
33};
34
35s32 N(DefenseTable)[] = {
37 ELEMENT_WATER, -2,
38 ELEMENT_ICE, -2,
39 ELEMENT_FIRE, 99,
41};
42
43s32 N(StatusTable)[] = {
66};
67
68ActorPartBlueprint N(ActorParts)[] = {
69 {
71 .index = PRT_MAIN,
72 .posOffset = { 0, 0, 0 },
73 .targetOffset = { -2, 25 },
74 .opacity = 255,
75 .idleAnimations = N(DefaultAnims),
76 .defenseTable = N(DefenseTable),
77 .eventFlags = ACTOR_EVENT_FLAG_FIREY,
78 .elementImmunityFlags = 0,
79 .projectileTargetOffset = { -3, -10 },
80 },
81 {
83 .index = PRT_FIRE_1,
84 .posOffset = { 0, 0, 0 },
85 .targetOffset = { 0, 24 },
86 .opacity = 255,
87 .idleAnimations = N(ProjectileAnims),
88 .defenseTable = N(DefenseTable),
89 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
90 .elementImmunityFlags = 0,
91 .projectileTargetOffset = { -1, -10 },
92 },
93 {
95 .index = PRT_FIRE_2,
96 .posOffset = { 0, 0, 0 },
97 .targetOffset = { 0, 24 },
98 .opacity = 255,
99 .idleAnimations = N(ProjectileAnims),
100 .defenseTable = N(DefenseTable),
101 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
102 .elementImmunityFlags = 0,
103 .projectileTargetOffset = { -1, -10 },
104 },
105 {
107 .index = PRT_FIRE_3,
108 .posOffset = { 0, 0, 0 },
109 .targetOffset = { 0, 24 },
110 .opacity = 255,
111 .idleAnimations = N(ProjectileAnims),
112 .defenseTable = N(DefenseTable),
113 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
114 .elementImmunityFlags = 0,
115 .projectileTargetOffset = { -1, -10 },
116 },
117 {
119 .index = PRT_FIRE_4,
120 .posOffset = { 0, 0, 0 },
121 .targetOffset = { 0, 24 },
122 .opacity = 255,
123 .idleAnimations = N(ProjectileAnims),
124 .defenseTable = N(DefenseTable),
125 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
126 .elementImmunityFlags = 0,
127 .projectileTargetOffset = { -1, -10 },
128 },
129};
130
131ActorBlueprint NAMESPACE = {
132 .flags = ACTOR_FLAG_FLYING,
133 .type = ACTOR_TYPE_EMBER,
134 .level = ACTOR_LEVEL_EMBER,
135 .maxHP = 10,
136 .partCount = ARRAY_COUNT(N(ActorParts)),
137 .partsData = N(ActorParts),
138 .initScript = &N(EVS_Init),
139 .statusTable = N(StatusTable),
140 .escapeChance = 60,
141 .airLiftChance = 80,
142 .hurricaneChance = 75,
143 .spookChance = 50,
144 .upAndAwayChance = 95,
145 .spinSmashReq = 0,
146 .powerBounceChance = 80,
147 .coinReward = 2,
148 .size = { 33, 32 },
149 .healthBarOffset = { 0, 0 },
150 .statusIconOffset = { -10, 20 },
151 .statusTextOffset = { 10, 20 },
152};
153
154s32 N(DefaultAnims)[] = {
155 STATUS_KEY_NORMAL, ANIM_LavaBubble_Blue_Anim01,
156 STATUS_KEY_STONE, ANIM_LavaBubble_Blue_Anim00,
157 STATUS_KEY_SLEEP, ANIM_LavaBubble_Blue_Anim01,
158 STATUS_KEY_POISON, ANIM_LavaBubble_Blue_Anim01,
159 STATUS_KEY_STOP, ANIM_LavaBubble_Blue_Anim00,
160 STATUS_KEY_STATIC, ANIM_LavaBubble_Blue_Anim01,
161 STATUS_KEY_PARALYZE, ANIM_LavaBubble_Blue_Anim00,
162 STATUS_KEY_DIZZY, ANIM_LavaBubble_Blue_Anim0A,
163 STATUS_KEY_FEAR, ANIM_LavaBubble_Blue_Anim0A,
165};
166
167s32 N(ProjectileAnims)[] = {
168 STATUS_KEY_NORMAL, ANIM_LavaBubble_Blue_Anim01,
170};
171
172EvtScript N(EVS_Init) = {
173 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
174 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
175 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
176 Call(GetActorVar, ACTOR_SELF, AVAR_IN_Flying, LVar0)
178 CaseEq(0)
179 Call(SetActorVar, ACTOR_SELF, AVAR_StayNearGound, TRUE)
180 CaseEq(1)
181 Call(SetActorVar, ACTOR_SELF, AVAR_StayNearGound, FALSE)
183 Call(SetPartScale, ACTOR_SELF, PRT_FIRE_1, Float(0.5), Float(0.5), Float(0.5))
184 Call(SetPartScale, ACTOR_SELF, PRT_FIRE_2, Float(0.5), Float(0.5), Float(0.5))
185 Call(SetPartScale, ACTOR_SELF, PRT_FIRE_3, Float(0.5), Float(0.5), Float(0.5))
186 Call(SetPartScale, ACTOR_SELF, PRT_FIRE_4, Float(0.5), Float(0.5), Float(0.5))
187 Call(SetActorVar, ACTOR_SELF, AVAR_Generation, 0)
188 Call(SetActorVar, ACTOR_SELF, AVAR_PauseIdle, FALSE)
189 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
190 Add(LVar1, 5)
191 Call(ForceHomePos, ACTOR_SELF, LVar0, LVar1, LVar2)
192 Call(HPBarToHome, ACTOR_SELF)
193 Return
194 End
195};
196
197EvtScript N(EVS_Idle) = {
198 Label(0)
199 Call(MakeLerp, 0, 10, 25, EASING_COS_IN_OUT)
200 Label(1)
202 Call(GetHomePos, ACTOR_SELF, LVar2, LVar3, LVar4)
203 Add(LVar0, LVar3)
204 Call(SetActorPos, ACTOR_SELF, LVar2, LVar0, LVar4)
205 IfEq(LVar1, 1)
206 Label(11)
207 Wait(1)
208 Call(GetStatusFlags, ACTOR_SELF, LVar0)
210 Goto(11)
211 EndIf
212 Call(GetActorVar, ACTOR_SELF, AVAR_PauseIdle, LVar0)
213 IfEq(LVar0, TRUE)
214 Goto(11)
215 EndIf
216 Goto(1)
217 EndIf
218 Call(MakeLerp, 10, 0, 25, EASING_COS_IN_OUT)
219 Label(2)
221 Call(GetHomePos, ACTOR_SELF, LVar2, LVar3, LVar4)
222 Add(LVar0, LVar3)
223 Call(SetActorPos, ACTOR_SELF, LVar2, LVar0, LVar4)
224 IfEq(LVar1, 1)
225 Label(22)
226 Wait(1)
227 Call(GetStatusFlags, ACTOR_SELF, LVar0)
229 Goto(22)
230 EndIf
231 Call(GetActorVar, ACTOR_SELF, AVAR_PauseIdle, LVar0)
232 IfEq(LVar0, TRUE)
233 Goto(22)
234 EndIf
235 Goto(2)
236 EndIf
237 Goto(0)
238 Return
239 End
240};
241
242#include "common/PlayLavaBubbleFlightSound.inc.c"
243
244EvtScript N(EVS_FlyHome) = {
245 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_LavaBubble_Blue_Anim03)
246 Call(SetGoalToHome, ACTOR_SELF)
247 Call(SetActorSpeed, ACTOR_SELF, Float(8.0))
248 Thread
249 Call(N(PlayLavaBubbleFlightSound))
251 Call(FlyToGoal, ACTOR_SELF, 0, 1, EASING_SIN_OUT)
252 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_LavaBubble_Blue_Anim01)
253 Return
254 End
255};
256
257EvtScript N(EVS_GetAvailableColumn) = {
258 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
259 Call(InitTargetIterator)
260 Label(0)
261 Call(GetOwnerTarget, LVar0, LVar5)
262 Call(GetIndexFromHome, LVar0, LVar5)
263 Mod(LVar5, 4)
265 CaseEq(0)
266 Set(LFlag1, TRUE)
267 CaseEq(1)
268 Set(LFlag2, TRUE)
269 CaseEq(2)
270 Set(LFlag3, TRUE)
271 CaseEq(3)
272 Set(LFlag4, TRUE)
274 Call(ChooseNextTarget, ITER_NEXT, LVar0)
276 Goto(0)
277 EndIf
278 IfEq(LFlag1, FALSE)
279 Set(LVarA, 0)
280 Return
281 EndIf
282 IfEq(LFlag2, FALSE)
283 Set(LVarA, 1)
284 Return
285 EndIf
286 IfEq(LFlag3, FALSE)
287 Set(LVarA, 2)
288 Return
289 EndIf
290 IfEq(LFlag4, FALSE)
291 Set(LVarA, 3)
292 Return
293 EndIf
294 Set(LVarA, -1)
295 Return
296 End
297};
298
299Vec3i N(SummonPos) = { NPC_DISPOSE_LOCATION };
300
301Formation N(SummonFormation) = {
302 ACTOR_BY_POS(NAMESPACE, N(SummonPos), 0),
303};
304
305EvtScript N(EVS_TrySplit) = {
306 Call(GetLastDamage, ACTOR_SELF, LVar0)
307 IfEq(LVar0, 0)
308 Return
309 EndIf
310 Call(GetActorHP, ACTOR_SELF, LVar0)
311 IfLe(LVar0, 0)
312 Return
313 EndIf
314 Call(GetLastElement, LVar0)
315 IfFlag(LVar0, DAMAGE_TYPE_MULTIPLE_POPUPS) // interesting use-case
316 Return
317 EndIf
318 Call(GetActorVar, ACTOR_SELF, AVAR_Generation, LVar0)
319 IfGe(LVar0, 2)
320 Return
321 EndIf
322 ExecWait(N(EVS_GetAvailableColumn))
324 CaseOrEq(0)
325 CaseOrEq(1)
326 CaseOrEq(2)
327 CaseOrEq(3)
328 Call(SummonEnemy, Ref(N(SummonFormation)), FALSE)
329 Call(SetActorVar, LVar0, AVAR_PauseIdle, TRUE)
330 Call(GetActorHP, ACTOR_SELF, LVarB)
331 Call(SetEnemyHP, LVar0, LVarB)
332 Call(GetActorPos, ACTOR_SELF, LVarB, LVarC, LVarD)
333 Call(SetActorPos, LVar0, LVarB, LVarC, LVarD)
334 Call(SetGoalToIndex, LVar0, LVarA)
335 Call(GetGoalPos, LVar0, LVarB, LVarC, LVarD)
336 Call(SetHomePos, LVar0, LVarB, LVarC, LVarD)
337 Call(SetActorJumpGravity, LVar0, Float(1.2))
338 Call(JumpToGoal, LVar0, 20, FALSE, TRUE, FALSE)
339 Call(HPBarToHome, LVar0)
340 Call(GetActorVar, ACTOR_SELF, AVAR_Generation, LVar1)
342 CaseEq(0)
343 Call(SetActorVar, LVar0, AVAR_Generation, 1)
344 CaseEq(1)
345 Call(SetActorVar, LVar0, AVAR_Generation, 2)
347 Call(SetActorVar, ACTOR_SELF, AVAR_Generation, 3)
348 Call(SetActorVar, LVar0, AVAR_PauseIdle, FALSE)
352 Return
353 End
354};
355
356EvtScript N(EVS_HandleEvent) = {
357 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
358 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
359 Call(GetLastEvent, ACTOR_SELF, LVar0)
363 Exec(N(EVS_TrySplit))
364 SetConst(LVar0, PRT_MAIN)
365 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim07)
369 Exec(N(EVS_TrySplit))
370 SetConst(LVar0, PRT_MAIN)
371 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim08)
372 SetConst(LVar2, ANIM_LavaBubble_Blue_Anim09)
375 SetConst(LVar0, PRT_MAIN)
376 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim08)
377 SetConst(LVar2, ANIM_LavaBubble_Blue_Anim09)
379 SetConst(LVar0, PRT_MAIN)
380 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim09)
382 Return
384 Exec(N(EVS_TrySplit))
385 SetConst(LVar0, PRT_MAIN)
386 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim07)
389 SetConst(LVar0, PRT_MAIN)
390 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim07)
392 SetConst(LVar0, PRT_MAIN)
393 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim07)
395 Return
398 SetConst(LVar0, PRT_MAIN)
399 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim07)
401 SetConst(LVar0, PRT_MAIN)
402 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim07)
404 ExecWait(N(EVS_FlyHome))
407 SetConst(LVar0, PRT_MAIN)
408 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim07)
410 SetConst(LVar0, PRT_MAIN)
411 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim07)
413 Return
418 SetConst(LVar0, PRT_MAIN)
419 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim01)
423 SetConst(LVar0, PRT_MAIN)
424 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim07)
426 SetConst(LVar0, PRT_MAIN)
427 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim07)
429 Return
431 Call(SetActorPos, ACTOR_SELF, 20, 0, 0)
432 Call(HPBarToCurrent, ACTOR_SELF)
434 ExecWait(N(EVS_FlyHome))
435 Call(HPBarToHome, ACTOR_SELF)
437 SetConst(LVar0, PRT_MAIN)
438 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim01)
441 SetConst(LVar0, PRT_MAIN)
442 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim03)
443 SetConst(LVar2, ANIM_LavaBubble_Blue_Anim07)
445 Return
447 SetConst(LVar0, PRT_MAIN)
448 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim03)
451 SetConst(LVar0, PRT_MAIN)
452 SetConst(LVar1, ANIM_LavaBubble_Blue_Anim03)
454 Return
456 // nothing
459 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
460 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
461 Return
462 End
463};
464
465EvtScript N(EVS_Attack_Tackle) = {
466 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
467 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
468 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
469 Call(UseBattleCamPreset, BTL_CAM_ENEMY_APPROACH)
470 Call(BattleCamTargetActor, ACTOR_SELF)
471 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
472 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_LavaBubble_Blue_Anim03)
473 Call(SetGoalToTarget, ACTOR_SELF)
474 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
475 Add(LVar0, 30)
476 Set(LVar1, 5)
477 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
478 Call(SetActorSpeed, ACTOR_SELF, Float(6.0))
479 Thread
480 Call(N(PlayLavaBubbleFlightSound))
482 Call(FlyToGoal, ACTOR_SELF, 0, 0, EASING_SIN_OUT)
483 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_LavaBubble_Blue_Anim01)
484 Call(EnemyTestTarget, ACTOR_SELF, LVar0, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS)
488 Set(LVarA, LVar0)
489 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_LavaBubble_Blue_Anim04)
490 Call(SetGoalToTarget, ACTOR_SELF)
491 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
492 Sub(LVar0, 20)
493 Set(LVar1, 0)
494 Add(LVar2, 1)
495 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.0))
496 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
497 Call(JumpToGoal, ACTOR_SELF, 15, FALSE, TRUE, FALSE)
499 Call(EnemyTestTarget, ACTOR_SELF, LVarA, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
500 EndIf
501 Sub(LVar0, 30)
502 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
503 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
504 Sub(LVar0, 20)
505 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
506 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
507 Sub(LVar0, 10)
508 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
509 Call(JumpToGoal, ACTOR_SELF, 3, FALSE, TRUE, FALSE)
510 Wait(14)
511 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
512 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
513 Call(SetActorYaw, ACTOR_SELF, 180)
514 ExecWait(N(EVS_FlyHome))
515 Call(SetActorYaw, ACTOR_SELF, 0)
516 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
517 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_RESTART)
518 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
519 Return
522 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_LavaBubble_Blue_Anim04)
523 Call(SetGoalToTarget, ACTOR_SELF)
524 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
525 Add(LVar2, 1)
526 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.6))
527 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
528 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
529 Wait(2)
530 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_FIRE, 0, 0, DMG_TACKLE, BS_FLAGS1_TRIGGER_EVENTS)
534 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
535 Set(LVar0, PRT_MAIN)
536 Set(LVar1, ANIM_LavaBubble_Blue_Anim04)
538 Wait(5)
539 ExecWait(N(EVS_FlyHome))
542 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_RESTART)
543 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
544 Return
545 End
546};
547
548// (in) LVar3 posX
549// (in) LVar4 posY
550// (in) LVar5 posZ
551EvtScript N(EVS_ShootFire_Impl) = {
552 Set(LVar6, PRT_FIRE_1)
553 Loop(4)
554 Thread
555 Call(GetStatusFlags, ACTOR_SELF, LVarA)
557 Call(SetPartScale, ACTOR_SELF, LVar6, Float(0.2), Float(0.2), Float(0.2))
558 Else
559 Call(SetPartScale, ACTOR_SELF, LVar6, Float(0.5), Float(0.5), Float(0.5))
560 EndIf
561 Call(SetPartPos, ACTOR_SELF, LVar6, LVar0, LVar1, LVar2)
562 Call(SetPartFlagBits, ACTOR_SELF, LVar6, ACTOR_PART_FLAG_INVISIBLE, FALSE)
563 Call(SetPartMoveSpeed, ACTOR_SELF, LVar6, Float(8.0))
564 Call(SetPartJumpGravity, ACTOR_SELF, LVar6, Float(0.01))
566 Call(JumpPartTo, ACTOR_SELF, LVar6, LVar3, LVar4, LVar5, 0, FALSE)
567 Call(SetPartFlagBits, ACTOR_SELF, LVar6, ACTOR_PART_FLAG_INVISIBLE, TRUE)
569 Wait(3)
570 Add(LVar6, 1)
571 EndLoop
572 Return
573 End
574};
575
576// Shoot fireballs at a target and wait before yielding.
577// (in) LVar3 posX
578// (in) LVar4 posY
579// (in) LVar5 posZ
580EvtScript N(EVS_ShootFire) = {
581 Exec(N(EVS_ShootFire_Impl))
582 Call(GetDistanceToGoal, ACTOR_SELF, LVar0)
583 DivF(LVar0, Float(8.0))
584 Add(LVar0, 1)
585 Wait(LVar0)
586 Return
587 End
588};
589
590EvtScript N(EVS_Attack_ShootPartner) = {
591 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
592 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
593 Call(SetTargetActor, ACTOR_SELF, ACTOR_PARTNER)
594 Call(UseBattleCamPreset, BTL_CAM_ENEMY_APPROACH)
595 Call(BattleCamTargetActor, ACTOR_SELF)
596 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
597 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
598 Call(GetActorVar, ACTOR_SELF, AVAR_StayNearGound, LVarA)
599 IfEq(LVarA, TRUE)
600 Add(LVar0, 100)
601 Set(LVar1, 5)
602 Else
603 Add(LVar0, 30)
604 Set(LVar1, 50)
605 EndIf
606 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
607 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_LavaBubble_Blue_Anim03)
608 Call(SetActorSpeed, ACTOR_SELF, Float(6.0))
609 Thread
610 Call(N(PlayLavaBubbleFlightSound))
612 Call(FlyToGoal, ACTOR_SELF, 0, -4, EASING_SIN_OUT)
613 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_LavaBubble_Blue_Anim01)
614 Wait(10)
615 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_LavaBubble_Blue_Anim05)
616 Wait(30)
617 Call(EnemyTestTarget, ACTOR_SELF, LVar0, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS)
621 Set(LVarA, LVar0)
622 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_LavaBubble_Blue_Anim06)
623 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
624 Sub(LVar0, 5)
625 Add(LVar1, 4)
626 Add(LVar2, 2)
627 Call(SetGoalToTarget, ACTOR_SELF)
628 Call(GetGoalPos, ACTOR_SELF, LVar3, LVar4, LVar5)
629 Sub(LVar3, 100)
630 Add(LVar5, 2)
631 ExecWait(N(EVS_ShootFire))
633 Call(EnemyTestTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
634 EndIf
635 Wait(20)
636 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
637 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
638 Call(SetActorYaw, ACTOR_SELF, 180)
639 ExecWait(N(EVS_FlyHome))
640 Wait(20)
641 Call(SetActorYaw, ACTOR_SELF, 0)
642 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
643 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
644 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
645 Return
648 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_LavaBubble_Blue_Anim06)
649 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
650 Sub(LVar0, 5)
651 Add(LVar1, 4)
652 Add(LVar2, 2)
653 Call(SetGoalToTarget, ACTOR_SELF)
654 Call(GetGoalPos, ACTOR_SELF, LVar3, LVar4, LVar5)
655 Sub(LVar4, 6)
656 Add(LVar5, 2)
657 ExecWait(N(EVS_ShootFire))
658 Wait(2)
659 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, (DAMAGE_TYPE_FIRE | DAMAGE_TYPE_NO_CONTACT), 0, 0, DMG_SHOOT, BS_FLAGS1_TRIGGER_EVENTS)
660 Wait(20)
664 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
665 ExecWait(N(EVS_FlyHome))
668 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
669 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
670 Return
671 End
672};
673
674EvtScript N(EVS_Attack_AirSweep) = {
675 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
676 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
677 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
678 Call(UseBattleCamPreset, BTL_CAM_ENEMY_APPROACH)
679 Call(BattleCamTargetActor, ACTOR_SELF)
680 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
681 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_LavaBubble_Blue_Anim03)
682 Call(SetGoalToTarget, ACTOR_SELF)
683 Call(AddGoalPos, ACTOR_SELF, 30, 0, 0)
684 Call(SetActorSpeed, ACTOR_SELF, Float(5.0))
685 Thread
686 Call(N(PlayLavaBubbleFlightSound))
688 Call(FlyToGoal, ACTOR_SELF, 0, -4, EASING_SIN_OUT)
689 Call(EnemyTestTarget, ACTOR_SELF, LVar0, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS)
693 Set(LVarA, LVar0)
694 Wait(10)
695 Call(SetActorSounds, ACTOR_SELF, ACTOR_SOUND_JUMP, SOUND_NONE, 0)
696 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_EMBER_JUMP)
697 Call(SetActorSpeed, ACTOR_SELF, Float(5.0))
698 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.8))
699 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_LavaBubble_Blue_Anim04)
700 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
701 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
702 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, FALSE, FALSE)
703 Call(ResetActorSounds, ACTOR_SELF, ACTOR_SOUND_JUMP)
704 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_ACTOR_HOP)
705 Call(SetGoalToTarget, ACTOR_SELF)
706 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
707 Sub(LVar0, 30)
708 Add(LVar2, 2)
709 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
710 Call(SetActorSpeed, ACTOR_SELF, Float(8.0))
711 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_LavaBubble_Blue_Anim04)
712 Call(FlyToGoal, ACTOR_SELF, 0, -10, EASING_QUADRATIC_OUT)
714 Call(EnemyTestTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
715 EndIf
716 Wait(30)
717 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
718 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
719 Call(SetActorYaw, ACTOR_SELF, 180)
720 ExecWait(N(EVS_FlyHome))
721 Call(SetActorYaw, ACTOR_SELF, 0)
722 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
723 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_RESTART)
724 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
725 Return
728 Wait(5)
729 Call(SetActorSounds, ACTOR_SELF, ACTOR_SOUND_JUMP, SOUND_NONE, 0)
730 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_EMBER_JUMP)
731 Call(SetActorSpeed, ACTOR_SELF, Float(5.0))
732 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.8))
733 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_LavaBubble_Blue_Anim04)
734 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
735 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
736 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, FALSE, FALSE)
737 Call(ResetActorSounds, ACTOR_SELF, ACTOR_SOUND_JUMP)
738 Set(LVarA, LVar0)
739 Set(LVarB, LVar1)
740 Set(LVarC, LVar2)
741 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_ACTOR_HOP)
742 Call(SetGoalToTarget, ACTOR_SELF)
743 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
744 Add(LVar2, 2)
745 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
746 Call(SetActorSpeed, ACTOR_SELF, Float(8.0))
747 Call(FlyToGoal, ACTOR_SELF, 0, -10, EASING_QUADRATIC_OUT)
748 Wait(2)
749 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_FIRE, 0, 0, DMG_AIR_SWEEP, BS_FLAGS1_TRIGGER_EVENTS)
753 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
754 Call(SetGoalPos, ACTOR_SELF, LVarA, LVarB, LVarC)
755 Call(FlyToGoal, ACTOR_SELF, 0, -10, EASING_LINEAR)
756 Wait(20)
757 ExecWait(N(EVS_FlyHome))
760 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_RESTART)
761 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
762 Return
763 End
764};
765
766EvtScript N(EVS_TakeTurn) = {
767 Call(GetBattlePhase, LVar0)
769 Call(GetActorVar, ACTOR_SELF, AVAR_StayNearGound, LVar0)
771 CaseEq(1)
772 ExecWait(N(EVS_Attack_Tackle))
773 CaseEq(0)
774 ExecWait(N(EVS_Attack_AirSweep))
776 Return
777 EndIf
778 Call(GetActorVar, ACTOR_SELF, AVAR_StayNearGound, LVar0)
780 CaseEq(1)
781 Call(GetStatusFlags, ACTOR_PARTNER, LVar0)
783 ExecWait(N(EVS_Attack_Tackle))
784 Else
785 Call(RandInt, 1000, LVar0)
786 IfLe(LVar0, 300)
787 ExecWait(N(EVS_Attack_ShootPartner))
788 Else
789 ExecWait(N(EVS_Attack_Tackle))
790 EndIf
791 EndIf
792 CaseEq(0)
793 Call(GetStatusFlags, ACTOR_PARTNER, LVar0)
795 ExecWait(N(EVS_Attack_AirSweep))
796 Else
797 Call(RandInt, 1000, LVar0)
798 IfLe(LVar0, 300)
799 ExecWait(N(EVS_Attack_ShootPartner))
800 Else
801 ExecWait(N(EVS_Attack_AirSweep))
802 EndIf
803 EndIf
805 Return
806 End
807};
Bytecode EvtScript[]
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2834
@ BTL_CAM_XADJ_AVG
Definition enums.h:4900
@ ACTOR_SOUND_JUMP
Definition enums.h:2036
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3575
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3571
@ ELEMENT_FIRE
Definition enums.h:2116
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_ICE
Definition enums.h:2118
@ ELEMENT_WATER
Definition enums.h:2117
@ ELEMENT_NORMAL
Definition enums.h:2115
@ ITER_NO_MORE
Definition enums.h:2030
@ ITER_NEXT
Definition enums.h:2025
@ ACTOR_EVENT_FLAGS_NONE
Definition enums.h:3370
@ ACTOR_EVENT_FLAG_FIREY
Player takes burn damage upon contact.
Definition enums.h:3371
@ ACTOR_DECORATION_SWEAT
Definition enums.h:2045
@ PHASE_FIRST_STRIKE
Definition enums.h:2059
@ STATUS_KEY_PARALYZE
Definition enums.h:2201
@ STATUS_TURN_MOD_DEFAULT
Definition enums.h:2227
@ STATUS_TURN_MOD_PARALYZE
Definition enums.h:2234
@ STATUS_KEY_FROZEN
Definition enums.h:2203
@ STATUS_TURN_MOD_SLEEP
Definition enums.h:2228
@ STATUS_TURN_MOD_DIZZY
Definition enums.h:2232
@ STATUS_KEY_STATIC
Definition enums.h:2207
@ STATUS_END
Definition enums.h:2196
@ STATUS_TURN_MOD_POISON
Definition enums.h:2233
@ STATUS_KEY_FEAR
Definition enums.h:2199
@ STATUS_TURN_MOD_STOP
Definition enums.h:2237
@ STATUS_KEY_SLEEP
Definition enums.h:2202
@ STATUS_KEY_STONE
Definition enums.h:2208
@ STATUS_KEY_STOP
Definition enums.h:2204
@ STATUS_TURN_MOD_FROZEN
Definition enums.h:2230
@ STATUS_KEY_SHRINK
Definition enums.h:2206
@ STATUS_KEY_DIZZY
Definition enums.h:2200
@ STATUS_KEY_POISON
Definition enums.h:2205
@ STATUS_TURN_MOD_STATIC
Definition enums.h:2229
@ STATUS_TURN_MOD_FEAR
Definition enums.h:2231
@ STATUS_KEY_NORMAL
Definition enums.h:2197
@ STATUS_TURN_MOD_SHRINK
Definition enums.h:2235
@ STATUS_KEY_DEFAULT
Definition enums.h:2198
@ HIT_RESULT_NO_DAMAGE
Definition enums.h:1952
@ HIT_RESULT_HIT
Definition enums.h:1950
@ HIT_RESULT_LUCKY
Definition enums.h:1955
@ HIT_RESULT_MISS
Definition enums.h:1956
@ BTL_CAM_DEFAULT
Definition enums.h:4824
@ BTL_CAM_ENEMY_APPROACH
Definition enums.h:4885
@ TARGET_FLAG_PRIMARY_ONLY
Definition enums.h:1863
@ TARGET_FLAG_2
Definition enums.h:1850
@ SOUND_ID_TRIGGER_CHANGE_SOUND
Definition enums.h:532
@ EASING_SIN_OUT
Definition enums.h:521
@ EASING_COS_IN_OUT
Definition enums.h:520
@ EASING_QUADRATIC_OUT
Definition enums.h:514
@ EASING_LINEAR
Definition enums.h:510
@ IDLE_SCRIPT_RESTART
Definition enums.h:6409
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6408
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6407
@ STATUS_FLAG_SHRINK
Definition enums.h:2819
@ STATUS_FLAG_KO
Definition enums.h:2823
@ SOUND_EMBER_JUMP
Definition enums.h:1041
@ SOUND_NONE
Definition enums.h:547
@ SOUND_ACTOR_HOP
Definition enums.h:1073
@ SOUND_EMBER_FLY
Definition enums.h:1163
@ SOUND_EMBER_SPIT
Definition enums.h:1042
@ 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
@ BTL_CAM_YADJ_TARGET
Definition enums.h:4905
@ EVENT_HIT
Definition enums.h:2132
@ EVENT_UP_AND_AWAY
Definition enums.h:2176
@ EVENT_SCARE_AWAY
Definition enums.h:2174
@ EVENT_BURN_HIT
Definition enums.h:2136
@ EVENT_BEGIN_FIRST_STRIKE
Definition enums.h:2173
@ EVENT_END_FIRST_STRIKE
Definition enums.h:2171
@ EVENT_IMMUNE
Definition enums.h:2146
@ EVENT_BURN_DEATH
Definition enums.h:2157
@ EVENT_ZERO_DAMAGE
Definition enums.h:2144
@ EVENT_SHOCK_DEATH
Definition enums.h:2159
@ EVENT_SPIN_SMASH_HIT
Definition enums.h:2133
@ EVENT_SPIN_SMASH_DEATH
Definition enums.h:2154
@ EVENT_HIT_COMBO
Definition enums.h:2131
@ EVENT_AIR_LIFT_FAILED
Definition enums.h:2152
@ EVENT_BEGIN_AIR_LIFT
Definition enums.h:2175
@ EVENT_DEATH
Definition enums.h:2153
@ EVENT_SHOCK_HIT
Definition enums.h:2165
@ EVENT_RECOVER_STATUS
Definition enums.h:2167
@ EVENT_BURN_TAUNT
Definition enums.h:2149
@ EVENT_BLOW_AWAY
Definition enums.h:2143
@ ACTOR_PART_FLAG_PRIMARY_TARGET
Definition enums.h:3362
@ ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION
Definition enums.h:3361
@ ACTOR_PART_FLAG_NO_TARGET
Cannot be targeted.
Definition enums.h:3360
@ ACTOR_PART_FLAG_INVISIBLE
Definition enums.h:3350
@ DAMAGE_TYPE_FIRE
Definition enums.h:2852
@ DAMAGE_TYPE_TRIGGER_LUCKY
Definition enums.h:2881
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2878
@ DAMAGE_TYPE_MULTIPLE_POPUPS
Definition enums.h:2879
EvtScript EVS_Enemy_Knockback
EvtScript EVS_Enemy_ScareAway
EvtScript EVS_Enemy_Hit
EvtScript EVS_Enemy_Death
EvtScript EVS_Enemy_SpinSmashHit
EvtScript EVS_Enemy_ShockHit
EvtScript EVS_Enemy_AirLift
EvtScript EVS_Enemy_BlowAway
EvtScript EVS_Enemy_Recover
EvtScript EVS_Enemy_BurnHit
EvtScript EVS_Enemy_NoDamageHit
ApiStatus UpdateLerp(Evt *script, b32 isInitialCall)
ApiStatus RandInt(Evt *script, b32 isInitialCall)
ApiStatus MakeLerp(Evt *script, b32 isInitialCall)
#define Else
Marks the end of an if statement and the start of the else block.
Definition macros.h:295
#define Switch(LVAR)
Marks the start of a switch statement.
Definition macros.h:311
#define LVar6
Definition macros.h:154
#define Ref(sym)
Address/pointer constant.
Definition macros.h:60
#define DivF(VAR, FLOAT_VALUE)
Definition macros.h:386
#define IfGe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR >= RVAR.
Definition macros.h:284
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#define CaseEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR. It also marks the end of any pre...
Definition macros.h:319
#define Sub(VAR, INT_VALUE)
Definition macros.h:377
#define LFlag4
Definition macros.h:171
#define IfNe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR != RVAR.
Definition macros.h:272
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define Mod(VAR, INT_VALUE)
Definition macros.h:380
#define Add(VAR, INT_VALUE)
Definition macros.h:376
#define EndLoop
Marks the end of a loop.
Definition macros.h:248
#define EndCaseGroup
Marks the end of a switch case group (CaseOrEq and/or CaseAndEq), stopping fallthrough.
Definition macros.h:352
#define Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define LVarC
Definition macros.h:160
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define Float(DOUBLE)
Definition macros.h:51
#define LFlag1
Definition macros.h:168
#define Label(LABEL_ID)
Marks this point in the script as a Goto target.
Definition macros.h:227
#define CaseOrEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR.
Definition macros.h:341
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define LVar5
Definition macros.h:153
#define CaseDefault
Marks the start of a switch case that executes unconditionally. It also marks the end of any previous...
Definition macros.h:337
#define LVarB
Definition macros.h:159
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:475
#define IfLe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR > RVAR.
Definition macros.h:281
#define Thread
Marks the start of a thread block.
Definition macros.h:544
#define EndThread
Marks the end of a thread block.
Definition macros.h:547
#define IfFlag(LVAR, RVAR)
Marks the beginning of an if statement that only executes if the RVAR flag is set on LVAR,...
Definition macros.h:288
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#define LVarA
Definition macros.h:158
#define LVarD
Definition macros.h:161
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define LFlag2
Definition macros.h:169
#define NPC_DISPOSE_LOCATION
Definition macros.h:158
#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 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 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 Exec(EVT_SOURCE)
Launches a new thread.
Definition macros.h:455
#define Return
Kills the current EVT thread.
Definition macros.h:217
#define ACTOR_BY_POS(_name, _pos, _priority, args...)
Definition battle.h:230
FormationRow Formation[]
Definition battle.h:167