mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-17 03:57:38 +01:00
Merge pull request #1588 from BuffelSaft/burmy-form-change
Implement Burmy form change
This commit is contained in:
commit
f22e01b1d0
@ -151,6 +151,7 @@ void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast);
|
||||
bool32 CompareStat(u8 battlerId, u8 statId, u8 cmpTo, u8 cmpKind);
|
||||
bool32 TryRoomService(u8 battlerId);
|
||||
void BufferStatChange(u8 battlerId, u8 statId, u8 stringId);
|
||||
void DoBurmyFormChange(u32 monId);
|
||||
|
||||
// ability checks
|
||||
bool32 IsRolePlayBannedAbilityAtk(u16 ability);
|
||||
|
@ -37,6 +37,9 @@
|
||||
#define SPECIES_ZYGARDE 0 // 50%
|
||||
#define SPECIES_ZYGARDE_10 10011 // 10 %
|
||||
#define SPECIES_ZYGARDE_COMPLETE 10012 // 100 %
|
||||
#define SPECIES_BURMY 0
|
||||
#define SPECIES_BURMY_SANDY_CLOAK 10013
|
||||
#define SPECIES_BURMY_TRASH_CLOAK 10014
|
||||
#endif
|
||||
|
||||
// Items with peculiar battle effects.
|
||||
|
@ -4897,6 +4897,7 @@ static void HandleEndTurn_FinishBattle(void)
|
||||
{
|
||||
UndoMegaEvolution(i);
|
||||
UndoFormChange(i, B_SIDE_PLAYER, FALSE);
|
||||
DoBurmyFormChange(i);
|
||||
}
|
||||
gBattleMainFunc = FreeResetData_ReturnToOvOrDoEvolutions;
|
||||
gCB2_AfterEvolution = BattleMainCB2;
|
||||
|
@ -9170,3 +9170,43 @@ bool32 TryRoomService(u8 battlerId)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void DoBurmyFormChange(u32 monId)
|
||||
{
|
||||
u16 newSpecies, currSpecies;
|
||||
s32 sentIn;
|
||||
struct Pokemon *party = gPlayerParty;
|
||||
|
||||
sentIn = gSentPokesToOpponent[(gBattlerFainted & 2) >> 1];
|
||||
currSpecies = GetMonData(&party[monId], MON_DATA_SPECIES, NULL);
|
||||
|
||||
if ((GET_BASE_SPECIES_ID(currSpecies) == SPECIES_BURMY) && (gBitTable[monId] & sentIn))
|
||||
{
|
||||
switch (gBattleTerrain)
|
||||
{
|
||||
case BATTLE_TERRAIN_GRASS:
|
||||
case BATTLE_TERRAIN_LONG_GRASS:
|
||||
case BATTLE_TERRAIN_POND:
|
||||
case BATTLE_TERRAIN_MOUNTAIN:
|
||||
case BATTLE_TERRAIN_PLAIN:
|
||||
newSpecies = SPECIES_BURMY;
|
||||
break;
|
||||
case BATTLE_TERRAIN_CAVE:
|
||||
case BATTLE_TERRAIN_SAND:
|
||||
newSpecies = SPECIES_BURMY_SANDY_CLOAK;
|
||||
break;
|
||||
case BATTLE_TERRAIN_BUILDING:
|
||||
newSpecies = SPECIES_BURMY_TRASH_CLOAK;
|
||||
break;
|
||||
default: // Don't change form if last battle was water-related
|
||||
newSpecies = SPECIES_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (newSpecies != SPECIES_NONE)
|
||||
{
|
||||
SetMonData(&party[monId], MON_DATA_SPECIES, &newSpecies);
|
||||
CalculateMonStats(&party[monId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user