Merge pull request #1928 from AsparagusEduardo/BE_fixTransformForm

Prevent Transforming Pokémon from changing forms
This commit is contained in:
ghoulslash 2022-07-28 22:26:56 -04:00 committed by GitHub
commit 0c79d04dec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View file

@ -4393,10 +4393,13 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break; break;
case EFFECT_RELIC_SONG: case EFFECT_RELIC_SONG:
#if (defined SPECIES_MELOETTA && defined SPECIES_MELOETTA_PIROUETTE) #if (defined SPECIES_MELOETTA && defined SPECIES_MELOETTA_PIROUETTE)
if (gBattleMons[battlerAtk].species == SPECIES_MELOETTA && gBattleMons[battlerDef].defense < gBattleMons[battlerDef].spDefense) if (!(gBattleMons[battlerAtk].status2 & STATUS2_TRANSFORMED)) // Don't try to change form if it's transformed.
score += 3; // Change to pirouette if can do more damage {
else if (gBattleMons[battlerAtk].species == SPECIES_MELOETTA_PIROUETTE && gBattleMons[battlerDef].spDefense < gBattleMons[battlerDef].defense) if (gBattleMons[battlerAtk].species == SPECIES_MELOETTA && gBattleMons[battlerDef].defense < gBattleMons[battlerDef].spDefense)
score += 3; // Change to Aria if can do more damage score += 3; // Change to Pirouette if can do more damage
else if (gBattleMons[battlerAtk].species == SPECIES_MELOETTA_PIROUETTE && gBattleMons[battlerDef].spDefense < gBattleMons[battlerDef].defense)
score += 3; // Change to Aria if can do more damage
}
#endif #endif
break; break;
case EFFECT_ELECTRIC_TERRAIN: case EFFECT_ELECTRIC_TERRAIN:

View file

@ -3494,7 +3494,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
} }
break; break;
case MOVE_EFFECT_RELIC_SONG: case MOVE_EFFECT_RELIC_SONG:
if (GetBattlerAbility(gBattlerAttacker) != ABILITY_SHEER_FORCE) if (GetBattlerAbility(gBattlerAttacker) != ABILITY_SHEER_FORCE && !(gBattleMons[gBattlerAttacker].status2 & STATUS2_TRANSFORMED))
{ {
if (gBattleMons[gBattlerAttacker].species == SPECIES_MELOETTA) if (gBattleMons[gBattlerAttacker].species == SPECIES_MELOETTA)
{ {

View file

@ -4072,6 +4072,9 @@ static bool32 ShouldChangeFormHpBased(u32 battler)
u32 i; u32 i;
u16 battlerAbility = GetBattlerAbility(battler); u16 battlerAbility = GetBattlerAbility(battler);
if (gBattleMons[battler].status2 & STATUS2_TRANSFORMED)
return FALSE;
for (i = 0; i < ARRAY_COUNT(forms); i++) for (i = 0; i < ARRAY_COUNT(forms); i++)
{ {
if (battlerAbility == forms[i][0]) if (battlerAbility == forms[i][0])