implemented Gigantamax form change

This commit is contained in:
AgustinGDLV 2023-03-11 10:48:21 -08:00
parent 89e778225c
commit c823e19705
6 changed files with 40 additions and 16 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 268 B

View file

@ -58,10 +58,9 @@ enum
#define TAG_MEGA_TRIGGER_PAL 0xD777
#define TAG_MEGA_INDICATOR_PAL 0xD778
#define TAG_ALPHA_OMEGA_INDICATOR_PAL 0xD779 // Alpha and Omega indicators use the same palette as each of them only uses 4 different colors.
#define TAG_MISC_INDICATOR_PAL 0xD779 // Alpha, Omega, and Dynamax indicators use the same palette as each of them only uses 4 different colors.
#define TAG_ZMOVE_TRIGGER_PAL 0xD77B
#define TAG_DYNAMAX_TRIGGER_PAL 0xD77C
#define TAG_DYNAMAX_INDICATOR_PAL 0xD77D
enum

View file

@ -10,6 +10,8 @@
// FORM_CHANGE_ITEM_USE param2 Arguments
#define DAY 1
#define NIGHT 2
// FORM_CHANGE_BATTLE_SWITCH
#define PRESERVE_MEGA 1
#define FORM_CHANGE_TERMINATOR 0

View file

@ -128,22 +128,34 @@ void ApplyDynamaxHPMultiplier(u16 battlerId, struct Pokemon* mon)
}
}
// Sets flags used for Dynamaxing.
// Sets flags used for Dynamaxing and checks Gigantamax forms.
void PrepareBattlerForDynamax(u16 battlerId)
{
u8 side = GetBattlerSide(battlerId);
u16 newSpecies;
gBattleStruct->dynamax.alreadyDynamaxed[side] = TRUE;
gBattleStruct->dynamax.dynamaxed[battlerId] = TRUE;
gBattleStruct->dynamax.dynamaxTurns[battlerId] = DYNAMAX_TURNS;
// Try Gigantamax form change.
newSpecies = GetBattleFormChangeTargetSpecies(battlerId, FORM_CHANGE_BATTLE_GIGANTAMAX);
if (newSpecies != SPECIES_NONE)
{
gBattleMons[battlerId].species = newSpecies;
PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[battlerId].species);
BtlController_EmitSetMonData(BUFFER_A, REQUEST_SPECIES_BATTLE, gBitTable[gBattlerPartyIndexes[battlerId]], sizeof(gBattleMons[battlerId].species), &gBattleMons[battlerId].species);
MarkBattlerForControllerExec(battlerId);
}
}
// Sets flags needed for undoing Dynamax.
// Sets flags needed for undoing Dynamax and undoes Gigantamax forms.
void UndoDynamax(u16 battlerId)
{
u8 side = GetBattlerSide(battlerId);
gBattleStruct->dynamax.dynamaxed[battlerId] = FALSE;
gBattleStruct->dynamax.dynamaxTurns[battlerId] = 0; // safety check for switch-in / faint
// TODO: Undo Gigantamax form change.
TryBattleFormChange(battlerId, FORM_CHANGE_BATTLE_SWITCH); // TODO: maybe nicer way to do this?
}
// Returns whether a move should be converted into a Max Move.
@ -806,7 +818,7 @@ void DestroyDynamaxTriggerSprite(void)
// DYNAMAX INDICATOR:
static const u8 ALIGNED(4) sDynamaxIndicatorGfx[] = INCBIN_U8("graphics/battle_interface/dynamax_indicator.4bpp");
static const u16 sDynamaxIndicatorPal[] = INCBIN_U16("graphics/battle_interface/dynamax_indicator.gbapal");
static const u16 sDynamaxIndicatorPal[] = INCBIN_U16("graphics/battle_interface/misc_indicator.gbapal");
static const struct SpriteSheet sSpriteSheet_DynamaxIndicator =
{
@ -814,7 +826,7 @@ static const struct SpriteSheet sSpriteSheet_DynamaxIndicator =
};
static const struct SpritePalette sSpritePalette_DynamaxIndicator =
{
sDynamaxIndicatorPal, TAG_DYNAMAX_INDICATOR_PAL
sDynamaxIndicatorPal, TAG_MISC_INDICATOR_PAL
};
static const struct SpriteSheet sDynamaxIndicator_SpriteSheet[] =
@ -824,7 +836,7 @@ static const struct SpriteSheet sDynamaxIndicator_SpriteSheet[] =
static const struct SpritePalette sDynamaxIndicator_SpritePalette[] =
{
sDynamaxIndicatorPal, TAG_DYNAMAX_INDICATOR_PAL
sDynamaxIndicatorPal, TAG_MISC_INDICATOR_PAL
};
static const struct OamData sOamData_DynamaxIndicator =
@ -837,7 +849,7 @@ static const struct OamData sOamData_DynamaxIndicator =
static const struct SpriteTemplate sSpriteTemplate_DynamaxIndicator =
{
.tileTag = TAG_DYNAMAX_INDICATOR_TILE,
.paletteTag = TAG_DYNAMAX_INDICATOR_PAL,
.paletteTag = TAG_MISC_INDICATOR_PAL,
.oam = &sOamData_DynamaxIndicator,
.anims = gDummySpriteAnimTable,
.images = NULL,

View file

@ -10180,7 +10180,8 @@ u16 GetBattleFormChangeTargetSpecies(u8 battlerId, u16 method)
targetSpecies = formChanges[i].targetSpecies;
break;
case FORM_CHANGE_BATTLE_SWITCH:
targetSpecies = formChanges[i].targetSpecies;
if (!(IsBattlerMegaEvolved(battlerId) && formChanges[i].param1 == PRESERVE_MEGA))
targetSpecies = formChanges[i].targetSpecies;
break;
case FORM_CHANGE_BATTLE_HP_PERCENT:
if (formChanges[i].param1 == GetBattlerAbility(battlerId))
@ -10200,6 +10201,11 @@ u16 GetBattleFormChangeTargetSpecies(u8 battlerId, u16 method)
}
}
break;
case FORM_CHANGE_BATTLE_GIGANTAMAX:
// TODO: check Gigantamax factor
if (IsDynamaxed(battlerId))
targetSpecies = formChanges[i].targetSpecies;
break;
case FORM_CHANGE_BATTLE_TURN_END:
if (formChanges[i].param1 == GetBattlerAbility(battlerId))
targetSpecies = formChanges[i].targetSpecies;

