Fix Burmy form change
Wasn't properly tracking if Burmy had appeared in battle; gSentPokesToOpponent is used only for exp calculation and is cleared when an opponent faints, so a new var was needed.
This commit is contained in:
parent
3ac480076c
commit
62f01e89d7
4 changed files with 12 additions and 4 deletions
|
@ -616,6 +616,7 @@ struct BattleStruct
|
||||||
u8 blunderPolicy:1; // should blunder policy activate
|
u8 blunderPolicy:1; // should blunder policy activate
|
||||||
u8 ballSpriteIds[2]; // item gfx, window gfx
|
u8 ballSpriteIds[2]; // item gfx, window gfx
|
||||||
u8 stickyWebUser;
|
u8 stickyWebUser;
|
||||||
|
u8 appearedInBattle; // Bitfield to track which Pokemon appeared in battle. Used for Burmy's form change
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GET_MOVE_TYPE(move, typeArg) \
|
#define GET_MOVE_TYPE(move, typeArg) \
|
||||||
|
|
|
@ -2937,6 +2937,7 @@ static void BattleStartClearSetData(void)
|
||||||
gBattleStruct->mega.triggerSpriteId = 0xFF;
|
gBattleStruct->mega.triggerSpriteId = 0xFF;
|
||||||
|
|
||||||
gBattleStruct->stickyWebUser = 0xFF;
|
gBattleStruct->stickyWebUser = 0xFF;
|
||||||
|
gBattleStruct->appearedInBattle = 0;
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
|
@ -3577,6 +3578,9 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||||
*(gBattleStruct->monToSwitchIntoId + i) = PARTY_SIZE;
|
*(gBattleStruct->monToSwitchIntoId + i) = PARTY_SIZE;
|
||||||
gChosenActionByBattler[i] = B_ACTION_NONE;
|
gChosenActionByBattler[i] = B_ACTION_NONE;
|
||||||
gChosenMoveByBattler[i] = MOVE_NONE;
|
gChosenMoveByBattler[i] = MOVE_NONE;
|
||||||
|
// Record party slots of player's mons that appeared in battle
|
||||||
|
if (!IsBattlerAIControlled(i))
|
||||||
|
gBattleStruct->appearedInBattle |= gBitTable[gBattlerPartyIndexes[i]];
|
||||||
}
|
}
|
||||||
TurnValuesCleanUp(FALSE);
|
TurnValuesCleanUp(FALSE);
|
||||||
SpecialStatusesClear();
|
SpecialStatusesClear();
|
||||||
|
|
|
@ -6177,6 +6177,9 @@ static void Cmd_switchineffects(void)
|
||||||
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
|
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
|
||||||
gSpecialStatuses[gActiveBattler].flag40 = 0;
|
gSpecialStatuses[gActiveBattler].flag40 = 0;
|
||||||
|
|
||||||
|
if (!IsBattlerAIControlled(gActiveBattler))
|
||||||
|
gBattleStruct->appearedInBattle |= gBitTable[gBattlerPartyIndexes[gActiveBattler]];
|
||||||
|
|
||||||
// Neutralizing Gas announces itself before hazards
|
// Neutralizing Gas announces itself before hazards
|
||||||
if (gBattleMons[gActiveBattler].ability == ABILITY_NEUTRALIZING_GAS && gSpecialStatuses[gActiveBattler].announceNeutralizingGas == 0)
|
if (gBattleMons[gActiveBattler].ability == ABILITY_NEUTRALIZING_GAS && gSpecialStatuses[gActiveBattler].announceNeutralizingGas == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9769,13 +9769,13 @@ bool32 TryRoomService(u8 battlerId)
|
||||||
void DoBurmyFormChange(u32 monId)
|
void DoBurmyFormChange(u32 monId)
|
||||||
{
|
{
|
||||||
u16 newSpecies, currSpecies;
|
u16 newSpecies, currSpecies;
|
||||||
s32 sentIn;
|
|
||||||
struct Pokemon *party = gPlayerParty;
|
struct Pokemon *party = gPlayerParty;
|
||||||
|
|
||||||
sentIn = gSentPokesToOpponent[(gBattlerFainted & 2) >> 1];
|
|
||||||
currSpecies = GetMonData(&party[monId], MON_DATA_SPECIES, NULL);
|
currSpecies = GetMonData(&party[monId], MON_DATA_SPECIES, NULL);
|
||||||
|
|
||||||
if ((GET_BASE_SPECIES_ID(currSpecies) == SPECIES_BURMY) && (gBitTable[monId] & sentIn))
|
if ((GET_BASE_SPECIES_ID(currSpecies) == SPECIES_BURMY)
|
||||||
|
&& (gBattleStruct->appearedInBattle & gBitTable[monId]) // Burmy appeared in battle
|
||||||
|
&& GetMonData(&party[monId], MON_DATA_HP, NULL) != 0) // Burmy isn't fainted
|
||||||
{
|
{
|
||||||
switch (gBattleTerrain)
|
switch (gBattleTerrain)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue