Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
monty_mole.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "sprite/npc/MontyMole.h"
4
5#define NAMESPACE A(monty_mole)
6
7extern s32 N(DefaultAnims)[];
8extern s32 N(RockAnims)[];
9extern EvtScript N(EVS_Init);
10extern EvtScript N(EVS_Idle);
11extern EvtScript N(EVS_TakeTurn);
12extern EvtScript N(EVS_HandleEvent);
13
14enum N(ActorPartIDs) {
15 PRT_MAIN = 1,
16 PRT_TARGET = 2,
17 PRT_ROCK = 3,
18};
19
20enum N(ActorVars) {
22};
23
24enum N(ActorParams) {
25 DMG_TOSS = 2,
26};
27
28s32 N(DefenseTable)[] = {
31};
32
33s32 N(StatusTable)[] = {
44 STATUS_KEY_STOP, 100,
56};
57
58ActorPartBlueprint N(ActorParts)[] = {
59 {
61 .index = PRT_MAIN,
62 .posOffset = { 0, 0, 0 },
63 .targetOffset = { -2, 16 },
64 .opacity = 255,
65 .idleAnimations = N(DefaultAnims),
66 .defenseTable = N(DefenseTable),
67 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
68 .elementImmunityFlags = 0,
69 .projectileTargetOffset = { 0, -7 },
70 },
71 {
73 .index = PRT_TARGET,
74 .posOffset = { 0, 0, -15 },
75 .targetOffset = { -2, 12 },
76 .opacity = 255,
77 .idleAnimations = N(DefaultAnims),
78 .defenseTable = N(DefenseTable),
79 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
80 .elementImmunityFlags = 0,
81 .projectileTargetOffset = { 0, -7 },
82 },
83 {
85 .index = PRT_ROCK,
86 .posOffset = { 0, 0, 0 },
87 .targetOffset = { 0, 0 },
88 .opacity = 255,
89 .idleAnimations = N(RockAnims),
90 .defenseTable = N(DefenseTable),
91 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
92 .elementImmunityFlags = 0,
93 .projectileTargetOffset = { 0, 0 },
94 },
95};
96
97ActorBlueprint NAMESPACE = {
98 .flags = 0,
100 .level = ACTOR_LEVEL_MONTY_MOLE,
101 .maxHP = 3,
102 .partCount = ARRAY_COUNT(N(ActorParts)),
103 .partsData = N(ActorParts),
104 .initScript = &N(EVS_Init),
105 .statusTable = N(StatusTable),
106 .escapeChance = 80,
107 .airLiftChance = 70,
108 .hurricaneChance = 50,
109 .spookChance = 85,
110 .upAndAwayChance = 95,
111 .spinSmashReq = 4,
112 .powerBounceChance = 100,
113 .coinReward = 1,
114 .size = { 34, 18 },
115 .healthBarOffset = { 0, 0 },
116 .statusIconOffset = { -10, 20 },
117 .statusTextOffset = { 10, 20 },
118};
119
120s32 N(DefaultAnims)[] = {
131};
132
133s32 N(RockAnims)[] = {
136};
137
138s32 N(EmptyHoleAnims)[] = {
141};
142
143// unused
144s32 N(LeapAnims)[] = {
147};
148
150 {
152 .index = PRT_MAIN,
153 .posOffset = { 0, 0, 0 },
154 .targetOffset = { 0, 0 },
155 .opacity = 255,
156 .idleAnimations = N(EmptyHoleAnims),
157 .defenseTable = NULL,
158 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
159 .elementImmunityFlags = 0,
160 .projectileTargetOffset = { 0, 0 },
161 },
162};
163
166 IfEq(LVar0, TRUE)
167 Call(SetPartScale, ACTOR_SELF, PRT_MAIN, Float(0.4), Float(0.4), Float(0.4))
168 EndIf
169 Return
170 End
171};
172
173ActorBlueprint N(hole) = {
175 .type = ACTOR_TYPE_MONTY_HOLE,
176 .level = ACTOR_LEVEL_MONTY_HOLE,
177 .maxHP = 5,
178 .partCount = ARRAY_COUNT(N(HoleParts)),
179 .partsData = N(HoleParts),
180 .initScript = &N(EVS_Hole_Init),
181 .statusTable = NULL,
182 .escapeChance = 80,
183 .airLiftChance = 0,
184 .hurricaneChance = 80,
185 .spookChance = 80,
186 .upAndAwayChance = 90,
187 .spinSmashReq = 4,
188 .powerBounceChance = 90,
189 .coinReward = 2,
190 .size = { 32, 18 },
191 .healthBarOffset = { 0, 0 },
192 .statusIconOffset = { -10, 20 },
193 .statusTextOffset = { 10, 20 },
194};
195
197
199 ACTOR_BY_POS(N(hole), N(SummonPos), 0, FALSE),
200};
201
203 ACTOR_BY_POS(N(hole), N(SummonPos), 0, TRUE),
204};
205
210 Else
212 EndIf
214 Sub(LVar3, 1)
216 Return
217 End
218};
219
220EvtScript N(EVS_Init) = {
221 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
222 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
223 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
225 Return
226 End
227};
228
229EvtScript N(EVS_Idle) = {
230 Return
231 End
232};
233
234EvtScript N(EVS_HandleEvent) = {
244 Wait(8)
247 SetConst(LVar0, PRT_MAIN)
251 Wait(10)
252 Else
253 SetConst(LVar0, PRT_MAIN)
256 EndIf
259 SetConst(LVar0, PRT_MAIN)
264 SetConst(LVar0, PRT_MAIN)
269 SetConst(LVar0, PRT_MAIN)
272 Return
278 Call(SetAnimationRate, ACTOR_SELF, PRT_MAIN, Float(2.0))
280 Wait(80)
282 Call(SetAnimationRate, ACTOR_SELF, PRT_MAIN, Float(1.0))
284 Wait(20)
286 Wait(20)
287 Else
288 SetConst(LVar0, PRT_MAIN)
291 EndIf
294 SetConst(LVar0, PRT_MAIN)
298 Wait(10)
300 SetConst(LVar0, PRT_MAIN)
303 Return
306 Wait(8)
308 Wait(5)
310 Wait(8)
313 Wait(15)
315 Wait(15)
317 Wait(15)
320 Return
322 SetConst(LVar0, PRT_MAIN)
331 Else
334 Else
336 EndIf
338 EndIf
339 Wait(1000)
340 Return
343 Call(SetAnimationRate, ACTOR_SELF, PRT_MAIN, Float(2.0))
345 Wait(40)
347 Call(SetAnimationRate, ACTOR_SELF, PRT_MAIN, Float(1.0))
349 Wait(20)
351 Wait(20)
358 Return
359 End
360};
361
362EvtScript N(EVS_TakeTurn) = {
371 EndIf
374 Wait(20)
378 Wait(37)
380 Add(LVar1, 20)
382 Wait(1)
387 Else
389 EndIf
396 Set(LVarA, LVar0)
400 Sub(LVar0, 100)
401 Set(LVar1, -5)
409 EndIf
413 Return
423 Wait(2)
429 Sub(LVar0, 55)
430 Set(LVar1, 0)
435 Sub(LVar0, 20)
442 Return
443 End
444};
BSS s32 PopupMenu_SelectedIndex
Bytecode EvtScript[]
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2868
@ ACTOR_SOUND_FLY
Definition enums.h:2068
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3608
@ ELEMENT_END
Definition enums.h:2147
@ ELEMENT_NORMAL
Definition enums.h:2148
@ ACTOR_EVENT_FLAGS_NONE
Definition enums.h:3404
@ PHASE_FIRST_STRIKE
Definition enums.h:2092
@ STATUS_KEY_PARALYZE
Definition enums.h:2806
@ STATUS_TURN_MOD_DEFAULT
Definition enums.h:2832
@ STATUS_TURN_MOD_PARALYZE
Definition enums.h:2839
@ STATUS_KEY_FROZEN
Definition enums.h:2808
@ STATUS_TURN_MOD_SLEEP
Definition enums.h:2833
@ STATUS_TURN_MOD_DIZZY
Definition enums.h:2837
@ STATUS_TURN_MOD_UNUSED
Definition enums.h:2836
@ STATUS_KEY_STATIC
Definition enums.h:2812
@ STATUS_END
Definition enums.h:2801
@ STATUS_TURN_MOD_POISON
Definition enums.h:2838
@ STATUS_TURN_MOD_STOP
Definition enums.h:2842
@ STATUS_KEY_SLEEP
Definition enums.h:2807
@ STATUS_KEY_UNUSED
Definition enums.h:2804
@ STATUS_KEY_STONE
Definition enums.h:2813
@ STATUS_KEY_STOP
Definition enums.h:2809
@ STATUS_TURN_MOD_FROZEN
Definition enums.h:2835
@ STATUS_KEY_SHRINK
Definition enums.h:2811
@ STATUS_KEY_DIZZY
Definition enums.h:2805
@ STATUS_KEY_POISON
Definition enums.h:2810
@ STATUS_TURN_MOD_STATIC
Definition enums.h:2834
@ STATUS_KEY_NORMAL
Definition enums.h:2802
@ STATUS_TURN_MOD_SHRINK
Definition enums.h:2840
@ STATUS_KEY_DEFAULT
Definition enums.h:2803
@ HIT_RESULT_NO_DAMAGE
Definition enums.h:1978
@ HIT_RESULT_HIT
Definition enums.h:1976
@ HIT_RESULT_LUCKY
Definition enums.h:1981
@ HIT_RESULT_MISS
Definition enums.h:1982
@ BTL_CAM_DEFAULT
Definition enums.h:4409
@ EASING_LINEAR
Definition enums.h:510
@ IDLE_SCRIPT_ENABLE
Definition enums.h:5999
@ IDLE_SCRIPT_DISABLE
Definition enums.h:5998
@ STATUS_FLAG_SHRINK
Definition enums.h:2853
@ SOUND_BURROW_SURFACE
Definition enums.h:1120
@ SOUND_NONE
Definition enums.h:550
@ SOUND_BURROW_DIG
Definition enums.h:1121
@ SOUND_MOLE_THROW
Definition enums.h:1299
@ ACTOR_PLAYER
Definition enums.h:2118
@ ACTOR_SELF
Definition enums.h:2117
@ ACTOR_FLAG_NO_SHADOW
Hide shadow.
Definition enums.h:3359
@ ACTOR_FLAG_TARGET_ONLY
Battle ends even if undefeated. No turn.
Definition enums.h:3368
@ ACTOR_FLAG_NO_HEALTH_BAR
Definition enums.h:3371
@ ACTOR_FLAG_NO_DMG_APPLY
Damage is not applied to actor HP.
Definition enums.h:3374
@ ACTOR_FLAG_NO_ATTACK
Skip attack turn.
Definition enums.h:3373
@ EVENT_HIT
Definition enums.h:2165
@ EVENT_UP_AND_AWAY
Definition enums.h:2209
@ EVENT_SCARE_AWAY
Definition enums.h:2207
@ EVENT_BURN_HIT
Definition enums.h:2169
@ EVENT_IMMUNE
Definition enums.h:2179
@ EVENT_BURN_DEATH
Definition enums.h:2190
@ EVENT_ZERO_DAMAGE
Definition enums.h:2177
@ EVENT_HIT_COMBO
Definition enums.h:2164
@ EVENT_AIR_LIFT_FAILED
Definition enums.h:2185
@ EVENT_BEGIN_AIR_LIFT
Definition enums.h:2208
@ EVENT_DEATH
Definition enums.h:2186
@ EVENT_RECOVER_STATUS
Definition enums.h:2200
@ EVENT_BLOW_AWAY
Definition enums.h:2176
@ ACTOR_PART_FLAG_PRIMARY_TARGET
Definition enums.h:3396
@ ACTOR_PART_FLAG_SKIP_MOVEMENT_ALLOC
Definition enums.h:3400
@ ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION
Definition enums.h:3395
@ ACTOR_PART_FLAG_NO_TARGET
Cannot be targeted.
Definition enums.h:3394
@ ACTOR_PART_FLAG_DAMAGE_IMMUNE
electrified Plays extra hurt SFX?
Definition enums.h:3392
@ ACTOR_PART_FLAG_INVISIBLE
Definition enums.h:3384
@ DAMAGE_TYPE_SMASH
Definition enums.h:2891
@ DAMAGE_TYPE_TRIGGER_LUCKY
Definition enums.h:2915
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2912
EvtScript EVS_Enemy_Hit
EvtScript EVS_Enemy_Death
EvtScript EVS_Enemy_AirLift
EvtScript EVS_Enemy_BurnHit
EvtScript EVS_Enemy_NoDamageHit
#define Else
Marks the end of an if statement and the start of the else block.
Definition macros.h:296
#define Switch(LVAR)
Marks the start of a switch statement.
Definition macros.h:312
#define Ref(sym)
Address/pointer constant.
Definition macros.h:61
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:366
#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:320
#define EndChildThread
Marks the end of a child thread block.
Definition macros.h:564
#define Sub(VAR, INT_VALUE)
Definition macros.h:378
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:214
#define Add(VAR, INT_VALUE)
Definition macros.h:377
#define EndCaseGroup
Marks the end of a switch case group (CaseOrEq and/or CaseAndEq), stopping fallthrough.
Definition macros.h:353
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define Float(DOUBLE)
Definition macros.h:52
#define CaseOrEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR.
Definition macros.h:342
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:299
#define CaseDefault
Marks the start of a switch case that executes unconditionally. It also marks the end of any previous...
Definition macros.h:338
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:476
#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:289
#define LVar2
Definition macros.h:151
#define LVar1
Definition macros.h:150
#define LVarA
Definition macros.h:159
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:255
#define NPC_DISPOSE_LOCATION
Definition macros.h:170
#define EndSwitch
Marks the end of a switch statement and any case.
Definition macros.h:363
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
Definition macros.h:270
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:577
#define ChildThread
Marks the start of a child thread block.
Definition macros.h:561
#define LVar3
Definition macros.h:152
#define LVarE
Definition macros.h:163
#define LVar0
Definition macros.h:149
#define SetConst(VAR, CONST)
Sets the given variable to a given value, skipping the evt_get_variable call.
Definition macros.h:371
#define Return
Kills the current EVT thread.
Definition macros.h:218
#define ACTOR_BY_POS(_name, _pos, _priority, args...)
Definition battle.h:230
FormationRow Formation[]
Definition battle.h:167