5 more callnatives

- jumpifshelltrap
- jumpifemergencyexited
- jumpifrodaffected
- jumpifabsorbaffected
- jumpifmotoraffected
This commit is contained in:
Eduardo Quezada 2023-08-31 23:43:48 -04:00
parent 4ac61ad15f
commit c4553c71aa
3 changed files with 81 additions and 81 deletions

View File

@ -1400,6 +1400,33 @@
.byte \case .byte \case
.endm .endm
.macro jumpifshelltrap battler:req, jumpInstr:req
callnative BS_JumpIfShellTrap
.byte \battler
.4byte \jumpInstr
.endm
.macro jumpifemergencyexited battler:req, jumpInstr:req
callnative BS_JumpIfEmergencyExited
.byte \battler
.4byte \jumpInstr
.endm
.macro jumpifrodaffected battler:req, jumpInstr:req
callnative BS_JumpIfRod
.4byte \jumpInstr
.endm
.macro jumpifabsorbaffected battler:req, jumpInstr:req
callnative BS_JumpIfAbsorb
.4byte \jumpInstr
.endm
.macro jumpifmotoraffected battler:req, jumpInstr:req
callnative BS_JumpIfMotor
.4byte \jumpInstr
.endm
@ various command changed to more readable macros @ various command changed to more readable macros
.macro cancelmultiturnmoves battler:req .macro cancelmultiturnmoves battler:req
various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES
@ -2017,21 +2044,6 @@
various BS_ATTACKER, VARIOUS_SHELL_SIDE_ARM_CHECK various BS_ATTACKER, VARIOUS_SHELL_SIDE_ARM_CHECK
.endm .endm
.macro jumpifrodaffected battler:req, jumpInstr:req
various \battler, VARIOUS_JUMP_IF_ROD
.4byte \jumpInstr
.endm
.macro jumpifabsorbaffected battler:req, jumpInstr:req
various \battler, VARIOUS_JUMP_IF_ABSORB
.4byte \jumpInstr
.endm
.macro jumpifmotoraffected battler:req, jumpInstr:req
various \battler, VARIOUS_JUMP_IF_MOTOR
.4byte \jumpInstr
.endm
.macro jumpifteanoberry jumpInstr:req .macro jumpifteanoberry jumpInstr:req
various BS_ATTACKER, VARIOUS_TEATIME_TARGETS various BS_ATTACKER, VARIOUS_TEATIME_TARGETS
.4byte \jumpInstr .4byte \jumpInstr
@ -2301,16 +2313,6 @@
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
.endm .endm
.macro jumpifemergencyexited battler:req, jumpInstr:req
various \battler, VARIOUS_JUMP_IF_EMERGENCY_EXITED
.4byte \jumpInstr
.endm
.macro jumpifshelltrap battler:req, ptr:req
various \battler, VARIOUS_JUMP_IF_SHELL_TRAP
.4byte \ptr
.endm
.macro hitswitchtargetfailed .macro hitswitchtargetfailed
various 0, VARIOUS_HIT_SWITCH_TARGET_FAILED various 0, VARIOUS_HIT_SWITCH_TARGET_FAILED
.endm .endm

View File

