added Gigantamax check + move display and tint when dynamaxed

This commit is contained in:
AgustinGDLV 2023-03-07 19:21:59 -08:00
parent 7de7599a7b
commit ac649a476f
5 changed files with 49 additions and 9 deletions

View file

@ -54,6 +54,7 @@ enum MaxMoveEffect
MAX_EFFECT_BYPASS_PROTECT,
};
bool8 IsDynamaxed(u16 battlerId);
bool8 ShouldUseMaxMove(u16 battlerId, u16 baseMove);
u16 GetMaxMove(u16 battlerId, u16 baseMove);
u8 GetMaxMovePower(u16 move);

View file

@ -6,7 +6,7 @@
// still has them in the ROM. This is because the developers forgot
// to define NDEBUG before release, however this has been changed as
// Ruby's actual debug build does not use the AGBPrint features.
#define NDEBUG
// #define NDEBUG
// To enable printf debugging, comment out "#define NDEBUG". This allows
// the various AGBPrint functions to be used. (See include/gba/isagbprint.h).

View file

@ -1685,7 +1685,10 @@ static void MoveSelectionDisplayMoveNames(void)
for (i = 0; i < MAX_MON_MOVES; i++)
{
MoveSelectionDestroyCursorAt(i);
StringCopy(gDisplayedStringBattle, gMoveNames[moveInfo->moves[i]]);
if (IsDynamaxed(gActiveBattler))
StringCopy(gDisplayedStringBattle, gMoveNames[GetMaxMove(gActiveBattler, moveInfo->moves[i])]);
else
StringCopy(gDisplayedStringBattle, gMoveNames[moveInfo->moves[i]]);
// Prints on windows B_WIN_MOVE_NAME_1, B_WIN_MOVE_NAME_2, B_WIN_MOVE_NAME_3, B_WIN_MOVE_NAME_4
BattlePutTextOnWindow(gDisplayedStringBattle, i + B_WIN_MOVE_NAME_1);
if (moveInfo->moves[i] != MOVE_NONE)

View file

@ -48,8 +48,8 @@ struct GMaxMove
static const struct GMaxMove sGMaxMoveTable[] =
{
{SPECIES_VENUSAUR_GMAX, TYPE_GRASS, MOVE_G_MAX_VINE_LASH},
{SPECIES_CHARIZARD_GMAX, TYPE_FIRE, MOVE_G_MAX_WILDFIRE},
{SPECIES_BLASTOISE_GMAX, TYPE_WATER, MOVE_G_MAX_CANNONADE},
{SPECIES_CHARIZARD_GMAX, TYPE_FIRE, MOVE_G_MAX_WILDFIRE},
{SPECIES_BUTTERFREE_GMAX, TYPE_BUG, MOVE_G_MAX_BEFUDDLE},
{SPECIES_PIKACHU_GMAX, TYPE_ELECTRIC, MOVE_G_MAX_VOLT_CRASH},
{SPECIES_MEOWTH_GMAX, TYPE_NORMAL, MOVE_G_MAX_GOLD_RUSH},
@ -84,22 +84,51 @@ static const struct GMaxMove sGMaxMoveTable[] =
extern u8 gMaxMovePowers[MOVES_COUNT];
bool8 IsDynamaxed(u16 battlerId)
{
if (/*IsRaidBoss(battlerId) ||*/ gBattleStruct->dynamax.dynamaxTurns[battlerId] > 0)
return TRUE;
return FALSE;
}
// Returns whether a move should be converted into a Max Move.
bool8 ShouldUseMaxMove(u16 battlerId, u16 baseMove)
{
// TODO: Raids
//if (IsRaidBoss(battlerId))
// return !IsRaidBossUsingRegularMove(battlerId, baseMove);
if (gBattleStruct->dynamax.dynamaxTurns[battlerId] > 0)
return TRUE;
return FALSE;
return IsDynamaxed(battlerId);
}
static u16 GetTypeBasedMaxMove(u16 battlerId, u16 type)
{
u32 species;
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL);
else
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL);
// Gigantamax check
if (species >= (SPECIES_VENUSAUR_GMAX)
&& sGMaxMoveTable[species - (SPECIES_VENUSAUR_GMAX)].moveType == type)
return sGMaxMoveTable[species - (SPECIES_VENUSAUR_GMAX)].gmaxMove;
// regular Max Move
else
{
return sMaxMoveTable[type];
}
}
// Returns the appropriate Max Move or G-Max Move for a battler to use.
u16 GetMaxMove(u16 battlerId, u16 baseMove)
{
u16 move = baseMove;
if (baseMove == MOVE_STRUGGLE)
if (baseMove == MOVE_NONE) // for move display
{
return MOVE_NONE;
}
else if (baseMove == MOVE_STRUGGLE)
{
return MOVE_STRUGGLE;
}
@ -109,12 +138,12 @@ u16 GetMaxMove(u16 battlerId, u16 baseMove)
}
else if (gBattleStruct->dynamicMoveType) // unsure of how to deal with Hidden Power
{
move = sMaxMoveTable[gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK];
move = GetTypeBasedMaxMove(battlerId, gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK);
gBattleStruct->dynamax.splits[battlerId] = gBattleMoves[baseMove].split;
}
else
{
move = sMaxMoveTable[gBattleMoves[baseMove].type];
move = GetTypeBasedMaxMove(battlerId, gBattleMoves[baseMove].type);
gBattleStruct->dynamax.splits[battlerId] = gBattleMoves[baseMove].split;
}

View file

@ -611,6 +611,13 @@ static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 op
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, PLTT_SIZEOF(16));
}
// dynamax tint
if (IsDynamaxed(battlerId))
{
BlendPalette(paletteOffset, 16, 4, RGB(31, 0, 12));
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32);
}
}
void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId)