updated Gigantamax form changing + tests
This commit is contained in:
parent
5a9e1de836
commit
4ceb61b1dd
3 changed files with 48 additions and 7 deletions
|
@ -150,12 +150,7 @@ void PrepareBattlerForDynamax(u16 battlerId)
|
|||
gBattleStruct->choicedMove[battlerId] = MOVE_NONE;
|
||||
|
||||
// Try Gigantamax form change.
|
||||
newSpecies = GetBattleFormChangeTargetSpecies(battlerId, FORM_CHANGE_BATTLE_GIGANTAMAX);
|
||||
if (newSpecies != SPECIES_NONE)
|
||||
{
|
||||
gBattleStruct->changedSpecies[gBitTable[gBattlerPartyIndexes[battlerId]]] = gBattleMons[battlerId].species;
|
||||
TryBattleFormChange(battlerId, FORM_CHANGE_BATTLE_GIGANTAMAX);
|
||||
}
|
||||
TryBattleFormChange(battlerId, FORM_CHANGE_BATTLE_GIGANTAMAX);
|
||||
}
|
||||
|
||||
// Sets flags needed for undoing Dynamax and undoes Gigantamax forms.
|
||||
|
@ -164,7 +159,6 @@ void UndoDynamax(u16 battlerId)
|
|||
u8 side = GetBattlerSide(battlerId);
|
||||
gBattleStruct->dynamax.dynamaxed[battlerId] = FALSE;
|
||||
gBattleStruct->dynamax.dynamaxTurns[battlerId] = 0; // safety check for switch-in / faint
|
||||
TryBattleFormChange(battlerId, FORM_CHANGE_BATTLE_SWITCH); // TODO: maybe nicer way to do this?
|
||||
}
|
||||
|
||||
// Weight-based moves (and some other moves in Raids) are blocked by Dynamax.
|
||||
|
|
|
@ -10232,6 +10232,9 @@ bool32 CanBattlerFormChange(u8 battlerId, u16 method)
|
|||
return TRUE;
|
||||
else if (IsBattlerPrimalReverted(battlerId) && (method == FORM_CHANGE_END_BATTLE))
|
||||
return TRUE;
|
||||
// Gigantamaxed Pokemon should revert upon fainting, switching, or ending the battle.
|
||||
else if (IsDynamaxed(battlerId) && (method == FORM_CHANGE_FAINT || method == FORM_CHANGE_BATTLE_SWITCH || method == FORM_CHANGE_END_BATTLE))
|
||||
return TRUE;
|
||||
return DoesSpeciesHaveFormChangeMethod(gBattleMons[battlerId].species, method);
|
||||
}
|
||||
|
||||
|
@ -10272,6 +10275,10 @@ bool32 TryBattleFormChange(u8 battlerId, u16 method)
|
|||
else if (IsBattlerPrimalReverted(battlerId) && (method == FORM_CHANGE_END_BATTLE))
|
||||
restoreSpecies = TRUE;
|
||||
|
||||
// Gigantamax Pokemon have their forms reverted after fainting, switching, or ending the battle.
|
||||
else if (IsDynamaxed(battlerId) && (method == FORM_CHANGE_FAINT || method == FORM_CHANGE_BATTLE_SWITCH || method == FORM_CHANGE_END_BATTLE))
|
||||
restoreSpecies = TRUE;
|
||||
|
||||
if (restoreSpecies)
|
||||
{
|
||||
// Reverts the original species
|
||||
|
|
|
@ -436,6 +436,46 @@ DOUBLE_BATTLE_TEST("(DYNAMAX) Dynamaxed Pokemon are immune to Instruct")
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Gigantamax factor
|
||||
SINGLE_BATTLE_TEST("(DYNAMAX) Pokemon with Gigantamax forms change upon Dynamaxing")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_VENUSAUR);
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_TACKLE, dynamax: TRUE); }
|
||||
} FINALLY {
|
||||
EXPECT_EQ(gBattleMons[B_POSITION_PLAYER_LEFT].species, SPECIES_VENUSAUR_GMAX);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("(DYNAMAX) Pokemon with Gigantamax forms revert upon switching")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_VENUSAUR);
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_TACKLE, dynamax: TRUE); }
|
||||
TURN { SWITCH(player, 1); }
|
||||
TURN { SWITCH(player, 0); }
|
||||
} FINALLY {
|
||||
EXPECT_EQ(gBattleMons[B_POSITION_PLAYER_LEFT].species, SPECIES_VENUSAUR);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("(DYNAMAX) Pokemon with Gigantamax forms revert upon fainting")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_VENUSAUR) { HP(1); };
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_TACKLE, dynamax: TRUE); MOVE(opponent, MOVE_TACKLE); }
|
||||
} FINALLY {
|
||||
EXPECT_EQ(gBattleMons[B_POSITION_PLAYER_LEFT].species, SPECIES_VENUSAUR);
|
||||
}
|
||||
}
|
||||
|
||||
// Move selection tests can't be simulated :(
|
||||
SINGLE_BATTLE_TEST("(DYNAMAX) Dynamaxed Pokemon are not affected by Choice items", s16 damage)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue