Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
bandit.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects.h"
3#include "battle/battle.h"
4#include "script_api/battle.h"
5#include "sprite/npc/Bandit.h"
6
7#define NAMESPACE A(bandit)
8
9extern EvtScript N(EVS_Init);
10extern EvtScript N(EVS_Idle);
11extern EvtScript N(EVS_Init_Coin);
12extern EvtScript N(EVS_TakeTurn);
13extern EvtScript N(EVS_HandleEvent);
14
15BSS s32 N(DropCoinScript)[1];
16
17enum N(ActorPartIDs) {
18 PRT_MAIN = 1,
19 PRT_COIN = 2,
20};
21
22enum N(ActorVars) {
23 AVAR_HasCoin = 0, // has stolen coins
24 AVAR_NumCoins = 1, // number of coins stolen
25 AVAR_Coin_NumCoins = 1, // number of coins stolen also stored in coin actor
26};
27
28enum N(ActorParams) {
29 DMG_TACKLE = 2,
30};
31
32s32 N(DefaultAnims)[] = {
33 STATUS_KEY_NORMAL, ANIM_Bandit_Idle,
34 STATUS_KEY_STONE, ANIM_Bandit_Still,
35 STATUS_KEY_SLEEP, ANIM_Bandit_Sleep,
36 STATUS_KEY_POISON, ANIM_Bandit_Idle,
37 STATUS_KEY_STOP, ANIM_Bandit_Still,
38 STATUS_KEY_STATIC, ANIM_Bandit_Idle,
39 STATUS_KEY_PARALYZE, ANIM_Bandit_Still,
40 STATUS_KEY_DIZZY, ANIM_Bandit_Dizzy,
41 STATUS_KEY_FEAR, ANIM_Bandit_Dizzy,
43};
44
45s32 N(HoldingAnims)[] = {
46 STATUS_KEY_NORMAL, ANIM_Bandit_IdleHolding,
47 STATUS_KEY_STONE, ANIM_Bandit_StillHolding,
48 STATUS_KEY_SLEEP, ANIM_Bandit_Sleep,
49 STATUS_KEY_POISON, ANIM_Bandit_IdleHolding,
50 STATUS_KEY_STOP, ANIM_Bandit_StillHolding,
51 STATUS_KEY_STATIC, ANIM_Bandit_IdleHolding,
52 STATUS_KEY_PARALYZE, ANIM_Bandit_StillHolding,
53 STATUS_KEY_DIZZY, ANIM_Bandit_Dizzy,
54 STATUS_KEY_FEAR, ANIM_Bandit_Dizzy,
56};
57
58s32 N(CoinAnims)[] = {
59 STATUS_KEY_NORMAL, ANIM_Bandit_Coin,
61};
62
63s32 N(DefenseTable)[] = {
66};
67
68s32 N(StatusTable)[] = {
79 STATUS_KEY_STOP, 100,
91};
92
93ActorPartBlueprint N(ActorParts)[] = {
94 {
96 .index = PRT_MAIN,
97 .posOffset = { 0, 0, 0 },
98 .targetOffset = { -2, 28 },
99 .opacity = 255,
100 .idleAnimations = N(DefaultAnims),
101 .defenseTable = N(DefenseTable),
102 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
103 .elementImmunityFlags = 0,
104 .projectileTargetOffset = { 0, -12 },
105 },
106 {
108 .index = PRT_COIN,
109 .posOffset = { 0, 30, 0 },
110 .targetOffset = { 0, 0 },
111 .opacity = 255,
112 .idleAnimations = N(CoinAnims),
113 .defenseTable = N(DefenseTable),
114 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
115 .elementImmunityFlags = 0,
116 .projectileTargetOffset = { 0, 0 },
117 },
118};
119
120ActorPartBlueprint N(CoinParts)[] = {
121 {
123 .index = PRT_COIN,
124 .posOffset = { 0, 0, 0 },
125 .targetOffset = { 0, 0 },
126 .opacity = 255,
127 .idleAnimations = N(CoinAnims),
128 .defenseTable = N(DefenseTable),
129 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
130 .elementImmunityFlags = 0,
131 .projectileTargetOffset = { 0, 0 },
132 },
133};
134
135ActorBlueprint NAMESPACE = {
136 .flags = 0,
137 .type = ACTOR_TYPE_BANDIT,
138 .level = ACTOR_LEVEL_BANDIT,
139 .maxHP = 5,
140 .partCount = ARRAY_COUNT(N(ActorParts)),
141 .partsData = N(ActorParts),
142 .initScript = &N(EVS_Init),
143 .statusTable = N(StatusTable),
144 .escapeChance = 40,
145 .airLiftChance = 90,
146 .hurricaneChance = 90,
147 .spookChance = 90,
148 .upAndAwayChance = 95,
149 .spinSmashReq = 0,
150 .powerBounceChance = 80,
151 .coinReward = 1,
152 .size = { 26, 32 },
153 .healthBarOffset = { 0, 0 },
154 .statusIconOffset = { -10, 25 },
155 .statusTextOffset = { 10, 25 },
156};
157
158ActorBlueprint N(coin) = {
160 .type = ACTOR_TYPE_BANDIT,
161 .level = ACTOR_LEVEL_BANDIT,
162 .maxHP = 5,
163 .partCount = ARRAY_COUNT(N(CoinParts)),
164 .partsData = N(CoinParts),
165 .initScript = &N(EVS_Init_Coin),
166 .statusTable = N(StatusTable),
167 .escapeChance = 40,
168 .airLiftChance = 90,
169 .hurricaneChance = 90,
170 .spookChance = 90,
171 .upAndAwayChance = 95,
172 .spinSmashReq = 0,
173 .powerBounceChance = 80,
174 .coinReward = 1,
175 .size = { 26, 32 },
176 .healthBarOffset = { 0, 0 },
177 .statusIconOffset = { -10, 25 },
178 .statusTextOffset = { 10, 25 },
179};
180
181Vec3i N(CoinPos) = { NPC_DISPOSE_LOCATION };
182
183Formation N(CoinFormation) = {
184 ACTOR_BY_POS(N(coin), N(CoinPos), 0),
185};
186
187EvtScript N(EVS_Init) = {
188 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
189 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
190 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
191 Call(SetActorVar, ACTOR_SELF, AVAR_HasCoin, 0)
192 Return
193 End
194};
195
196EvtScript N(EVS_Dummy) = {
197 Return
198 End
199};
200
201EvtScript N(EVS_Init_Coin) = {
202 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_Dummy)))
203 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Dummy)))
204 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_Dummy)))
205 Return
206 End
207};
208
209EvtScript N(EVS_Idle) = {
210 Return
211 End
212};
213
214EvtScript N(EVS_DropCoin) = {
215 Call(GetActorVar, ACTOR_SELF, AVAR_HasCoin, LVar0)
217 CaseEq(FALSE)
218 // do nothing
219 CaseEq(TRUE)
220 Call(SetActorVar, ACTOR_SELF, AVAR_HasCoin, FALSE)
221 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(DefaultAnims)))
222 Call(SetPartFlagBits, ACTOR_SELF, PRT_COIN, ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION, FALSE)
223 Call(SummonEnemy, Ref(N(CoinFormation)), FALSE)
224 Set(LVarA, LVar0)
225 Call(GetPartOffset, ACTOR_SELF, PRT_COIN, LVar1, LVar2, LVar3)
226 Call(SetActorPos, LVarA, LVar1, LVar2, LVar3)
227 Call(SetPartFlagBits, ACTOR_SELF, PRT_COIN, ACTOR_PART_FLAG_INVISIBLE, TRUE)
228 Call(GetActorVar, ACTOR_SELF, AVAR_NumCoins, LVar0)
229 Call(SetActorVar, LVarA, AVAR_Coin_NumCoins, LVar0)
230 Call(SetActorJumpGravity, LVarA, Float(1.0))
231 Call(RandInt, 360, LVar0)
232 Call(GetActorPos, ACTOR_SELF, LVar1, LVar2, LVar3)
233 Add(LVar2, 30)
234 Call(SetActorPos, LVarA, LVar1, LVar2, LVar3)
235 Call(SetActorSounds, LVarA, ACTOR_SOUND_JUMP, SOUND_NONE, 0)
237 Call(SetGoalPos, LVarA, LVar1, 0, LVar3)
238 Call(JumpToGoal, LVarA, 20, FALSE, TRUE, FALSE)
239 Call(PlaySoundAtActor, LVarA, SOUND_COIN_BOUNCE)
241 Call(SetGoalPos, LVarA, LVar1, 0, LVar3)
242 Call(JumpToGoal, LVarA, 10, FALSE, TRUE, FALSE)
243 Call(PlaySoundAtActor, LVarA, SOUND_COIN_BOUNCE)
245 Call(SetGoalPos, LVarA, LVar1, 0, LVar3)
246 Call(JumpToGoal, LVarA, 5, FALSE, TRUE, FALSE)
247 Call(PlaySoundAtActor, LVarA, SOUND_COIN_BOUNCE)
248 Loop(0)
249 Call(GetBattleFlags, LVar1)
252 EndIf
255 EndIf
256 Wait(1)
257 EndLoop
258 Wait(15)
259 Call(SetActorJumpGravity, LVarA, Float(1.0))
260 Call(SetActorSpeed, LVarA, Float(6.0))
261 Set(LVar0, -70)
262 Set(LVar1, 0)
263 Set(LVar2, 10)
264 Label(5)
265 Call(GetActorPos, LVarA, LVar3, LVar4, LVar5)
267 Goto(10)
268 EndIf
270 Set(LVar4, LVar0)
271 Sub(LVar4, LVar3)
272 IfLt(LVar4, 30)
273 Call(SetGoalPos, LVarA, LVar0, LVar1, LVar2)
274 Call(JumpToGoal, LVarA, 5, FALSE, TRUE, FALSE)
275 Call(PlaySoundAtActor, LVarA, SOUND_COIN_BOUNCE)
276 Else
277 Set(LVar4, LVar3)
278 Add(LVar3, 30)
279 Call(SetGoalPos, LVarA, LVar3, LVar1, LVar2)
280 Call(JumpToGoal, LVarA, 0, FALSE, TRUE, FALSE)
281 Call(PlaySoundAtActor, LVarA, SOUND_COIN_BOUNCE)
282 EndIf
283 Else
284 Set(LVar4, LVar3)
285 Sub(LVar4, LVar0)
286 IfLt(LVar4, 30)
287 Call(SetGoalPos, LVarA, LVar0, LVar1, LVar2)
288 Call(JumpToGoal, LVarA, 5, FALSE, TRUE, FALSE)
289 Call(PlaySoundAtActor, LVarA, SOUND_COIN_BOUNCE)
290 Else
291 Sub(LVar3, 30)
292 Call(SetGoalPos, LVarA, LVar3, LVar1, LVar2)
293 Call(JumpToGoal, LVarA, 0, FALSE, TRUE, FALSE)
294 Call(PlaySoundAtActor, LVarA, SOUND_COIN_BOUNCE)
295 EndIf
296 EndIf
297 Goto(5)
298 Label(10)
299 Call(EnableActorBlur, LVarA, ACTOR_BLUR_ENABLE)
300 Call(SetTargetActor, LVarA, ACTOR_PLAYER)
301 Call(SetGoalToTarget, LVarA)
302 Call(JumpToGoal, LVarA, 15, FALSE, FALSE, FALSE)
303 Call(GetGoalPos, LVarA, LVar0, LVar1, LVar2)
304 PlayEffect(EFFECT_SMALL_GOLD_SPARKLE, 0, LVar0, LVar1, LVar2, Float(1.0), 0, 0)
305 Call(PlaySoundAtActor, LVarA, SOUND_COIN_PICKUP)
306 Call(GetActorVar, LVarA, AVAR_Coin_NumCoins, LVar0)
308 Call(RemoveActor, LVarA)
310 Return
311 End
312};
313
314EvtScript N(EVS_HandleEvent) = {
315 UseArray(Ref(N(DropCoinScript)))
316 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
317 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
318 Call(GetLastEvent, ACTOR_SELF, LVar0)
321 ExecGetTID(N(EVS_DropCoin), ArrayVar(0))
322 SetConst(LVar0, PRT_MAIN)
323 SetConst(LVar1, ANIM_Bandit_Hurt)
325 Loop(0)
327 IfEq(LVar0, 0)
329 EndIf
330 Wait(1)
331 EndLoop
334 ExecGetTID(N(EVS_DropCoin), ArrayVar(0))
335 SetConst(LVar0, PRT_MAIN)
336 SetConst(LVar1, ANIM_Bandit_Hurt)
338 Loop(0)
340 IfEq(LVar0, 0)
342 EndIf
343 Wait(1)
344 EndLoop
347 ExecGetTID(N(EVS_DropCoin), ArrayVar(0))
348 SetConst(LVar0, PRT_MAIN)
349 SetConst(LVar1, ANIM_Bandit_BurnHurt)
350 SetConst(LVar2, ANIM_Bandit_BurnStill)
352 Loop(0)
354 IfEq(LVar0, 0)
356 EndIf
357 Wait(1)
358 EndLoop
360 ExecGetTID(N(EVS_DropCoin), ArrayVar(0))
361 SetConst(LVar0, PRT_MAIN)
362 SetConst(LVar1, ANIM_Bandit_BurnHurt)
363 SetConst(LVar2, ANIM_Bandit_BurnStill)
365 SetConst(LVar0, PRT_MAIN)
366 SetConst(LVar1, ANIM_Bandit_BurnStill)
368 Loop(0)
370 IfEq(LVar0, 0)
372 EndIf
373 Wait(1)
374 EndLoop
375 Return
377 ExecGetTID(N(EVS_DropCoin), ArrayVar(0))
378 SetConst(LVar0, PRT_MAIN)
379 SetConst(LVar1, ANIM_Bandit_Hurt)
381 Loop(0)
383 IfEq(LVar0, 0)
385 EndIf
386 Wait(1)
387 EndLoop
389 ExecGetTID(N(EVS_DropCoin), ArrayVar(0))
390 SetConst(LVar0, PRT_MAIN)
391 SetConst(LVar1, ANIM_Bandit_Hurt)
393 SetConst(LVar0, PRT_MAIN)
394 SetConst(LVar1, ANIM_Bandit_Hurt)
396 Loop(0)
398 IfEq(LVar0, 0)
400 EndIf
401 Wait(1)
402 EndLoop
403 Return
405 SetConst(LVar0, PRT_MAIN)
406 SetConst(LVar1, ANIM_Bandit_Hurt)
408 SetConst(LVar0, PRT_MAIN)
409 SetConst(LVar1, ANIM_Bandit_Hurt)
411 SetConst(LVar0, PRT_MAIN)
412 SetConst(LVar1, ANIM_Bandit_Run)
414 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.6))
415 Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE)
417 SetConst(LVar0, PRT_MAIN)
418 SetConst(LVar1, ANIM_Bandit_Hurt)
420 SetConst(LVar0, PRT_MAIN)
421 SetConst(LVar1, ANIM_Bandit_Hurt)
423 Return
427 Call(GetActorVar, ACTOR_SELF, AVAR_HasCoin, LVar0)
429 CaseEq(0)
430 SetConst(LVar1, ANIM_Bandit_Idle)
431 CaseEq(1)
432 SetConst(LVar1, ANIM_Bandit_IdleHolding)
434 SetConst(LVar0, PRT_MAIN)
439 ExecGetTID(N(EVS_DropCoin), ArrayVar(0))
440 SetConst(LVar0, PRT_MAIN)
441 SetConst(LVar1, ANIM_Bandit_Hurt)
443 Wait(10)
444 SetConst(LVar0, PRT_MAIN)
445 SetConst(LVar1, ANIM_Bandit_Hurt)
447 Loop(0)
449 IfEq(LVar0, 0)
451 EndIf
452 Wait(1)
453 EndLoop
454 Return
457 SetConst(LVar0, PRT_MAIN)
458 SetConst(LVar1, ANIM_Bandit_Idle)
461 ExecGetTID(N(EVS_DropCoin), ArrayVar(0))
462 SetConst(LVar0, PRT_MAIN)
463 SetConst(LVar1, ANIM_Bandit_Run)
464 SetConst(LVar2, ANIM_Bandit_Hurt)
466 Loop(0)
468 IfEq(LVar0, 0)
470 EndIf
471 Wait(1)
472 EndLoop
473 Return
475 ExecGetTID(N(EVS_DropCoin), ArrayVar(0))
476 SetConst(LVar0, PRT_MAIN)
477 SetConst(LVar1, ANIM_Bandit_Hurt)
479 Loop(0)
481 IfEq(LVar0, 0)
483 EndIf
484 Wait(1)
485 EndLoop
487 SetConst(LVar0, PRT_MAIN)
488 SetConst(LVar1, ANIM_Bandit_Hurt)
491 Return
494 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_Idle)
495 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
496 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
497 Return
498 End
499};
500
501EvtScript N(EVS_TakeTurn) = {
502 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
503 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
504 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
505 // if carrying a coin, run away
506 Call(GetActorVar, ACTOR_SELF, AVAR_HasCoin, LVar0)
507 IfEq(LVar0, 1)
508 Call(SetActorYaw, ACTOR_SELF, 180)
509 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_RunHolding)
510 Wait(30)
511 Call(SetActorSpeed, ACTOR_SELF, Float(10.0))
512 Call(SetGoalPos, ACTOR_SELF, 300, 0, 0)
513 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
514 Call(SetBattleFlagBits, BS_FLAGS1_BATTLE_FLED, TRUE)
515 Call(HideHealthBar, ACTOR_SELF)
516 Call(RemoveActor, ACTOR_SELF)
517 Return
518 EndIf
519 Call(UseBattleCamPreset, BTL_CAM_ENEMY_APPROACH)
520 Call(BattleCamTargetActor, ACTOR_SELF)
521 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
522 Call(GetBattlePhase, LVar0)
524 Call(SetGoalToTarget, ACTOR_SELF)
525 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
526 Add(LVar0, 50)
527 Set(LVar1, 0)
528 Call(SetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
529 Else
530 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_Run)
531 Call(SetGoalToTarget, ACTOR_SELF)
532 Call(AddGoalPos, ACTOR_SELF, 50, 0, 0)
533 Call(SetActorSpeed, ACTOR_SELF, Float(6.0))
534 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
535 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_Idle)
536 Wait(6)
537 EndIf
538 Call(SetActorSpeed, ACTOR_SELF, Float(2.0))
539 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_Walk)
540 Call(SetGoalToTarget, ACTOR_SELF)
541 Call(AddGoalPos, ACTOR_SELF, 35, 0, 0)
542 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
543 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_BANDIT_STEAL)
545 Call(EnemyTestTarget, ACTOR_SELF, LVar0, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS)
549 Set(LVarA, LVar0)
550 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_Tackle)
551 Call(SetGoalToTarget, ACTOR_SELF)
552 Call(SetActorSpeed, ACTOR_SELF, Float(8.0))
553 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
554 Call(ResetAllActorSounds, ACTOR_SELF)
555 Call(SetActorSpeed, ACTOR_SELF, Float(6.0))
556 Call(SetActorJumpGravity, ACTOR_SELF, Float(0.5))
557 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
558 Sub(LVar0, 30)
559 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
560 Call(JumpToGoal, ACTOR_SELF, 8, FALSE, TRUE, FALSE)
561 Sub(LVar0, 20)
562 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
563 Call(JumpToGoal, ACTOR_SELF, 8, FALSE, TRUE, FALSE)
564 Wait(5)
566 Call(EnemyTestTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
567 EndIf
568 Wait(5)
569 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
570 Call(YieldTurn)
571 Call(SetActorYaw, ACTOR_SELF, 180)
572 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
573 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_Run)
574 Call(SetGoalToHome, ACTOR_SELF)
575 Call(SetActorSpeed, ACTOR_SELF, Float(8.0))
576 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
577 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_Idle)
578 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
579 Call(SetActorYaw, ACTOR_SELF, 0)
580 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
581 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
582 Return
585 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_Tackle)
586 Call(SetGoalToTarget, ACTOR_SELF)
587 Call(SetActorSpeed, ACTOR_SELF, Float(8.0))
588 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
589 Call(ResetAllActorSounds, ACTOR_SELF)
590 Wait(2)
591 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, 0, 0, 0, DMG_TACKLE, BS_FLAGS1_TRIGGER_EVENTS)
595 // dont steal coins if no damage, blocked
596 Call(GetLastDamage, ACTOR_PLAYER, LVar0)
597 IfLe(LVar0, 0)
598 Set(LVar0, 1)
599 Goto(10)
600 EndIf
601 Call(GetBattleFlags, LVar0)
603 Set(LVar0, 1)
604 Goto(10)
605 EndIf
606 // cant steal coins if shrunk
607 Call(GetStatusFlags, ACTOR_SELF, LVar0)
609 Set(LVar0, 0)
610 Goto(10)
611 EndIf
612 // cant steal coins if player is stone
613 Call(GetStatusFlags, ACTOR_PLAYER, LVar0)
615 Set(LVar0, 0)
616 Goto(10)
617 EndIf
618 Call(AddCoin, 0)
619 // choose outcome based on stolen coin count
621 CaseEq(0)
622 Set(LVar0, 1)
623 CaseLt(10)
624 Call(SetActorVar, ACTOR_SELF, AVAR_NumCoins, LVar0)
625 Set(LVar0, 2)
626 CaseGe(10)
627 // cap num stolen to 10
628 Call(SetActorVar, ACTOR_SELF, AVAR_NumCoins, 10)
629 Set(LVar0, 2)
631 Label(10)
633 CaseEq(0)
634 // couldn't steal (from shrunk or player stone)
635 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
636 Add(LVar0, 30)
637 Set(LVar1, 0)
638 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.8))
639 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
640 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
641 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_Idle)
642 Wait(20)
643 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_Run)
644 CaseEq(1)
645 // failed to steal (player blocked or damage negated)
646 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
647 Add(LVar0, 30)
648 Set(LVar1, 0)
649 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.8))
650 Call(SetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
651 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
652 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_LookUp)
653 Wait(20)
654 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_DISAPPOINTED)
655 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_Sleep)
656 Wait(20)
657 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_Run)
659 // stole coins
660 Call(SetGoalToTarget, ACTOR_SELF)
661 Call(GetGoalPos, ACTOR_SELF, LVarA, LVarB, LVarC)
662 Add(LVarA, 30)
663 Set(LVarB, 0)
664 Call(GetActorVar, ACTOR_SELF, AVAR_NumCoins, LVar0)
665 Mul(LVar0, -1)
667 Thread
668 Call(SetPartFlagBits, ACTOR_SELF, PRT_COIN, ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION, TRUE)
669 Call(SetPartFlagBits, ACTOR_SELF, PRT_COIN, ACTOR_PART_FLAG_INVISIBLE, FALSE)
670 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
671 Call(SetPartPos, ACTOR_SELF, PRT_COIN, LVar0, LVar1, LVar2)
672 Call(SetPartJumpGravity, ACTOR_SELF, PRT_COIN, Float(1.0))
673 Add(LVarB, 30)
674 Call(JumpPartTo, ACTOR_SELF, PRT_COIN, LVarA, LVarB, LVarC, 22, TRUE)
675 Call(SetPartFlagBits, ACTOR_SELF, PRT_COIN, ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION, FALSE)
677 Thread
678 Call(GetActorVar, ACTOR_SELF, AVAR_NumCoins, LVar0)
679 Loop(LVar0)
680 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_COIN_BOUNCE)
681 Wait(1)
682 EndLoop
684 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.8))
685 Call(SetGoalPos, ACTOR_SELF, LVarA, LVarB, LVarC)
686 Call(JumpToGoal, ACTOR_SELF, 10, FALSE, TRUE, FALSE)
687 Call(SetIdleAnimations, ACTOR_SELF, PRT_MAIN, Ref(N(HoldingAnims)))
688 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_LookUp)
689 Call(SetActorVar, ACTOR_SELF, AVAR_HasCoin, 1)
690 Wait(7)
691 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_GotCoin)
692 Wait(20)
693 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Bandit_RunHolding)
695 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
696 Call(YieldTurn)
697 Call(SetGoalToHome, ACTOR_SELF)
698 Call(SetActorSpeed, ACTOR_SELF, Float(8.0))
699 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
702 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
703 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
704 Return
705 End
706};
Bytecode EvtScript[]
@ BTL_CAM_XADJ_AVG
Definition enums.h:4900
@ ACTOR_SOUND_WALK
Definition enums.h:2034
@ ACTOR_SOUND_JUMP
Definition enums.h:2036
@ BS_FLAGS1_BATTLE_FLED
Definition enums.h:3587
@ BS_FLAGS1_PARTNER_ACTING
Definition enums.h:3588
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3575
@ BS_FLAGS1_ATK_BLOCKED
Definition enums.h:3600
@ 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_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_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_ENABLE
Definition enums.h:6408
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6407
@ STATUS_FLAG_SHRINK
Definition enums.h:2819
@ STATUS_FLAG_STONE
Definition enums.h:2820
@ STATUS_FLAG_DIZZY
Definition enums.h:2818
@ SOUND_COIN_BOUNCE
Definition enums.h:923
@ SOUND_NONE
Definition enums.h:547
@ SOUND_BANDIT_STEAL
Definition enums.h:1481
@ SOUND_COIN_PICKUP
Definition enums.h:922
@ SOUND_DISAPPOINTED
Definition enums.h:1482
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_NO_DMG_APPLY
Damage is not applied to actor HP.
Definition enums.h:3340
@ ACTOR_FLAG_NO_ATTACK
Skip attack turn.
Definition enums.h:3339
@ BTL_CAM_YADJ_TARGET
Definition enums.h:4905
@ ACTOR_BLUR_ENABLE
Definition enums.h:6414
@ EVENT_HIT
Definition enums.h:2132
@ EVENT_SPIN_SMASH_LAUNCH_HIT
Definition enums.h:2138
@ 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_SPIN_SMASH_LAUNCH_DEATH
Definition enums.h:2158
@ 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
@ ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION
Definition enums.h:3361
@ ACTOR_PART_FLAG_NO_TARGET
Cannot be targeted.
Definition enums.h:3360
@ ACTOR_PART_FLAG_INVISIBLE
Definition enums.h:3350
@ DAMAGE_TYPE_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 AddVectorPolar(Evt *script, b32 isInitialCall)
ApiStatus RandInt(Evt *script, b32 isInitialCall)
ApiStatus AddCoin(Evt *script, b32 isInitialCall)
#define ArrayVar(INDEX)
User Word.
Definition macros.h:122
#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 Mul(VAR, INT_VALUE)
Definition macros.h:378
#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 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 CaseGe(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:334
#define Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define BSS
Definition macros.h:7
#define LVarC
Definition macros.h:160
#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 IsThreadRunning(TID, OUTVAR)
Sets OUTVAR to TRUE/FALSE depending on whether a thread with the given ID exists (i....
Definition macros.h:540
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define LVar5
Definition macros.h:153
#define CaseDefault
Marks the start of a switch case that executes unconditionally. It also marks the end of any previous...
Definition macros.h:337
#define LVarB
Definition macros.h:159
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:475
#define IfLe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR > RVAR.
Definition macros.h:281
#define 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 UseArray(INT_PTR)
Loads an s32 array pointer into the current thread for use with ArrayVar(INDEX).
Definition macros.h:425
#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 ExecGetTID(EVT_SOURCE, OUTVAR)
Identical to Exec, but the newly-launched thread ID is stored in OUTVAR.
Definition macros.h:460
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define 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 CaseLt(RVAR)
Marks the start of a switch case that executes only if LVAR < RVAR. It also marks the end of any prev...
Definition macros.h:325
#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 Return
Kills the current EVT thread.
Definition macros.h:217
#define ACTOR_BY_POS(_name, _pos, _priority, args...)
Definition battle.h:230
FormationRow Formation[]
Definition battle.h:167