@ -241,18 +241,13 @@
#define VARIOUS_SET_BEAK_BLAST 150 #define VARIOUS_SET_BEAK_BLAST 150
#define VARIOUS_SWAP_SIDE_STATUSES 151 #define VARIOUS_SWAP_SIDE_STATUSES 151
#define VARIOUS_SWAP_STATS 152 #define VARIOUS_SWAP_STATS 152
#define VARIOUS_JUMP_IF_ROD 153
#define VARIOUS_JUMP_IF_ABSORB 154
#define VARIOUS_JUMP_IF_MOTOR 155
#define VARIOUS_TEATIME_INVUL 156 #define VARIOUS_TEATIME_INVUL 156
#define VARIOUS_TEATIME_TARGETS 157 #define VARIOUS_TEATIME_TARGETS 157
#define VARIOUS_TRY_WIND_RIDER_POWER 158 #define VARIOUS_TRY_WIND_RIDER_POWER 158
#define VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES 159 #define VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES 159
#define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 160 #define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 160
#define VARIOUS_JUMP_IF_EMERGENCY_EXITED 161
#define VARIOUS_STORE_HEALING_WISH 162 #define VARIOUS_STORE_HEALING_WISH 162
#define VARIOUS_HIT_SWITCH_TARGET_FAILED 163 #define VARIOUS_HIT_SWITCH_TARGET_FAILED 163
#define VARIOUS_JUMP_IF_SHELL_TRAP 164
#define VARIOUS_TRY_REVIVAL_BLESSING 165 #define VARIOUS_TRY_REVIVAL_BLESSING 165
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE 166 #define VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE 166
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION 167 #define VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION 167

View File

