Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
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_power_bounce
8
10
12 7, 6, 5, 4, 3, 2, 1, 0
13};
14
15s32 N(BaseHitChance) = 200;
16
17API_CALLABLE(N(GetHitChance)) {
19 s32 powerBounceChance;
20
21 script->varTable[0] = 99;
22 powerBounceChance = targetActor->actorBlueprint->powerBounceChance;
24 powerBounceChance += 7;
25 }
26 N(BaseHitChance) = N(BaseHitChance) * powerBounceChance / 100;
27
28 if (N(BaseHitChance) < rand_int(100)) {
29 script->varTable[0] = 0;
30 }
31
32 return ApiStatus_DONE2;
33}
34
35BSS s32 N(HitCounter);
36
37API_CALLABLE(N(InitializeHitCounter)) {
38 N(HitCounter) = 0;
39 return ApiStatus_DONE2;
40}
41
42API_CALLABLE(N(IncrementHitCounter)) {
43 N(HitCounter)++;
44 return ApiStatus_DONE2;
45}
46
47API_CALLABLE(N(StoreHitCountRecord)) {
49
50 if (playerData->powerBounces < N(HitCounter)) {
52 }
53
54 return ApiStatus_DONE2;
55}
56
60
67 CaseEq(0)
68 Set(LVarC, 1)
70 CaseEq(1)
71 Set(LVarC, 2)
73 CaseEq(2)
74 Set(LVarC, 3)
78 Return
79 End
80};
81
96 Return
97 EndIf
98 Wait(1)
112 Return
120 Wait(5)
126 Set(LVarD, 0)
127 Set(LVarF, 0)
129 Label(10)
132 Wait(5)
140 Set(LVarA, 24)
142 CaseEq(0)
144 CaseEq(1)
146 CaseEq(2)
148 CaseEq(3)
153 Sub(LVarD, 1)
156 IfEq(LVarF, 0)
158 Else
160 EndIf
162 IfEq(LVar1, 1)
163 IfGe(LVarF, 3)
164 Set(LFlag0, TRUE)
165 EndIf
166 EndIf
169 Set(LFlag0, TRUE)
170 EndIf
171 Wait(1)
174 CaseGt(0)
178 Else
181 EndIf
187 CaseEq(0)
189 CaseEq(1)
191 CaseEq(2)
193 CaseEq(3)
204 Return
205 EndIf
207 Return
213 Return
214 EndIf
217 Add(LVarF, 1)
219 Goto(10)
220 Return
221 End
222};
223
238 Return
239 EndIf
240 Wait(1)
254 Return
262 Set(LVarD, 0)
263 Set(LVarF, 0)
265 Label(10)
268 Wait(5)
276 Set(LVarA, 37)
278 CaseEq(0)
280 CaseEq(1)
282 CaseEq(2)
284 CaseEq(3)
289 Sub(LVarD, 1)
293 IfEq(LVarF, 0)
295 Wait(7)
297 Else
299 Wait(7)
301 EndIf
304 IfEq(LVar1, 1)
305 IfGt(LVarF, 3)
306 Set(LFlag0, TRUE)
307 EndIf
308 EndIf
311 Set(LFlag0, TRUE)
312 EndIf
313 Wait(1)
320 Else
323 EndIf
329 CaseEq(0)
331 CaseEq(1)
333 CaseEq(2)
335 CaseEq(3)
346 Return
347 EndIf
349 Return
355 Return
356 EndIf
359 Add(LVarF, 1)
361 Goto(10)
362 Return
363 End
364};
365
380 Return
381 EndIf
382 Wait(1)
396 Return
404 Set(LVarD, 0)
405 // LVarF = iteration count
406 Set(LVarF, 0)
408 Label(10)
411 Wait(5)
419 Set(LVarA, 25)
421 CaseEq(0)
423 CaseEq(1)
425 CaseEq(2)
427 CaseEq(3)
432 Sub(LVarD, 1)
436 IfEq(LVarF, 0)
438 Else
440 EndIf
443 IfEq(LVar1, 1)
444 IfGt(LVarF, 3)
445 Set(LFlag0, TRUE)
446 EndIf
447 EndIf
450 Set(LFlag0, TRUE)
451 EndIf
452 Wait(1)
459 Else
462 EndIf
468 CaseEq(0)
470 CaseEq(1)
472 CaseEq(2)
474 CaseEq(3)
485 Return
486 EndIf
488 Return
494 Return
495 EndIf
498 Add(LVarF, 1)
500 Goto(10)
501 Return
502 End
503};
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_NO_RATING
Definition enums.h:3576
@ BS_FLAGS1_NICE_HIT
Definition enums.h:3575
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3574
@ 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 BSS
Definition macros.h:7
#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
PlayerData gPlayerData
Definition 77480.c:40