Skip to content

Commit

Permalink
Document battle script commands 0x90 - 0xA6
Browse files Browse the repository at this point in the history
  • Loading branch information
lhearachel committed Nov 1, 2023
1 parent 63ae021 commit 221cde6
Show file tree
Hide file tree
Showing 6 changed files with 858 additions and 550 deletions.
31 changes: 28 additions & 3 deletions include/battle/btlcmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ enum OpCode {
VALOP_AND,
};

enum CheckAbilityOp {
CHECK_ABILITY_HAVE,
CHECK_ABILITY_NONE,
enum CheckHaveOp {
CHECK_HAVE,
CHECK_NOT_HAVE,
};

enum StatusEffect {
Expand Down Expand Up @@ -161,5 +161,30 @@ enum MessageStatusCondition {
MSGCOND_INFATUATION,
};

enum TurnFlag {
TURN_FLAG_STRUGGLING = 0,
TURN_FLAG_PP_DECREMENTED,
TURN_FLAG_PROTECTING,
TURN_FLAG_HELPING_HAND,
TURN_FLAG_MAGIC_COAT,
TURN_FLAG_SNATCHING,
TURN_FLAG_ROOSTING,
};

enum CheckSideConditionOp {
CHECK_SIDE_COND_VAL_ZERO = 0,
CHECK_SIDE_COND_VAL_NOT_ZERO,
CHECK_SIDE_COND_CLEAR,
};

enum SideCondition {
SIDE_COND_REFLECT_TURNS = 0,
SIDE_COND_LIGHT_SCREEN_TURNS,
SIDE_COND_MIST_TURNS,
SIDE_COND_SAFEGUARD_TURNS,
SIDE_COND_SPIKES_LAYERS,
SIDE_COND_TOXIC_SPIKES_LAYERS,
};

#endif // POKEPLATINUM_BATTLE_BTLCMD_H

1 change: 1 addition & 0 deletions include/battle/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#define ATTACKER_MOVE_SLOT (battleCtx->moveSlot[battleCtx->attacker])
#define ATTACKER_ACTION (battleCtx->battlerActions[battleCtx->attacker])
#define DEFENDER_ACTION (battleCtx->battlerActions[battleCtx->defender])

#define ATTACKER_TURN_FLAGS (battleCtx->turnFlags[battleCtx->attacker])
#define DEFENDER_TURN_FLAGS (battleCtx->turnFlags[battleCtx->defender])
Expand Down
11 changes: 10 additions & 1 deletion include/overlay016/ov16_0225177C.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,16 @@ void BattleSystem_SortMonsBySpeed(BattleSystem * param0, BattleContext * param1)
BOOL BattleSystem_FailsInHighGravity(BattleSystem * param0, BattleContext * param1, int param2, int param3);
BOOL BattleSystem_HealBlocked(BattleSystem * param0, BattleContext * param1, int param2, int param3);
void BattleSystem_UpdateLastResort(BattleSystem * param0, BattleContext * param1);
int ov16_02256128(BattleSystem * param0, BattleContext * param1, int param2);

/**
* @brief Count the number of moves known by a battler.
*
* @param battleSys
* @param battleCtx
* @param battler
* @return The number of moves known.
*/
int Battler_CountMoves(BattleSystem *battleSys, BattleContext *battleCtx, int battler);
int BattleSystem_CheckImmunityAbilities(BattleContext * param0, int param1, int param2);
BOOL BattleSystem_TriggerTurnEndAbility(BattleSystem * param0, BattleContext * param1, int param2);

Expand Down
2 changes: 1 addition & 1 deletion src/overlay014/ov14_0221FC20.c
Original file line number Diff line number Diff line change
Expand Up @@ -2307,7 +2307,7 @@ static void ov14_02221F1C (BattleSystem * param0, BattleContext * param1)
v1 = ov14_02222CF0(param1);
v2 = ov14_02222CF0(param1);
v0 = ov14_02222D34(param1, v1);
v3 = ov16_02256128(param0, param1, v0);
v3 = Battler_CountMoves(param0, param1, v0);

if ((param1->battleMons[v0].moveEffectsData.lastResortCount >= (v3 - 1)) && (v3 > 1)) {
ov14_02222D24(param1, v2);
Expand Down
Loading

0 comments on commit 221cde6

Please sign in to comment.