Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shiny animation not respecting Illusion mon target and Imposter revealing opponent ability #2985

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -9373,8 +9373,8 @@ BattleScript_FriskActivates::
end3

BattleScript_ImposterActivates::
transformdataexecution
call BattleScript_AbilityPopUp
transformdataexecution
playmoveanimation BS_ATTACKER, MOVE_TRANSFORM
waitanimation
printstring STRINGID_IMPOSTERTRANSFORM
Expand Down
5 changes: 5 additions & 0 deletions src/battle_anim_throw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2484,9 +2484,14 @@ void TryShinyAnimation(u8 battler, struct Pokemon *mon)
u32 otId, personality;
u32 shinyValue;
u8 taskCirc, taskDgnl;
struct Pokemon* illusionMon;

isShiny = FALSE;
gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = TRUE;
illusionMon = GetIllusionMonPtr(battler);
if (illusionMon != NULL)
mon = illusionMon;

otId = GetMonData(mon, MON_DATA_OT_ID);
personality = GetMonData(mon, MON_DATA_PERSONALITY);

Expand Down
7 changes: 7 additions & 0 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -10398,12 +10398,19 @@ bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId)
{
struct Pokemon *party, *partnerMon;
s32 i, id;
u8 side, partyCount;

gBattleStruct->illusion[battlerId].set = 1;
if (GetMonAbility(mon) != ABILITY_ILLUSION)
return FALSE;

party = GetBattlerParty(battlerId);
side = GetBattlerSide(battlerId);
partyCount = side == B_SIDE_PLAYER ? gPlayerPartyCount : gEnemyPartyCount;

// If this pokemon is last in the party, ignore Illusion.
if (&party[partyCount - 1] == mon)
return FALSE;

if (IsBattlerAlive(BATTLE_PARTNER(battlerId)))
partnerMon = &party[gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]];
Expand Down