Fix in-battle form changes always reverting (#8810)
This commit is contained in:
parent
b1de0a8484
commit
41038cbc88
@ -1075,7 +1075,8 @@ These tables, unlike the regular form tables, registers how Pokémon can switch
|
||||
|
||||
```c
|
||||
#if P_FAMILY_GASTLY
|
||||
static const struct FormChange sGengarFormChangeTable[] = {
|
||||
static const struct FormChange sGengarFormChangeTable[] =
|
||||
{
|
||||
{FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM, SPECIES_GENGAR_MEGA, ITEM_GENGARITE},
|
||||
{FORM_CHANGE_BATTLE_GIGANTAMAX, SPECIES_GENGAR_GIGANTAMAX},
|
||||
{FORM_CHANGE_TERMINATOR},
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -6932,6 +6932,7 @@ const struct SpeciesInfo gSpeciesInfoGen7[] =
|
||||
.levelUpLearnset = sNecrozmaLevelUpLearnset,
|
||||
.teachableLearnset = sNecrozmaTeachableLearnset,
|
||||
.formSpeciesIdTable = sNecrozmaFormSpeciesIdTable,
|
||||
.formChangeTable = sNecrozmaUltraFormChangeTable,
|
||||
},
|
||||
#endif //P_ULTRA_BURST_FORMS
|
||||
#endif //P_FUSION_FORMS
|
||||
|
||||
@ -7390,6 +7390,7 @@ const struct SpeciesInfo gSpeciesInfoGen8[] =
|
||||
.levelUpLearnset = sUrshifuSingleStrikeLevelUpLearnset,
|
||||
.teachableLearnset = sUrshifuSingleStrikeTeachableLearnset,
|
||||
.formSpeciesIdTable = sUrshifuFormSpeciesIdTable,
|
||||
.formChangeTable = sUrshifuSingleStrikeFormChangeTable,
|
||||
},
|
||||
#endif //P_GIGANTAMAX_FORMS
|
||||
|
||||
@ -7517,6 +7518,7 @@ const struct SpeciesInfo gSpeciesInfoGen8[] =
|
||||
.levelUpLearnset = sUrshifuRapidStrikeLevelUpLearnset,
|
||||
.teachableLearnset = sUrshifuRapidStrikeTeachableLearnset,
|
||||
.formSpeciesIdTable = sUrshifuFormSpeciesIdTable,
|
||||
.formChangeTable = sUrshifuRapidStrikeFormChangeTable,
|
||||
},
|
||||
#endif //P_GIGANTAMAX_FORMS
|
||||
#endif //P_FAMILY_KUBFU
|
||||
|
||||
@ -7154,10 +7154,19 @@ bool32 TryFormChange(u32 monId, enum BattleSide side, enum FormChanges method)
|
||||
u32 currentSpecies = GetMonData(&party[monId], MON_DATA_SPECIES);
|
||||
u32 targetSpecies = GetFormChangeTargetSpecies(&party[monId], method, 0);
|
||||
|
||||
if (targetSpecies == currentSpecies && gBattleStruct != NULL && gBattleStruct->partyState[side][monId].changedSpecies != SPECIES_NONE)
|
||||
// If the battle ends, and there's not a specified species to change back to,,
|
||||
// use the species at the start of the battle.
|
||||
if (targetSpecies == SPECIES_NONE
|
||||
&& gBattleStruct != NULL
|
||||
&& gBattleStruct->partyState[side][monId].changedSpecies != SPECIES_NONE
|
||||
// This is added to prevent FORM_CHANGE_END_BATTLE_ENVIRONMENT from omitting move changes
|
||||
// at the end of the battle, as it was being counting as a successful form change.
|
||||
&& method == FORM_CHANGE_END_BATTLE)
|
||||
{
|
||||
targetSpecies = gBattleStruct->partyState[side][monId].changedSpecies;
|
||||
}
|
||||
|
||||
if (targetSpecies != currentSpecies)
|
||||
if (targetSpecies != currentSpecies && targetSpecies != SPECIES_NONE)
|
||||
{
|
||||
TryToSetBattleFormChangeMoves(&party[monId], method);
|
||||
SetMonData(&party[monId], MON_DATA_SPECIES, &targetSpecies);
|
||||
@ -7367,7 +7376,7 @@ void UpdateDaysPassedSinceFormChange(u16 days)
|
||||
{
|
||||
u32 targetSpecies = GetFormChangeTargetSpecies(mon, FORM_CHANGE_DAYS_PASSED, 0);
|
||||
|
||||
if (targetSpecies != currentSpecies)
|
||||
if (targetSpecies != currentSpecies && targetSpecies != SPECIES_NONE)
|
||||
{
|
||||
SetMonData(mon, MON_DATA_SPECIES, &targetSpecies);
|
||||
CalculateMonStats(mon);
|
||||
|
||||
@ -90,7 +90,6 @@ SINGLE_BATTLE_TEST("Palafin returns to Zero form upon battle end")
|
||||
|
||||
SINGLE_BATTLE_TEST("Shaymin retains Land form if it was frozen or frostbitten in battle")
|
||||
{
|
||||
KNOWN_FAILING; // changedSpecies is forcing the return to Sky Form
|
||||
GIVEN {
|
||||
ASSUME(MoveHasAdditionalEffect(MOVE_POWDER_SNOW, MOVE_EFFECT_FREEZE_OR_FROSTBITE));
|
||||
PLAYER(SPECIES_SHAYMIN_SKY);
|
||||
|
||||
@ -59,6 +59,23 @@ TEST("Form change tables contain only forms in the form species ID table")
|
||||
}
|
||||
}
|
||||
|
||||
TEST("Forms have the appropriate species form changes")
|
||||
{
|
||||
u32 i;
|
||||
u32 species = SPECIES_NONE;
|
||||
|
||||
for (i = 0; i < NUM_SPECIES; i++)
|
||||
{
|
||||
if (gSpeciesInfo[i].isMegaEvolution
|
||||
|| gSpeciesInfo[i].isGigantamax
|
||||
|| gSpeciesInfo[i].isUltraBurst)
|
||||
{
|
||||
PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; }
|
||||
}
|
||||
}
|
||||
EXPECT(DoesSpeciesHaveFormChangeMethod(species, FORM_CHANGE_END_BATTLE));
|
||||
}
|
||||
|
||||
TEST("Form change targets have the appropriate species flags")
|
||||
{
|
||||
u32 i;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user