-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 Teleport ending trainer battles #3166
Conversation
Redirecting to Baton Pass' script will reduce PP twice |
You should update EDIT: static bool32 CanTeleport(u8 battlerId)
{
struct Pokemon *party = GetBattlerParty(battlerId);
u32 species, count, i;
for (i = 0; i < PARTY_SIZE; i++)
{
species = GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG);
if (species != SPECIES_NONE && species != SPECIES_EGG && GetMonData(&party[i], MON_DATA_HP) != 0)
count++;
}
switch (GetBattlerSide(battlerId))
{
case B_SIDE_OPPONENT:
- if (count == 1 || gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
+ if (count == 1 || gBattleTypeFlags & (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TRAINER))
return FALSE;
break;
case B_SIDE_PLAYER:
if (count == 1 || (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && count <= 2))
return FALSE;
break;
}
return TRUE;
} EDIT2: Also, I intended to do this at some point, but I guess I never ended up pushing it. |
This implies that Teleport fails in trainer battles for the opponent, which is not the case. |
Fixed
I think |
Noice! The suggestion can still be applied to |
Something like this? + .macro jumpifside battler:req, side:req, jumpInstr:req
+ getbattlerside \battler
+ jumpifbyte CMP_EQUAL, gBattleCommunication, \side, \jumpInstr
+ .endm
- getbattlerside BS_ATTACKER
- jumpifbyte CMP_EQUAL, gBattleCommunication, B_SIDE_PLAYER, BattleScript_EffectBatonPass
+ jumpifside BS_ATTACKER, B_SIDE_PLAYER, BattleScript_EffectBatonPass
jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_EffectBatonPass
- jumpifbyte CMP_EQUAL, gBattleCommunication, B_SIDE_OPPONENT, BattleScript_EffectTeleportTryToRunAway
+ jumpifside BS_ATTACKER, B_SIDE_OPPONENT, BattleScript_EffectTeleportTryToRunAway |
Yup. I guess that adds a pointless function call to + .macro jumpifside battler:req, side:req, equalJumpInstr:req, notEqualJumpInstr:req
+ getbattlerside \battler
+ jumpifbyte CMP_EQUAL, gBattleCommunication, \side, \equalJumpInstr
+ jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, \side, \notEqualJumpInstr
+ .endm
- getbattlerside BS_ATTACKER
- jumpifbyte CMP_EQUAL, gBattleCommunication, B_SIDE_PLAYER, BattleScript_EffectBatonPass
+ jumpifside BS_ATTACKER, B_SIDE_PLAYER, BattleScript_EffectBatonPass, BattleScript_EffectTeleportTryToRunAway
jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_EffectBatonPass
- jumpifbyte CMP_EQUAL, gBattleCommunication, B_SIDE_OPPONENT, BattleScript_EffectTeleportTryToRunAway |
Looks good, I like it but I think a small modification is needed to avoid the same issue the PR is trying to solve where Teleport would end a trainer battle. + .macro jumpifside battler:req, side:req, equalJumpInstr:req, notEqualJumpInstr:req
+ getbattlerside \battler
+ jumpifbyte CMP_EQUAL, gBattleCommunication, \side, \equalJumpInstr
+ jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, \side, \notEqualJumpInstr
+ .endm
- getbattlerside BS_ATTACKER
- jumpifbyte CMP_EQUAL, gBattleCommunication, B_SIDE_PLAYER, BattleScript_EffectBatonPass
+ jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_EffectBatonPass
+ jumpifside BS_ATTACKER, B_SIDE_PLAYER, BattleScript_EffectBatonPass, BattleScript_EffectTeleportTryToRunAway
- jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_EffectBatonPass
- jumpifbyte CMP_EQUAL, gBattleCommunication, B_SIDE_OPPONENT, BattleScript_EffectTeleportTryToRunAway |
Added macro |
Description
Fix by redirecting to the Baton Pass script when it's a trainer battle.
Images
Issue(s) that this PR fixes
Fixes #3164
Discord contact info