From 5cc7330f33eb924b1227edfff4f3caac12adec1f Mon Sep 17 00:00:00 2001 From: PhallenTree <168426989+PhallenTree@users.noreply.github.com> Date: Tue, 14 May 2024 12:34:36 +0100 Subject: [PATCH] Fixes cries in move animations ignoring Illusion (#4564) * Fixes cries in move animations not taking into account the ability Illusion * Fixes cry for Link Battles --- src/battle_anim_sound_tasks.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/battle_anim_sound_tasks.c b/src/battle_anim_sound_tasks.c index bd4638224f..c4ad988a0b 100644 --- a/src/battle_anim_sound_tasks.c +++ b/src/battle_anim_sound_tasks.c @@ -167,10 +167,7 @@ void SoundTask_PlayCryHighPitch(u8 taskId) return; } - if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) - species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - else - species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); + species = (GetIllusionMonSpecies(battlerId) != SPECIES_NONE) ? GetIllusionMonSpecies(battlerId) : gAnimBattlerSpecies[battlerId]; } if (species != SPECIES_NONE) @@ -215,10 +212,7 @@ void SoundTask_PlayDoubleCry(u8 taskId) return; } - if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) - species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - else - species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); + species = (GetIllusionMonSpecies(battlerId) != SPECIES_NONE) ? GetIllusionMonSpecies(battlerId) : gAnimBattlerSpecies[battlerId]; } gTasks[taskId].data[0] = gBattleAnimArgs[1]; @@ -285,7 +279,8 @@ void SoundTask_WaitForCry(u8 taskId) void SoundTask_PlayNormalCry(u8 taskId) { - PlayCry_ByMode(gBattleMons[gBattleAnimAttacker].species, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER), CRY_MODE_NORMAL); + u16 species = (GetIllusionMonSpecies(gBattleAnimAttacker) != SPECIES_NONE) ? GetIllusionMonSpecies(gBattleAnimAttacker) : gAnimBattlerSpecies[gBattleAnimAttacker]; + PlayCry_ByMode(species, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER), CRY_MODE_NORMAL); gTasks[taskId].func = SoundTask_WaitForCry; } @@ -305,7 +300,7 @@ void SoundTask_PlayCryWithEcho(u8 taskId) if (IsContest()) species = gContestResources->moveAnim->species; else - species = gAnimBattlerSpecies[gBattleAnimAttacker]; + species = (GetIllusionMonSpecies(gBattleAnimAttacker) != SPECIES_NONE) ? GetIllusionMonSpecies(gBattleAnimAttacker) : gAnimBattlerSpecies[gBattleAnimAttacker]; gTasks[taskId].tSpecies = species; gTasks[taskId].tPan = pan;