Skip to content

Commit

Permalink
Document Battler_StatusCondition
Browse files Browse the repository at this point in the history
  • Loading branch information
lhearachel committed Nov 8, 2023
1 parent a43f2c0 commit 5937b5c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 20 deletions.
8 changes: 8 additions & 0 deletions include/battle/btlcmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ enum CheckHaveOp {
};

enum StatusEffect {
STATUS_EFFECT_NONE = 0,

STATUS_EFFECT_SLEEP,
STATUS_EFFECT_POISON,
STATUS_EFFECT_BURN,
STATUS_EFFECT_FREEZE,
STATUS_EFFECT_PARALYSIS,

STATUS_EFFECT_LEVEL_UP = 8,

STATUS_EFFECT_STAGE_UP = 12,
Expand Down
12 changes: 11 additions & 1 deletion include/overlay016/ov16_0225177C.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "battle/battle_context.h"
#include "battle/battle_mon.h"
#include "battle/battle_message.h"
#include "battle/btlcmd.h"

enum BattleContextParam {
BATTLECTX_SIDE_CONDITIONS_MASK = 0,
Expand Down Expand Up @@ -403,7 +404,16 @@ void Battler_LockMoveChoice(BattleSystem *battleSys, BattleContext *battleCtx, i
* @param battler
*/
void Battler_UnlockMoveChoice(BattleSystem *battleSys, BattleContext *battleCtx, int battler);
int ov16_02253F7C(BattleContext * param0, int param1);

/**
* @brief Calculate the status effect value for a battler's non-volatile
* condition, if any.
*
* @param battleCtx
* @param battler
* @return A value representing the battler's status non-volatile status.
*/
enum StatusEffect Battler_StatusCondition(BattleContext *battleCtx, int battler);
BOOL BattleSystem_CheckTrainerMessage(BattleSystem * param0, BattleContext * param1);
void BattleContext_Init(BattleContext * param0);
void BattleContext_InitCounters(BattleSystem * param0, BattleContext * param1);
Expand Down
34 changes: 17 additions & 17 deletions src/overlay016/ov16_0225177C.c
Original file line number Diff line number Diff line change
Expand Up @@ -1843,23 +1843,23 @@ void Battler_UnlockMoveChoice(BattleSystem *battleSys, BattleContext *battleCtx,
battleCtx->battleMons[battler].moveEffectsData.furyCutterCount = 0;
}

int ov16_02253F7C (BattleContext * param0, int param1)
{
if (param0->battleMons[param1].status & 0x7) {
return 1;
} else if (param0->battleMons[param1].status & 0x8) {
return 2;
} else if (param0->battleMons[param1].status & 0x10) {
return 3;
} else if (param0->battleMons[param1].status & 0x20) {
return 4;
} else if (param0->battleMons[param1].status & 0x40) {
return 5;
} else if (param0->battleMons[param1].status & 0x80) {
return 2;
}

return 0;
enum StatusEffect Battler_StatusCondition(BattleContext *battleCtx, int battler)
{
if (battleCtx->battleMons[battler].status & MON_CONDITION_SLEEP) {
return STATUS_EFFECT_SLEEP;
} else if (battleCtx->battleMons[battler].status & MON_CONDITION_POISON) {
return STATUS_EFFECT_POISON;
} else if (battleCtx->battleMons[battler].status & MON_CONDITION_BURN) {
return STATUS_EFFECT_BURN;
} else if (battleCtx->battleMons[battler].status & MON_CONDITION_FREEZE) {
return STATUS_EFFECT_FREEZE;
} else if (battleCtx->battleMons[battler].status & MON_CONDITION_PARALYSIS) {
return STATUS_EFFECT_PARALYSIS;
} else if (battleCtx->battleMons[battler].status & MON_CONDITION_TOXIC) {
return STATUS_EFFECT_POISON;
}

return STATUS_EFFECT_NONE;
}

BOOL BattleSystem_CheckTrainerMessage (BattleSystem * param0, BattleContext * param1)
Expand Down
4 changes: 2 additions & 2 deletions src/overlay016/ov16_0226485C.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ void BattleIO_SlideHPGaugeIn (BattleSystem * param0, BattleContext * param1, int
v0.unk_02 = param1->battleMons[param2].curHP;
v0.unk_04 = param1->battleMons[param2].maxHP;
v0.unk_06 = param1->selectedPartySlot[param2];
v0.unk_07_0 = ov16_02253F7C(param1, param2);
v0.unk_07_0 = Battler_StatusCondition(param1, param2);

if (((param1->battleMons[param2].species == 29) || (param1->battleMons[param2].species == 32)) && (param1->battleMons[param2].hasNickname == 0)) {
v0.unk_07_5 = 2;
Expand Down Expand Up @@ -1241,7 +1241,7 @@ void BattleIO_RefreshHPGauge (BattleSystem * param0, BattleContext * param1, int
v0.unk_02 = param1->battleMons[param2].curHP;
v0.unk_04 = param1->battleMons[param2].maxHP;
v0.unk_06 = param1->selectedPartySlot[param2];
v0.unk_07_0 = ov16_02253F7C(param1, param2);
v0.unk_07_0 = Battler_StatusCondition(param1, param2);

if (((param1->battleMons[param2].species == 29) || (param1->battleMons[param2].species == 32)) && (param1->battleMons[param2].hasNickname == 0)) {
v0.unk_07_5 = 2;
Expand Down

0 comments on commit 5937b5c

Please sign in to comment.