Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
ghost_parakarry.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "sprite/npc/BattleParakarry.h"
4
5#define NAMESPACE A(parakarry_clone)
6
7extern EvtScript N(EVS_Init);
8extern EvtScript N(EVS_Idle);
9extern EvtScript N(EVS_TakeTurn);
10extern EvtScript N(EVS_HandleEvent);
11
12s32 N(DefaultAnims)[] = {
13 STATUS_KEY_NORMAL, ANIM_BattleParakarry_Idle,
14 STATUS_KEY_STONE, ANIM_BattleParakarry_Still,
15 STATUS_KEY_SLEEP, ANIM_BattleParakarry_Still,
16 STATUS_KEY_POISON, ANIM_BattleParakarry_Idle,
17 STATUS_KEY_STOP, ANIM_BattleParakarry_Still,
18 STATUS_KEY_STATIC, ANIM_BattleParakarry_Idle,
19 STATUS_KEY_PARALYZE, ANIM_BattleParakarry_Still,
20 STATUS_KEY_DIZZY, ANIM_BattleParakarry_Idle,
21 STATUS_KEY_FEAR, ANIM_BattleParakarry_Idle,
23};
24
25s32 N(DefenseTable)[] = {
28};
29
30s32 N(StatusTable)[] = {
53};
54
55ActorPartBlueprint N(ActorParts)[] = {
56 {
58 .index = PRT_MAIN,
59 .posOffset = { 0, 0, 0 },
60 .targetOffset = { -3, 32 },
61 .opacity = 255,
62 .idleAnimations = N(DefaultAnims),
63 .defenseTable = N(DefenseTable),
64 .eventFlags = 0,
65 .elementImmunityFlags = 0,
66 .projectileTargetOffset = { 0, -16 },
67 },
68 {
70 .index = PRT_TARGET,
71 .posOffset = { 0, 50, 0 },
72 .targetOffset = { -3, -18 },
73 .opacity = 255,
74 .idleAnimations = NULL,
75 .defenseTable = N(DefenseTable),
76 .eventFlags = 0,
77 .elementImmunityFlags = 0,
78 .projectileTargetOffset = { 0, -16 },
79 },
80};
81
82ActorBlueprint NAMESPACE = {
83 .flags = ACTOR_FLAG_FLYING,
84 .type = ACTOR_TYPE_GHOST_PARAKARRY,
85 .level = ACTOR_LEVEL_GHOST_PARAKARRY,
86 .maxHP = 15,
87 .partCount = ARRAY_COUNT(N(ActorParts)),
88 .partsData = N(ActorParts),
89 .initScript = &N(EVS_Init),
90 .statusTable = N(StatusTable),
91 .escapeChance = 50,
92 .airLiftChance = 80,
93 .hurricaneChance = 70,
94 .spookChance = 50,
95 .upAndAwayChance = 95,
96 .spinSmashReq = 0,
97 .powerBounceChance = 90,
98 .coinReward = 2,
99 .size = { 38, 38 },
100 .healthBarOffset = { 0, 0 },
101 .statusIconOffset = { -10, 20 },
102 .statusTextOffset = { 10, 20 },
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
113EvtScript N(EVS_Idle) = {
114 Return
115 End
116};
117
118EvtScript N(EVS_HandleEvent) = {
119 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
120 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
121 Call(GetLastEvent, ACTOR_SELF, LVar0)
125 Call(GetLastElement, LVar1)
127 SetConst(LVar0, PRT_MAIN)
128 SetConst(LVar1, ANIM_BattleParakarry_Hurt)
129 ExecWait(A(EVS_Duplighost_OnHitElectric))
130 Return
131 Else
132 SetConst(LVar0, PRT_MAIN)
133 SetConst(LVar1, ANIM_BattleParakarry_Hurt)
135 EndIf
138 SetConst(LVar0, PRT_MAIN)
139 SetConst(LVar1, ANIM_BattleParakarry_BurnHurt)
140 SetConst(LVar2, ANIM_BattleParakarry_BurnStill)
143 SetConst(LVar0, PRT_MAIN)
144 SetConst(LVar1, ANIM_BattleParakarry_BurnHurt)
145 SetConst(LVar2, ANIM_BattleParakarry_BurnStill)
147 ExecWait(A(EVS_Duplighost_OnDeath))
148 Wait(10)
149 SetConst(LVar0, PRT_MAIN)
150 SetConst(LVar1, ANIM_BattleParakarry_BurnStill)
152 Return
154 SetConst(LVar0, PRT_MAIN)
155 SetConst(LVar1, ANIM_BattleParakarry_Hurt)
158 ExecWait(A(EVS_Duplighost_OnDeath))
159 SetConst(LVar0, PRT_MAIN)
160 SetConst(LVar1, ANIM_BattleParakarry_Hurt)
162 SetConst(LVar0, PRT_MAIN)
163 SetConst(LVar1, ANIM_BattleParakarry_Hurt)
165 Return
167 SetConst(LVar0, PRT_MAIN)
168 SetConst(LVar1, ANIM_BattleParakarry_Hurt)
169 ExecWait(A(EVS_Duplighost_OnShockHit))
170 Return
172 ExecWait(A(EVS_Duplighost_OnDeath))
173 SetConst(LVar0, PRT_MAIN)
174 SetConst(LVar1, ANIM_BattleParakarry_HurtStill)
175 Set(LVar2, 22)
176 ExecWait(A(EVS_Duplighost_OnShockDeath))
177 SetConst(LVar0, PRT_MAIN)
178 SetConst(LVar1, ANIM_BattleParakarry_Hurt)
180 Return
184 SetConst(LVar0, PRT_MAIN)
185 SetConst(LVar1, ANIM_BattleParakarry_Idle)
189 ExecWait(A(EVS_Duplighost_OnDeath))
190 SetConst(LVar0, PRT_MAIN)
191 SetConst(LVar1, ANIM_BattleParakarry_Hurt)
193 Wait(10)
194 SetConst(LVar0, PRT_MAIN)
195 SetConst(LVar1, ANIM_BattleParakarry_Hurt)
197 Return
199 SetConst(LVar0, PRT_MAIN)
200 SetConst(LVar1, ANIM_BattleParakarry_Idle)
203 SetConst(LVar0, PRT_MAIN)
204 SetConst(LVar1, ANIM_BattleParakarry_Run)
205 SetConst(LVar2, ANIM_BattleParakarry_Hurt)
207 Return
209 SetConst(LVar0, PRT_MAIN)
210 SetConst(LVar1, ANIM_BattleParakarry_Run)
213 Call(GetStatusFlags, ACTOR_SELF, LVar0)
216 Call(SetActorDispOffset, ACTOR_SELF, 0, 1, 0)
217 Else
218 Call(SetActorDispOffset, ACTOR_SELF, 0, 3, 0)
219 EndIf
220 EndIf
221 SetConst(LVar0, PRT_MAIN)
222 SetConst(LVar1, ANIM_BattleParakarry_Hurt)
224 Return
227 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
228 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
229 Return
230 End
231};
232
233EvtScript N(EVS_Attack_SkyDive) = {
234 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
235 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
236 Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER)
237 Call(UseBattleCamPreset, BTL_CAM_ENEMY_APPROACH)
238 Call(BattleCamTargetActor, ACTOR_SELF)
239 Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_TARGET, BTL_CAM_XADJ_AVG, FALSE)
240 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleParakarry_Run)
241 Call(SetGoalToTarget, ACTOR_SELF)
242 Call(AddGoalPos, ACTOR_SELF, 20, 0, 0)
243 Call(SetActorSpeed, ACTOR_SELF, Float(4.0))
244 Call(FlyToGoal, ACTOR_SELF, 0, -10, EASING_COS_IN_OUT)
245 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleParakarry_Still)
246 Wait(3)
247 Call(UseBattleCamPresetImmediately, BTL_CAM_INTERRUPT)
249 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_PARAKARRY_PREDIVE)
250 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleParakarry_FlyFast)
251 Call(AddGoalPos, ACTOR_SELF, 0, 10, 0)
252 Call(FlyToGoal, ACTOR_SELF, 5, 0, EASING_LINEAR)
253 Wait(2)
254 Thread
255 Wait(3)
256 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleParakarry_PreDive)
258 Call(AddGoalPos, ACTOR_SELF, 40, 15, 0)
259 Call(FlyToGoal, ACTOR_SELF, 20, -20, EASING_QUARTIC_OUT)
260 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_PARAKARRY_DIVE)
261 Call(EnableActorBlur, ACTOR_SELF, ACTOR_BLUR_ENABLE)
262 Call(SetGoalToTarget, ACTOR_SELF)
263 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleParakarry_Dive)
264 Call(FlyToGoal, ACTOR_SELF, 5, 0, EASING_LINEAR)
265 Call(EnemyTestTarget, ACTOR_SELF, LVar0, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS)
269 Set(LVarA, LVar0)
270 Thread
271 Wait(5)
272 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleParakarry_Idle)
274 Call(SetGoalToTarget, ACTOR_SELF)
275 Call(AddGoalPos, ACTOR_SELF, -40, 10, 0)
276 Call(FlyToGoal, ACTOR_SELF, 10, -20, EASING_QUADRATIC_OUT)
278 Call(EnemyTestTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_TRIGGER_LUCKY, 0, 0, 0)
279 EndIf
280 Wait(20)
281 Call(EnableActorBlur, ACTOR_SELF, ACTOR_BLUR_DISABLE)
282 Wait(15)
283 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
284 Call(YieldTurn)
285 Call(SetGoalToHome, ACTOR_SELF)
286 Call(SetActorSpeed, ACTOR_SELF, Float(6.0))
287 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleParakarry_Run)
288 Call(FlyToGoal, ACTOR_SELF, 0, -5, EASING_LINEAR)
289 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
290 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
291 Return
294 Call(EnableActorBlur, ACTOR_SELF, ACTOR_BLUR_DISABLE)
295 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleParakarry_PostDive)
296 Wait(1)
297 Call(GetActorVar, ACTOR_SELF, AVAR_Copy_PartnerLevel, LVar9)
300 Wait(2)
301#if VERSION_JP
302 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, 0, 0, 0, 1, BS_FLAGS1_TRIGGER_EVENTS)
303#else
304 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, 0, 0, 0, 2, BS_FLAGS1_TRIGGER_EVENTS)
305#endif
307 Wait(2)
308 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, 0, 0, 0, 3, BS_FLAGS1_TRIGGER_EVENTS)
310 Wait(2)
311 Call(EnemyDamageTarget, ACTOR_SELF, LVar0, 0, 0, 0, 5, BS_FLAGS1_TRIGGER_EVENTS)
317 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
318 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleParakarry_Dive)
319 Call(SetActorJumpGravity, ACTOR_SELF, Float(1.4))
320 Call(AddGoalPos, ACTOR_SELF, 50, 0, 0)
321 Call(JumpToGoal, ACTOR_SELF, 15, FALSE, FALSE, FALSE)
322 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleParakarry_Still)
323 Thread
324 Wait(4)
325 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleParakarry_Run)
327 Call(AddGoalPos, ACTOR_SELF, 30, 0, 0)
328 Call(JumpWithBounce, ACTOR_SELF, 10, Float(4.0))
329 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleParakarry_Idle)
330 Wait(6)
331 Call(YieldTurn)
332 Call(SetGoalToHome, ACTOR_SELF)
333 Call(SetActorSpeed, ACTOR_SELF, Float(6.0))
334 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleParakarry_Run)
335 Call(FlyToGoal, ACTOR_SELF, 0, -5, EASING_LINEAR)
338 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
339 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
340 Return
341 End
342};
343
344EvtScript N(EVS_TakeTurn) = {
345 ExecWait(N(EVS_Attack_SkyDive))
346 Return
347 End
348};
349
350Formation A(ParakarryCloneFormation) = {
351 ACTOR_BY_POS(NAMESPACE, A(DuplighostSummonPos), 0),
352};
Bytecode EvtScript[]
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2834
@ BTL_CAM_XADJ_AVG
Definition enums.h:4900
@ ACTOR_SOUND_FLY
Definition enums.h:2035
@ 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
@ 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_INTERRUPT
Definition enums.h:4823
@ BTL_CAM_ENEMY_APPROACH
Definition enums.h:4885
@ EASING_COS_IN_OUT
Definition enums.h:520
@ EASING_QUARTIC_OUT
Definition enums.h:516
@ EASING_QUADRATIC_OUT
Definition enums.h:514
@ EASING_LINEAR
Definition enums.h:510
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6408
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6407
@ PARTNER_RANK_NORMAL
Definition enums.h:2018
@ PARTNER_RANK_SUPER
Definition enums.h:2019
@ PARTNER_RANK_ULTRA
Definition enums.h:2020
@ STATUS_FLAG_SHRINK
Definition enums.h:2819
@ SOUND_PARAKARRY_PREDIVE
Definition enums.h:1315
@ SOUND_NONE
Definition enums.h:547
@ SOUND_PARAKARRY_DIVE
Definition enums.h:1316
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_FLYING
Quake Hammer can't hit.
Definition enums.h:3329
@ BTL_CAM_YADJ_TARGET
Definition enums.h:4905
@ ACTOR_BLUR_ENABLE
Definition enums.h:6414
@ ACTOR_BLUR_DISABLE
Definition enums.h:6413
@ 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_SKIP_MOVEMENT_ALLOC
Definition enums.h:3366
@ ACTOR_PART_FLAG_NO_TARGET
Cannot be targeted.
Definition enums.h:3360
@ ACTOR_PART_FLAG_INVISIBLE
Definition enums.h:3350
@ DAMAGE_TYPE_SHOCK
Definition enums.h:2856
@ 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_AirLift
EvtScript EVS_Enemy_BlowAway
EvtScript EVS_Enemy_Recover
EvtScript EVS_Enemy_BurnHit
EvtScript EVS_Enemy_NoDamageHit
ApiStatus PlaySound(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 End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#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 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 Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define LVar9
Definition macros.h:157
#define A(sym)
Definition macros.h:36
#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
#define ACTOR_BY_POS(_name, _pos, _priority, args...)
Definition battle.h:230
FormationRow Formation[]
Definition battle.h:167