Fix regression introduced for Eject Button (#3738)

Fix regression introduced for Eject Button
This commit is contained in:
ghoulslash 2023-12-16 07:57:36 -05:00 committed by GitHub
commit 050d3a546f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 12 deletions

View file

@ -362,11 +362,6 @@
.byte 0x3f
.endm
.macro jumpifaffectedbyprotect failInstr:req
.byte 0x40
.4byte \failInstr
.endm
.macro call instr:req
.byte 0x41
.4byte \instr

View file

@ -773,7 +773,7 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER
#define BATTLER_MAX_HP(battlerId)(gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP)
#define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0) || (gBattleStruct->enduredDamage & gBitTable[gBattlerTarget]))
#define BATTLER_DAMAGED(battlerId) ((gSpecialStatuses[battlerId].physicalDmg != 0 || gSpecialStatuses[battlerId].specialDmg != 0))
#define BATTLER_TURN_DAMAGED(battlerId) ((gSpecialStatuses[battlerId].physicalDmg != 0 || gSpecialStatuses[battlerId].specialDmg != 0) || (gBattleStruct->enduredDamage & gBitTable[battler]))
#define IS_BATTLER_OF_TYPE(battlerId, type)((GetBattlerType(battlerId, 0) == type || GetBattlerType(battlerId, 1) == type || (GetBattlerType(battlerId, 2) != TYPE_MYSTERY && GetBattlerType(battlerId, 2) == type)))

View file

@ -418,7 +418,7 @@ static void Cmd_return(void);
static void Cmd_end(void);
static void Cmd_end2(void);
static void Cmd_end3(void);
static void Cmd_jumpifaffectedbyprotect(void);
static void Cmd_unused5(void);
static void Cmd_call(void);
static void Cmd_setroost(void);
static void Cmd_jumpifabilitypresent(void);
@ -677,7 +677,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
Cmd_end, //0x3D
Cmd_end2, //0x3E
Cmd_end3, //0x3F
Cmd_jumpifaffectedbyprotect, //0x40
Cmd_unused5, //0x40
Cmd_call, //0x41
Cmd_setroost, //0x42
Cmd_jumpifabilitypresent, //0x43
@ -1507,7 +1507,7 @@ static bool32 JumpIfMoveFailed(u8 adder, u16 move)
return FALSE;
}
static void Cmd_jumpifaffectedbyprotect(void)
static void Cmd_unused5(void)
{
CMD_ARGS(const u8 *failInstr);
@ -5853,7 +5853,7 @@ static void Cmd_moveend(void)
if (IsBattlerAlive(battler)
&& gBattlerAttacker != battler
&& GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_EJECT_BUTTON
&& TARGET_TURN_DAMAGED
&& BATTLER_TURN_DAMAGED(battler)
&& CountUsablePartyMons(battler) > 0) // Has mon to switch into
{
gBattleScripting.battler = battler;
@ -5888,7 +5888,7 @@ static void Cmd_moveend(void)
&& IsBattlerAlive(battler)
&& !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove)
&& GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_RED_CARD
&& (gSpecialStatuses[battler].physicalDmg != 0 || gSpecialStatuses[battler].specialDmg != 0)
&& BATTLER_TURN_DAMAGED(battler)
&& CanBattlerSwitch(gBattlerAttacker))
{
gLastUsedItem = gBattleMons[battler].item;
@ -5952,7 +5952,7 @@ static void Cmd_moveend(void)
// Attacker is mon who made contact, battler is mon with pickpocket
if (battler != gBattlerAttacker // Cannot pickpocket yourself
&& GetBattlerAbility(battler) == ABILITY_PICKPOCKET // Target must have pickpocket ability
&& BATTLER_DAMAGED(battler) // Target needs to have been damaged
&& BATTLER_TURN_DAMAGED(battler) // Target needs to have been damaged
&& !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove) // Subsitute unaffected
&& IsBattlerAlive(battler) // Battler must be alive to pickpocket
&& gBattleMons[battler].item == ITEM_NONE // Pickpocketer can't have an item already