diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 7529edc55a..da6935ed3c 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -2375,3 +2375,20 @@ setvar VAR_TEMP_1, \ballId special SetMonBall .endm + + OPEN_PARTY_SCREEN = FALSE + NO_PARTY_SCREEN = TRUE + + @ Check if the Player has \speciesId in their party. + .macro checkforspecies speciesId:req, silent:req, script:req + .if \silent == OPEN_PARTY_SCREEN + special ChoosePartyMon + waitstate + specialvar VAR_RESULT, ScriptGetPartyMonSpecies + goto_if_eq VAR_RESULT, \speciesId, \script + .else + setvar VAR_TEMP_1, \speciesId + specialvar VAR_RESULT, CheckPartyForMon + goto_if_eq VAR_RESULT, TRUE, \script + .endif + .endm diff --git a/data/specials.inc b/data/specials.inc index 67e82c0e18..00a8c54029 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -561,3 +561,4 @@ gSpecials:: def_special SetSeenMon def_special SetCaughtMon def_special SetMonBall + def_special CheckPartyForMon diff --git a/src/field_specials.c b/src/field_specials.c index a574083ae4..78ac17678b 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -4337,3 +4337,15 @@ void SetMonBall(void) u16 ballId = VarGet(VAR_TEMP_1); SetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_POKEBALL, &ballId); } + +bool8 CheckPartyForMon(void) +{ + int i; + for (i = 0; i < CalculatePlayerPartyCount(); i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == VarGet(VAR_TEMP_1)) + return TRUE; + } + return FALSE; +} +