Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
clubba.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "sprite/npc/BattleClubba.h"
4
5#define NAMESPACE A(clubba)
6
7extern EvtScript N(EVS_Init);
8extern EvtScript N(EVS_Idle);
9extern EvtScript N(EVS_TakeTurn);
10extern EvtScript N(EVS_HandleEvent);
11
12enum N(ActorPartIDs) {
13 PRT_MAIN = 1,
14};
15
16enum N(ActorParams) {
17 DMG_SWING = 3,
18};
19
20s32 N(DefaultAnims)[] = {
21 STATUS_KEY_NORMAL, ANIM_BattleClubba_Anim01,
22 STATUS_KEY_STONE, ANIM_BattleClubba_Anim00,
23 STATUS_KEY_SLEEP, ANIM_BattleClubba_Anim03,
24 STATUS_KEY_POISON, ANIM_BattleClubba_Anim01,
25 STATUS_KEY_STOP, ANIM_BattleClubba_Anim00,
26 STATUS_KEY_STATIC, ANIM_BattleClubba_Anim01,
27 STATUS_KEY_PARALYZE, ANIM_BattleClubba_Anim00,
28 STATUS_KEY_DIZZY, ANIM_BattleClubba_Anim05,
29 STATUS_KEY_FEAR, ANIM_BattleClubba_Anim05,
31};
32
33s32 N(DefenseTable)[] = {
36};
37
38s32 N(StatusTable)[] = {
45 STATUS_KEY_FEAR, 100,
61};
62
63ActorPartBlueprint N(ActorParts)[] = {
64 {
66 .index = PRT_MAIN,
67 .posOffset = { 0, 0, 0 },
68 .targetOffset = { -12, 32 },
69 .opacity = 255,
70 .idleAnimations = N(DefaultAnims),
71 .defenseTable = N(DefenseTable),
72 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
73 .elementImmunityFlags = 0,
74 .projectileTargetOffset = { 8, -3 },
75 },
76};
77
78ActorBlueprint NAMESPACE = {
79 .flags = 0,
80 .type = ACTOR_TYPE_CLUBBA,
81 .level = ACTOR_LEVEL_CLUBBA,
82 .maxHP = 8,
83 .partCount = ARRAY_COUNT(N(ActorParts)),
84 .partsData = N(ActorParts),
85 .initScript = &N(EVS_Init),
86 .statusTable = N(StatusTable),
87 .escapeChance = 60,
88 .airLiftChance = 60,
89 .hurricaneChance = 70,
90 .spookChance = 70,
91 .upAndAwayChance = 95,
92 .spinSmashReq = 0,
93 .powerBounceChance = 80,
94 .coinReward = 1,
95 .size = { 42, 42 },
96 .healthBarOffset = { 0, 0 },
97 .statusIconOffset = { -10, 20 },
98 .statusTextOffset = { 10, 35 },
99};
100
101EvtScript N(EVS_Init) = {
102 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
103 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
104 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
105 Return
106 End
107};
108
109EvtScript N(EVS_Idle) = {
110 Return
111 End
112};
113
114EvtScript N(EVS_HandleEvent) = {
115 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
116 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
117 Call(GetLastEvent, ACTOR_SELF, LVar0)
121 SetConst(LVar0, PRT_MAIN)
122 SetConst(LVar1, ANIM_BattleClubba_Anim04)
126 SetConst(LVar0, PRT_MAIN)
127 SetConst(LVar1, ANIM_BattleClubba_Anim06)
128 SetConst(LVar2, ANIM_BattleClubba_Anim07)
131 SetConst(LVar0, PRT_MAIN)
132 SetConst(LVar1, ANIM_BattleClubba_Anim06)
133 SetConst(LVar2, ANIM_BattleClubba_Anim07)
135 SetConst(LVar0, PRT_MAIN)
136 SetConst(LVar1, ANIM_BattleClubba_Anim07)
138 Return
140 SetConst(LVar0, PRT_MAIN)
141 SetConst(LVar1, ANIM_BattleClubba_Anim04)
144 SetConst(LVar0, PRT_MAIN)
145 SetConst(LVar1, ANIM_BattleClubba_Anim04)
147 SetConst(LVar0, PRT_MAIN)
148 SetConst(LVar1, ANIM_BattleClubba_Anim04)
150 Return
152 SetConst(LVar0, PRT_MAIN)
153 SetConst(LVar1, ANIM_BattleClubba_Anim04)
155 SetConst(LVar0, PRT_MAIN)
156 SetConst(LVar1, ANIM_BattleClubba_Anim04)
158 SetConst(LVar0, PRT_MAIN)
159 SetConst(LVar1, ANIM_BattleClubba_Anim02)
162 SetConst(LVar0, PRT_MAIN)
163 SetConst(LVar1, ANIM_BattleClubba_Anim04)
165 SetConst(LVar0, PRT_MAIN)
166 SetConst(LVar1, ANIM_BattleClubba_Anim04)
168 Return
172 SetConst(LVar0, PRT_MAIN)
173 SetConst(LVar1, ANIM_BattleClubba_Anim01)
177 SetConst(LVar0, PRT_MAIN)
178 SetConst(LVar1, ANIM_BattleClubba_Anim04)
180 Wait(10)
181 SetConst(LVar0, PRT_MAIN)
182 SetConst(LVar1, ANIM_BattleClubba_Anim04)
184 Return
186 SetConst(LVar0, PRT_MAIN)
187 SetConst(LVar1, ANIM_BattleClubba_Anim01)
190 SetConst(LVar0, PRT_MAIN)
191 SetConst(LVar1, ANIM_BattleClubba_Anim02)
192 SetConst(LVar2, ANIM_BattleClubba_Anim04)
194 Return
196 SetConst(LVar0, PRT_MAIN)
197 SetConst(LVar1, ANIM_BattleClubba_Anim04)
200 SetConst(LVar0, PRT_MAIN)
201 SetConst(LVar1, ANIM_BattleClubba_Anim04)
203 Return
206 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
207 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
208 Return
209 End
210};
211
212EvtScript N(EVS_TakeTurn) = {
213 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
214 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
215 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
216 Call(UseBattleCamPreset, BTL_CAM_ENEMY_APPROACH)
217 Call(BattleCamTargetActor, ACTOR_SELF)
218 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
219 Call(GetBattlePhase, LVar0)
221 Call(SetGoalToTarget, ACTOR_SELF)
222 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
223 Add(LVar0, 27)
224 Set(LVar1, 0)
225 Sub(LVar2, 6)
226 Call(SetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
227 Wait(15)
228 Else
229 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleClubba_Anim02)
230 Call(SetActorSpeed, ACTOR_SELF, Float(4.0))
231 Call(SetGoalToTarget, ACTOR_SELF)
232 Call(GetStatusFlags, ACTOR_SELF, LVar0)
234 Call(AddGoalPos, ACTOR_SELF, 27, 0, -6)
235 Else
236 Call(AddGoalPos, ACTOR_SELF, 10, 0, -6)
237 EndIf
238 Call(RunToGoal, ACTOR_SELF, 0, FALSE)
239 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleClubba_Anim01)
240 Wait(10)
241 EndIf
242 Call(EnemyTestTarget, ACTOR_SELF, LVar0, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS)
246 Set(LVarA, LVar0)
247 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_CLUBBA_SWING)
248 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleClubba_Anim08)
249 Wait(10)
251 Call(EnemyTestTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
252 Wait(20)
253 EndIf
254 Call(YieldTurn)
255 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
256 Call(SetActorYaw, ACTOR_SELF, 180)
257 Call(AddActorDecoration, ACTOR_SELF, PRT_MAIN, 0, ACTOR_DECORATION_SWEAT)
258 SetConst(LVar0, PRT_MAIN)
259 SetConst(LVar1, ANIM_BattleClubba_Anim02)
261 Call(RemoveActorDecoration, ACTOR_SELF, PRT_MAIN, 0)
262 Call(SetActorYaw, ACTOR_SELF, 0)
263 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
264 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
265 Return
268 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleClubba_Anim09)
269 Wait(15)
270 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_CLUBBA_SWING)
271 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleClubba_Anim0A)
272 Wait(2)
273 Wait(2)
274 Call(SetGoalToTarget, ACTOR_SELF)
275 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_NO_CONTACT, 0, 0, DMG_SWING, BS_FLAGS1_TRIGGER_EVENTS)
279 Thread
280 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.5))
282 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
283 Wait(19)
284 Call(YieldTurn)
285 SetConst(LVar0, PRT_MAIN)
286 SetConst(LVar1, ANIM_BattleClubba_Anim02)
290 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
291 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
292 Return
293 End
294};
Bytecode EvtScript[]
@ 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
@ 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
@ SOUND_CLUBBA_SWING
Definition enums.h:1484
@ 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
@ CAM_BATTLE
Definition enums.h:1801
@ DAMAGE_TYPE_TRIGGER_LUCKY
Definition enums.h:2881
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2878
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 ShakeCam(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 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 ARRAY_COUNT(arr)
Definition macros.h:40
#define Float(DOUBLE)
Definition macros.h:51
#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 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 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 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 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