@ -8452,8 +8452,8 @@ static bool32 IsAbilityRodAffected(void)
if (gBattleStruct->dynamicMoveType == 0) if (gBattleStruct->dynamicMoveType == 0)
moveType = gBattleMoves[gCurrentMove].type; moveType = gBattleMoves[gCurrentMove].type;
else if (!(gBattleStruct->dynamicMoveType & 0x40)) else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_1))
moveType = gBattleStruct->dynamicMoveType & 0x3F; moveType = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK;
else else
moveType = gBattleMoves[gCurrentMove].type; moveType = gBattleMoves[gCurrentMove].type;
@ -8469,8 +8469,8 @@ static bool32 IsAbilityMotorAffected(void)
if (gBattleStruct->dynamicMoveType == 0) if (gBattleStruct->dynamicMoveType == 0)
moveType = gBattleMoves[gCurrentMove].type; moveType = gBattleMoves[gCurrentMove].type;
else if (!(gBattleStruct->dynamicMoveType & 0x40)) else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_1))
moveType = gBattleStruct->dynamicMoveType & 0x3F; moveType = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK;
else else
moveType = gBattleMoves[gCurrentMove].type; moveType = gBattleMoves[gCurrentMove].type;
@ -8486,8 +8486,8 @@ static bool32 IsAbilityAbsorbAffected(void)
if (gBattleStruct->dynamicMoveType == 0) if (gBattleStruct->dynamicMoveType == 0)
moveType = gBattleMoves[gCurrentMove].type; moveType = gBattleMoves[gCurrentMove].type;
else if (!(gBattleStruct->dynamicMoveType & 0x40)) else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_1))
moveType = gBattleStruct->dynamicMoveType & 0x3F; moveType = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK;
else else
moveType = gBattleMoves[gCurrentMove].type; moveType = gBattleMoves[gCurrentMove].type;
@ -10810,33 +10810,6 @@ static void Cmd_various(void)
gBattlescriptCurrInstr = cmd->jumpInstr; gBattlescriptCurrInstr = cmd->jumpInstr;
return; return;
} }
case VARIOUS_JUMP_IF_ROD:
{
VARIOUS_ARGS(const u8 *jumpInstr);
if (IsAbilityRodAffected())
gBattlescriptCurrInstr = cmd->jumpInstr;
else
gBattlescriptCurrInstr = cmd->nextInstr;
return;
}
case VARIOUS_JUMP_IF_MOTOR:
{
VARIOUS_ARGS(const u8 *jumpInstr);
if (IsAbilityMotorAffected())
gBattlescriptCurrInstr = cmd->jumpInstr;
else
gBattlescriptCurrInstr = cmd->nextInstr;
return;
}
case VARIOUS_JUMP_IF_ABSORB:
{
VARIOUS_ARGS(const u8 *jumpInstr);
if (IsAbilityAbsorbAffected())
gBattlescriptCurrInstr = cmd->jumpInstr;
else
gBattlescriptCurrInstr = cmd->nextInstr;
return;
}
case VARIOUS_TRY_WIND_RIDER_POWER: case VARIOUS_TRY_WIND_RIDER_POWER:
{ {
VARIOUS_ARGS(const u8 *failInstr); VARIOUS_ARGS(const u8 *failInstr);
@ -10869,15 +10842,6 @@ static void Cmd_various(void)
AbilityBattleEffects(ABILITYEFFECT_ON_TERRAIN, gActiveBattler, 0, 0, 0); AbilityBattleEffects(ABILITYEFFECT_ON_TERRAIN, gActiveBattler, 0, 0, 0);
return; return;
} }
case VARIOUS_JUMP_IF_EMERGENCY_EXITED:
{
VARIOUS_ARGS(const u8 *jumpInstr);
if (gSpecialStatuses[gActiveBattler].emergencyExited)
gBattlescriptCurrInstr = cmd->jumpInstr;
else
gBattlescriptCurrInstr = cmd->nextInstr;
return;
}
case VARIOUS_STORE_HEALING_WISH: case VARIOUS_STORE_HEALING_WISH:
{ {
VARIOUS_ARGS(); VARIOUS_ARGS();
@ -10894,15 +10858,6 @@ static void Cmd_various(void)
gBattlescriptCurrInstr = cmd->nextInstr; gBattlescriptCurrInstr = cmd->nextInstr;
return; return;
} }
case VARIOUS_JUMP_IF_SHELL_TRAP:
{
VARIOUS_ARGS(const u8 *jumpInstr);
if (gProtectStructs[gActiveBattler].shellTrap)
gBattlescriptCurrInstr = cmd->jumpInstr;
else
gBattlescriptCurrInstr = cmd->nextInstr;
return;
}
case VARIOUS_TRY_REVIVAL_BLESSING: case VARIOUS_TRY_REVIVAL_BLESSING:
{ {
VARIOUS_ARGS(const u8 *failInstr); VARIOUS_ARGS(const u8 *failInstr);
@ -16389,3 +16344,51 @@ void BS_HandleUltraBurst(void)
HandleScriptMegaPrimalBurst(cmd->caseId, gActiveBattler, HANDLE_TYPE_ULTRA_BURST); HandleScriptMegaPrimalBurst(cmd->caseId, gActiveBattler, HANDLE_TYPE_ULTRA_BURST);
gBattlescriptCurrInstr = cmd->nextInstr; gBattlescriptCurrInstr = cmd->nextInstr;
} }
void BS_JumpIfShellTrap(void)
{
NATIVE_ARGS(u8 battler, const u8 *jumpInstr);
gActiveBattler = GetBattlerForBattleScript(cmd->battler);
if (gProtectStructs[gActiveBattler].shellTrap)
gBattlescriptCurrInstr = cmd->jumpInstr;
else
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_JumpIfEmergencyExited(void)
{
NATIVE_ARGS(u8 battler, const u8 *jumpInstr);
gActiveBattler = GetBattlerForBattleScript(cmd->battler);
if (gSpecialStatuses[gActiveBattler].emergencyExited)
gBattlescriptCurrInstr = cmd->jumpInstr;
else
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_JumpIfRod(void)
{
NATIVE_ARGS(const u8 *jumpInstr);
if (IsAbilityRodAffected())
gBattlescriptCurrInstr = cmd->jumpInstr;
else
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_JumpIfAbsorb(void)
{
NATIVE_ARGS(const u8 *jumpInstr);
if (IsAbilityAbsorbAffected())
gBattlescriptCurrInstr = cmd->jumpInstr;
else
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_JumpIfMotor(void)
{
NATIVE_ARGS(const u8 *jumpInstr);
if (IsAbilityMotorAffected())
gBattlescriptCurrInstr = cmd->jumpInstr;
else
gBattlescriptCurrInstr = cmd->nextInstr;
}