Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
whacka.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "sprite/npc/Whacka.h"
4
5#define NAMESPACE A(whacka)
6
7extern EvtScript N(EVS_Init);
8extern EvtScript N(EVS_Idle);
9extern EvtScript N(EVS_TakeTurn);
12extern EvtScript N(EVS_Death);
13
14enum N(ActorPartIDs) {
15 PRT_MAIN = 1,
16};
17
18enum N(ActorVars) {
20};
21
22s32 N(DefaultAnims)[] = {
33};
34
35s32 N(DefenseTable)[] = {
38};
39
40s32 N(StatusTable)[] = {
63};
64
66 {
68 .index = PRT_MAIN,
69 .posOffset = { 0, 0, 0 },
70 .targetOffset = { 0, 30 },
71 .opacity = 255,
72 .idleAnimations = N(DefaultAnims),
73 .defenseTable = N(DefenseTable),
74 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
75 .elementImmunityFlags = 0,
76 .projectileTargetOffset = { 0, -5 },
77 },
78};
79
80ActorBlueprint NAMESPACE = {
82 .type = ACTOR_TYPE_WHACKA,
83 .level = ACTOR_LEVEL_WHACKA,
84 .maxHP = 99,
85 .partCount = ARRAY_COUNT(N(ActorParts)),
86 .partsData = N(ActorParts),
87 .initScript = &N(EVS_Init),
88 .statusTable = N(StatusTable),
89 .escapeChance = 0,
90 .airLiftChance = 0,
91 .hurricaneChance = 0,
92 .spookChance = 0,
93 .upAndAwayChance = 0,
94 .spinSmashReq = 4,
95 .powerBounceChance = 50,
96 .coinReward = 0,
97 .size = { 47, 32 },
98 .healthBarOffset = { 0, 0 },
99 .statusIconOffset = { -20, 40 },
100 .statusTextOffset = { 10, 30 },
101};
102
103API_CALLABLE(N(IsHitEightTimes)) {
104 script->varTable[0] = 0;
106 script->varTable[0] = 1;
107 }
108
109 return ApiStatus_DONE2;
110}
111
112EvtScript N(EVS_Init) = {
118 IfEq(LVar0, 0)
121 EndIf
122 Return
123 End
124};
125
126EvtScript N(EVS_Idle) = {
127 Label(0)
128 Wait(1)
129 Goto(0)
130 Return
131 End
132};
133
149 Call(RandInt, 100, LVar0)
150 IfLe(LVar0, 100)
152 Return
153 EndIf
160 Call(RandInt, 100, LVar0)
161 IfLe(LVar0, 100)
163 Return
164 EndIf
171 IfGe(100, 100)
173 Return
174 Else
178 Return
179 EndIf
184 Call(RandInt, 100, LVar0)
185 IfLe(LVar0, 100)
187 Return
188 EndIf
193 IfGe(100, 100)
195 Return
196 Else
200 Return
201 EndIf
219 Return
228 Call(RandInt, 100, LVar0)
229 IfLe(LVar0, 100)
231 Return
232 EndIf
237 Call(RandInt, 100, LVar0)
238 IfLe(LVar0, 100)
240 Return
241 EndIf
247 Wait(10)
248 IfGe(100, 100)
250 Return
251 Else
255 Return
256 EndIf
266 Return
275 Return
280 Return
281 End
282};
283
285 Call(RandInt, 100, LVar0)
286 IfLe(LVar0, 100)
288 Return
289 EndIf
290 Return
291 End
292};
293
297 Thread
298 Wait(15)
301 Add(LVar0, 5)
302 Add(LVar1, 20)
303 Add(LVar2, 10)
306 Return
307 End
308};
309
310EvtScript N(EVS_Death) = {
315 Wait(40)
319 EndIf
323 Return
324 End
325};
BSS s32 PopupMenu_SelectedIndex
Bytecode EvtScript[]
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_NORMAL
Definition enums.h:2115
@ ACTOR_EVENT_FLAGS_NONE
Definition enums.h:3370
@ ITEM_SPAWN_MODE_FALL_SPAWN_ALWAYS
Definition enums.h:2303
@ BS_FLAGS2_DROP_WHACKA_BUMP
Definition enums.h:3621
@ 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
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6407
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6406
@ SOUND_BURROW_DIG
Definition enums.h:1118
@ SOUND_HIT_WHACKA
Definition enums.h:1412
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_INVISIBLE
Actor is not rendered.
Definition enums.h:3324
@ ACTOR_FLAG_NO_SHADOW
Hide shadow.
Definition enums.h:3325
@ ACTOR_FLAG_NO_HEALTH_BAR
Definition enums.h:3337
@ 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
@ 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
@ ACTOR_PART_FLAG_NO_TARGET
Cannot be targeted.
Definition enums.h:3360
#define ApiStatus_DONE2
Definition evt.h:118
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1689
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_NoDamageHit
@ GB_IWA00_Whacka_HitCount
ApiStatus MakeItemEntity(Evt *script, b32 isInitialCall)
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 IfGe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR >= RVAR.
Definition macros.h:284
#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 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 Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define Label(LABEL_ID)
Marks this point in the script as a Goto target.
Definition macros.h:227
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define CaseDefault
Marks the start of a switch case that executes unconditionally. It also marks the end of any previous...
Definition macros.h:337
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:475
#define IfLe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR > RVAR.
Definition macros.h:281
#define Thread
Marks the start of a thread block.
Definition macros.h:544
#define EndThread
Marks the end of a thread block.
Definition macros.h:547
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#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 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