diff --git a/include/battle_dynamax.h b/include/battle_dynamax.h index faa7a0dd99..1996dc4c5c 100644 --- a/include/battle_dynamax.h +++ b/include/battle_dynamax.h @@ -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); diff --git a/include/config.h b/include/config.h index 2ad84f29cd..9412c8f426 100644 --- a/include/config.h +++ b/include/config.h @@ -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). diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 82a9d7b7a9..75581bd761 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -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) diff --git a/src/battle_dynamax.c b/src/battle_dynamax.c index 727bd6a2f2..bd3d24584d 100644 --- a/src/battle_dynamax.c +++ b/src/battle_dynamax.c @@ -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; } diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 389832fb20..9e67c2abb4 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -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)