Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
bony_beetle.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "sprite/npc/BonyBeetle.h"
4#include "effects.h"
5
6#define NAMESPACE A(bony_beetle)
7
8extern EvtScript N(EVS_Init);
9extern EvtScript N(EVS_Idle);
10extern EvtScript N(EVS_TakeTurn);
11extern EvtScript N(EVS_HandleEvent);
12extern EvtScript N(EVS_HandleEvent_SmoothUpright);
13extern EvtScript N(EVS_HandleEvent_SpikyUpright);
14extern EvtScript N(EVS_HandleEvent_SmoothToppled);
15extern EvtScript N(EVS_HandleEvent_SpikyToppled);
16extern EvtScript N(EVS_TrySwitchingSpikyState);
17extern EvtScript N(EVS_TryGettingUp_Smooth);
18extern EvtScript N(EVS_TryGettingUp_Spiky);
19extern EvtScript N(EVS_Attack_ShellToss);
20extern EvtScript N(EVS_Attack_SpikeBounce);
21
22enum N(ActorPartIDs) {
23 PRT_MAIN = 1,
24};
25
26enum N(ActorVars) {
27 AVAR_IN_OnCeiling = 0,
28 AVAR_ShouldTrySwitching = 1,
29 AVAR_State = 8,
30 AVAL_State_SmoothUpright = 0,
31 AVAL_State_SpikyUpright = 1,
32 AVAL_State_SmoothToppled = 2,
33 AVAL_State_SpikyToppled = 3,
34 AVAR_ToppleTurns = 9,
35};
36
37enum N(ActorParams) {
38 DMG_SHELL_TOSS = 3,
39 DMG_SPIKE_BOUNCE = 5,
40};
41
42s32 N(DefaultAnims)[] = {
43 STATUS_KEY_NORMAL, ANIM_BonyBeetle_Anim04,
44 STATUS_KEY_STONE, ANIM_BonyBeetle_Anim00,
45 STATUS_KEY_SLEEP, ANIM_BonyBeetle_Anim2A,
46 STATUS_KEY_POISON, ANIM_BonyBeetle_Anim04,
47 STATUS_KEY_STOP, ANIM_BonyBeetle_Anim00,
48 STATUS_KEY_STATIC, ANIM_BonyBeetle_Anim04,
49 STATUS_KEY_PARALYZE, ANIM_BonyBeetle_Anim00,
50 STATUS_KEY_DIZZY, ANIM_BonyBeetle_Anim26,
51 STATUS_KEY_FEAR, ANIM_BonyBeetle_Anim26,
53};
54
55s32 N(SpikyAnims)[] = {
56 STATUS_KEY_NORMAL, ANIM_BonyBeetle_Anim05,
57 STATUS_KEY_STONE, ANIM_BonyBeetle_Anim01,
58 STATUS_KEY_SLEEP, ANIM_BonyBeetle_Anim2B,
59 STATUS_KEY_POISON, ANIM_BonyBeetle_Anim05,
60 STATUS_KEY_STOP, ANIM_BonyBeetle_Anim01,
61 STATUS_KEY_STATIC, ANIM_BonyBeetle_Anim05,
62 STATUS_KEY_PARALYZE, ANIM_BonyBeetle_Anim01,
63 STATUS_KEY_DIZZY, ANIM_BonyBeetle_Anim27,
64 STATUS_KEY_FEAR, ANIM_BonyBeetle_Anim27,
66};
67
68s32 N(ToppledAnims)[] = {
69 STATUS_KEY_NORMAL, ANIM_BonyBeetle_Anim06,
70 STATUS_KEY_STONE, ANIM_BonyBeetle_Anim02,
71 STATUS_KEY_SLEEP, ANIM_BonyBeetle_Anim2C,
72 STATUS_KEY_POISON, ANIM_BonyBeetle_Anim06,
73 STATUS_KEY_STOP, ANIM_BonyBeetle_Anim02,
74 STATUS_KEY_STATIC, ANIM_BonyBeetle_Anim06,
75 STATUS_KEY_PARALYZE, ANIM_BonyBeetle_Anim02,
76 STATUS_KEY_DIZZY, ANIM_BonyBeetle_Anim28,
77 STATUS_KEY_FEAR, ANIM_BonyBeetle_Anim28,
79};
80
81s32 N(ToppledSpikyAnims)[] = {
82 STATUS_KEY_NORMAL, ANIM_BonyBeetle_Anim07,
83 STATUS_KEY_STONE, ANIM_BonyBeetle_Anim03,
84 STATUS_KEY_SLEEP, ANIM_BonyBeetle_Anim2D,
85 STATUS_KEY_POISON, ANIM_BonyBeetle_Anim07,
86 STATUS_KEY_STOP, ANIM_BonyBeetle_Anim03,
87 STATUS_KEY_STATIC, ANIM_BonyBeetle_Anim07,
88 STATUS_KEY_PARALYZE, ANIM_BonyBeetle_Anim03,
89 STATUS_KEY_DIZZY, ANIM_BonyBeetle_Anim29,
90 STATUS_KEY_FEAR, ANIM_BonyBeetle_Anim29,
92};
93
94s32 N(DefenseTable)[] = {
97};
98
99s32 N(ToppledDefenseTable)[] = {
102};
103
104s32 N(StatusTable)[] = {
115 STATUS_KEY_STOP, 85,
127};
128
129ActorPartBlueprint N(ActorParts)[] = {
130 {
132 .index = PRT_MAIN,
133 .posOffset = { 0, 0, 0 },
134 .targetOffset = { -3, 21 },
135 .opacity = 255,
136 .idleAnimations = N(SpikyAnims),
137 .defenseTable = N(DefenseTable),
139 .elementImmunityFlags = 0,
140 .projectileTargetOffset = { 0, -8 },
141 },
142};
143
144ActorBlueprint NAMESPACE = {
145 .flags = 0,
146 .type = ACTOR_TYPE_BONY_BEETLE,
147 .level = ACTOR_LEVEL_BONY_BEETLE,
148 .maxHP = 8,
149 .partCount = ARRAY_COUNT(N(ActorParts)),
150 .partsData = N(ActorParts),
151 .initScript = &N(EVS_Init),
152 .statusTable = N(StatusTable),
153 .escapeChance = 50,
154 .airLiftChance = 70,
155 .hurricaneChance = 60,
156 .spookChance = 60,
157 .upAndAwayChance = 95,
158 .spinSmashReq = 0,
159 .powerBounceChance = 90,
160 .coinReward = 1,
161 .size = { 27, 27 },
162 .healthBarOffset = { 0, 0 },
163 .statusIconOffset = { -10, 20 },
164 .statusTextOffset = { 10, 20 },
165};
166
167EvtScript N(EVS_Init) = {
168 Call(GetActorVar, ACTOR_SELF, AVAR_IN_OnCeiling, LVar0)
169 Call(GetInstigatorValue, ACTOR_SELF, LVar1)
170 IfEq(LVar0, 1)
171 IfEq(LVar1, 1)
172 Call(SetActorVar, ACTOR_SELF, AVAR_State, AVAL_State_SpikyUpright)
173 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(SpikyAnims)))
174 Call(SetPartEventBits, ACTOR_SELF, PRT_MAIN, ACTOR_EVENT_FLAG_SPIKY_TOP, TRUE)
175 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim05)
176 Else
177 Call(SetActorVar, ACTOR_SELF, AVAR_State, AVAL_State_SmoothUpright)
178 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(DefaultAnims)))
179 Call(SetPartEventBits, ACTOR_SELF, PRT_MAIN, ACTOR_EVENT_FLAG_SPIKY_TOP, FALSE)
180 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim04)
181 EndIf
182 Else
183 Call(RandInt, 1000, LVar0)
184 IfLt(LVar0, 500)
185 Call(SetActorVar, ACTOR_SELF, AVAR_State, AVAL_State_SmoothUpright)
186 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(DefaultAnims)))
187 Call(SetPartEventBits, ACTOR_SELF, PRT_MAIN, ACTOR_EVENT_FLAG_SPIKY_TOP, FALSE)
188 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim04)
189 Else
190 Call(SetActorVar, ACTOR_SELF, AVAR_State, AVAL_State_SpikyUpright)
191 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(SpikyAnims)))
192 Call(SetPartEventBits, ACTOR_SELF, PRT_MAIN, ACTOR_EVENT_FLAG_SPIKY_TOP, TRUE)
193 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim05)
194 EndIf
195 EndIf
196EndIf
197Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_MAIN, 0, -8)
198Call(SetTargetOffset, ACTOR_SELF, PRT_MAIN, -3, 21)
199Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_UPSIDE_DOWN, FALSE)
200Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
201Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
202Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
203Call(HPBarToHome, ACTOR_SELF)
204Call(SetActorVar, ACTOR_SELF, AVAR_ShouldTrySwitching, FALSE)
205Return
206End
207};
208
209EvtScript N(EVS_Idle) = {
210 Return
211 End
212};
213
214EvtScript N(EVS_HandleEvent) = {
215 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
216 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
217 Call(GetActorVar, ACTOR_SELF, AVAR_State, LVar0)
219 CaseEq(AVAL_State_SmoothUpright)
220 ExecWait(N(EVS_HandleEvent_SmoothUpright))
221 CaseEq(AVAL_State_SpikyUpright)
222 ExecWait(N(EVS_HandleEvent_SpikyUpright))
223 CaseEq(AVAL_State_SmoothToppled)
224 ExecWait(N(EVS_HandleEvent_SmoothToppled))
225 CaseEq(AVAL_State_SpikyToppled)
226 ExecWait(N(EVS_HandleEvent_SpikyToppled))
228 Call(ActorExists, ACTOR_SELF, LVar0)
229 IfEq(LVar0, 1)
230 Call(GetActorVar, ACTOR_SELF, AVAR_ShouldTrySwitching, LVar0)
231 IfEq(LVar0, TRUE)
232 ExecWait(N(EVS_TrySwitchingSpikyState))
233 Call(SetActorVar, ACTOR_SELF, AVAR_ShouldTrySwitching, FALSE)
234 EndIf
235 EndIf
236 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
237 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
238 Return
239 End
240};
241
242EvtScript N(EVS_TrySwitchingSpikyState) = {
243 Call(GetLastDamage, ACTOR_SELF, LVar0)
244 IfLe(LVar0, 0)
245 Return
246 EndIf
247 Call(GetStatusFlags, ACTOR_SELF, LVar0)
249 Return
250 EndIf
251 Label(0)
252 Call(GetBattleFlags, LVarA)
254 Wait(1)
255 Goto(0)
256 EndIf
257 Call(GetActorVar, ACTOR_SELF, AVAR_State, LVar0)
259 CaseEq(AVAL_State_SmoothUpright)
261 Call(SetActorVar, ACTOR_SELF, AVAR_State, AVAL_State_SpikyUpright)
262 Call(SetPartEventBits, ACTOR_SELF, PRT_MAIN, ACTOR_EVENT_FLAG_SPIKY_TOP, TRUE)
263 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim2E)
264 Wait(25)
265 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(SpikyAnims)))
266 CaseEq(AVAL_State_SpikyUpright)
268 Call(SetActorVar, ACTOR_SELF, AVAR_State, AVAL_State_SmoothUpright)
269 Call(SetPartEventBits, ACTOR_SELF, PRT_MAIN, ACTOR_EVENT_FLAG_SPIKY_TOP, FALSE)
270 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim2F)
271 Wait(25)
272 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(DefaultAnims)))
273 CaseEq(AVAL_State_SmoothToppled)
274 CaseEq(AVAL_State_SpikyToppled)
276 Return
277 End
278};
279
280EvtScript N(EVS_TakeTurn) = {
281 Call(GetActorVar, ACTOR_SELF, AVAR_State, LVar0)
283 CaseEq(AVAL_State_SmoothUpright)
284 ExecWait(N(EVS_Attack_ShellToss))
285 CaseEq(AVAL_State_SpikyUpright)
286 ExecWait(N(EVS_Attack_SpikeBounce))
287 CaseEq(AVAL_State_SmoothToppled)
288 ExecWait(N(EVS_TryGettingUp_Smooth))
289 CaseEq(AVAL_State_SpikyToppled)
290 ExecWait(N(EVS_TryGettingUp_Spiky))
292 Return
293 End
294};
295
296s32 N(FlipPosOffsets)[] = { 7, 13, 17, 21, 23, 24, 23, 21, 17, 13, 7, 0, 4, 6, 7, 6, 4, 0, 2, 0 };
297
298EvtScript N(EVS_HandleEvent_SmoothUpright) = {
299 Call(GetLastEvent, ACTOR_SELF, LVar0)
303 SetConst(LVar0, PRT_MAIN)
304 SetConst(LVar1, ANIM_BonyBeetle_Anim18)
306 Call(SetActorVar, ACTOR_SELF, AVAR_ShouldTrySwitching, TRUE)
309 SetConst(LVar0, PRT_MAIN)
310 SetConst(LVar1, ANIM_BonyBeetle_Anim1E)
311 SetConst(LVar2, ANIM_BonyBeetle_Anim1F)
313 Call(SetActorVar, ACTOR_SELF, AVAR_ShouldTrySwitching, TRUE)
315 SetConst(LVar0, PRT_MAIN)
316 SetConst(LVar1, ANIM_BonyBeetle_Anim1E)
317 SetConst(LVar2, ANIM_BonyBeetle_Anim1F)
319 SetConst(LVar0, PRT_MAIN)
320 SetConst(LVar1, ANIM_BonyBeetle_Anim1F)
322 Return
324 SetConst(LVar0, PRT_MAIN)
325 SetConst(LVar1, ANIM_BonyBeetle_Anim18)
327 Call(SetActorVar, ACTOR_SELF, AVAR_ShouldTrySwitching, TRUE)
329 SetConst(LVar0, PRT_MAIN)
330 SetConst(LVar1, ANIM_BonyBeetle_Anim18)
332 SetConst(LVar0, PRT_MAIN)
333 SetConst(LVar1, ANIM_BonyBeetle_Anim18)
335 Return
337 Call(SetActorVar, ACTOR_SELF, AVAR_State, AVAL_State_SmoothToppled)
338 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_MAIN, 0, -8)
339 Call(SetTargetOffset, ACTOR_SELF, PRT_MAIN, -3, 21)
340 Call(SetActorVar, ACTOR_SELF, AVAR_ToppleTurns, 1)
341 Call(SetDefenseTable, ACTOR_SELF, PRT_MAIN, Ref(N(ToppledDefenseTable)))
342 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(ToppledAnims)))
343 Call(SetPartEventBits, ACTOR_SELF, PRT_MAIN, ACTOR_EVENT_FLAG_SPIKY_TOP, FALSE)
344 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_FLIPPED, TRUE)
345 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim08)
346 UseBuf(N(FlipPosOffsets))
347 Loop(20)
349 Call(SetActorDispOffset, ACTOR_SELF, 0, LVar0, 0)
350 Wait(1)
351 EndLoop
352 Wait(20)
354 SetConst(LVar0, PRT_MAIN)
355 SetConst(LVar1, ANIM_BonyBeetle_Anim18)
357 SetConst(LVar0, PRT_MAIN)
358 SetConst(LVar1, ANIM_BonyBeetle_Anim18)
360 SetConst(LVar0, PRT_MAIN)
361 SetConst(LVar1, ANIM_BonyBeetle_Anim0E)
366 SetConst(LVar0, PRT_MAIN)
367 SetConst(LVar1, ANIM_BonyBeetle_Anim10)
369 Wait(20)
370 Call(GetStatusFlags, ACTOR_SELF, LVar0)
372 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim12)
373 Wait(10)
374 EndIf
377 SetConst(LVar0, PRT_MAIN)
378 SetConst(LVar1, ANIM_BonyBeetle_Anim18)
380 SetConst(LVar0, PRT_MAIN)
381 SetConst(LVar1, ANIM_BonyBeetle_Anim18)
383 Return
385 SetConst(LVar0, PRT_MAIN)
386 SetConst(LVar1, ANIM_BonyBeetle_Anim18)
388 Wait(10)
389 SetConst(LVar0, PRT_MAIN)
390 SetConst(LVar1, ANIM_BonyBeetle_Anim18)
392 Return
394 SetConst(LVar0, PRT_MAIN)
395 SetConst(LVar1, ANIM_BonyBeetle_Anim04)
398 SetConst(LVar0, PRT_MAIN)
399 SetConst(LVar1, ANIM_BonyBeetle_Anim0E)
400 SetConst(LVar2, ANIM_BonyBeetle_Anim18)
402 Return
404 SetConst(LVar0, PRT_MAIN)
405 SetConst(LVar1, ANIM_BonyBeetle_Anim0E)
408 SetConst(LVar0, PRT_MAIN)
409 SetConst(LVar1, ANIM_BonyBeetle_Anim18)
411 Return
414 Return
415 End
416};
417
418EvtScript N(EVS_Attack_ShellToss) = {
419 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
420 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
421 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
422 Call(GetBattlePhase, LVar0)
424 Call(UseBattleCamPreset, BTL_CAM_ENEMY_APPROACH)
425 Call(BattleCamTargetActor, ACTOR_SELF)
426 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
427 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim16)
428 Goto(100)
429 EndIf
430 Call(UseBattleCamPreset, BTL_CAM_ENEMY_APPROACH)
431 Call(BattleCamTargetActor, ACTOR_SELF)
432 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
433 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim10)
434 Wait(10)
435 Thread
436 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
437 PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar0, LVar1, LVar2, 32, 4, 0, 10, 0)
438 Wait(10)
439 PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar0, LVar1, LVar2, 32, 4, 0, 10, 0)
440 Wait(5)
441 PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar0, LVar1, LVar2, 32, 4, 0, 10, 0)
443 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SHELL_SPIN)
444 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim16)
445 Wait(15)
446 Label(100)
447 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SHELL_TOSS)
449 Call(EnemyTestTarget, ACTOR_SELF, LVar0, 0, 0, 3, BS_FLAGS1_INCLUDE_POWER_UPS)
453 Set(LVarA, LVar0)
454 Call(SetGoalToTarget, ACTOR_SELF)
455 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
456 Sub(LVar0, 40)
457 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
458 Call(SetActorSpeed, ACTOR_SELF, Float(16.0))
459 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
461 Call(EnemyTestTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
462 EndIf
463 Wait(20)
464 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim12)
465 Wait(15)
466 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
467 Call(ResetAllActorSounds, ACTOR_SELF)
468 Call(SetActorYaw, ACTOR_SELF, 180)
469 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
470 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim0E)
471 Call(SetGoalToHome, ACTOR_SELF)
472 Call(SetActorSpeed, ACTOR_SELF, Float(8.0))
473 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
474 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim04)
475 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
476 Call(SetActorYaw, ACTOR_SELF, 0)
477 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
478 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
479 Return
482 Call(SetGoalToTarget, ACTOR_SELF)
483 Call(SetActorSpeed, ACTOR_SELF, Float(16.0))
484 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
485 Call(ResetAllActorSounds, ACTOR_SELF)
486 Wait(2)
487 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, 0, SUPPRESS_EVENT_ALL, 0, DMG_SHELL_TOSS, BS_FLAGS1_TRIGGER_EVENTS)
491 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
492 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
493 Add(LVar0, 40)
494 Set(LVar1, 0)
495 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.8))
496 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
497 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
498 Add(LVar0, 30)
499 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
500 Call(JumpToGoal, ACTOR_SELF, 8, FALSE, TRUE, FALSE)
501 Add(LVar0, 20)
502 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
503 Call(JumpToGoal, ACTOR_SELF, 6, FALSE, TRUE, FALSE)
504 Wait(15)
505 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim12)
506 Wait(5)
507 Call(YieldTurn)
508 SetConst(LVar0, PRT_MAIN)
509 SetConst(LVar1, ANIM_BonyBeetle_Anim0E)
511 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim04)
514 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
515 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
516 Return
517 End
518};
519
520EvtScript N(EVS_HandleEvent_SpikyUpright) = {
521 Call(GetLastEvent, ACTOR_SELF, LVar0)
525 SetConst(LVar0, PRT_MAIN)
526 SetConst(LVar1, ANIM_BonyBeetle_Anim19)
528 Call(SetActorVar, ACTOR_SELF, AVAR_ShouldTrySwitching, TRUE)
531 SetConst(LVar0, PRT_MAIN)
532 SetConst(LVar1, ANIM_BonyBeetle_Anim20)
533 SetConst(LVar2, ANIM_BonyBeetle_Anim21)
535 Call(SetActorVar, ACTOR_SELF, AVAR_ShouldTrySwitching, TRUE)
537 SetConst(LVar0, PRT_MAIN)
538 SetConst(LVar1, ANIM_BonyBeetle_Anim20)
539 SetConst(LVar2, ANIM_BonyBeetle_Anim21)
541 SetConst(LVar0, PRT_MAIN)
542 SetConst(LVar1, ANIM_BonyBeetle_Anim21)
544 Return
546 SetConst(LVar0, PRT_MAIN)
547 SetConst(LVar1, ANIM_BonyBeetle_Anim19)
549 Call(SetActorVar, ACTOR_SELF, AVAR_ShouldTrySwitching, TRUE)
551 SetConst(LVar0, PRT_MAIN)
552 SetConst(LVar1, ANIM_BonyBeetle_Anim19)
554 SetConst(LVar0, PRT_MAIN)
555 SetConst(LVar1, ANIM_BonyBeetle_Anim19)
557 Return
559 Call(SetActorVar, ACTOR_SELF, AVAR_State, AVAL_State_SpikyToppled)
560 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_MAIN, 0, -8)
561 Call(SetTargetOffset, ACTOR_SELF, PRT_MAIN, -3, 21)
562 Call(SetActorVar, ACTOR_SELF, AVAR_ToppleTurns, 1)
563 Call(SetDefenseTable, ACTOR_SELF, PRT_MAIN, Ref(N(ToppledDefenseTable)))
564 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(ToppledSpikyAnims)))
565 Call(SetPartEventBits, ACTOR_SELF, PRT_MAIN, ACTOR_EVENT_FLAG_SPIKY_TOP, FALSE)
566 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_FLIPPED, TRUE)
567 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim09)
568 UseBuf(N(FlipPosOffsets))
569 Loop(20)
571 Call(SetActorDispOffset, ACTOR_SELF, 0, LVar0, 0)
572 Wait(1)
573 EndLoop
574 Wait(20)
576 Call(SetActorRotationOffset, ACTOR_SELF, 0, 0, 0)
577 Call(SetActorRotation, ACTOR_SELF, 0, 0, 0)
578 SetConst(LVar0, PRT_MAIN)
579 SetConst(LVar1, ANIM_BonyBeetle_Anim19)
581 SetConst(LVar0, PRT_MAIN)
582 SetConst(LVar1, ANIM_BonyBeetle_Anim19)
584 SetConst(LVar0, PRT_MAIN)
585 SetConst(LVar1, ANIM_BonyBeetle_Anim0F)
589 SetConst(LVar0, PRT_MAIN)
590 SetConst(LVar1, ANIM_BonyBeetle_Anim11)
592 Wait(20)
593 Call(GetStatusFlags, ACTOR_SELF, LVar0)
595 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim13)
596 EndIf
597 Wait(10)
600 Wait(10)
601 Set(LFlag0, FALSE)
602 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
603 Call(GetStatusFlags, ACTOR_SELF, LVar3)
605 Add(LVar0, -3)
606 Add(LVar1, 10)
607 Set(LFlag0, TRUE)
608 EndIf
610 Add(LVar0, 0)
611 Add(LVar1, 26)
612 Set(LFlag0, TRUE)
613 EndIf
614 IfEq(LFlag0, FALSE)
615 Add(LVar0, -8)
616 Add(LVar1, 26)
617 EndIf
618 PlayEffect(EFFECT_LENS_FLARE, 0, LVar0, LVar1, LVar2, 20, 0)
619 Wait(20)
621 Call(SetActorRotationOffset, ACTOR_SELF, 0, 0, 0)
622 Call(SetActorRotation, ACTOR_SELF, 0, 0, 0)
623 SetConst(LVar0, PRT_MAIN)
624 SetConst(LVar1, ANIM_BonyBeetle_Anim19)
626 SetConst(LVar0, PRT_MAIN)
627 SetConst(LVar1, ANIM_BonyBeetle_Anim19)
629 Return
631 SetConst(LVar0, PRT_MAIN)
632 SetConst(LVar1, ANIM_BonyBeetle_Anim19)
634 Wait(10)
635 SetConst(LVar0, PRT_MAIN)
636 SetConst(LVar1, ANIM_BonyBeetle_Anim19)
638 Return
640 SetConst(LVar0, PRT_MAIN)
641 SetConst(LVar1, ANIM_BonyBeetle_Anim05)
644 SetConst(LVar0, PRT_MAIN)
645 SetConst(LVar1, ANIM_BonyBeetle_Anim0F)
646 SetConst(LVar2, ANIM_BonyBeetle_Anim19)
648 Return
651 Return
652 End
653};
654
655EvtScript N(EVS_Attack_SpikeBounce) = {
656 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
657 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
658 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
659 Call(GetBattlePhase, LVar0)
661 Call(UseBattleCamPreset, BTL_CAM_ENEMY_APPROACH)
662 Call(BattleCamTargetActor, ACTOR_SELF)
663 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
664 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim17)
665 Wait(10)
666 Goto(100)
667 EndIf
668 Call(UseBattleCamPreset, BTL_CAM_ENEMY_APPROACH)
669 Call(BattleCamTargetActor, ACTOR_SELF)
670 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
671 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim11)
672 Wait(10)
673 Thread
674 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
675 PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 32, 4, 0, 10, 0)
676 Wait(10)
677 PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 32, 6, 0, 10, 0)
678 Wait(5)
679 PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 32, 8, 0, 10, 0)
680 Wait(5)
681 PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 32, 10, 0, 10, 0)
682 Wait(5)
683 PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 32, 12, 0, 10, 0)
685 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SHELL_SPIN)
686 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim17)
687 Wait(15)
688 Label(100)
689 Thread
690 Loop(20)
691 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
692 PlayEffect(EFFECT_WALKING_DUST, 0, LVar0, LVar1, LVar2, 0, 0, 0)
693 Wait(1)
694 EndLoop
696 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_SHELL_TOSS)
698 Call(EnemyTestTarget, ACTOR_SELF, LVar0, 0, 0, DMG_SPIKE_BOUNCE, BS_FLAGS1_INCLUDE_POWER_UPS)
702 Set(LVarA, LVar0)
703 Call(SetGoalToTarget, ACTOR_SELF)
704 Call(AddGoalPos, ACTOR_SELF, 50, 0, 0)
705 Call(SetActorSpeed, ACTOR_SELF, Float(24.0))
706 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
707 Call(UseBattleCamPreset, BTL_CAM_INTERRUPT)
708 Thread
709 Call(SetActorRotationOffset, ACTOR_SELF, 0, 16, 0)
710 Set(LVar0, 0)
711 Loop(10)
712 Add(LVar0, 18)
713 Call(SetActorRotation, ACTOR_SELF, 0, 0, LVar0)
714 Wait(1)
715 EndLoop
717 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.5))
718 Call(SetGoalToTarget, ACTOR_SELF)
719 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
720 Sub(LVar0, 20)
721 Set(LVar1, 0)
722 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
723 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
725 Call(EnemyTestTarget, ACTOR_SELF, LVarA, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
726 EndIf
727 Thread
728 Call(SetActorRotationOffset, ACTOR_SELF, 0, 16, 0)
729 Set(LVar0, 180)
730 Loop(15)
731 Add(LVar0, 12)
732 Call(SetActorRotation, ACTOR_SELF, 0, 0, LVar0)
733 Wait(1)
734 EndLoop
736 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.5))
737 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
738 Sub(LVar0, 50)
739 Set(LVar1, 0)
740 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
741 Call(JumpToGoal, ACTOR_SELF, 15, FALSE, TRUE, FALSE)
742 Thread
743 Call(SetActorRotationOffset, ACTOR_SELF, 0, 16, 0)
744 Set(LVar0, 0)
745 Loop(10)
746 Add(LVar0, 18)
747 Call(SetActorRotation, ACTOR_SELF, 0, 0, LVar0)
748 Wait(1)
749 EndLoop
751 Sub(LVar0, 40)
752 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
753 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
754 Thread
755 Call(SetActorRotationOffset, ACTOR_SELF, 0, 16, 0)
756 Set(LVar0, 180)
757 Loop(5)
758 Add(LVar0, 18)
759 Call(SetActorRotation, ACTOR_SELF, 0, 0, LVar0)
760 Wait(1)
761 EndLoop
763 Sub(LVar0, 30)
764 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
765 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
766 Wait(5)
767 Call(SetActorRotationOffset, ACTOR_SELF, 0, 0, 0)
768 Call(SetActorRotation, ACTOR_SELF, 0, 0, 0)
769 Call(ResetAllActorSounds, ACTOR_SELF)
770 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
771 Call(YieldTurn)
772 Call(SetActorYaw, ACTOR_SELF, 180)
773 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
774 SetConst(LVar0, PRT_MAIN)
775 SetConst(LVar1, ANIM_BonyBeetle_Anim0F)
777 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
778 Call(SetActorYaw, ACTOR_SELF, 0)
779 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
780 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
781 Return
784 Call(SetGoalToTarget, ACTOR_SELF)
785 Call(AddGoalPos, ACTOR_SELF, 50, 0, 0)
786 Call(SetActorSpeed, ACTOR_SELF, Float(24.0))
787 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
788 Thread
789 Call(SetActorRotationOffset, ACTOR_SELF, 0, 16, 0)
790 Set(LVar0, 0)
791 Loop(10)
792 Add(LVar0, 18)
793 Call(SetActorRotation, ACTOR_SELF, 0, 0, LVar0)
794 Wait(1)
795 EndLoop
797 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.5))
798 Call(SetGoalToTarget, ACTOR_SELF)
799 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
800 Call(ResetAllActorSounds, ACTOR_SELF)
801 Wait(2)
802 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, 0, SUPPRESS_EVENT_ALL, 0, DMG_SPIKE_BOUNCE, BS_FLAGS1_TRIGGER_EVENTS)
806 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
807 Thread
808 Call(SetActorRotationOffset, ACTOR_SELF, 0, 16, 0)
809 Set(LVar0, 180)
810 Loop(15)
811 Add(LVar0, 12)
812 Call(SetActorRotation, ACTOR_SELF, 0, 0, LVar0)
813 Wait(1)
814 EndLoop
816 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.5))
817 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
818 Sub(LVar0, 50)
819 Set(LVar1, 0)
820 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
821 Call(JumpToGoal, ACTOR_SELF, 15, FALSE, TRUE, FALSE)
822 Thread
823 Call(SetActorRotationOffset, ACTOR_SELF, 0, 16, 0)
824 Set(LVar0, 0)
825 Loop(10)
826 Add(LVar0, 18)
827 Call(SetActorRotation, ACTOR_SELF, 0, 0, LVar0)
828 Wait(1)
829 EndLoop
831 Sub(LVar0, 40)
832 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
833 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
834 Thread
835 Call(SetActorRotationOffset, ACTOR_SELF, 0, 16, 0)
836 Set(LVar0, 180)
837 Loop(5)
838 Add(LVar0, 18)
839 Call(SetActorRotation, ACTOR_SELF, 0, 0, LVar0)
840 Wait(1)
841 EndLoop
843 Sub(LVar0, 30)
844 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
845 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
846 Wait(5)
847 Call(SetActorRotationOffset, ACTOR_SELF, 0, 0, 0)
848 Call(SetActorRotation, ACTOR_SELF, 0, 0, 0)
849 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim13)
850 Wait(5)
851 Call(YieldTurn)
852 Call(SetActorYaw, ACTOR_SELF, 180)
853 SetConst(LVar0, PRT_MAIN)
854 SetConst(LVar1, ANIM_BonyBeetle_Anim0F)
856 Call(SetActorYaw, ACTOR_SELF, 0)
859 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
860 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
861 Return
862 End
863};
864
865#include "common/battle/SetAbsoluteStatusOffsets.inc.c"
866
867// unused
868EvtScript N(EVS_FallFromCeiling) = {
869 Call(HideHealthBar, ACTOR_SELF)
870 Call(SetActorVar, ACTOR_SELF, AVAR_State, AVAL_State_SmoothToppled)
871 Call(SetActorVar, ACTOR_SELF, AVAR_ToppleTurns, 1)
872 Call(SetDefenseTable, ACTOR_SELF, PRT_MAIN, Ref(N(ToppledDefenseTable)))
873 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(ToppledAnims)))
874 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_UPSIDE_DOWN, FALSE)
875 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_MAIN, 0, -8)
876 Call(SetTargetOffset, ACTOR_SELF, PRT_MAIN, -3, 21)
877 Call(N(SetAbsoluteStatusOffsets), -10, 20, 10, 20)
878 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim06)
879 Call(SetActorYaw, ACTOR_SELF, 180)
880 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
881 Sub(LVar1, 24)
882 Call(SetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
883 Set(LVar1, 0)
884 Call(SetHomePos, ACTOR_SELF, LVar0, LVar1, LVar2)
885 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_FALL_QUICK)
886 Call(SetActorSounds, ACTOR_SELF, ACTOR_SOUND_JUMP, SOUND_NONE, 0)
887 Call(SetActorJumpGravity, ACTOR_SELF, Float(0.8))
888 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
889 Call(JumpToGoal, ACTOR_SELF, 15, FALSE, TRUE, FALSE)
890 Call(ResetAllActorSounds, ACTOR_SELF)
891 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
892 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
893 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
894 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
895 Call(HPBarToHome, ACTOR_SELF)
896 Return
897 End
898};
899
900EvtScript N(EVS_HandleEvent_SmoothToppled) = {
901 Call(GetLastEvent, ACTOR_SELF, LVar0)
905 SetConst(LVar0, PRT_MAIN)
906 SetConst(LVar1, ANIM_BonyBeetle_Anim1A)
910 SetConst(LVar0, PRT_MAIN)
911 SetConst(LVar1, ANIM_BonyBeetle_Anim22)
912 SetConst(LVar2, ANIM_BonyBeetle_Anim23)
915 SetConst(LVar0, PRT_MAIN)
916 SetConst(LVar1, ANIM_BonyBeetle_Anim22)
917 SetConst(LVar2, ANIM_BonyBeetle_Anim23)
919 SetConst(LVar0, PRT_MAIN)
920 SetConst(LVar1, ANIM_BonyBeetle_Anim23)
922 Return
924 SetConst(LVar0, PRT_MAIN)
925 SetConst(LVar1, ANIM_BonyBeetle_Anim1A)
928 SetConst(LVar0, PRT_MAIN)
929 SetConst(LVar1, ANIM_BonyBeetle_Anim1A)
931 SetConst(LVar0, PRT_MAIN)
932 SetConst(LVar1, ANIM_BonyBeetle_Anim1A)
934 Return
936 Call(SetActorVar, ACTOR_SELF, AVAR_State, AVAL_State_SmoothToppled)
937 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_MAIN, 0, -8)
938 Call(SetTargetOffset, ACTOR_SELF, PRT_MAIN, -3, 21)
939 Call(N(SetAbsoluteStatusOffsets), -10, 20, 10, 20)
940 Call(SetActorVar, ACTOR_SELF, AVAR_ToppleTurns, 1)
941 Call(SetDefenseTable, ACTOR_SELF, PRT_MAIN, Ref(N(ToppledDefenseTable)))
942 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(ToppledAnims)))
943 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim1A)
944 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_FLIPPED, TRUE)
945 UseBuf(N(FlipPosOffsets))
946 Loop(20)
948 Call(SetActorDispOffset, ACTOR_SELF, 0, LVar0, 0)
949 Wait(1)
950 EndLoop
951 Wait(20)
956 SetConst(LVar0, PRT_MAIN)
957 SetConst(LVar1, ANIM_BonyBeetle_Anim06)
961 SetConst(LVar0, PRT_MAIN)
962 SetConst(LVar1, ANIM_BonyBeetle_Anim1A)
964 SetConst(LVar0, PRT_MAIN)
965 SetConst(LVar1, ANIM_BonyBeetle_Anim1A)
967 Return
969 SetConst(LVar0, PRT_MAIN)
970 SetConst(LVar1, ANIM_BonyBeetle_Anim1A)
972 Wait(10)
973 SetConst(LVar0, PRT_MAIN)
974 SetConst(LVar1, ANIM_BonyBeetle_Anim1A)
976 Return
978 SetConst(LVar0, PRT_MAIN)
979 SetConst(LVar1, ANIM_BonyBeetle_Anim06)
982 SetConst(LVar0, PRT_MAIN)
983 SetConst(LVar1, ANIM_BonyBeetle_Anim06)
986 SetConst(LVar0, PRT_MAIN)
987 SetConst(LVar1, ANIM_BonyBeetle_Anim1A)
990 Return
991 End
992};
993
994EvtScript N(EVS_TryGettingUp_Smooth) = {
995 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
996 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
997 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
998 Call(GetActorVar, ACTOR_SELF, AVAR_ToppleTurns, LVar0)
999 Sub(LVar0, 1)
1000 IfGt(LVar0, 0)
1001 Call(SetActorVar, ACTOR_SELF, AVAR_ToppleTurns, LVar0)
1002 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
1003 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim1C)
1004 Wait(20)
1005 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim06)
1006 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
1007 Else
1008 Call(UseBattleCamPreset, BTL_CAM_ACTOR_FAR)
1009 Call(SetBattleCamDist, 350)
1010 Call(SetBattleCamOffsetY, 20)
1011 Call(BattleCamTargetActor, ACTOR_SELF)
1012 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
1013 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim1C)
1014 Wait(20)
1015 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim06)
1016 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
1017 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim0A)
1018 Wait(20)
1019 Call(SetActorYaw, ACTOR_SELF, 0)
1020 Call(SetActorVar, ACTOR_SELF, AVAR_State, AVAL_State_SmoothUpright)
1021 Call(SetDefenseTable, ACTOR_SELF, PRT_MAIN, Ref(N(DefenseTable)))
1022 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(DefaultAnims)))
1023 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_FLIPPED, FALSE)
1024 EndIf
1025 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1026 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
1027 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
1028 Return
1029 End
1030};
1031
1032EvtScript N(EVS_HandleEvent_SpikyToppled) = {
1033 Call(GetLastEvent, ACTOR_SELF, LVar0)
1034 Switch(LVar0)
1037 SetConst(LVar0, PRT_MAIN)
1038 SetConst(LVar1, ANIM_BonyBeetle_Anim1B)
1042 SetConst(LVar0, PRT_MAIN)
1043 SetConst(LVar1, ANIM_BonyBeetle_Anim24)
1044 SetConst(LVar2, ANIM_BonyBeetle_Anim25)
1047 SetConst(LVar0, PRT_MAIN)
1048 SetConst(LVar1, ANIM_BonyBeetle_Anim24)
1049 SetConst(LVar2, ANIM_BonyBeetle_Anim25)
1051 SetConst(LVar0, PRT_MAIN)
1052 SetConst(LVar1, ANIM_BonyBeetle_Anim25)
1054 Return
1056 SetConst(LVar0, PRT_MAIN)
1057 SetConst(LVar1, ANIM_BonyBeetle_Anim1B)
1060 SetConst(LVar0, PRT_MAIN)
1061 SetConst(LVar1, ANIM_BonyBeetle_Anim1B)
1063 SetConst(LVar0, PRT_MAIN)
1064 SetConst(LVar1, ANIM_BonyBeetle_Anim1B)
1066 Return
1068 Call(SetActorVar, ACTOR_SELF, AVAR_State, AVAL_State_SpikyToppled)
1069 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_MAIN, 0, -8)
1070 Call(SetTargetOffset, ACTOR_SELF, PRT_MAIN, -3, 21)
1071 Call(N(SetAbsoluteStatusOffsets), -10, 20, 10, 20)
1072 Call(SetActorVar, ACTOR_SELF, AVAR_ToppleTurns, 1)
1073 Call(SetDefenseTable, ACTOR_SELF, PRT_MAIN, Ref(N(ToppledDefenseTable)))
1074 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(ToppledSpikyAnims)))
1075 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim1B)
1076 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_FLIPPED, TRUE)
1077 UseBuf(N(FlipPosOffsets))
1078 Loop(20)
1080 Call(SetActorDispOffset, ACTOR_SELF, 0, LVar0, 0)
1081 Wait(1)
1082 EndLoop
1083 Wait(20)
1088 SetConst(LVar0, PRT_MAIN)
1089 SetConst(LVar1, ANIM_BonyBeetle_Anim07)
1093 SetConst(LVar0, PRT_MAIN)
1094 SetConst(LVar1, ANIM_BonyBeetle_Anim1B)
1096 SetConst(LVar0, PRT_MAIN)
1097 SetConst(LVar1, ANIM_BonyBeetle_Anim1B)
1099 Return
1101 SetConst(LVar0, PRT_MAIN)
1102 SetConst(LVar1, ANIM_BonyBeetle_Anim1B)
1104 Wait(10)
1105 SetConst(LVar0, PRT_MAIN)
1106 SetConst(LVar1, ANIM_BonyBeetle_Anim1B)
1108 Return
1110 SetConst(LVar0, PRT_MAIN)
1111 SetConst(LVar1, ANIM_BonyBeetle_Anim07)
1114 SetConst(LVar0, PRT_MAIN)
1115 SetConst(LVar1, ANIM_BonyBeetle_Anim07)
1118 SetConst(LVar0, PRT_MAIN)
1119 SetConst(LVar1, ANIM_BonyBeetle_Anim1B)
1121 Return
1122 EndSwitch
1123 Return
1124 End
1125};
1126
1127EvtScript N(EVS_TryGettingUp_Spiky) = {
1128 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
1129 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
1130 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
1131 Call(GetActorVar, ACTOR_SELF, AVAR_ToppleTurns, LVar0)
1132 Sub(LVar0, 1)
1133 IfGt(LVar0, 0)
1134 Call(SetActorVar, ACTOR_SELF, AVAR_ToppleTurns, LVar0)
1135 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
1136 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim1D)
1137 Wait(20)
1138 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim07)
1139 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
1140 Else
1141 Call(UseBattleCamPreset, BTL_CAM_ACTOR_FAR)
1142 Call(SetBattleCamDist, 350)
1143 Call(SetBattleCamOffsetY, 20)
1144 Call(BattleCamTargetActor, ACTOR_SELF)
1145 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
1146 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim1D)
1147 Wait(20)
1148 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim07)
1149 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
1150 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BonyBeetle_Anim0B)
1151 Wait(20)
1152 Call(SetActorYaw, ACTOR_SELF, 0)
1153 Call(SetActorVar, ACTOR_SELF, AVAR_State, AVAL_State_SpikyUpright)
1154 Call(SetDefenseTable, ACTOR_SELF, PRT_MAIN, Ref(N(DefenseTable)))
1155 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(SpikyAnims)))
1156 Call(SetPartEventBits, ACTOR_SELF, PRT_MAIN, ACTOR_EVENT_FLAG_SPIKY_TOP, TRUE)
1157 Call(SetActorFlagBits, ACTOR_SELF, ACTOR_FLAG_FLIPPED, FALSE)
1158 EndIf
1159 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
1160 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
1161 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
1162 Return
1163 End
1164};
1165
Bytecode EvtScript[]
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2834
@ BTL_CAM_XADJ_AVG
Definition enums.h:4900
@ ACTOR_SOUND_WALK
Definition enums.h:2034
@ ACTOR_SOUND_JUMP
Definition enums.h:2036
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3575
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3571
@ BS_FLAGS1_EXECUTING_MOVE
Definition enums.h:3578
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_NORMAL
Definition enums.h:2115
@ ACTOR_EVENT_FLAG_FLIPABLE
Actor can be flipped; triggered by jump and quake attacks.
Definition enums.h:3380
@ ACTOR_EVENT_FLAG_SPIKY_TOP
Player takes spike damage from jump attacks.
Definition enums.h:3373
@ ACTOR_DECORATION_SWEAT
Definition enums.h:2045
@ PHASE_FIRST_STRIKE
Definition enums.h:2059
@ STATUS_KEY_PARALYZE
Definition enums.h:2201
@ STATUS_TURN_MOD_DEFAULT
Definition enums.h:2227
@ STATUS_TURN_MOD_PARALYZE
Definition enums.h:2234
@ STATUS_KEY_FROZEN
Definition enums.h:2203
@ STATUS_TURN_MOD_SLEEP
Definition enums.h:2228
@ STATUS_TURN_MOD_DIZZY
Definition enums.h:2232
@ STATUS_KEY_STATIC
Definition enums.h:2207
@ STATUS_END
Definition enums.h:2196
@ STATUS_TURN_MOD_POISON
Definition enums.h:2233
@ STATUS_KEY_FEAR
Definition enums.h:2199
@ STATUS_TURN_MOD_STOP
Definition enums.h:2237
@ STATUS_KEY_SLEEP
Definition enums.h:2202
@ STATUS_KEY_STONE
Definition enums.h:2208
@ STATUS_KEY_STOP
Definition enums.h:2204
@ STATUS_TURN_MOD_FROZEN
Definition enums.h:2230
@ STATUS_KEY_SHRINK
Definition enums.h:2206
@ STATUS_KEY_DIZZY
Definition enums.h:2200
@ STATUS_KEY_POISON
Definition enums.h:2205
@ STATUS_TURN_MOD_STATIC
Definition enums.h:2229
@ STATUS_TURN_MOD_FEAR
Definition enums.h:2231
@ STATUS_KEY_NORMAL
Definition enums.h:2197
@ STATUS_TURN_MOD_SHRINK
Definition enums.h:2235
@ STATUS_KEY_DEFAULT
Definition enums.h:2198
@ HIT_RESULT_NO_DAMAGE
Definition enums.h:1952
@ HIT_RESULT_HIT
Definition enums.h:1950
@ HIT_RESULT_LUCKY
Definition enums.h:1955
@ HIT_RESULT_MISS
Definition enums.h:1956
@ BTL_CAM_DEFAULT
Definition enums.h:4824
@ BTL_CAM_INTERRUPT
Definition enums.h:4823
@ BTL_CAM_ACTOR_FAR
Definition enums.h:4837
@ BTL_CAM_ENEMY_APPROACH
Definition enums.h:4885
@ SUPPRESS_EVENT_ALL
Definition enums.h:2907
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6408
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6407
@ STATUS_FLAG_SHRINK
Definition enums.h:2819
@ STATUS_FLAG_DIZZY
Definition enums.h:2818
@ SOUND_BONY_BEETLE_EXTEND_SPIKES
Definition enums.h:1492
@ SOUND_NONE
Definition enums.h:547
@ SOUND_SHELL_SPIN
Definition enums.h:1342
@ SOUND_BONY_BEETLE_RETRACT_SPIKES
Definition enums.h:1493
@ SOUND_FALL_QUICK
Definition enums.h:1090
@ SOUND_SHELL_TOSS
Definition enums.h:1497
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_UPSIDE_DOWN
HP bar offset below actor (e.g. Swooper when upside-down).
Definition enums.h:3331
@ ACTOR_FLAG_FLIPPED
Actor has been flipped over.
Definition enums.h:3330
@ BTL_CAM_YADJ_TARGET
Definition enums.h:4905
@ EVENT_HIT
Definition enums.h:2132
@ EVENT_SCARE_AWAY
Definition enums.h:2174
@ EVENT_BURN_HIT
Definition enums.h:2136
@ 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_SPIKE_TAUNT
Definition enums.h:2148
@ EVENT_AIR_LIFT_FAILED
Definition enums.h:2152
@ EVENT_BEGIN_AIR_LIFT
Definition enums.h:2175
@ EVENT_DEATH
Definition enums.h:2153
@ EVENT_FLIP_TRIGGER
Definition enums.h:2135
@ EVENT_SHOCK_HIT
Definition enums.h:2165
@ EVENT_RECOVER_STATUS
Definition enums.h:2167
@ EVENT_BLOW_AWAY
Definition enums.h:2143
@ ACTOR_PART_FLAG_PRIMARY_TARGET
Definition enums.h:3362
@ DAMAGE_TYPE_TRIGGER_LUCKY
Definition enums.h:2881
EvtScript EVS_Enemy_ReturnHome
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 RandInt(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 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 Sub(VAR, INT_VALUE)
Definition macros.h:377
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define UseBuf(INT_PTR)
Loads a s32 pointer for use with subsequent EVT_BUF_READ commands.
Definition macros.h:389
#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 BufRead1(VAR)
Consumes the next s32 from the buffer and stores it in the given variable.
Definition macros.h:392
#define IfGt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR <= RVAR.
Definition macros.h:278
#define IfLt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR < RVAR.
Definition macros.h:275
#define Float(DOUBLE)
Definition macros.h:51
#define Label(LABEL_ID)
Marks this point in the script as a Goto target.
Definition macros.h:227
#define CaseOrEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR.
Definition macros.h:341
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define CaseDefault
Marks the start of a switch case that executes unconditionally. It also marks the end of any previous...
Definition macros.h:337
#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 LFlag0
Definition macros.h:167
#define LVarA
Definition macros.h:158
#define IfNotFlag(LVAR, RVAR)
Marks the beginning of an if statement that only executes if the RVAR flag is unset on LVAR,...
Definition macros.h:292
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define PlayEffect(args...)
Definition macros.h:807
#define EndSwitch
Marks the end of a switch statement and any case.
Definition macros.h:362
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
Definition macros.h:269
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define Loop(TIMES)
Marks the beginning of a loop.
Definition macros.h:245
#define LVar3
Definition macros.h:151
#define LVar0
Definition macros.h:148
#define SetConst(VAR, CONST)
Sets the given variable to a given value, skipping the evt_get_variable call.
Definition macros.h:370
#define Return
Kills the current EVT thread.
Definition macros.h:217