Fix 1 vs 2 battles with eggs

This commit is contained in:
DizzyEggg 2023-02-08 10:24:19 +01:00
parent ff088752e7
commit 8c257bde99
4 changed files with 11 additions and 3 deletions

View File

@ -557,6 +557,9 @@ static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 op
if (illusionMon != NULL)
mon = illusionMon;
if (GetMonData(mon, MON_DATA_IS_EGG)) // Don't load GFX of egg pokemon.
return;
monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY);
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE)
{

View File

@ -3655,7 +3655,7 @@ static void TryDoEventsBeforeFirstTurn(void)
{
for (i = 0; i < gBattlersCount; i++)
{
if (gBattleMons[i].hp == 0 || gBattleMons[i].species == SPECIES_NONE)
if (gBattleMons[i].hp == 0 || gBattleMons[i].species == SPECIES_NONE || GetMonData(GetBattlerPartyData(i), MON_DATA_IS_EGG))
gAbsentBattlerFlags |= gBitTable[i];
}
}

View File

@ -4036,6 +4036,8 @@ static void Cmd_getexp(void)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE || GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0)
continue;
if (GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG))
continue;
if (gBitTable[i] & sentIn)
viaSentIn++;
@ -4125,7 +4127,8 @@ static void Cmd_getexp(void)
gBattleStruct->wildVictorySong++;
}
if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP))
if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP)
&& !GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_IS_EGG))
{
if (gBattleStruct->sentInPokes & 1)
gBattleMoveDamage = *exp;

View File

@ -258,6 +258,8 @@ static void CreateBattlerSprite(u8 battler)
{
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_HP) == 0)
return;
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_IS_EGG))
return;
SetMultiuseSpriteTemplateToPokemon(GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler));
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2), posY, GetBattlerSpriteSubpriority(battler));
@ -311,7 +313,7 @@ static void CreateHealthboxSprite(u8 battler)
}
else if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI))
{
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_HP) == 0)
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_HP) == 0 || GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_IS_EGG))
SetHealthboxSpriteInvisible(healthboxSpriteId);
}
}