Removed more instances of hardcoded move IDs (#8539)
Some checks are pending
CI / build (push) Waiting to run
CI / docs_validate (push) Waiting to run
CI / allcontributors (push) Waiting to run

This commit is contained in:
Eduardo Quezada 2025-12-14 19:59:53 -03:00 committed by GitHub
parent e65f30bf60
commit 5b458f54e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 132 deletions

View File

@ -5237,7 +5237,7 @@ static void CheckChangingTurnOrderEffects(void)
battler = gBattlerAttacker = gBattleStruct->quickClawBattlerId;
gBattleStruct->quickClawBattlerId++;
if (gChosenActionByBattler[battler] == B_ACTION_USE_MOVE
&& gChosenMoveByBattler[battler] != MOVE_FOCUS_PUNCH // quick claw message doesn't need to activate here
&& GetMoveEffect(gChosenMoveByBattler[battler]) != EFFECT_FOCUS_PUNCH // quick claw message doesn't need to activate here
&& (gProtectStructs[battler].usedCustapBerry || gProtectStructs[battler].quickDraw)
&& !(gBattleMons[battler].status1 & STATUS1_SLEEP)
&& !(gDisableStructs[gBattlerAttacker].truantCounter)

View File

@ -1499,49 +1499,6 @@ static const u8 sText_Your1[] = _("Your");
static const u8 sText_Opposing1[] = _("The opposing");
static const u8 sText_Your2[] = _("your");
static const u8 sText_Opposing2[] = _("the opposing");
// This is four lists of moves which use a different attack string in Japanese
// to the default. See the documentation for ChooseTypeOfMoveUsedString for more detail.
static const u16 sGrammarMoveUsedTable[] =
{
MOVE_SWORDS_DANCE, MOVE_STRENGTH, MOVE_GROWTH,
MOVE_HARDEN, MOVE_MINIMIZE, MOVE_SMOKESCREEN,
MOVE_WITHDRAW, MOVE_DEFENSE_CURL, MOVE_EGG_BOMB,
MOVE_SMOG, MOVE_BONE_CLUB, MOVE_FLASH, MOVE_SPLASH,
MOVE_ACID_ARMOR, MOVE_BONEMERANG, MOVE_REST, MOVE_SHARPEN,
MOVE_SUBSTITUTE, MOVE_MIND_READER, MOVE_SNORE,
MOVE_PROTECT, MOVE_SPIKES, MOVE_ENDURE, MOVE_ROLLOUT,
MOVE_SWAGGER, MOVE_SLEEP_TALK, MOVE_HIDDEN_POWER,
MOVE_PSYCH_UP, MOVE_EXTREME_SPEED, MOVE_FOLLOW_ME,
MOVE_TRICK, MOVE_ASSIST, MOVE_INGRAIN, MOVE_KNOCK_OFF,
MOVE_CAMOUFLAGE, MOVE_ASTONISH, MOVE_ODOR_SLEUTH,
MOVE_GRASS_WHISTLE, MOVE_SHEER_COLD, MOVE_MUDDY_WATER,
MOVE_IRON_DEFENSE, MOVE_BOUNCE, 0,
MOVE_TELEPORT, MOVE_RECOVER, MOVE_BIDE, MOVE_AMNESIA,
MOVE_FLAIL, MOVE_TAUNT, MOVE_BULK_UP, 0,
MOVE_MEDITATE, MOVE_AGILITY, MOVE_MIMIC, MOVE_DOUBLE_TEAM,
MOVE_BARRAGE, MOVE_TRANSFORM, MOVE_STRUGGLE, MOVE_SCARY_FACE,
MOVE_CHARGE, MOVE_WISH, MOVE_BRICK_BREAK, MOVE_YAWN,
MOVE_FEATHER_DANCE, MOVE_TEETER_DANCE, MOVE_MUD_SPORT,
MOVE_FAKE_TEARS, MOVE_WATER_SPORT, MOVE_CALM_MIND, 0,
MOVE_POUND, MOVE_SCRATCH, MOVE_VISE_GRIP,
MOVE_WING_ATTACK, MOVE_FLY, MOVE_BIND, MOVE_SLAM,
MOVE_HORN_ATTACK, MOVE_WRAP, MOVE_THRASH, MOVE_TAIL_WHIP,
MOVE_LEER, MOVE_BITE, MOVE_GROWL, MOVE_ROAR,
MOVE_SING, MOVE_PECK, MOVE_ABSORB, MOVE_STRING_SHOT,
MOVE_EARTHQUAKE, MOVE_FISSURE, MOVE_DIG, MOVE_TOXIC,
MOVE_SCREECH, MOVE_METRONOME, MOVE_LICK, MOVE_CLAMP,
MOVE_CONSTRICT, MOVE_POISON_GAS, MOVE_BUBBLE,
MOVE_SLASH, MOVE_SPIDER_WEB, MOVE_NIGHTMARE, MOVE_CURSE,
MOVE_FORESIGHT, MOVE_CHARM, MOVE_ATTRACT, MOVE_ROCK_SMASH,
MOVE_UPROAR, MOVE_SPIT_UP, MOVE_SWALLOW, MOVE_TORMENT,
MOVE_FLATTER, MOVE_ROLE_PLAY, MOVE_ENDEAVOR, MOVE_TICKLE,
MOVE_COVET, 0
};
static const u8 sText_EmptyStatus[] = _("$$$$$$$");
static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
@ -3554,86 +3511,6 @@ void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
}
}
// Loads one of two text strings into the provided buffer. This is functionally
// unused, since the value loaded into the buffer is not read; it loaded one of
// two particles (either "?" or "?") which works in tandem with ChooseTypeOfMoveUsedString
// below to effect changes in the meaning of the line.
static void UNUSED ChooseMoveUsedParticle(u8 *textBuff)
{
s32 counter = 0;
u32 i = 0;
while (counter != MAX_MON_MOVES)
{
if (sGrammarMoveUsedTable[i] == 0)
counter++;
if (sGrammarMoveUsedTable[i++] == gBattleMsgDataPtr->currentMove)
break;
}
if (counter >= 0)
{
if (counter <= 2)
StringCopy(textBuff, sText_SpaceIs); // is
else if (counter <= MAX_MON_MOVES)
StringCopy(textBuff, sText_ApostropheS); // 's
}
}
// Appends "!" to the text buffer `dst`. In the original Japanese this looked
// into the table of moves at sGrammarMoveUsedTable and varied the line accordingly.
//
// sText_ExclamationMark was a plain "!", used for any attack not on the list.
// It resulted in the translation "<NAME>'s <ATTACK>!".
//
// sText_ExclamationMark2 was "? ????!". This resulted in the translation
// "<NAME> used <ATTACK>!", which was used for all attacks in English.
//
// sText_ExclamationMark3 was "??!". This was used for those moves whose
// names were verbs, such as Recover, and resulted in translations like "<NAME>
// recovered itself!".
//
// sText_ExclamationMark4 was "? ??!" This resulted in a translation of
// "<NAME> did an <ATTACK>!".
//
// sText_ExclamationMark5 was " ????!" This resulted in a translation of
// "<NAME>'s <ATTACK> attack!".
static void UNUSED ChooseTypeOfMoveUsedString(u8 *dst)
{
s32 counter = 0;
s32 i = 0;
while (*dst != EOS)
dst++;
while (counter != MAX_MON_MOVES)
{
if (sGrammarMoveUsedTable[i] == MOVE_NONE)
counter++;
if (sGrammarMoveUsedTable[i++] == gBattleMsgDataPtr->currentMove)
break;
}
switch (counter)
{
case 0:
StringCopy(dst, sText_ExclamationMark);
break;
case 1:
StringCopy(dst, sText_ExclamationMark2);
break;
case 2:
StringCopy(dst, sText_ExclamationMark3);
break;
case 3:
StringCopy(dst, sText_ExclamationMark4);
break;
case 4:
StringCopy(dst, sText_ExclamationMark5);
break;
}
}
void BattlePutTextOnWindow(const u8 *text, u8 windowId)
{
const struct BattleWindowText *textInfo = sBattleTextOnWindowsInfo[gBattleScripting.windowsType];

View File

@ -9045,7 +9045,7 @@ u32 IsAbilityStatusProtected(u32 battler, enum Ability ability)
|| IsFlowerVeilProtected(battler);
}
static bool32 IsRototillerAffected(u32 battler)
static bool32 IsRototillerAffected(u32 battler, u32 move)
{
if (!IsBattlerAlive(battler))
return FALSE;
@ -9055,7 +9055,7 @@ static bool32 IsRototillerAffected(u32 battler)
return FALSE; // Only grass types affected
if (IsSemiInvulnerable(battler, CHECK_ALL))
return FALSE; // Rototiller doesn't affected semi-invulnerable battlers
if (BlocksPrankster(MOVE_ROTOTILLER, gBattlerAttacker, battler, FALSE))
if (BlocksPrankster(move, gBattlerAttacker, battler, FALSE))
return FALSE;
return TRUE;
}
@ -9810,8 +9810,9 @@ static u32 ChangeStatBuffs(u32 battler, s8 statValue, enum Stat statId, union St
if (statValue <= -1) // Stat decrease.
{
enum BattleMoveEffects effect = GetMoveEffect(gCurrentMove);
if (gSideTimers[GetBattlerSide(battler)].mistTimer
&& !flags.certain && gCurrentMove != MOVE_CURSE
&& !flags.certain && effect != EFFECT_CURSE
&& !(battler == gBattlerTarget && GetBattlerAbility(gBattlerAttacker) == ABILITY_INFILTRATOR))
{
if (flags.allowPtr)
@ -9830,13 +9831,13 @@ static u32 ChangeStatBuffs(u32 battler, s8 statValue, enum Stat statId, union St
}
return STAT_CHANGE_DIDNT_WORK;
}
else if (gCurrentMove != MOVE_CURSE
else if (effect != EFFECT_CURSE
&& !flags.notProtectAffected && JumpIfMoveAffectedByProtect(gCurrentMove, gBattlerTarget, TRUE, BattleScript_ButItFailed))
{
return STAT_CHANGE_DIDNT_WORK;
}
else if ((battlerHoldEffect == HOLD_EFFECT_CLEAR_AMULET || CanAbilityPreventStatLoss(battlerAbility))
&& (flags.statDropPrevention || gBattlerAttacker != gBattlerTarget || flags.mirrorArmored) && !flags.certain && gCurrentMove != MOVE_CURSE)
&& (flags.statDropPrevention || gBattlerAttacker != gBattlerTarget || flags.mirrorArmored) && !flags.certain && effect != EFFECT_CURSE)
{
if (flags.allowPtr)
{
@ -17380,7 +17381,7 @@ void BS_GetRototillerTargets(void)
for (u32 battler = 0; battler < gBattlersCount; battler++)
{
gSpecialStatuses[battler].rototillerAffected = FALSE;
if (IsRototillerAffected(battler))
if (IsRototillerAffected(battler, gCurrentMove))
{
gSpecialStatuses[battler].rototillerAffected = TRUE;
count++;

View File

@ -433,7 +433,7 @@ bool32 HandleMoveTargetRedirection(void)
redirectorOrderNum = GetBattlerTurnOrderNum(battler);
}
}
if (redirectorOrderNum != MAX_BATTLERS_COUNT && gCurrentMove != MOVE_TEATIME)
if (redirectorOrderNum != MAX_BATTLERS_COUNT && moveEffect != EFFECT_TEATIME)
{
enum Ability battlerAbility;
battler = gBattlerByTurnOrder[redirectorOrderNum];
@ -1932,7 +1932,8 @@ void TryClearRageAndFuryCutter(void)
s32 i;
for (i = 0; i < gBattlersCount; i++)
{
if (gBattleMons[i].volatiles.rage && gChosenMoveByBattler[i] != MOVE_RAGE)
u32 effect = GetMoveEffect(gChosenMoveByBattler[i]);
if (gBattleMons[i].volatiles.rage && effect != EFFECT_RAGE)
gBattleMons[i].volatiles.rage = FALSE;
}
}