mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
Fix graphical/exp bugs with 2 vs 1 trainer battles (#3105)
This commit is contained in:
parent
81522554c2
commit
34aff01d3a
6
src/battle_anim_throw.c
Executable file → Normal file
6
src/battle_anim_throw.c
Executable file → Normal file
@ -2491,11 +2491,11 @@ void TryShinyAnimation(u8 battler, struct Pokemon *mon)
|
|||||||
illusionMon = GetIllusionMonPtr(battler);
|
illusionMon = GetIllusionMonPtr(battler);
|
||||||
if (illusionMon != NULL)
|
if (illusionMon != NULL)
|
||||||
mon = illusionMon;
|
mon = illusionMon;
|
||||||
|
|
||||||
otId = GetMonData(mon, MON_DATA_OT_ID);
|
otId = GetMonData(mon, MON_DATA_OT_ID);
|
||||||
personality = GetMonData(mon, MON_DATA_PERSONALITY);
|
personality = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||||
|
|
||||||
if (IsBattlerSpriteVisible(battler))
|
if (IsBattlerSpriteVisible(battler) && IsValidForBattle(mon))
|
||||||
{
|
{
|
||||||
shinyValue = GET_SHINY_VALUE(otId, personality);
|
shinyValue = GET_SHINY_VALUE(otId, personality);
|
||||||
if (shinyValue < SHINY_ODDS)
|
if (shinyValue < SHINY_ODDS)
|
||||||
@ -2771,7 +2771,7 @@ void AnimTask_GetTrappedMoveAnimId(u8 taskId)
|
|||||||
gBattleAnimArgs[0] = TRAP_ANIM_BIND;
|
gBattleAnimArgs[0] = TRAP_ANIM_BIND;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DestroyAnimVisualTask(taskId);
|
DestroyAnimVisualTask(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1377,7 +1377,7 @@ static void Task_GiveExpToMon(u8 taskId)
|
|||||||
u8 battlerId = gTasks[taskId].tExpTask_battler;
|
u8 battlerId = gTasks[taskId].tExpTask_battler;
|
||||||
s32 gainedExp = GetTaskExpValue(taskId);
|
s32 gainedExp = GetTaskExpValue(taskId);
|
||||||
|
|
||||||
if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[battlerId]) // Give exp without moving the expbar.
|
if (WhichBattleCoords(battlerId) == 1 || monId != gBattlerPartyIndexes[battlerId]) // Give exp without moving the expbar.
|
||||||
{
|
{
|
||||||
struct Pokemon *mon = &gPlayerParty[monId];
|
struct Pokemon *mon = &gPlayerParty[monId];
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
|
@ -558,7 +558,7 @@ static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 op
|
|||||||
if (illusionMon != NULL)
|
if (illusionMon != NULL)
|
||||||
mon = illusionMon;
|
mon = illusionMon;
|
||||||
|
|
||||||
if (GetMonData(mon, MON_DATA_IS_EGG)) // Don't load GFX of egg pokemon.
|
if (GetMonData(mon, MON_DATA_IS_EGG) || GetMonData(mon, MON_DATA_SPECIES) == SPECIES_NONE) // Don't load GFX of egg pokemon.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY);
|
monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||||
|
@ -4268,9 +4268,7 @@ static void Cmd_getexp(void)
|
|||||||
|
|
||||||
for (viaSentIn = 0, i = 0; i < PARTY_SIZE; i++)
|
for (viaSentIn = 0, i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE || GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0)
|
if (!IsValidForBattle(&gPlayerParty[i]))
|
||||||
continue;
|
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG))
|
|
||||||
continue;
|
continue;
|
||||||
if (gBitTable[i] & sentIn)
|
if (gBitTable[i] & sentIn)
|
||||||
viaSentIn++;
|
viaSentIn++;
|
||||||
@ -4361,8 +4359,7 @@ static void Cmd_getexp(void)
|
|||||||
gBattleStruct->wildVictorySong++;
|
gBattleStruct->wildVictorySong++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP)
|
if (IsValidForBattle(&gPlayerParty[gBattleStruct->expGetterMonId]))
|
||||||
&& !GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_IS_EGG))
|
|
||||||
{
|
{
|
||||||
if (gBattleStruct->sentInPokes & 1)
|
if (gBattleStruct->sentInPokes & 1)
|
||||||
gBattleMoveDamage = *exp;
|
gBattleMoveDamage = *exp;
|
||||||
|
@ -256,9 +256,7 @@ static void CreateBattlerSprite(u8 battler)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_HP) == 0)
|
if (!IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[battler]]))
|
||||||
return;
|
|
||||||
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_IS_EGG))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetMultiuseSpriteTemplateToPokemon(GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler));
|
SetMultiuseSpriteTemplateToPokemon(GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler));
|
||||||
@ -313,7 +311,7 @@ static void CreateHealthboxSprite(u8 battler)
|
|||||||
}
|
}
|
||||||
else if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI))
|
else if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI))
|
||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_HP) == 0 || GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_IS_EGG))
|
if (!IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[battler]]))
|
||||||
SetHealthboxSpriteInvisible(healthboxSpriteId);
|
SetHealthboxSpriteInvisible(healthboxSpriteId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user