Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
demo_power_bounce.c
Go to the documentation of this file.
1#include "common.h"
2#include "script_api/battle.h"
4#include "battle/battle.h"
5#include "sprite/player.h"
6
7#define NAMESPACE battle_move_demo_power_bounce
8
10
12 7, 6, 5, 4, 3, 2, 1, 0
13};
14
15s32 N(BaseHitChance) = 200;
16
17API_CALLABLE(N(GetHitChance)) {
20
21 script->varTable[0] = 99;
22
23 enemyTargetPowerBounceChance = enemyTargetActor->actorBlueprint->powerBounceChance;
24
27 }
28
30 N(BaseHitChance) /= 100;
31
32 if (N(BaseHitChance) < rand_int(100)) {
33 script->varTable[0] = 0;
34 }
35
36 return ApiStatus_DONE2;
37}
38
42
49 CaseEq(0)
50 Set(LVarC, 1)
52 CaseEq(1)
53 Set(LVarC, 2)
55 CaseEq(2)
56 Set(LVarC, 3)
59 Return
60 End
61};
62
77 Return
78 EndIf
79 Wait(1)
93 Return
101 Wait(5)
106 Set(LVarD, 0)
107 Set(LVarF, 0)
109 Label(10)
112 Wait(5)
120 Set(LVarA, 24)
122 CaseEq(0)
124 CaseEq(1)
126 CaseEq(2)
128 CaseEq(3)
133 Sub(LVarD, 1)
136 IfEq(LVarF, 0)
138 Else
140 EndIf
142 IfEq(LVar1, 1)
143 IfGe(LVarF, 3)
144 Set(LFlag0, TRUE)
145 EndIf
146 EndIf
149 Set(LFlag0, TRUE)
150 EndIf
151 Wait(1)
158 Else
161 EndIf
167 CaseEq(0)
169 CaseEq(1)
171 CaseEq(2)
173 CaseEq(3)
183 Return
189 Return
190 EndIf
193 Add(LVarF, 1)
194 Goto(10)
195 Return
196 End
197};
198
213 Return
214 EndIf
215 Wait(1)
229 Return
236 Set(LVarD, 0)
237 Set(LVarF, 0)
239 Label(10)
242 Wait(5)
250 Set(LVarA, 37)
252 CaseEq(0)
254 CaseEq(1)
256 CaseEq(2)
258 CaseEq(3)
263 Sub(LVarD, 1)
267 IfEq(LVarF, 0)
269 Wait(7)
271 Else
273 Wait(7)
275 EndIf
278 IfEq(LVar1, 1)
279 IfGt(LVarF, 3)
280 Set(LFlag0, TRUE)
281 EndIf
282 EndIf
285 Set(LFlag0, TRUE)
286 EndIf
287 Wait(1)
294 Else
297 EndIf
303 CaseEq(0)
305 CaseEq(1)
307 CaseEq(2)
309 CaseEq(3)
319 Return
325 Return
326 EndIf
329 Add(LVarF, 1)
330 Goto(10)
331 Return
332 End
333};
334
349 Return
350 EndIf
351 Wait(1)
365 Return
372 Set(LVarD, 0)
373 Set(LVarF, 0)
375 Label(10)
378 Wait(5)
386 Set(LVarA, 25)
388 CaseEq(0)
390 CaseEq(1)
392 CaseEq(2)
394 CaseEq(3)
399 Sub(LVarD, 1)
403 IfEq(LVarF, 0)
405 Else
407 EndIf
410 IfEq(LVar1, 1)
411 IfGt(LVarF, 3)
412 Set(LFlag0, TRUE)
413 EndIf
414 EndIf
417 Set(LFlag0, TRUE)
418 EndIf
419 Wait(1)
426 Else
429 EndIf
435 CaseEq(0)
437 CaseEq(1)
439 CaseEq(2)
441 CaseEq(3)
451 Return
457 Return
458 EndIf
461 Add(LVarF, 1)
462 Goto(10)
463 Return
464 End
465};
BSS s32 PopupMenu_SelectedIndex
@ AC_DIFFICULTY_2
Definition action_cmd.h:44
@ AC_DIFFICULTY_1
Definition action_cmd.h:43
@ AC_DIFFICULTY_3
Definition action_cmd.h:45
@ AC_DIFFICULTY_4
Definition action_cmd.h:46
@ AC_DIFFICULTY_5
Definition action_cmd.h:47
s16 targetActorID
Bytecode EvtScript[]
#define rand_int
@ ACTION_COMMAND_JUMP
Definition enums.h:3473
@ ACTOR_SOUND_HURT
Definition enums.h:2037
@ BS_FLAGS1_NICE_HIT
Definition enums.h:3575
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3574
@ BS_FLAGS1_AUTO_SUCCEED_ACTION
Definition enums.h:3580
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3570
@ PLAYER_ULTRA_JUMP_2
Definition enums.h:4314
@ PLAYER_ULTRA_JUMP_4
Definition enums.h:4316
@ PLAYER_SUPER_JUMP_3
Definition enums.h:4305
@ PLAYER_SUPER_JUMP_4
Definition enums.h:4306
@ PLAYER_SUPER_JUMP_5
Definition enums.h:4307
@ PLAYER_SUPER_JUMP_6
Definition enums.h:4308
@ HIT_RESULT_NO_DAMAGE
Definition enums.h:1952
@ HIT_RESULT_HIT
Definition enums.h:1950
@ HIT_RESULT_NICE_NO_DAMAGE
Definition enums.h:1953
@ HIT_RESULT_NICE
Definition enums.h:1951
@ HIT_RESULT_MISS
Definition enums.h:1956
@ BTL_CAM_PLAYER_PRE_ULTRA_JUMP_FINISH
Definition enums.h:4849
@ BTL_CAM_PLAYER_PRE_JUMP_FINISH
Definition enums.h:4848
@ BTL_CAM_PLAYER_JUMP_FINISH
Definition enums.h:4856
@ BTL_CAM_PLAYER_JUMP_MIDAIR
Definition enums.h:4855
@ PLAYER_BASIC_JUMP_3
Definition enums.h:4297
@ PLAYER_BASIC_JUMP_4
Definition enums.h:4298
@ PLAYER_BASIC_JUMP_0
Definition enums.h:4294
@ ABILITY_DODGE_MASTER
Definition enums.h:436
@ SOUND_ACTOR_JUMPED_2
Definition enums.h:778
@ SOUND_JUMP_COMBO_1
Definition enums.h:954
@ SOUND_ACTOR_JUMPED_1
Definition enums.h:777
@ SOUND_NONE
Definition enums.h:547
@ SOUND_JUMP_COMBO_4
Definition enums.h:957
@ SOUND_JUMP_COMBO_3
Definition enums.h:956
@ SOUND_ACTOR_JUMPED_3
Definition enums.h:779
@ SOUND_JUMP_COMBO_2
Definition enums.h:955
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_BLUR_ENABLE
Definition enums.h:6413
@ ACTOR_BLUR_DISABLE
Definition enums.h:6412
@ DAMAGE_TYPE_POWER_BOUNCE
Definition enums.h:2870
@ DAMAGE_TYPE_JUMP
Definition enums.h:2858
#define ApiStatus_DONE2
Definition evt.h:118
s32 is_ability_active(s32 arg0)
Definition inventory.c:1736
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
#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 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 EndChildThread
Marks the end of a child thread block.
Definition macros.h:563
#define Sub(VAR, INT_VALUE)
Definition macros.h:377
#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 LFlagA
Definition macros.h:177
#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 LVarC
Definition macros.h:160
#define IfGt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR <= RVAR.
Definition macros.h:278
#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 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 LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#define LFlag0
Definition macros.h:167
#define LVarA
Definition macros.h:158
#define LVarD
Definition macros.h:161
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
s32 Difficulty1D[8]
Definition macros.h:106
#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 ChildThread
Marks the start of a child thread block.
Definition macros.h:560
#define CaseGt(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:328
#define LVarE
Definition macros.h:162
#define LVar0
Definition macros.h:148
#define Return
Kills the current EVT thread.
Definition macros.h:217