Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
forest_fuzzy.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "sprite/npc/Fuzzy.h"
4#include "sprite/player.h"
5
6#define NAMESPACE A(forest_fuzzy)
7
8extern s32 N(DefaultAnims)[];
9extern EvtScript N(EVS_Init);
10extern EvtScript N(EVS_Idle);
11extern EvtScript N(EVS_TakeTurn);
12extern EvtScript N(EVS_HandleEvent);
13extern Formation N(CloneFormation);
14
15enum N(ActorPartIDs) {
16 PRT_MAIN = 1,
17};
18
19enum N(ActorVars) {
20 AVAR_Generation = 0,
21};
22
23enum N(ActorParams) {
24 DMG_LEECH = 1,
25};
26
27s32 N(DefenseTable)[] = {
30};
31
32s32 N(StatusTable)[] = {
55};
56
57ActorPartBlueprint N(ActorParts)[] = {
58 {
60 .index = PRT_MAIN,
61 .posOffset = { 0, 0, 0 },
62 .targetOffset = { 0, 20 },
63 .opacity = 255,
64 .idleAnimations = N(DefaultAnims),
65 .defenseTable = N(DefenseTable),
66 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
67 .elementImmunityFlags = 0,
68 .projectileTargetOffset = { 0, -10 },
69 },
70};
71
72ActorBlueprint NAMESPACE = {
73 .flags = 0,
74 .type = ACTOR_TYPE_FOREST_FUZZY,
75 .level = ACTOR_LEVEL_FOREST_FUZZY,
76 .maxHP = 6,
77 .partCount = ARRAY_COUNT(N(ActorParts)),
78 .partsData = N(ActorParts),
79 .initScript = &N(EVS_Init),
80 .statusTable = N(StatusTable),
81 .escapeChance = 40,
82 .airLiftChance = 90,
83 .hurricaneChance = 90,
84 .spookChance = 85,
85 .upAndAwayChance = 95,
86 .spinSmashReq = 0,
87 .powerBounceChance = 100,
88 .coinReward = 1,
89 .size = { 33, 28 },
90 .healthBarOffset = { 0, 0 },
91 .statusIconOffset = { -10, 20 },
92 .statusTextOffset = { 10, 20 },
93};
94
95s32 N(DefaultAnims)[] = {
96 STATUS_KEY_NORMAL, ANIM_Fuzzy_Forest_Idle,
97 STATUS_KEY_STONE, ANIM_Fuzzy_Forest_Still,
98 STATUS_KEY_SLEEP, ANIM_Fuzzy_Forest_Sleep,
99 STATUS_KEY_POISON, ANIM_Fuzzy_Forest_Idle,
100 STATUS_KEY_STOP, ANIM_Fuzzy_Forest_Still,
101 STATUS_KEY_STATIC, ANIM_Fuzzy_Forest_Idle,
102 STATUS_KEY_PARALYZE, ANIM_Fuzzy_Forest_Still,
103 STATUS_KEY_DIZZY, ANIM_Fuzzy_Forest_Stunned,
104 STATUS_KEY_FEAR, ANIM_Fuzzy_Forest_Stunned,
106};
107
108EvtScript N(EVS_Init) = {
109 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
110 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
111 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
112 Call(SetActorVar, ACTOR_SELF, AVAR_Generation, 0)
113 Return
114 End
115};
116
117EvtScript N(EVS_Idle) = {
118 Return
119 End
120};
121
122EvtScript N(EVS_HandleEvent) = {
123 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
124 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
125 Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0))
126 Call(SetActorDispOffset, ACTOR_SELF, 0, 0, 0)
127 Call(GetLastEvent, ACTOR_SELF, LVar0)
131 Call(GetLastElement, LVar0)
133 SetConst(LVar0, PRT_MAIN)
134 SetConst(LVar1, ANIM_Fuzzy_Forest_HurtShock)
135 Else
136 SetConst(LVar0, PRT_MAIN)
137 SetConst(LVar1, ANIM_Fuzzy_Forest_Hurt)
138 EndIf
142 SetConst(LVar0, PRT_MAIN)
143 SetConst(LVar1, ANIM_Fuzzy_Forest_Burn)
144 SetConst(LVar2, ANIM_Fuzzy_Forest_BurnStill)
147 SetConst(LVar0, PRT_MAIN)
148 SetConst(LVar1, ANIM_Fuzzy_Forest_Burn)
149 SetConst(LVar2, ANIM_Fuzzy_Forest_BurnStill)
151 SetConst(LVar0, PRT_MAIN)
152 SetConst(LVar1, ANIM_Fuzzy_Forest_BurnStill)
154 Return
156 SetConst(LVar0, PRT_MAIN)
157 SetConst(LVar1, ANIM_Fuzzy_Forest_Hurt)
160 SetConst(LVar0, PRT_MAIN)
161 SetConst(LVar1, ANIM_Fuzzy_Forest_Hurt)
163 SetConst(LVar0, PRT_MAIN)
164 SetConst(LVar1, ANIM_Fuzzy_Forest_Hurt)
166 Return
168 Call(func_80269470)
169 SetConst(LVar0, PRT_MAIN)
170 SetConst(LVar1, ANIM_Fuzzy_Forest_HurtShock)
172 SetConst(LVar0, PRT_MAIN)
173 SetConst(LVar1, ANIM_Fuzzy_Forest_HurtShock)
175 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
176 SetConst(LVar0, PRT_MAIN)
177 SetConst(LVar1, ANIM_Fuzzy_Forest_Run)
179 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.6))
180 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
182 Call(func_80269470)
183 SetConst(LVar0, PRT_MAIN)
184 SetConst(LVar1, ANIM_Fuzzy_Forest_HurtShock)
186 SetConst(LVar0, PRT_MAIN)
187 SetConst(LVar1, ANIM_Fuzzy_Forest_HurtShock)
189 Return
192 SetConst(LVar0, PRT_MAIN)
193 SetConst(LVar1, ANIM_Fuzzy_Forest_Idle)
197 Call(GetLastElement, LVar0)
199 SetConst(LVar0, PRT_MAIN)
200 SetConst(LVar1, ANIM_Fuzzy_Forest_HurtShock)
202 Wait(10)
203 SetConst(LVar0, PRT_MAIN)
204 SetConst(LVar1, ANIM_Fuzzy_Forest_HurtShock)
206 Else
207 SetConst(LVar0, PRT_MAIN)
208 SetConst(LVar1, ANIM_Fuzzy_Forest_Hurt)
210 Wait(10)
211 SetConst(LVar0, PRT_MAIN)
212 SetConst(LVar1, ANIM_Fuzzy_Forest_Hurt)
214 EndIf
215 Return
217 SetConst(LVar0, PRT_MAIN)
218 SetConst(LVar1, ANIM_Fuzzy_Forest_Idle)
221 SetConst(LVar0, PRT_MAIN)
222 SetConst(LVar1, ANIM_Fuzzy_Forest_Run)
223 SetConst(LVar2, ANIM_Fuzzy_Forest_Anim09)
225 Return
227 SetConst(LVar0, PRT_MAIN)
228 SetConst(LVar1, ANIM_Fuzzy_Forest_Run)
231 SetConst(LVar0, PRT_MAIN)
232 SetConst(LVar1, ANIM_Fuzzy_Forest_Run)
234 Return
236 SetConst(LVar0, PRT_MAIN)
237 SetConst(LVar1, ANIM_Fuzzy_Forest_Idle)
241 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
242 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
243 Return
244 End
245};
246
247EvtScript N(EVS_Move_Clone) = {
248 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
249 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
250 Call(UseBattleCamPreset, BTL_CAM_REPOSITION)
251 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
252 Call(SetBattleCamTarget, LVar0, LVar1, LVar2)
253 Call(SetBattleCamDist, 330)
254 Call(SetBattleCamOffsetY, 30)
255 Call(MoveBattleCamOver, 20)
256 Wait(20)
257 Call(SetActorDispOffset, ACTOR_SELF, 0, 0, 0)
258 Call(UseBattleCamPreset, BTL_CAM_INTERRUPT)
259 Thread
260 Wait(30)
261 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_FUZZY_RUMBLE)
262 Wait(30)
263 Loop(4)
264 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_FUZZY_SHAKE)
265 Wait(11)
266 EndLoop
267 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_FUZZY_DIVIDE)
269 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Forest_Anim0D)
270 Wait(130)
271 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Forest_Walk)
272 Call(SummonEnemy, Ref(N(CloneFormation)), FALSE)
273 Call(GetActorPos, ACTOR_SELF, LVar1, LVar2, LVar3)
274 Call(SetActorPos, LVar0, LVar1, LVar2, LVar3)
275 Call(SetGoalToIndex, LVar0, LVarA)
276 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
277 Call(MoveBattleCamOver, 20)
278 Thread
279 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Forest_Walk)
280 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.4))
281 Call(GetActorPos, ACTOR_SELF, LVar1, LVar2, LVar3)
282 Call(SetGoalPos, ACTOR_SELF, LVar1, LVar2, LVar3)
283 Call(JumpToGoal, ACTOR_SELF, 14, FALSE, TRUE, FALSE)
285 Wait(1)
286 Call(SetAnimation, LVar0, 1, ANIM_Fuzzy_Forest_Walk)
287 Call(SetActorJumpGravity, LVar0, Float(1.4))
288 Call(JumpToGoal, LVar0, 14, FALSE, TRUE, FALSE)
289 Call(GetActorPos, LVar0, LVar1, LVar2, LVar3)
290 Call(ForceHomePos, LVar0, LVar1, LVar2, LVar3)
291 Call(HPBarToHome, LVar0)
292 Call(SetAnimation, LVar0, 1, ANIM_Fuzzy_Forest_Idle)
293 Call(GetActorVar, ACTOR_SELF, AVAR_Generation, LVar1)
295 CaseEq(0)
296 Call(SetActorVar, LVar0, AVAR_Generation, 1)
297 CaseEq(1)
298 Call(SetActorVar, LVar0, AVAR_Generation, 2)
300 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
301 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
302 Return
303 End
304};
305
306#include "common/SpawnEnemyDrainFX.inc.c"
307
308EvtScript N(EVS_Attack_Leech) = {
309 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
310 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
311 Call(UseBattleCamPreset, BTL_CAM_ENEMY_APPROACH)
312 Call(BattleCamTargetActor, ACTOR_SELF)
313 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
314 Call(GetBattlePhase, LVar0)
316 Call(SetGoalToTarget, ACTOR_SELF)
317 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
318 Add(LVar0, 50)
319 Set(LVar1, 0)
320 Call(SetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
321 Goto(100)
322 EndIf
323 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
324 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Forest_Run)
325 Call(SetGoalToTarget, ACTOR_SELF)
326 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
327 Add(LVar0, 50)
328 Set(LVar1, 0)
329 Call(SetActorSpeed, ACTOR_SELF, Float(6.0))
330 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.8))
332 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Forest_Idle)
333 Label(100)
334 Call(SetActorDispOffset, ACTOR_SELF, 0, 10, 0)
335 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Forest_Leech)
336 Call(SetActorDispOffset, ACTOR_SELF, 0, 9, 0)
337 Wait(1)
338 Call(SetActorDispOffset, ACTOR_SELF, 0, 8, 0)
339 Wait(5)
344 Set(LVarA, LVar0)
345 Call(SetGoalToTarget, ACTOR_SELF)
346 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
347 Sub(LVar0, 5)
348 Set(LVar1, 0)
349 Sub(LVar2, 5)
350 Call(SetActorJumpGravity, ACTOR_SELF, Float(3.0))
351 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Forest_Jump)
352 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
353 Call(JumpToGoal, ACTOR_SELF, 11, FALSE, TRUE, FALSE)
354 Call(SetActorDispOffset, ACTOR_SELF, 0, 0, 0)
355 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Forest_Anim09)
356 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
357 Sub(LVar0, 20)
358 Call(SetActorJumpGravity, ACTOR_SELF, Float(3.0))
359 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
360 Call(JumpToGoal, ACTOR_SELF, 6, FALSE, TRUE, FALSE)
361 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
362 Sub(LVar0, 15)
363 Call(SetActorJumpGravity, ACTOR_SELF, Float(3.0))
364 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
365 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
366 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
367 Wait(4)
368 Wait(5)
370 Call(EnemyTestTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
371 EndIf
372 Wait(5)
373 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
374 Call(YieldTurn)
375 Call(SetActorYaw, ACTOR_SELF, 180)
376 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
377 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Forest_Run)
378 Call(SetGoalToHome, ACTOR_SELF)
379 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
380 Call(SetActorSpeed, ACTOR_SELF, Float(8.0))
381 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.8))
383 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
384 Call(SetActorYaw, ACTOR_SELF, 0)
385 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
386 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
387 Return
390 Call(GetStatusFlags, ACTOR_SELF, LVar0)
392 Set(LFlag0, FALSE)
393 Else
394 Set(LFlag0, TRUE)
395 EndIf
397 Call(SetGoalToTarget, ACTOR_SELF)
398 Call(AddGoalPos, ACTOR_SELF, -3, -12, -15)
399 Call(SetActorJumpGravity, ACTOR_SELF, Float(3.0))
400 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Forest_Jump)
401 Call(JumpToGoal, ACTOR_SELF, 8, FALSE, TRUE, FALSE)
402 IfEq(LFlag0, TRUE)
404 Return
405 EndIf
406 Wait(10)
407 Call(UseIdleAnimation, ACTOR_PLAYER, FALSE)
408 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB1_Leeching)
409 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_LEECH)
410 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Forest_Bite)
411 Wait(21)
412 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Forest_Still)
413 Call(SetActorRotation, ACTOR_SELF, 0, 0, 330)
414 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_LEECH)
415 Call(SetActorDispOffset, ACTOR_SELF, -3, -2, 0)
416 Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0))
417 Wait(1)
418 Call(SetActorScale, ACTOR_SELF, Float(0.9), Float(1.2), Float(1.0))
419 Wait(1)
420 Call(SetActorScale, ACTOR_SELF, Float(0.8), Float(1.3), Float(1.0))
421 Wait(1)
422 Call(SetActorScale, ACTOR_SELF, Float(0.7), Float(1.4), Float(1.0))
423 Wait(1)
424 Call(SetActorScale, ACTOR_SELF, Float(0.7), Float(1.5), Float(1.0))
425 Wait(2)
426 Call(SetActorScale, ACTOR_SELF, Float(0.6), Float(1.6), Float(1.0))
427 Wait(10)
428 Wait(2)
429 Call(UseIdleAnimation, ACTOR_PLAYER, TRUE)
430 Call(EnemyDamageTarget, ACTOR_SELF, LVarA, DAMAGE_TYPE_IGNORE_DEFENSE, 0, 0, DMG_LEECH, BS_FLAGS1_TRIGGER_EVENTS)
431 Call(SetActorDispOffset, ACTOR_SELF, 0, 0, 0)
432 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Forest_Idle)
433 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
434 Call(GetLastDamage, ACTOR_PLAYER, LVar3)
435 IfNe(LVar3, 0)
436 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_RECOVER_HEART)
437 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_HEART_BOUNCE)
438 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
439 Add(LVar1, 10)
440 Call(N(SpawnDrainHealthStartFX), LVar0, LVar1, LVar2, LVar3)
441 Thread
442 Wait(15)
443 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_STAR_BOUNCE_A)
444 Call(N(SpawnDrainHealthContinueFX), LVar0, LVar1, LVar2, LVar3)
446 Add(LVar0, 20)
447 Add(LVar1, 20)
448 PlayEffect(EFFECT_RECOVER, 0, LVar0, LVar1, LVar2, LVar3, 0)
449 Call(GetActorHP, ACTOR_SELF, LVar0)
450 Add(LVar0, LVar3)
451 Call(SetEnemyHP, ACTOR_SELF, LVar0)
452 EndIf
453 Thread
454 Call(SetActorScale, ACTOR_SELF, Float(1.6), Float(0.6), Float(1.0))
455 Call(SetActorRotationOffset, ACTOR_SELF, 0, 10, 0)
456 Wait(1)
457 Call(SetActorRotation, ACTOR_SELF, 0, 0, 330)
458 Wait(1)
459 Call(SetActorScale, ACTOR_SELF, Float(0.7), Float(1.5), Float(1.0))
460 Call(SetActorRotation, ACTOR_SELF, 0, 0, 300)
461 Wait(1)
462 Call(SetActorRotation, ACTOR_SELF, 0, 0, 270)
463 Wait(1)
464 Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(0.7), Float(1.0))
465 Call(SetActorRotation, ACTOR_SELF, 0, 0, 240)
466 Wait(1)
467 Call(SetActorRotation, ACTOR_SELF, 0, 0, 210)
468 Wait(1)
469 Call(SetActorScale, ACTOR_SELF, Float(0.7), Float(1.4), Float(1.0))
470 Call(SetActorRotation, ACTOR_SELF, 0, 0, 180)
471 Wait(2)
472 Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(0.7), Float(1.0))
473 Wait(2)
474 Call(SetActorScale, ACTOR_SELF, Float(1.2), Float(0.5), Float(1.0))
476 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
477 Add(LVar0, 40)
478 Set(LVar1, 0)
479 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.8))
480 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
481 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
482 Call(SetActorScale, ACTOR_SELF, Float(1.4), Float(0.2), Float(1.0))
483 Wait(1)
484 Thread
485 Wait(1)
486 Call(SetActorScale, ACTOR_SELF, Float(1.2), Float(0.5), Float(1.0))
487 Call(SetActorRotation, ACTOR_SELF, 0, 0, 150)
488 Wait(1)
489 Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0))
490 Call(SetActorRotation, ACTOR_SELF, 0, 0, 120)
491 Wait(1)
492 Call(SetActorRotation, ACTOR_SELF, 0, 0, 90)
493 Wait(1)
494 Call(SetActorRotation, ACTOR_SELF, 0, 0, 60)
495 Wait(1)
496 Call(SetActorRotation, ACTOR_SELF, 0, 0, 30)
497 Wait(1)
498 Call(SetActorRotation, ACTOR_SELF, 0, 0, 0)
499 Call(SetActorRotationOffset, ACTOR_SELF, 0, 0, 0)
501 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
502 Add(LVar0, 30)
503 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
504 Call(JumpToGoal, ACTOR_SELF, 8, FALSE, TRUE, FALSE)
505 Wait(5)
506 Call(YieldTurn)
507 Call(SetActorDispOffset, ACTOR_SELF, 0, 0, 0)
508 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Forest_Run)
509 Call(SetGoalToHome, ACTOR_SELF)
510 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
511 Call(SetActorSpeed, ACTOR_SELF, Float(8.0))
512 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.8))
514 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Forest_Idle)
515 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
516 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
517 Return
518 End
519};
520
521EvtScript N(EVS_GetAvailableSpawnPos) = {
522 // find which columns are occupied
523 Set(LFlag1, FALSE)
524 Set(LFlag2, FALSE)
525 Set(LFlag3, FALSE)
526 Set(LFlag4, FALSE)
527 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
528 Call(InitTargetIterator)
529 Label(0)
530 Call(GetOwnerTarget, LVar0, LVar5)
531 Call(GetIndexFromHome, LVar0, LVar5)
532 Mod(LVar5, 4)
534 CaseEq(0)
535 Set(LFlag1, TRUE)
536 CaseEq(1)
537 Set(LFlag2, TRUE)
538 CaseEq(2)
539 Set(LFlag3, TRUE)
540 CaseEq(3)
541 Set(LFlag4, TRUE)
543 Call(ChooseNextTarget, ITER_NEXT, LVar0)
545 Goto(0)
546 EndIf
547 // check adjacent positions to self
548 Set(LVarA, -1)
549 Set(LVarB, -1)
550 Call(GetIndexFromHome, ACTOR_SELF, LVar0)
552 CaseEq(0)
553 IfEq(LFlag2, FALSE)
554 Set(LVarA, 1)
555 EndIf
556 CaseEq(1)
557 IfEq(LFlag1, FALSE)
558 Set(LVarA, 0)
559 EndIf
560 IfEq(LFlag3, FALSE)
561 IfEq(LVarA, -1)
562 Set(LVarA, 2)
563 Else
564 Set(LVarB, 2)
565 EndIf
566 EndIf
567 CaseEq(2)
568 IfEq(LFlag2, FALSE)
569 Set(LVarA, 1)
570 EndIf
571 IfEq(LFlag4, FALSE)
572 IfEq(LVarA, -1)
573 Set(LVarA, 3)
574 Else
575 Set(LVarB, 3)
576 EndIf
577 EndIf
578 CaseEq(3)
579 IfEq(LFlag3, FALSE)
580 Set(LVarA, 2)
581 EndIf
583 // if both positions are open, choose one at random
584 IfNe(LVarB, -1)
585 Call(RandInt, 1000, LVar0)
586 IfLt(LVar0, 500)
587 Set(LVarA, LVarB)
588 EndIf
589 EndIf
590 Return
591 End
592};
593
594EvtScript N(EVS_CountSummoners) = {
595 Set(LVar9, 0)
596 Call(CreateHomeTargetList, TARGET_FLAG_2 | TARGET_FLAG_PRIMARY_ONLY)
597 Call(InitTargetIterator)
598 Label(0)
599 Call(GetOwnerTarget, LVar0, LVar1)
600 Call(GetOriginalActorType, LVar0, LVar2)
602 CaseOrEq(ACTOR_TYPE_FOREST_FUZZY)
603 CaseOrEq(ACTOR_TYPE_JUNGLE_FUZZY)
604 Call(GetStatusFlags, LVar0, LVar3)
606 Call(GetActorVar, LVar0, AVAR_Generation, LVar3)
607 IfNe(LVar3, 2)
608 Add(LVar9, 1)
609 EndIf
610 EndIf
612 CaseEq(ACTOR_TYPE_SPEAR_GUY)
613 Call(GetStatusFlags, LVar0, LVar3)
616 IfLt(LVar3, 2)
617 Add(LVar9, 1)
618 EndIf
619 EndIf
621 Call(ChooseNextTarget, ITER_NEXT, LVar0)
623 Goto(0)
624 EndIf
625 Return
626 End
627};
628
629EvtScript N(EVS_TakeTurn) = {
630 Call(GetBattlePhase, LVar0)
632 ExecWait(N(EVS_Attack_Leech))
633 Return
634 EndIf
635 Call(GetActorVar, ACTOR_SELF, AVAR_Generation, LVar0)
636 IfEq(LVar0, 2)
637 ExecWait(N(EVS_Attack_Leech))
638 Return
639 EndIf
640 ExecWait(N(EVS_GetAvailableSpawnPos))
641 IfEq(LVarA, -1)
642 ExecWait(N(EVS_Attack_Leech))
643 Return
644 EndIf
645 // lower chance to summon when more summoners are in battle
646 ExecWait(N(EVS_CountSummoners))
648 CaseEq(1)
649 Call(RandInt, 1000, LVar0)
650 IfLt(LVar0, 300)
651 ExecWait(N(EVS_Move_Clone))
652 Return
653 EndIf
654 CaseEq(2)
655 Call(RandInt, 1000, LVar0)
656 IfLt(LVar0, 150)
657 ExecWait(N(EVS_Move_Clone))
658 Return
659 EndIf
660 CaseEq(3)
661 Call(RandInt, 1000, LVar0)
662 IfLt(LVar0, 100)
663 ExecWait(N(EVS_Move_Clone))
664 Return
665 EndIf
667 ExecWait(N(EVS_Attack_Leech))
668 Return
669 End
670};
671
672Vec3i N(SummonPos) = { NPC_DISPOSE_LOCATION };
673
674Formation N(CloneFormation) = {
675 ACTOR_BY_POS(NAMESPACE, N(SummonPos), 0),
676};
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
@ ITER_NO_MORE
Definition enums.h:2030
@ ITER_NEXT
Definition enums.h:2025
@ ACTOR_EVENT_FLAGS_NONE
Definition enums.h:3370
@ 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_HIT_STATIC
Definition enums.h:1957
@ 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_REPOSITION
Definition enums.h:4841
@ BTL_CAM_ENEMY_APPROACH
Definition enums.h:4885
@ TARGET_FLAG_PRIMARY_ONLY
Definition enums.h:1863
@ TARGET_FLAG_2
Definition enums.h:1850
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6408
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6407
@ STATUS_FLAG_STATIC
Definition enums.h:2813
@ SOUND_STAR_BOUNCE_A
Definition enums.h:975
@ SOUND_RECOVER_HEART
Definition enums.h:1406
@ SOUND_FUZZY_SHAKE
Definition enums.h:1408
@ SOUND_LEECH
Definition enums.h:1288
@ SOUND_FUZZY_RUMBLE
Definition enums.h:1407
@ SOUND_FUZZY_DIVIDE
Definition enums.h:1409
@ SOUND_HEART_BOUNCE
Definition enums.h:925
@ 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_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_PRIMARY_TARGET
Definition enums.h:3362
@ DAMAGE_TYPE_IGNORE_DEFENSE
Definition enums.h:2877
@ DAMAGE_TYPE_SHOCK
Definition enums.h:2856
@ DAMAGE_TYPE_TRIGGER_LUCKY
Definition enums.h:2881
EvtScript EVS_Enemy_Knockback
EvtScript EVS_Enemy_HopToPos
EvtScript EVS_Enemy_ScareAway
EvtScript EVS_Enemy_Hit
EvtScript EVS_Enemy_Death
EvtScript EVS_Enemy_SpinSmashHit
EvtScript EVS_Enemy_ShockHit
EvtScript EVS_Enemy_HopHome
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 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 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 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 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 LFlag2
Definition macros.h:169
#define LVar9
Definition macros.h:157
#define NPC_DISPOSE_LOCATION
Definition macros.h:158
#define PlayEffect(args...)
Definition macros.h:807
#define EndSwitch
Marks the end of a switch statement and any case.
Definition macros.h:362
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
Definition macros.h:269
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define LFlag3
Definition macros.h:170
#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
#define ACTOR_BY_POS(_name, _pos, _priority, args...)
Definition battle.h:230
@ AVAR_SpearGuy_Generation
Definition battle.h:101
FormationRow Formation[]
Definition battle.h:167