Removed multiple instances of hardcoded move IDs (#6856)

This commit is contained in:
Eduardo Quezada 2025-05-14 16:40:10 -04:00 committed by GitHub
parent 3ef61e6451
commit 12bc5a10b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 16 additions and 17 deletions

View File

@ -2078,7 +2078,7 @@ static u32 GetBestMonIntegrated(struct Pokemon *party, int firstId, int lastId,
canSwitchinWin1v1 = CanSwitchinWin1v1(hitsToKOAI, GetNoOfHitsToKOBattlerDmg(damageDealt, opposingBattler), isSwitchinFirst, isFreeSwitch);
// Check for Baton Pass; hitsToKO requirements mean mon can boost and BP without dying whether it's slower or not
if (aiMove == MOVE_BATON_PASS)
if (GetMoveEffect(aiMove) == EFFECT_BATON_PASS)
{
if ((isSwitchinFirst && hitsToKOAI > 1) || hitsToKOAI > 2) // Need to take an extra hit if slower
bits |= 1u << i;

View File

@ -15,6 +15,7 @@
#include "trig.h"
#include "util.h"
#include "constants/abilities.h"
#include "constants/battle_move_effects.h"
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/moves.h"
@ -6931,7 +6932,7 @@ static void AnimTask_AllySwitchDataSwap(u8 taskId)
if (!IsBattlerAlly(gBattleStruct->moveTarget[i], battlerAtk))
continue;
if (gChosenMoveByBattler[i] == MOVE_SNIPE_SHOT || ability == ABILITY_PROPELLER_TAIL || ability == ABILITY_STALWART)
if (GetMoveEffect(gChosenMoveByBattler[i]) == EFFECT_SNIPE_SHOT || ability == ABILITY_PROPELLER_TAIL || ability == ABILITY_STALWART)
gBattleStruct->moveTarget[i] ^= BIT_FLANK;
}

View File

@ -485,11 +485,7 @@ void AnimRockFragment(struct Sprite *sprite)
// args[6] - attacker or target
void AnimParticleInVortex(struct Sprite *sprite)
{
if (IsDoubleBattle()
&& (gAnimMoveIndex == MOVE_BLEAKWIND_STORM
|| gAnimMoveIndex == MOVE_SANDSEAR_STORM
|| gAnimMoveIndex == MOVE_SPRINGTIDE_STORM
|| gAnimMoveIndex == MOVE_WILDBOLT_STORM))
if (IsDoubleBattle() && GetMoveTarget(gAnimMoveIndex) == MOVE_TARGET_BOTH)
InitSpritePosToAnimTargetsCentre(sprite, FALSE);
else
InitSpritePosToAnimBattler(gBattleAnimArgs[6], sprite, FALSE);

View File

@ -3381,7 +3381,7 @@ void SetMoveEffect(bool32 primary, bool32 certain)
// If the confusion is activating due to being released from Sky Drop, go to "confused due to fatigue" script.
// Otherwise, do normal confusion script.
if (gCurrentMove == MOVE_SKY_DROP)
if (GetMoveEffect(gCurrentMove) == EFFECT_SKY_DROP)
{
gBattleMons[gEffectBattler].status2 &= ~(STATUS2_LOCK_CONFUSE);
gBattlerAttacker = gEffectBattler;
@ -6895,9 +6895,11 @@ static void Cmd_moveend(void)
&& !TargetFullyImmuneToCurrMove(gBattlerAttacker, BATTLE_PARTNER(gBattlerTarget)))
gBattlerTarget = BATTLE_PARTNER(gBattlerTarget); // Target the partner in doubles for second hit.
enum BattleMoveEffects chosenEffect = GetMoveEffect(gChosenMove);
if (gBattleMons[gBattlerAttacker].hp
&& gBattleMons[gBattlerTarget].hp
&& (gChosenMove == MOVE_SLEEP_TALK || (gChosenMove == MOVE_SNORE) || !(gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP))
&& (chosenEffect == EFFECT_SLEEP_TALK || chosenEffect == EFFECT_SNORE || !(gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP))
&& !(gBattleMons[gBattlerAttacker].status1 & STATUS1_FREEZE))
{
if (gSpecialStatuses[gBattlerAttacker].parentalBondState)
@ -13614,7 +13616,7 @@ static void Cmd_copymovepermanently(void)
for (i = 0; i < MAX_MON_MOVES; i++)
{
if (gBattleMons[gBattlerAttacker].moves[i] == MOVE_SKETCH)
if (GetMoveEffect(gBattleMons[gBattlerAttacker].moves[i]) == EFFECT_SKETCH)
continue;
if (gBattleMons[gBattlerAttacker].moves[i] == gLastPrintedMoves[gBattlerTarget])
break;
@ -14390,7 +14392,7 @@ static void Cmd_recoverbasedonsunlight(void)
gBattlerTarget = gBattlerAttacker;
if (gBattleMons[gBattlerAttacker].hp != gBattleMons[gBattlerAttacker].maxHP)
{
if (gCurrentMove == MOVE_SHORE_UP)
if (GetMoveEffect(gCurrentMove) == EFFECT_SHORE_UP)
{
if (HasWeatherEffect() && gBattleWeather & B_WEATHER_SANDSTORM)
gBattleStruct->moveDamage[gBattlerAttacker] = 20 * GetNonDynamaxMaxHP(gBattlerAttacker) / 30;

View File

@ -6072,7 +6072,7 @@ static enum ItemEffect TryEjectPack(u32 battler, enum ItemCaseId caseID)
if (gProtectStructs[battler].statFell
&& !gProtectStructs[battler].disableEjectPack
&& CountUsablePartyMons(battler) > 0
&& !(gCurrentMove == MOVE_PARTING_SHOT && CanBattlerSwitch(gBattlerAttacker))) // Does not activate if attacker used Parting Shot and can switch out
&& !(GetMoveEffect(gCurrentMove) == EFFECT_PARTING_SHOT && CanBattlerSwitch(gBattlerAttacker))) // Does not activate if attacker used Parting Shot and can switch out
{
gProtectStructs[battler].statFell = FALSE;
gBattleScripting.battler = battler;
@ -7587,9 +7587,9 @@ u8 GetAttackerObedienceForAction()
}
// is not obedient
if (gCurrentMove == MOVE_RAGE)
gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_RAGE;
enum BattleMoveEffects moveEffect = GetMoveEffect(gCurrentMove);
if (moveEffect == EFFECT_RAGE)
gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_RAGE;
if (gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP && (moveEffect == EFFECT_SNORE || moveEffect == EFFECT_SLEEP_TALK))
return DISOBEYS_WHILE_ASLEEP;
@ -10853,9 +10853,9 @@ bool32 IsBattlerWeatherAffected(u32 battler, u32 weatherFlags)
// Possible return values are defined in battle.h following MOVE_TARGET_SELECTED
u32 GetBattlerMoveTargetType(u32 battler, u32 move)
{
if (move == MOVE_CURSE && !IS_BATTLER_OF_TYPE(battler, TYPE_GHOST))
return MOVE_TARGET_USER;
enum BattleMoveEffects effect = GetMoveEffect(move);
if (effect == EFFECT_CURSE && !IS_BATTLER_OF_TYPE(battler, TYPE_GHOST))
return MOVE_TARGET_USER;
if (effect == EFFECT_EXPANDING_FORCE && IsBattlerTerrainAffected(battler, STATUS_FIELD_PSYCHIC_TERRAIN))
return MOVE_TARGET_BOTH;
if (effect == EFFECT_TERA_STARSTORM && gBattleMons[battler].species == SPECIES_TERAPAGOS_STELLAR)

View File

@ -364,7 +364,7 @@ bool32 MoveSelectionDisplayZMove(u16 zmove, u32 battler)
gDisplayedStringBattle[1] = CHAR_HYPHEN;
StringCopy(gDisplayedStringBattle + 2, GetMoveName(move));
}
else if (zmove == MOVE_EXTREME_EVOBOOST)
else if (GetMoveEffect(zmove) == EFFECT_EXTREME_EVOBOOST)
{
// Damaging move -> status z move
StringCopy(gDisplayedStringBattle, sText_StatsPlus2);