Fix typos and some cleanup (mainly in battle files) (#7107)

This commit is contained in:
PhallenTree 2025-06-13 13:12:13 +01:00 committed by GitHub
parent 6cb5016113
commit a000a743df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 44 additions and 48 deletions

View File

@ -1390,8 +1390,8 @@
.byte \battler
.endm
.macro tryintimidatejectpack
callnative BS_TryIntimidatEjectpack
.macro tryintimidateejectpack
callnative BS_TryIntimidateEjectPack
.endm
.macro allyswitchswapbattlers

View File

@ -2704,7 +2704,7 @@ BattleScript_TryTailwindAbilitiesLoop_WindPower:
waitmessage B_WAIT_TIME_LONG
goto BattleScript_TryTailwindAbilitiesLoop_Increment
BattleScript_EffectMircleEye::
BattleScript_EffectMiracleEye::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
@ -7658,7 +7658,7 @@ BattleScript_IntimidateLoopIncrement:
destroyabilitypopup
restoretarget
pause B_WAIT_TIME_MED
tryintimidatejectpack
tryintimidateejectpack
end3
BattleScript_IntimidatePrevented::
@ -7724,7 +7724,7 @@ BattleScript_SupersweetSyrupLoopIncrement:
destroyabilitypopup
restoretarget
pause B_WAIT_TIME_MED
tryintimidatejectpack
tryintimidateejectpack
end3
BattleScript_SupersweetSyrupWontDecrease:

View File

@ -737,7 +737,7 @@ extern const u8 BattleScript_EffectFling[];
extern const u8 BattleScript_EffectNaturalGift[];
extern const u8 BattleScript_EffectRoost[];
extern const u8 BattleScript_EffectGravity[];
extern const u8 BattleScript_EffectMircleEye[];
extern const u8 BattleScript_EffectMiracleEye[];
extern const u8 BattleScript_EffectTailwind[];
extern const u8 BattleScript_EffectEmbargo[];
extern const u8 BattleScript_EffectAquaRing[];

View File

@ -230,7 +230,7 @@ static bool32 ShouldSwitchIfHasBadOdds(u32 battler)
// Get maximum damage mon can deal
damageDealt = AI_GetDamage(battler, opposingBattler, i, AI_ATTACKING, gAiLogicData);
if(damageDealt > maxDamageDealt && !AI_DoesChoiceItemBlockMove(battler, aiMove))
if (damageDealt > maxDamageDealt && !AI_DoesChoiceItemBlockMove(battler, aiMove))
{
maxDamageDealt = damageDealt;
aiBestMove = aiMove;
@ -272,14 +272,14 @@ static bool32 ShouldSwitchIfHasBadOdds(u32 battler)
hitsToKoAI = GetNoOfHitsToKOBattlerDmg(maxDamageTaken, battler);
// Check if mon gets one shot
if(maxDamageTaken > gBattleMons[battler].hp
if (maxDamageTaken > gBattleMons[battler].hp
&& !(gItemsInfo[gBattleMons[battler].item].holdEffect == HOLD_EFFECT_FOCUS_SASH || (!IsMoldBreakerTypeAbility(opposingBattler, gBattleMons[opposingBattler].ability) && B_STURDY >= GEN_5 && aiAbility == ABILITY_STURDY)))
{
getsOneShot = TRUE;
}
// Check if current mon can 1v1 in spite of bad matchup, and don't switch out if it can
if(hitsToKoPlayer < hitsToKoAI || (hitsToKoPlayer == hitsToKoAI && AI_IsFaster(battler, opposingBattler, aiBestMove)))
if (hitsToKoPlayer < hitsToKoAI || (hitsToKoPlayer == hitsToKoAI && AI_IsFaster(battler, opposingBattler, aiBestMove)))
return FALSE;
// If we don't have any other viable options, don't switch out
@ -1702,7 +1702,7 @@ static u32 GetSwitchinRecurringDamage(void)
else if (holdEffect == HOLD_EFFECT_STICKY_BARB)
{
passiveDamage = maxHP / 8;
if(passiveDamage == 0)
if (passiveDamage == 0)
passiveDamage = 1;
}
}
@ -1727,7 +1727,7 @@ static u32 GetSwitchinStatusDamage(u32 battler)
statusDamage = maxHP / 16;
else
statusDamage = maxHP / 8;
if(ability == ABILITY_HEATPROOF)
if (ability == ABILITY_HEATPROOF)
statusDamage = statusDamage / 2;
if (statusDamage == 0)
statusDamage = 1;
@ -2095,10 +2095,10 @@ static u32 GetBestMonIntegrated(struct Pokemon *party, int firstId, int lastId,
}
// Track max hits to KO and set defensive mon
if(hitsToKOAI > maxHitsToKO && (canSwitchinWin1v1 || gAiThinkingStruct->aiFlags[battler] & AI_FLAG_STALL))
if (hitsToKOAI > maxHitsToKO && (canSwitchinWin1v1 || gAiThinkingStruct->aiFlags[battler] & AI_FLAG_STALL))
{
maxHitsToKO = hitsToKOAI;
if(maxHitsToKO > defensiveMonHitKOThreshold)
if (maxHitsToKO > defensiveMonHitKOThreshold)
defensiveMonId = i;
}
@ -2124,7 +2124,7 @@ static u32 GetBestMonIntegrated(struct Pokemon *party, int firstId, int lastId,
// Check that mon isn't one shot and set best damage mon
if (damageDealt > maxDamageDealt)
{
if((isFreeSwitch && hitsToKOAI > 1) || hitsToKOAI > 2) // This is a "default", we have uniquely low standards
if ((isFreeSwitch && hitsToKOAI > 1) || hitsToKOAI > 2) // This is a "default", we have uniquely low standards
{
maxDamageDealt = damageDealt;
damageMonId = i;

View File

@ -892,7 +892,7 @@ static bool32 AI_IsMoveEffectInPlus(u32 battlerAtk, u32 battlerDef, u32 move, s3
return TRUE;
break;
case EFFECT_PURSUIT:
if(noOfHitsToKo == 1)
if (noOfHitsToKo == 1)
return TRUE;
break;
default:

View File

@ -434,10 +434,6 @@ void CB2_InitBattle(void)
AllocateMonSpritesGfx();
RecordedBattle_ClearFrontierPassFlag();
#if T_SHOULD_RUN_MOVE_ANIM
gLoadFail = FALSE;
#endif // T_SHOULD_RUN_MOVE_ANIM
#if T_SHOULD_RUN_MOVE_ANIM
gLoadFail = FALSE;
#endif // T_SHOULD_RUN_MOVE_ANIM
@ -3107,7 +3103,7 @@ static void BattleStartClearSetData(void)
gSelectedMonPartyId = PARTY_SIZE; // Revival Blessing
gCategoryIconSpriteId = 0xFF;
if(IsSleepClauseEnabled())
if (IsSleepClauseEnabled())
{
// If monCausingSleepClause[side] equals PARTY_SIZE, Sleep Clause is not active for the given side.
gBattleStruct->monCausingSleepClause[B_SIDE_PLAYER] = PARTY_SIZE;
@ -4911,8 +4907,8 @@ s32 GetWhichBattlerFasterOrTies(u32 battler1, u32 battler2, bool32 ignoreChosenM
}
// 24 == MAX_BATTLERS_COUNT!.
// These are the possible orders if all the battlers speed tie. An order
// is chosen at the start of the turn.
// These are the possible orders if all the battlers speed tie.
// An order is chosen at the start of the turn.
static const u8 sBattlerOrders[24][4] =
{
{ 0, 1, 2, 3 },

View File

@ -344,7 +344,7 @@ static u32 GetNextTarget(u32 moveTarget, bool32 excludeCurrent);
static void TryUpdateEvolutionTracker(u32 evolutionCondition, u32 upAmount, u16 usedMove);
static void AccuracyCheck(bool32 recalcDragonDarts, const u8 *nextInstr, const u8 *failInstr, u16 move);
static void ResetValuesForCalledMove(void);
static void TryRestoreDamageAfterCheeckPouch(u32 battler);
static void TryRestoreDamageAfterCheekPouch(u32 battler);
static void Cmd_attackcanceler(void);
static void Cmd_accuracycheck(void);
@ -2748,7 +2748,7 @@ static void Cmd_datahpupdate(void)
gBattleStruct->timesGotHit[GetBattlerSide(gBattlerTarget)][gBattlerPartyIndexes[gBattlerTarget]]++;
}
TryRestoreDamageAfterCheeckPouch(battler);
TryRestoreDamageAfterCheekPouch(battler);
gBattlescriptCurrInstr = cmd->nextInstr;
}
@ -8283,22 +8283,21 @@ static bool32 DoSwitchInEffectsForBattler(u32 battler)
{
if (CanBePoisoned(gBattlerAttacker, battler, GetBattlerAbility(gBattlerAttacker), GetBattlerAbility(battler)))
{
u32 tspikes = 0;
if (gSideTimers[GetBattlerSide(battler)].toxicSpikesAmount >= 2) {
tspikes = 1;
gBattleScripting.battler = battler;
BattleScriptPushCursor();
if (gSideTimers[GetBattlerSide(battler)].toxicSpikesAmount >= 2)
{
gBattlescriptCurrInstr = BattleScript_ToxicSpikesBadlyPoisoned;
gBattleMons[battler].status1 |= STATUS1_TOXIC_POISON;
}
else
{
gBattlescriptCurrInstr = BattleScript_ToxicSpikesPoisoned;
gBattleMons[battler].status1 |= STATUS1_POISON;
}
BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[battler].status1), &gBattleMons[battler].status1);
MarkBattlerForControllerExec(battler);
gBattleScripting.battler = battler;
BattleScriptPushCursor();
if (tspikes == 0)
gBattlescriptCurrInstr = BattleScript_ToxicSpikesPoisoned;
else
gBattlescriptCurrInstr = BattleScript_ToxicSpikesBadlyPoisoned;
}
}
}
@ -8517,7 +8516,7 @@ static void Cmd_returntoball(void)
MarkBattlerForControllerExec(battler);
// Don't always execute a form change here otherwise we can stomp gigantamax
if(!cmd->changingForm)
if (!cmd->changingForm)
TryBattleFormChange(battler, FORM_CHANGE_BATTLE_SWITCH);
gBattlescriptCurrInstr = cmd->nextInstr;
@ -9142,7 +9141,7 @@ static bool32 TryCheekPouch(u32 battler, u32 itemId)
}
// When Cheek Pouch activates mid-battle it overwrites the current damage, so restore it
static void TryRestoreDamageAfterCheeckPouch(u32 battler)
static void TryRestoreDamageAfterCheekPouch(u32 battler)
{
if (gBattleStruct->cheekPouchActivated)
{
@ -9658,17 +9657,17 @@ static void RemoveAllWeather(void)
if (gBattleWeather & B_WEATHER_RAIN)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_END_RAIN;
else if(gBattleWeather & B_WEATHER_SANDSTORM)
else if (gBattleWeather & B_WEATHER_SANDSTORM)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_END_SANDSTORM;
else if(gBattleWeather & B_WEATHER_SUN)
else if (gBattleWeather & B_WEATHER_SUN)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_END_SUN;
else if(gBattleWeather & B_WEATHER_HAIL)
else if (gBattleWeather & B_WEATHER_HAIL)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_END_HAIL;
else if(gBattleWeather & B_WEATHER_STRONG_WINDS)
else if (gBattleWeather & B_WEATHER_STRONG_WINDS)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_END_STRONG_WINDS;
else if(gBattleWeather & B_WEATHER_SNOW)
else if (gBattleWeather & B_WEATHER_SNOW)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_END_SNOW;
else if(gBattleWeather & B_WEATHER_FOG)
else if (gBattleWeather & B_WEATHER_FOG)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_END_FOG;
else
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_END_COUNT; // failsafe
@ -16230,7 +16229,8 @@ static void Cmd_displaydexinfo(void)
}
break;
case 5:
if (!gPaletteFade.active) {
if (!gPaletteFade.active)
{
gBattlescriptCurrInstr = cmd->nextInstr;
}
break;
@ -16898,7 +16898,7 @@ static void TryUpdateRoundTurnOrder(void)
}
}
// Get battlers after us using round
// Get battlers after attacker using round
for (i = currRounder; i < gBattlersCount; i++)
{
if (gChosenMoveByBattler[gBattlerByTurnOrder[i]] == MOVE_ROUND)
@ -18005,7 +18005,7 @@ void BS_TryTarShot(void)
void BS_CanTarShotWork(void)
{
NATIVE_ARGS(const u8 *failInstr);
// Tar Shot will fail if it's already been used on the target and its speed can't be lowered further
// Tar Shot will fail if it's already been used on the target or if its speed can't be lowered further
if (!gDisableStructs[gBattlerTarget].tarShot
&& CompareStat(gBattlerTarget, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN))
gBattlescriptCurrInstr = cmd->nextInstr;
@ -18658,7 +18658,7 @@ void BS_JumpIfIntimidateAbilityPrevented(void)
}
}
void BS_TryIntimidatEjectpack(void)
void BS_TryIntimidateEjectPack(void)
{
NATIVE_ARGS();

View File

@ -902,7 +902,7 @@ void HandleAction_ActionFinished(void)
// We recalculate order only for action of the same priority. If any action other than switch/move has been taken, they should
// have been executed before. The only recalculation needed is for moves/switch. Mega evolution is handled in src/battle_main.c/TryChangeOrder
if((gActionsByTurnOrder[i] == B_ACTION_USE_MOVE && gActionsByTurnOrder[j] == B_ACTION_USE_MOVE))
if ((gActionsByTurnOrder[i] == B_ACTION_USE_MOVE && gActionsByTurnOrder[j] == B_ACTION_USE_MOVE))
{
if (GetWhichBattlerFaster(battler1, battler2, FALSE) == -1)
SwapTurnOrder(i, j);

View File

@ -1243,7 +1243,7 @@ const struct BattleMoveEffect gBattleMoveEffects[NUM_BATTLE_MOVE_EFFECTS] =
[EFFECT_MIRACLE_EYE] =
{
.battleScript = BattleScript_EffectMircleEye,
.battleScript = BattleScript_EffectMiracleEye,
.battleTvScore = 0, // TODO: Assign points
.encourageEncore = TRUE,
},

View File

@ -40,7 +40,7 @@ SINGLE_BATTLE_TEST("Jaboca Berry causes the attacker to lose 1/8 of its max HP i
}
}
SINGLE_BATTLE_TEST("Jaboca Berry tirggers before Bug Bite can steal it")
SINGLE_BATTLE_TEST("Jaboca Berry triggers before Bug Bite can steal it")
{
KNOWN_FAILING;
GIVEN {