Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
stone_chomp.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "sprite/npc/StoneChomp.h"
4
5#define NAMESPACE A(stone_chomp)
6
7extern EvtScript N(EVS_Init);
8extern EvtScript N(EVS_Idle);
9extern EvtScript N(EVS_TakeTurn);
10extern EvtScript N(EVS_HandleEvent);
11extern EvtScript N(EVS_Chomp_HopToPos);
12extern EvtScript N(EVS_UpdateChain);
13
14enum N(ActorPartIDs) {
15 PRT_MAIN = 1,
16 PRT_TARGET = 2,
17 PRT_CHAIN_1 = 3,
18 PRT_CHAIN_2 = 4,
19 PRT_CHAIN_3 = 5,
20 PRT_CHAIN_4 = 6,
21 PRT_CHAIN_5 = 7,
22 PRT_CHAIN_6 = 8,
23 PRT_CHAIN_7 = 9,
24 PRT_CHAIN_8 = 10,
25};
26
27enum N(ActorVars) {
28 AVAR_EnableChainSounds = 8,
29};
30
31enum N(ActorParams) {
32 DMG_CHOMP_BITE = 3,
33};
34
35s32 N(BasicAnims)[] = {
36 STATUS_KEY_NORMAL, ANIM_StoneChomp_Idle,
37 STATUS_KEY_STONE, ANIM_StoneChomp_Still,
38 STATUS_KEY_SLEEP, ANIM_StoneChomp_Sleep,
39 STATUS_KEY_POISON, ANIM_StoneChomp_Idle,
40 STATUS_KEY_STOP, ANIM_StoneChomp_Still,
41 STATUS_KEY_STATIC, ANIM_StoneChomp_Idle,
42 STATUS_KEY_DIZZY, ANIM_StoneChomp_Dizzy,
44};
45
46s32 N(QuickBiteAnims)[] = {
47 STATUS_KEY_NORMAL, ANIM_StoneChomp_QuickBite,
48 STATUS_KEY_POISON, ANIM_StoneChomp_QuickBite,
49 STATUS_KEY_STOP, ANIM_StoneChomp_Still,
50 STATUS_KEY_STONE, ANIM_StoneChomp_Still,
51 STATUS_KEY_SLEEP, ANIM_StoneChomp_Sleep,
52 STATUS_KEY_STATIC, ANIM_StoneChomp_QuickBite,
53 STATUS_KEY_DIZZY, ANIM_StoneChomp_Dizzy,
55};
56
57s32 N(BiteAnims)[] = {
58 STATUS_KEY_NORMAL, ANIM_StoneChomp_Bite,
59 STATUS_KEY_POISON, ANIM_StoneChomp_Bite,
60 STATUS_KEY_STOP, ANIM_StoneChomp_Still,
61 STATUS_KEY_STONE, ANIM_StoneChomp_Still,
62 STATUS_KEY_SLEEP, ANIM_StoneChomp_Sleep,
63 STATUS_KEY_STATIC, ANIM_StoneChomp_Bite,
64 STATUS_KEY_DIZZY, ANIM_StoneChomp_Dizzy,
66};
67
68s32 N(SlowBiteAnims)[] = {
69 STATUS_KEY_NORMAL, ANIM_StoneChomp_SlowBite,
70 STATUS_KEY_POISON, ANIM_StoneChomp_SlowBite,
71 STATUS_KEY_STOP, ANIM_StoneChomp_Still,
72 STATUS_KEY_STONE, ANIM_StoneChomp_Still,
73 STATUS_KEY_SLEEP, ANIM_StoneChomp_Sleep,
74 STATUS_KEY_STATIC, ANIM_StoneChomp_SlowBite,
75 STATUS_KEY_DIZZY, ANIM_StoneChomp_Dizzy,
77};
78
79s32 N(ChainAnims)[] = {
80 STATUS_KEY_NORMAL, ANIM_StoneChomp_Chain,
82};
83
84s32 N(DefenseTable)[] = {
87};
88
89s32 N(StatusTable)[] = {
100 STATUS_KEY_STOP, 75,
112};
113
114ActorPartBlueprint N(ActorParts)[] = {
115 {
117 .index = PRT_MAIN,
118 .posOffset = { 0, 0, 0 },
119 .targetOffset = { 0, 24 },
120 .opacity = 255,
121 .idleAnimations = N(BasicAnims),
122 .defenseTable = N(DefenseTable),
123 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
124 .elementImmunityFlags = 0,
125 .projectileTargetOffset = { 0, 0 },
126 },
127 {
129 .index = PRT_TARGET,
130 .posOffset = { 0, 0, 0 },
131 .targetOffset = { -13, 40 },
132 .opacity = 255,
133 .idleAnimations = N(BasicAnims),
134 .defenseTable = N(DefenseTable),
135 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
136 .elementImmunityFlags = 0,
137 .projectileTargetOffset = { 0, -14 },
138 },
139 {
141 .index = PRT_CHAIN_1,
142 .posOffset = { 0, 0, 0 },
143 .targetOffset = { 0, 12 },
144 .opacity = 255,
145 .idleAnimations = N(ChainAnims),
146 .defenseTable = N(DefenseTable),
147 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
148 .elementImmunityFlags = 0,
149 .projectileTargetOffset = { 0, 0 },
150 },
151 {
153 .index = PRT_CHAIN_2,
154 .posOffset = { 0, 0, 0 },
155 .targetOffset = { 0, 12 },
156 .opacity = 255,
157 .idleAnimations = N(ChainAnims),
158 .defenseTable = N(DefenseTable),
159 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
160 .elementImmunityFlags = 0,
161 .projectileTargetOffset = { 0, 0 },
162 },
163 {
165 .index = PRT_CHAIN_3,
166 .posOffset = { 0, 0, 0 },
167 .targetOffset = { 0, 12 },
168 .opacity = 255,
169 .idleAnimations = N(ChainAnims),
170 .defenseTable = N(DefenseTable),
171 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
172 .elementImmunityFlags = 0,
173 .projectileTargetOffset = { 0, 0 },
174 },
175 {
177 .index = PRT_CHAIN_4,
178 .posOffset = { 0, 0, 0 },
179 .targetOffset = { 0, 12 },
180 .opacity = 255,
181 .idleAnimations = N(ChainAnims),
182 .defenseTable = N(DefenseTable),
183 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
184 .elementImmunityFlags = 0,
185 .projectileTargetOffset = { 0, 0 },
186 },
187 {
189 .index = PRT_CHAIN_5,
190 .posOffset = { 0, 0, 0 },
191 .targetOffset = { 0, 12 },
192 .opacity = 255,
193 .idleAnimations = N(ChainAnims),
194 .defenseTable = N(DefenseTable),
195 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
196 .elementImmunityFlags = 0,
197 .projectileTargetOffset = { 0, 0 },
198 },
199 {
201 .index = PRT_CHAIN_6,
202 .posOffset = { 0, 0, 0 },
203 .targetOffset = { 0, 12 },
204 .opacity = 255,
205 .idleAnimations = N(ChainAnims),
206 .defenseTable = N(DefenseTable),
207 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
208 .elementImmunityFlags = 0,
209 .projectileTargetOffset = { 0, 0 },
210 },
211 {
213 .index = PRT_CHAIN_7,
214 .posOffset = { 0, 0, 0 },
215 .targetOffset = { 0, 12 },
216 .opacity = 255,
217 .idleAnimations = N(ChainAnims),
218 .defenseTable = N(DefenseTable),
219 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
220 .elementImmunityFlags = 0,
221 .projectileTargetOffset = { 0, 0 },
222 },
223 {
225 .index = PRT_CHAIN_8,
226 .posOffset = { 0, 0, 0 },
227 .targetOffset = { 0, 12 },
228 .opacity = 255,
229 .idleAnimations = N(ChainAnims),
230 .defenseTable = N(DefenseTable),
231 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
232 .elementImmunityFlags = 0,
233 .projectileTargetOffset = { 0, 0 },
234 },
235};
236
237ActorBlueprint NAMESPACE = {
238 .flags = 0,
239 .type = ACTOR_TYPE_STONE_CHOMP,
240 .level = ACTOR_LEVEL_STONE_CHOMP,
241 .maxHP = 4,
242 .partCount = ARRAY_COUNT(N(ActorParts)),
243 .partsData = N(ActorParts),
244 .initScript = &N(EVS_Init),
245 .statusTable = N(StatusTable),
246 .escapeChance = 0,
247 .airLiftChance = 25,
248 .hurricaneChance = 25,
249 .spookChance = 0,
250 .upAndAwayChance = 95,
251 .spinSmashReq = 0,
252 .powerBounceChance = 85,
253 .coinReward = 5,
254 .size = { 56, 40 },
255 .healthBarOffset = { 0, 0 },
256 .statusIconOffset = { -10, 20 },
257 .statusTextOffset = { 10, 20 },
258};
259
260#define CHOMP_CHAIN_FIRST_PART_IDX PRT_CHAIN_1
261#define CHOMP_CHAIN_LAST_PART_IDX PRT_CHAIN_8
262#define CHOMP_CHAIN_AVAR_SOUNDS AVAR_EnableChainSounds
264
265// Custom version of EVS_Enemy_HopHome
266// (in) LVar0: part idx
267// (in) LVar1: hopping animID
268EvtScript N(EVS_Chomp_HopHome) = {
269 Call(SetAnimation, ACTOR_SELF, LVar0, LVar1)
270 Call(SetGoalToHome, ACTOR_SELF)
271 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
272 Call(SetActorSpeed, ACTOR_SELF, Float(8.0))
273 Call(SetActorJumpGravity, ACTOR_SELF, Float(2.0))
274 ExecWait(N(EVS_Chomp_HopToPos))
275 Return
276 End
277};
278
279// Custom version of EVS_Enemy_HopToPos
280// (in) LVar0: target posX
281// (in) LVar1: target posY
282// (in) LVar2: target posZ
283EvtScript N(EVS_Chomp_HopToPos) = {
284 Call(GetActorPos, ACTOR_SELF, LVar3, LVar4, LVar5)
285 Label(0)
286 Call(GetActorPos, ACTOR_SELF, LVar3, LVar4, LVar5)
288 Goto(10)
289 EndIf
291 Set(LVar4, LVar0)
292 Sub(LVar4, LVar3)
293 IfLt(LVar4, 30)
294 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
295 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
296 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
297 Else
298 Set(LVar4, LVar3)
299 Add(LVar3, 30)
300 Call(SetGoalPos, ACTOR_SELF, LVar3, LVar1, LVar2)
301 Call(JumpToGoal, ACTOR_SELF, 0, FALSE, TRUE, FALSE)
302 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
303 EndIf
304 Else
305 Set(LVar4, LVar3)
306 Sub(LVar4, LVar0)
307 IfLt(LVar4, 30)
308 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
309 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
310 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
311 Else
312 Sub(LVar3, 30)
313 Call(SetGoalPos, ACTOR_SELF, LVar3, LVar1, LVar2)
314 Call(JumpToGoal, ACTOR_SELF, 0, FALSE, TRUE, FALSE)
315 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
316 EndIf
317 EndIf
318 Goto(0)
319 Label(10)
320 Return
321 End
322};
323
324EvtScript N(EVS_Init) = {
325 Call(SetActorVar, ACTOR_SELF, AVAR_EnableChainSounds, FALSE)
326 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
327 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
328 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
329 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
330 Call(SetPartPos, ACTOR_SELF, PRT_TARGET, LVar0, LVar1, LVar2)
331 Set(LVar0, PRT_CHAIN_1)
332 Loop(1 + (PRT_CHAIN_8 - PRT_CHAIN_1))
333 Call(SetPartSize, ACTOR_SELF, LVar0, 16, 16)
334 Add(LVar0, 1)
335 EndLoop
336 Call(N(ChompChainInit))
337 Exec(N(EVS_UpdateChain))
338 Return
339 End
340};
341
342EvtScript N(EVS_UpdateTargetPartPos) = {
343 Call(GetStatusFlags, ACTOR_SELF, LVar0)
345 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
346 Call(SetPartPos, ACTOR_SELF, PRT_TARGET, LVar0, LVar1, LVar2)
347 Call(SetTargetOffset, ACTOR_SELF, PRT_TARGET, 0, 24)
348 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_TARGET, 0, 0)
349 Else
350 Call(SetIdleGoalToHome, ACTOR_SELF)
351 Call(GetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
352 Call(SetPartPos, ACTOR_SELF, PRT_TARGET, LVar0, LVar1, LVar2)
353 Call(SetTargetOffset, ACTOR_SELF, PRT_TARGET, -13, 40)
354 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_TARGET, 0, -14)
355 EndIf
356 Return
357 End
358};
359
360EvtScript N(EVS_Idle) = {
361 Label(0)
362 Loop(0)
363 ExecWait(N(EVS_UpdateTargetPartPos))
364 Call(GetStatusFlags, ACTOR_SELF, LVar0)
367 EndIf
368 Wait(1)
369 EndLoop
370 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(SlowBiteAnims)))
371 Call(SetActorIdleJumpGravity, ACTOR_SELF, Float(1.0))
372 Call(SetIdleGoalToHome, ACTOR_SELF)
373 Call(GetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
374 Add(LVar0, 10)
375 Call(SetActorIdleJumpGravity, ACTOR_SELF, Float(0.8))
376 Call(SetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
377 Call(IdleJumpToGoal, ACTOR_SELF, 11, 1)
378 Loop(0)
379 ExecWait(N(EVS_UpdateTargetPartPos))
380 Call(GetStatusFlags, ACTOR_SELF, LVar0)
383 EndIf
384 Wait(1)
385 EndLoop
386 Call(SetActorIdleJumpGravity, ACTOR_SELF, Float(1.0))
387 Call(SetIdleGoalToHome, ACTOR_SELF)
388 Call(GetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
389 Call(SetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
390 Call(IdleJumpToGoal, ACTOR_SELF, 6, 1)
391 Call(RandInt, 10, LVar0)
392 Add(LVar0, 1)
393 Wait(LVar0)
394 Loop(0)
395 ExecWait(N(EVS_UpdateTargetPartPos))
396 Call(GetStatusFlags, ACTOR_SELF, LVar0)
399 EndIf
400 Wait(1)
401 EndLoop
402 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(BiteAnims)))
403 Call(SetActorIdleJumpGravity, ACTOR_SELF, Float(0.8))
404 Call(SetIdleGoalToHome, ACTOR_SELF)
405 Call(GetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
406 Call(SetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
407 Call(IdleJumpToGoal, ACTOR_SELF, 15, 1)
408 Loop(0)
409 ExecWait(N(EVS_UpdateTargetPartPos))
410 Call(GetStatusFlags, ACTOR_SELF, LVar0)
413 EndIf
414 Wait(1)
415 EndLoop
416 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(SlowBiteAnims)))
417 Call(SetActorIdleJumpGravity, ACTOR_SELF, Float(0.8))
418 Call(SetIdleGoalToHome, ACTOR_SELF)
419 Call(GetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
420 Sub(LVar0, 20)
421 Call(SetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
422 Call(IdleJumpToGoal, ACTOR_SELF, 12, 1)
423 Loop(0)
424 ExecWait(N(EVS_UpdateTargetPartPos))
425 Call(GetStatusFlags, ACTOR_SELF, LVar0)
428 EndIf
429 Wait(1)
430 EndLoop
431 Call(SetActorIdleJumpGravity, ACTOR_SELF, Float(0.8))
432 Call(SetIdleGoalToHome, ACTOR_SELF)
433 Call(GetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
434 Sub(LVar0, 10)
435 Call(SetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
436 Call(IdleJumpToGoal, ACTOR_SELF, 9, 1)
437 Loop(0)
438 ExecWait(N(EVS_UpdateTargetPartPos))
439 Call(GetStatusFlags, ACTOR_SELF, LVar0)
442 EndIf
443 Wait(1)
444 EndLoop
445 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(QuickBiteAnims)))
446 Call(SetActorIdleJumpGravity, ACTOR_SELF, Float(0.8))
447 Call(SetIdleGoalToHome, ACTOR_SELF)
448 Call(GetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
449 Call(SetIdleGoal, ACTOR_SELF, LVar0, LVar1, LVar2)
450 Call(IdleJumpToGoal, ACTOR_SELF, 6, 1)
451 Call(RandInt, 10, LVar0)
452 Add(LVar0, 10)
453 Wait(LVar0)
454 Goto(0)
455 Return
456 End
457};
458
459EvtScript N(EVS_UpdateChain) = {
460 Label(0)
461 Wait(1)
462 Call(N(ChompChainUpdate))
463 Goto(0)
464 Return
465 End
466};
467
468EvtScript N(EVS_HandleEvent) = {
469 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
470 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
471 Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0))
472 Call(GetLastEvent, ACTOR_SELF, LVar0)
476 SetConst(LVar0, PRT_MAIN)
477 SetConst(LVar1, ANIM_StoneChomp_Hurt)
481 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_1, ANIM_StoneChomp_BurnChain)
482 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_2, ANIM_StoneChomp_BurnChain)
483 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_3, ANIM_StoneChomp_BurnChain)
484 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_4, ANIM_StoneChomp_BurnChain)
485 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_5, ANIM_StoneChomp_BurnChain)
486 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_6, ANIM_StoneChomp_BurnChain)
487 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_7, ANIM_StoneChomp_BurnChain)
488 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_8, ANIM_StoneChomp_BurnChain)
489 SetConst(LVar0, PRT_MAIN)
490 SetConst(LVar1, ANIM_StoneChomp_BurnHurt)
491 SetConst(LVar2, ANIM_StoneChomp_BurnStill)
494 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_1, ANIM_StoneChomp_BurnChain)
495 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_2, ANIM_StoneChomp_BurnChain)
496 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_3, ANIM_StoneChomp_BurnChain)
497 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_4, ANIM_StoneChomp_BurnChain)
498 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_5, ANIM_StoneChomp_BurnChain)
499 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_6, ANIM_StoneChomp_BurnChain)
500 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_7, ANIM_StoneChomp_BurnChain)
501 Call(SetAnimation, ACTOR_SELF, PRT_CHAIN_8, ANIM_StoneChomp_BurnChain)
502 SetConst(LVar0, PRT_MAIN)
503 SetConst(LVar1, ANIM_StoneChomp_BurnHurt)
504 SetConst(LVar2, ANIM_StoneChomp_BurnStill)
506 SetConst(LVar0, PRT_MAIN)
507 SetConst(LVar1, ANIM_StoneChomp_BurnStill)
509 Return
511 SetConst(LVar0, PRT_MAIN)
512 SetConst(LVar1, ANIM_StoneChomp_Hurt)
514 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_RESTART)
515 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
516 Return
518 SetConst(LVar0, PRT_MAIN)
519 SetConst(LVar1, ANIM_StoneChomp_Hurt)
521 SetConst(LVar0, PRT_MAIN)
522 SetConst(LVar1, ANIM_StoneChomp_Hurt)
523 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
524 Call(SetAnimation, ACTOR_SELF, LVar0, LVar1)
525 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
526 Set(LVar1, 0)
527 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
528 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.4))
529 Call(AddGoalPos, ACTOR_SELF, 30, 0, 0)
530 Call(JumpToGoal, ACTOR_SELF, 15, FALSE, TRUE, FALSE)
531 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
532 Call(AddGoalPos, ACTOR_SELF, 15, 0, 0)
533 Call(JumpToGoal, ACTOR_SELF, 8, FALSE, TRUE, FALSE)
534 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
535 Call(AddGoalPos, ACTOR_SELF, 5, 0, 0)
536 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
537 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
538 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
539 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
540 SetConst(LVar0, PRT_MAIN)
541 SetConst(LVar1, ANIM_StoneChomp_SlowBite)
542 ExecWait(N(EVS_Chomp_HopHome))
543 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.6))
544 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
545 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
546 Thread
547 Call(ShakeCam, CAM_BATTLE, 0, 1, Float(0.5))
549 Call(SetGoalToHome, ACTOR_SELF)
550 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
551 Call(SetPartPos, ACTOR_SELF, PRT_TARGET, LVar0, LVar1, LVar2)
552 Call(SetActorVar, ACTOR_SELF, AVAR_EnableChainSounds, FALSE)
555 SetConst(LVar0, PRT_MAIN)
556 SetConst(LVar1, ANIM_StoneChomp_Idle)
560 SetConst(LVar0, PRT_MAIN)
561 SetConst(LVar1, ANIM_StoneChomp_Hurt)
563 Call(SetActorVar, ACTOR_SELF, AVAR_EnableChainSounds, FALSE)
564 SetConst(LVar0, PRT_MAIN)
565 SetConst(LVar1, ANIM_StoneChomp_Hurt)
567 Return
569 SetConst(LVar0, PRT_MAIN)
570 SetConst(LVar1, ANIM_StoneChomp_Hurt)
572 Wait(10)
573 SetConst(LVar0, PRT_MAIN)
574 SetConst(LVar1, ANIM_StoneChomp_Hurt)
576 Return
578 SetConst(LVar0, PRT_MAIN)
579 SetConst(LVar1, ANIM_StoneChomp_Hurt)
581 SetConst(LVar0, PRT_MAIN)
582 SetConst(LVar1, ANIM_StoneChomp_Hurt)
584 Return
586 SetConst(LVar0, PRT_MAIN)
587 SetConst(LVar1, ANIM_StoneChomp_Idle)
590 SetConst(LVar0, PRT_MAIN)
591 SetConst(LVar1, ANIM_StoneChomp_Idle)
592 SetConst(LVar2, ANIM_StoneChomp_Hurt)
594 Return
596 Call(GetStatusFlags, ACTOR_SELF, LVar0)
598 Call(SetGoalToHome, ACTOR_SELF)
599 Call(GetGoalPos, ACTOR_SELF, LVar1, LVar2, LVar3)
601 Sub(LVar1, 10)
602 Add(LVar2, 4)
603 Else
604 Sub(LVar1, 5)
605 Add(LVar2, 11)
606 EndIf
607 Call(SetActorPos, ACTOR_SELF, LVar1, LVar2, LVar3)
608 EndIf
609 SetConst(LVar0, PRT_MAIN)
610 SetConst(LVar1, ANIM_StoneChomp_Hurt)
612 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_RESTART)
613 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
614 Return
616 SetConst(LVar0, PRT_MAIN)
617 SetConst(LVar1, ANIM_StoneChomp_Hurt)
619 Return
621 SetConst(LVar0, PRT_MAIN)
622 SetConst(LVar1, ANIM_StoneChomp_Idle)
624 Call(SetAnimationRate, ACTOR_SELF, PRT_MAIN, Float(1.0))
626 Wait(1000)
629 Call(GetStatusFlags, ACTOR_SELF, LVar0)
631 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
632 IfNe(LVar1, 0)
633 Call(SetActorJumpGravity, ACTOR_SELF, Float(0.8))
634 Call(SetGoalPos, ACTOR_SELF, LVar0, 0, LVar2)
635 Call(FallToGoal, ACTOR_SELF, 11)
636 EndIf
637 EndIf
638 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
639 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
640 Return
641 End
642};
643
644EvtScript N(EVS_TakeTurn) = {
645 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
646 Call(SetActorVar, ACTOR_SELF, AVAR_EnableChainSounds, TRUE)
647 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
648 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
649 Call(UseBattleCamPreset, BTL_CAM_ENEMY_APPROACH)
650 Call(BattleCamTargetActor, ACTOR_SELF)
651 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
652 Call(SetActorJumpGravity, ACTOR_SELF, Float(0.5))
653 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
654 Set(LVar1, 0)
655 Add(LVar0, 45)
656 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
657 Call(JumpToGoal, ACTOR_SELF, 15, FALSE, TRUE, FALSE)
658 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
659 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_StoneChomp_SlowBite)
660 Wait(15)
661 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_ACTOR_HURT)
662 Call(EnemyTestTarget, ACTOR_SELF, LVar0, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS)
666 Set(LVarA, LVar0)
667 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_StoneChomp_Idle)
668 Call(SetGoalToTarget, ACTOR_SELF)
669 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
670 Sub(LVar0, 20)
671 Set(LVar1, 0)
672 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.8))
673 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
674 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
675 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
677 Call(EnemyTestTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
678 EndIf
679 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.8))
680 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
681 Sub(LVar0, 25)
682 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
683 Call(JumpToGoal, ACTOR_SELF, 6, FALSE, TRUE, FALSE)
684 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
685 Sub(LVar0, 15)
686 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
687 Call(JumpToGoal, ACTOR_SELF, 4, FALSE, TRUE, FALSE)
688 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
689 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_StoneChomp_Bite)
690 Wait(20)
691 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
692 Call(YieldTurn)
693 Call(SetActorYaw, ACTOR_SELF, 180)
694 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
695 Call(SetGoalToHome, ACTOR_SELF)
696 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
697 Call(SetActorSpeed, ACTOR_SELF, Float(4.0))
698 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_StoneChomp_Bite)
699 ExecWait(N(EVS_Chomp_HopToPos))
700 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_StoneChomp_Idle)
701 Call(SetActorYaw, ACTOR_SELF, 0)
702 Call(HPBarToHome, ACTOR_SELF)
703 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
704 Call(SetActorVar, ACTOR_SELF, AVAR_EnableChainSounds, FALSE)
705 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_RESTART)
706 Return
709 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_StoneChomp_Idle)
710 Call(SetGoalToTarget, ACTOR_SELF)
711 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
712 Call(GetStatusFlags, ACTOR_SELF, LVarA)
714 Add(LVar0, 4)
715 Else
716 Add(LVar0, 10)
717 EndIf
718 Set(LVar1, 27)
719 Call(SetActorJumpGravity, ACTOR_SELF, Float(0.2))
720 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
721 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
722 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
723 Call(SetPartPos, ACTOR_SELF, PRT_TARGET, LVar0, LVar1, LVar2)
724 Wait(2)
725 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, 0, 0, 0, DMG_CHOMP_BITE, BS_FLAGS1_TRIGGER_EVENTS)
729 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
730 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_StoneChomp_Bite)
731 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
732 Add(LVar0, 40)
733 Set(LVar1, 0)
734 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.8))
735 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
736 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
737 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
738 Add(LVar0, 30)
739 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
740 Call(JumpToGoal, ACTOR_SELF, 8, FALSE, TRUE, FALSE)
741 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
742 Add(LVar0, 20)
743 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
744 Call(JumpToGoal, ACTOR_SELF, 6, FALSE, TRUE, FALSE)
745 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
746 Sub(LVar0, 10)
747 Call(JumpToGoal, ACTOR_SELF, 4, FALSE, TRUE, FALSE)
748 Call(PlaySoundAtActor, ACTOR_SELF, STONE_STONE_CHOMP_STEP)
749 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_StoneChomp_Idle)
750 Wait(8)
751 Call(YieldTurn)
752 Call(SetGoalToHome, ACTOR_SELF)
753 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
754 Call(SetActorSpeed, ACTOR_SELF, Float(4.0))
755 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_StoneChomp_Bite)
756 ExecWait(N(EVS_Chomp_HopToPos))
757 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_StoneChomp_Idle)
758 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
759 Call(SetPartPos, ACTOR_SELF, PRT_TARGET, LVar0, LVar1, LVar2)
760 Call(SetActorYaw, ACTOR_SELF, 0)
763 Call(SetActorVar, ACTOR_SELF, AVAR_EnableChainSounds, FALSE)
764 Call(HPBarToHome, ACTOR_SELF)
765 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_RESTART)
766 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
767 Return
768 End
769};
Bytecode EvtScript[]
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2834
@ BTL_CAM_XADJ_AVG
Definition enums.h:4900
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3575
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3571
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_NORMAL
Definition enums.h:2115
@ ACTOR_EVENT_FLAGS_NONE
Definition enums.h:3370
@ ACTOR_DECORATION_SWEAT
Definition enums.h:2045
@ 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
@ 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_PARALYZE
Definition enums.h:2816
@ STATUS_FLAG_STONE
Definition enums.h:2820
@ STATUS_FLAG_DIZZY
Definition enums.h:2818
@ STATUS_FLAG_SLEEP
Definition enums.h:2812
@ SOUND_ACTOR_HURT
Definition enums.h:748
@ STONE_STONE_CHOMP_STEP
Definition enums.h:1310
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ 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_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_BLOW_AWAY
Definition enums.h:2143
@ ACTOR_PART_FLAG_TARGET_ONLY
Definition enums.h:3359
@ ACTOR_PART_FLAG_PRIMARY_TARGET
Definition enums.h:3362
@ ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION
Definition enums.h:3361
@ ACTOR_PART_FLAG_NO_DECORATIONS
Definition enums.h:3351
@ ACTOR_PART_FLAG_NO_TARGET
Cannot be targeted.
Definition enums.h:3360
@ ACTOR_PART_FLAG_INVISIBLE
Definition enums.h:3350
@ CAM_BATTLE
Definition enums.h:1801
@ DAMAGE_TYPE_TRIGGER_LUCKY
Definition enums.h:2881
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)
ApiStatus ShakeCam(Evt *script, b32 isInitialCall)
#define Else
Marks the end of an if statement and the start of the else block.
Definition macros.h:295
#define Switch(LVAR)
Marks the start of a switch statement.
Definition macros.h:311
#define 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 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 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 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 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 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 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 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 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