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

convert a few various to callnatives #2465

Merged
merged 6 commits into from
May 15, 2023
Merged
Changes from 1 commit
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
26 changes: 13 additions & 13 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -8805,7 +8805,7 @@ static bool32 CanTeleport(u8 battlerId)
{
struct Pokemon *party = GetBattlerParty(battlerId);
u32 species, count, i;

ghoulslash marked this conversation as resolved.
Show resolved Hide resolved
for (i = 0; i < PARTY_SIZE; i++)
{
species = GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG);
Expand Down Expand Up @@ -16317,33 +16317,33 @@ static bool8 IsFinalStrikeEffect(u16 move)
// 10 bytes long (callnative(5) + counter(1) + ptr(4))
ghoulslash marked this conversation as resolved.
Show resolved Hide resolved
void BS_CheckParentalBondCounter(void)
{
NATIVE_ARGS(u8 counter, const u8 *jumpInstr);
// Some effects should only happen on the first or second strike of Parental Bond,
// so a way to check this in battle scripts is useful
u8 counter = T1_READ_8(gBattlescriptCurrInstr + 5);
if (gSpecialStatuses[gBattlerAttacker].parentalBondState == counter && gBattleMons[gBattlerTarget].hp != 0)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 6);
if (gSpecialStatuses[gBattlerAttacker].parentalBondState == cmd->counter && gBattleMons[gBattlerTarget].hp != 0)
gBattlescriptCurrInstr = cmd->jumpInstr;
else
gBattlescriptCurrInstr += 10;
gBattlescriptCurrInstr = cmd->nextInstr;
}

// 6 bytes long (callnative(5) + battler(1))
ghoulslash marked this conversation as resolved.
Show resolved Hide resolved
void BS_GetBattlerSide(void)
{
gBattleCommunication[0] = GetBattlerSide(gBattlescriptCurrInstr[5]);
gBattlescriptCurrInstr += 6;
NATIVE_ARGS(u8 battler);
gBattleCommunication[0] = GetBattlerSide(cmd->battler);
gBattlescriptCurrInstr = cmd->nextInstr;
}

// 6 bytes long (callnative(5) + battler(1))
void BS_CanTeleport(void)
{
u8 battler = gBattlescriptCurrInstr[5];
gBattleCommunication[0] = CanTeleport(battler);
gBattlescriptCurrInstr += 6;
NATIVE_ARGS(u8 battler);
gBattleCommunication[0] = CanTeleport(cmd->battler);
gBattlescriptCurrInstr = cmd->nextInstr;
}

// 5 bytes long
void BS_TrySymbiosis(void)
{
NATIVE_ARGS();
//called by Bestow, Fling, and Bug Bite, which don't work with Cmd_removeitem.
gActiveBattler = gBattlerAttacker;
if (SYMBIOSIS_CHECK(gBattlerAttacker, BATTLE_PARTNER(gActiveBattler)))
Expand All @@ -16357,7 +16357,7 @@ void BS_TrySymbiosis(void)
return;
}

gBattlescriptCurrInstr += 5;
gBattlescriptCurrInstr = cmd->nextInstr;
}

void BS_SetZEffect(void)
Expand Down