checkforspecies

This commit is contained in:
pkmnsnfrn 2024-08-11 19:19:15 -07:00
parent e746334e1e
commit 262505589a
3 changed files with 30 additions and 0 deletions

View File

@ -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

View File

@ -561,3 +561,4 @@ gSpecials::
def_special SetSeenMon
def_special SetCaughtMon
def_special SetMonBall
def_special CheckPartyForMon

View File

@ -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;
}