Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
putrid_piranha.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "sprite/npc/LargePiranha.h"
4
5#define NAMESPACE A(putrid_piranha)
6
7extern EvtScript N(EVS_Init);
8extern EvtScript N(EVS_Idle);
9extern EvtScript N(EVS_TakeTurn);
10extern EvtScript N(EVS_HandleEvent);
13
14enum N(ActorPartIDs) {
15 PRT_MAIN = 1,
16};
17
18enum N(ActorParams) {
19 DMG_BITE = 3,
20 DMG_BREATH = 2,
21};
22
23s32 N(DefaultAnims)[] = {
34};
35
36s32 N(DefenseTable)[] = {
38 ELEMENT_FIRE, 0,
40};
41
42s32 N(StatusTable)[] = {
65};
66
67ActorPartBlueprint N(ActorParts)[] = {
68 {
70 .index = PRT_MAIN,
71 .posOffset = { 0, 0, 0 },
72 .targetOffset = { -15, 50 },
73 .opacity = 255,
74 .idleAnimations = N(DefaultAnims),
75 .defenseTable = N(DefenseTable),
76 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
77 .elementImmunityFlags = 0,
78 .projectileTargetOffset = { 3, -14 },
79 },
80};
81
82ActorBlueprint NAMESPACE = {
83 .flags = 0,
86 .maxHP = 12,
87 .partCount = ARRAY_COUNT(N(ActorParts)),
88 .partsData = N(ActorParts),
89 .initScript = &N(EVS_Init),
90 .statusTable = N(StatusTable),
91 .escapeChance = 60,
92 .airLiftChance = 20,
93 .hurricaneChance = 20,
94 .spookChance = 30,
95 .upAndAwayChance = 95,
96 .spinSmashReq = 0,
97 .powerBounceChance = 95,
98 .coinReward = 1,
99 .size = { 60, 52 },
100 .healthBarOffset = { 0, 0 },
101 .statusIconOffset = { -22, 32 },
102 .statusTextOffset = { 1, 44 },
103};
104
105EvtScript N(EVS_Init) = {
106 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
107 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
108 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
109 Return
110 End
111};
112
114
115EvtScript N(EVS_Idle) = {
116 Label(0)
119 Call(SetTargetOffset, ACTOR_SELF, PRT_MAIN, -27, 33)
120 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_MAIN, 5, -11)
121 Call(N(SetAbsoluteStatusOffsets), -37, 9, -7, 31)
122 Else
123 Call(SetTargetOffset, ACTOR_SELF, PRT_MAIN, -15, 50)
124 Call(SetProjectileTargetOffset, ACTOR_SELF, PRT_MAIN, 3, -14)
125 Call(N(SetAbsoluteStatusOffsets), -22, 32, 1, 44)
126 EndIf
127 Wait(1)
128 Goto(0)
129 Return
130 End
131};
132
139 Return
140 End
141};
142
143EvtScript N(EVS_HandleEvent) = {
150 SetConst(LVar0, PRT_MAIN)
155 SetConst(LVar0, PRT_MAIN)
160 SetConst(LVar0, PRT_MAIN)
164 SetConst(LVar0, PRT_MAIN)
167 Return
169 SetConst(LVar0, PRT_MAIN)
173 SetConst(LVar0, PRT_MAIN)
176 SetConst(LVar0, PRT_MAIN)
179 Return
181 SetConst(LVar0, PRT_MAIN)
187 SetConst(LVar0, PRT_MAIN)
190 SetConst(LVar0, PRT_MAIN)
193 Return
197 SetConst(LVar0, PRT_MAIN)
202 SetConst(LVar0, PRT_MAIN)
205 Wait(10)
206 SetConst(LVar0, PRT_MAIN)
209 Return
211 SetConst(LVar0, PRT_MAIN)
215 SetConst(LVar0, PRT_MAIN)
219 Return
221 SetConst(LVar0, PRT_MAIN)
225 SetConst(LVar0, PRT_MAIN)
228 Return
233 Return
234 End
235};
236
237EvtScript N(EVS_TakeTurn) = {
241 Return
242 EndIf
243 Call(RandInt, 100, LVar0)
244 IfLt(LVar0, 70)
246 Else
248 EndIf
249 Return
250 End
251};
252
261 Wait(8)
264 Add(LVar0, 27)
265 Set(LVar1, 0)
266 Set(LVar3, LVar0)
267 Set(LVar4, LVar1)
268 Set(LVar5, LVar2)
270 Add(LVar3, LVar6)
271 Add(LVar4, LVar7)
272 Add(LVar5, LVar8)
273 Div(LVar3, 2)
274 Div(LVar4, 2)
275 Div(LVar5, 2)
280 Wait(20)
285 Wait(8)
286 Else
297 Add(LVar0, 10)
298 Else
299 Add(LVar0, 27)
300 EndIf
301 Set(LVar1, 0)
305 EndIf
306 Thread
307 Wait(8)
315 Wait(10)
317 Wait(6)
321 EndIf
322 Wait(14)
332 Wait(10)
338 Wait(10)
340 Else
341 Call(SetAnimationRate, ACTOR_SELF, PRT_MAIN, Float(2.0))
347 Call(SetAnimationRate, ACTOR_SELF, PRT_MAIN, Float(1.0))
348 EndIf
351 Return
355 Wait(10)
357 Wait(1)
358 Wait(2)
361 Set(LVarF, LVar0)
366 Wait(10)
368 Wait(20)
376 Wait(10)
382 Wait(10)
384 Else
387 EndIf
392 Return
393 End
394};
395
396#include "common/UnkEffect6FFunc.inc.c"
397
412 Add(LVar0, 16)
413 Else
414 Add(LVar0, 40)
415 EndIf
416 Set(LVar1, 0)
421 Wait(11)
427 Add(LVar0, 12)
428 Set(LVar1, 5)
429 SetF(LVar3, Float(0.4))
430 Else
431 Add(LVar0, 32)
432 Set(LVar1, 13)
433 SetF(LVar3, Float(1.0))
434 EndIf
435 Call(N(UnkEffect6FFunc), LVar2, LVar0, LVar1, LVar2, LVar3, 30, 120, 0, 120)
436 Wait(1)
438 Wait(5)
443 Wait(10)
447 EndIf
448 Wait(14)
451 Call(SetAnimationRate, ACTOR_SELF, PRT_MAIN, Float(2.0))
457 Call(SetAnimationRate, ACTOR_SELF, PRT_MAIN, Float(1.0))
460 Return
463 Wait(2)
466 Set(LVarF, LVar0)
471 Wait(10)
473 Wait(20)
481 Return
482 End
483};
BSS s32 PopupMenu_SelectedIndex
Bytecode EvtScript[]
@ BTL_CAM_XADJ_AVG
Definition enums.h:4899
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3574
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3570
@ ELEMENT_FIRE
Definition enums.h:2116
@ 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:4823
@ BTL_CAM_REPOSITION
Definition enums.h:4840
@ BTL_CAM_ENEMY_APPROACH
Definition enums.h:4884
@ SUPPRESS_EVENT_ALL
Definition enums.h:2907
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6407
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6406
@ STATUS_FLAG_SHRINK
Definition enums.h:2819
@ STATUS_FLAG_DIZZY
Definition enums.h:2818
@ STATUS_FLAG_POISON
Definition enums.h:2817
@ SOUND_BURROW_SURFACE
Definition enums.h:1117
@ SOUND_BURROW_DIG
Definition enums.h:1118
@ SOUND_PIRANHA_BREATH
Definition enums.h:1241
@ SOUND_PIRANHA_BITE
Definition enums.h:1508
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_NO_SHADOW
Hide shadow.
Definition enums.h:3325
@ BTL_CAM_YADJ_TARGET
Definition enums.h:4904
@ 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_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)
#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 LVar6
Definition macros.h:154
#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 LVarF
Definition macros.h:163
#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 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 LVar7
Definition macros.h:155
#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 SetF(VAR, FLOAT_VALUE)
Sets the given variable to a given value, but supports Floats.
Definition macros.h:373
#define Div(VAR, INT_VALUE)
Definition macros.h:379
#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 LVar8
Definition macros.h:156
#define LVar2
Definition macros.h:150
#define DMG_STATUS_KEY(typeFlag, duration, chance)
Definition macros.h:228
#define LVar1
Definition macros.h:149
#define LVarA
Definition macros.h:158
#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 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