View file

@ -1,6 +1,7 @@
static const struct FormChange sVenusaurFormChangeTable[] = {
{FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM, SPECIES_VENUSAUR_MEGA, ITEM_VENUSAURITE},
{FORM_CHANGE_BATTLE_GIGANTAMAX, SPECIES_VENUSAUR_GMAX},
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_VENUSAUR, PRESERVE_MEGA},
{FORM_CHANGE_FAINT, SPECIES_VENUSAUR},
{FORM_CHANGE_END_BATTLE, SPECIES_VENUSAUR},
{FORM_CHANGE_TERMINATOR},
@ -10,6 +11,7 @@ static const struct FormChange sCharizardFormChangeTable[] = {
{FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM, SPECIES_CHARIZARD_MEGA_X, ITEM_CHARIZARDITE_X},
{FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM, SPECIES_CHARIZARD_MEGA_Y, ITEM_CHARIZARDITE_Y},
{FORM_CHANGE_BATTLE_GIGANTAMAX, SPECIES_CHARIZARD_GMAX},
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_CHARIZARD, PRESERVE_MEGA},
{FORM_CHANGE_FAINT, SPECIES_CHARIZARD},
{FORM_CHANGE_END_BATTLE, SPECIES_CHARIZARD},
{FORM_CHANGE_TERMINATOR},
@ -18,6 +20,7 @@ static const struct FormChange sCharizardFormChangeTable[] = {
static const struct FormChange sBlastoiseFormChangeTable[] = {
{FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM, SPECIES_BLASTOISE_MEGA, ITEM_BLASTOISINITE},
{FORM_CHANGE_BATTLE_GIGANTAMAX, SPECIES_BLASTOISE_GMAX},
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_BLASTOISE, PRESERVE_MEGA},
{FORM_CHANGE_FAINT, SPECIES_BLASTOISE},
{FORM_CHANGE_END_BATTLE, SPECIES_BLASTOISE},
{FORM_CHANGE_TERMINATOR},
@ -54,6 +57,7 @@ static const struct FormChange sSlowbroFormChangeTable[] = {
static const struct FormChange sGengarFormChangeTable[] = {
{FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM, SPECIES_GENGAR_MEGA, ITEM_GENGARITE},
{FORM_CHANGE_BATTLE_GIGANTAMAX, SPECIES_GENGAR_GMAX},
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_VENUSAUR, PRESERVE_MEGA},
{FORM_CHANGE_FAINT, SPECIES_GENGAR},
{FORM_CHANGE_END_BATTLE, SPECIES_GENGAR},
{FORM_CHANGE_TERMINATOR},
@ -643,12 +647,13 @@ static const struct FormChange sEnamorusFormChangeTable[] = {
#endif
// Gigantamax Forms
#define GIGANTAMAX_FORM(species) \
{ \
{FORM_CHANGE_BATTLE_GIGANTAMAX, SPECIES_##species##_GMAX}, \
{FORM_CHANGE_FAINT, SPECIES_##species}, \
{FORM_CHANGE_END_BATTLE, SPECIES_##species}, \
{FORM_CHANGE_TERMINATOR}, \
#define GIGANTAMAX_FORM(species) \
{ \
{FORM_CHANGE_BATTLE_GIGANTAMAX, SPECIES_##species##_GMAX}, \
{FORM_CHANGE_FAINT, SPECIES_##species}, \
{FORM_CHANGE_END_BATTLE, SPECIES_##species}, \
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_##species, PRESERVE_MEGA}, \
{FORM_CHANGE_TERMINATOR}, \
};
static const struct FormChange sButterfreeFormChangeTable[] = GIGANTAMAX_FORM(BUTTERFREE)