Add bad poison downgrade config (#3605)

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
Bassoonian 2023-11-27 12:42:53 +01:00 committed by GitHub
parent fe16a2cdee
commit b72581985c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View File

@ -219,6 +219,7 @@
#define B_OBEDIENCE_MECHANICS GEN_LATEST // In PLA+ (here Gen8+), obedience restrictions also apply to non-outsider Pokémon, albeit based on their level met rather than actual level
#define B_USE_FROSTBITE FALSE // In PLA, Frostbite replaces Freeze. Enabling this flag does the same here. Moves can still be cherry-picked to either Freeze or Frostbite. Freeze-Dry, Secret Power & Tri Attack depend on this config.
#define B_OVERWORLD_SNOW GEN_LATEST // In Gen9+, overworld Snow will summon snow instead of hail.
#define B_TOXIC_REVERSAL GEN_LATEST // In Gen5+, bad poison will change to regular poison at the end of battles.
// Animation Settings
#define B_NEW_SWORD_PARTICLE TRUE // If set to TRUE, it updates Swords Dance's particle.

View File

@ -677,6 +677,19 @@ void StartRegiBattle(void)
TryUpdateGymLeaderRematchFromWild();
}
static void DowngradeBadPoison(void)
{
u8 i;
u32 status = STATUS1_POISON;
if (B_TOXIC_REVERSAL < GEN_5)
return;
for(i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_HAS_SPECIES) && GetMonData(&gPlayerParty[i], MON_DATA_STATUS) == STATUS1_TOXIC_POISON)
SetMonData(&gPlayerParty[i], MON_DATA_STATUS, &status);
}
}
static void CB2_EndWildBattle(void)
{
CpuFill16(0, (void *)(BG_PLTT), BG_PLTT_SIZE);
@ -689,6 +702,7 @@ static void CB2_EndWildBattle(void)
else
{
SetMainCallback2(CB2_ReturnToField);
DowngradeBadPoison();
gFieldCallback = FieldCB_ReturnToFieldNoScriptCheckMusic;
}
}
@ -707,6 +721,7 @@ static void CB2_EndScriptedWildBattle(void)
}
else
{
DowngradeBadPoison();
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
}
@ -997,6 +1012,7 @@ static void CB2_StartFirstBattle(void)
static void CB2_EndFirstBattle(void)
{
Overworld_ClearSavedMusic();
DowngradeBadPoison();
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
@ -1414,6 +1430,7 @@ static void CB2_EndTrainerBattle(void)
if (gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
{
DowngradeBadPoison();
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
else if (IsPlayerDefeated(gBattleOutcome) == TRUE)
@ -1426,6 +1443,7 @@ static void CB2_EndTrainerBattle(void)
else
{
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
DowngradeBadPoison();
if (!InBattlePyramid() && !InTrainerHillChallenge())
{
RegisterTrainerInMatchCall();
@ -1438,6 +1456,7 @@ static void CB2_EndRematchBattle(void)
{
if (gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
{
DowngradeBadPoison();
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
else if (IsPlayerDefeated(gBattleOutcome) == TRUE)
@ -1450,6 +1469,7 @@ static void CB2_EndRematchBattle(void)
RegisterTrainerInMatchCall();
SetBattledTrainersFlags();
HandleRematchVarsOnBattleEnd();
DowngradeBadPoison();
}
}