Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
tasty_tonic.c
Go to the documentation of this file.
1#include "common.h"
2#include "script_api/battle.h"
3#include "effects.h"
4#include "sprite/player.h"
5
6#define NAMESPACE battle_item_tasty_tonic
7
9
10API_CALLABLE(N(func_802A123C_72223C)) {
11 s32 actorId = evt_get_variable(script, *script->ptrReadPos);
12 Actor* actor = get_actor(actorId);
13 s32 id = actor->actorID & ACTOR_CLASS_MASK;
14
15 if (actor->debuff != 0) {
16 actor->debuffDuration = 0;
17 actor->debuff = 0;
19 }
20
21 if (actor->koStatus != 0) {
22 actor->koDuration = 0;
23 actor->koStatus = 0;
24
25 switch (id) {
27 break;
30 }
32 }
33
34 return ApiStatus_DONE2;
35}
36
38
39EvtScript N(EVS_UseItem) = {
40 SetConst(LVarA, ITEM_TASTY_TONIC)
41 ExecWait(battle_item_tasty_tonic_UseItemWithEffect)
42 Call(InitTargetIterator)
43 Call(GetOwnerTarget, LVar0, LVar1)
44 IfEq(LVar0, 0)
45 ExecWait(battle_item_tasty_tonic_DrinkItem)
46 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
47 Add(LVar1, 25)
48 Add(LVar2, 5)
50 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
51 Add(LVar1, 20)
52 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_ThumbsUp)
53 Wait(30)
54 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
55 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
56 Add(LVar2, 5)
58 Call(battle_item_tasty_tonic_func_802A123C_72223C, 0)
59 Wait(20)
60 Else
61 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
62 Add(LVar1, 25)
63 Add(LVar2, 5)
65 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
66 Add(LVar1, 20)
67 Wait(30)
68 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
69 Add(LVar2, 5)
71 Call(battle_item_tasty_tonic_func_802A123C_72223C, 256)
72 Wait(20)
73 EndIf
74 ExecWait(battle_item_tasty_tonic_PlayerGoHome)
75 Return
76 End
77};
struct EffectInstance * disableEffect
s16 hudElementDataIndex
Bytecode EvtScript[]
s8 debuffDuration
struct DisableXFXData * disableX
Definition effects.h:2529
EffectData data
Definition effects.h:2605
@ ACTOR_CLASS_PLAYER
Definition enums.h:2077
@ ACTOR_CLASS_PARTNER
Definition enums.h:2078
@ ACTOR_CLASS_MASK
Definition enums.h:2080
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_PARTNER
Definition enums.h:2086
@ EVENT_RECOVER_STATUS
Definition enums.h:2167
#define ApiStatus_DONE2
Definition evt.h:118
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1690
void remove_status_debuff(s32)
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
void dispatch_event_partner(s32)
Definition dmg_partner.c:7
ApiStatus ShowRecoveryShimmer(Evt *script, b32 isInitialCall)
ApiStatus ShowStartRecoveryShimmer(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 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 EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#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 LVarA
Definition macros.h:158
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#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