From e3f7f47321bbe399dfcfc422d53d9beb5caab788 Mon Sep 17 00:00:00 2001 From: Thomas Winwood Date: Wed, 20 Nov 2019 16:37:14 +0000 Subject: [PATCH] Turn some magic numbers into named constants --- src/battle_script_commands.c | 4 ++-- src/field_control_avatar.c | 7 ++++--- src/pokemon.c | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 33c5f661b..eab7b7d04 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4555,7 +4555,7 @@ static void Cmd_moveend(void) case MOVEEND_CHOICE_MOVE: // update choice band move if (gHitMarker & HITMARKER_OBEYS && holdEffectAtk == HOLD_EFFECT_CHOICE_BAND - && gChosenMove != MOVE_STRUGGLE + && gChosenMove != MOVE_STRUGGLE && (*choicedMoveAtk == 0 || *choicedMoveAtk == 0xFFFF)) { if (gChosenMove == MOVE_BATON_PASS && !(gMoveResultFlags & MOVE_RESULT_FAILED)) @@ -7826,7 +7826,7 @@ static void Cmd_weatherdamage(void) gBattleMoveDamage = 0; } } - if (gBattleWeather & WEATHER_HAIL) + if (gBattleWeather & WEATHER_HAIL_ANY) { if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE) && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND) diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 41b7a4dbf..8b4c7380c 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -30,6 +30,7 @@ #include "wild_encounter.h" #include "constants/bg_event_constants.h" #include "constants/event_objects.h" +#include "constants/field_poison.h" #include "constants/map_types.h" #include "constants/maps.h" #include "constants/songs.h" @@ -647,11 +648,11 @@ static bool8 UpdatePoisonStepCounter(void) { switch (DoPoisonFieldEffect()) { - case 0: + case FLDPSN_NONE: return FALSE; - case 1: + case FLDPSN_PSN: return FALSE; - case 2: + case FLDPSN_FNT: return TRUE; } } diff --git a/src/pokemon.c b/src/pokemon.c index a30e20ea2..eba5a2ce2 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -3271,7 +3271,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de } // any weather except sun weakens solar beam - if ((gBattleWeather & (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_HAIL)) && gCurrentMove == MOVE_SOLAR_BEAM) + if ((gBattleWeather & (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_HAIL_ANY)) && gCurrentMove == MOVE_SOLAR_BEAM) damage /= 2; // sunny