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 3 variouses to callnatives #5646

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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 asm/macros/battle_script.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,19 @@
callnative BS_WaitFanfare
.endm

.macro setbeakblast
callnative BS_SetBeakBlast
.endm

.macro cantarshotwork failInstr:req
callnative BS_CanTarShotWork
.4byte \failInstr
.endm

.macro removeterrain
callnative BS_RemoveTerrain
.endm

@ various command changed to more readable macros
.macro cancelmultiturnmoves battler:req
various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES
Expand Down Expand Up @@ -2218,10 +2231,6 @@
.4byte \failInstr
.endm

.macro removeterrain
various BS_ATTACKER, VARIOUS_REMOVE_TERRAIN
.endm

.macro trytoclearprimalweather
various BS_ATTACKER, VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER
.endm
Expand Down Expand Up @@ -2270,11 +2279,6 @@
.4byte \failInstr
.endm

.macro cantarshotwork battler:req, failInstr:req
various \battler, VARIOUS_CAN_TAR_SHOT_WORK
.4byte \failInstr
.endm

.macro checkpoltergeist battler:req, failInstr:req
various \battler, VARIOUS_CHECK_POLTERGEIST
.4byte \failInstr
Expand Down Expand Up @@ -2316,10 +2320,6 @@
various \battler, VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM
.endm

.macro setbeakblast battler:req
various \battler, VARIOUS_SET_BEAK_BLAST
.endm

.macro swapsidestatuses
various BS_ATTACKER, VARIOUS_SWAP_SIDE_STATUSES
.endm
Expand Down
4 changes: 2 additions & 2 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ BattleScript_EffectCourtChange::
goto BattleScript_MoveEnd

BattleScript_BeakBlastSetUp::
setbeakblast BS_ATTACKER
setbeakblast
flushtextbox
playanimation BS_ATTACKER, B_ANIM_BEAK_BLAST_SETUP, NULL
printstring STRINGID_HEATUPBEAK
Expand Down Expand Up @@ -891,7 +891,7 @@ BattleScript_EffectTarShot::
attackcanceler
jumpifsubstituteblocks BattleScript_FailedFromAtkString
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
cantarshotwork BS_TARGET, BattleScript_FailedFromAtkString
cantarshotwork BattleScript_FailedFromAtkString
attackstring
ppreduce
setstatchanger STAT_SPEED, 1, TRUE
Expand Down
62 changes: 29 additions & 33 deletions include/constants/battle_script_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,39 +192,35 @@
#define VARIOUS_EERIE_SPELL_PP_REDUCE 100
#define VARIOUS_JUMP_IF_TEAM_HEALTHY 101
#define VARIOUS_TRY_HEAL_QUARTER_HP 102
#define VARIOUS_REMOVE_TERRAIN 103
#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 104
#define VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER 105
#define VARIOUS_GET_ROTOTILLER_TARGETS 106
#define VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED 107
#define VARIOUS_TRY_ACTIVATE_BATTLE_BOND 108
#define VARIOUS_CONSUME_BERRY 109
#define VARIOUS_JUMP_IF_CANT_REVERT_TO_PRIMAL 110
#define VARIOUS_JUMP_IF_SPECIES 111
#define VARIOUS_UPDATE_ABILITY_POPUP 112
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 113
#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 114
#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 115
#define VARIOUS_TRY_NO_RETREAT 116
#define VARIOUS_TRY_TAR_SHOT 117
#define VARIOUS_CAN_TAR_SHOT_WORK 118
#define VARIOUS_CHECK_POLTERGEIST 119
#define VARIOUS_CUT_1_3_HP_RAISE_STATS 120
#define VARIOUS_TRY_END_NEUTRALIZING_GAS 121
#define VARIOUS_JUMP_IF_UNDER_200 122
#define VARIOUS_SET_SKY_DROP 123
#define VARIOUS_CLEAR_SKY_DROP 124
#define VARIOUS_SKY_DROP_YAWN 125
#define VARIOUS_CURE_CERTAIN_STATUSES 126
#define VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES 127
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_BERRY 128
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_HOLD_EFFECT 129
#define VARIOUS_SAVE_BATTLER_ITEM 130
#define VARIOUS_RESTORE_BATTLER_ITEM 131
#define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 132
#define VARIOUS_SET_BEAK_BLAST 133
#define VARIOUS_SWAP_SIDE_STATUSES 134
#define VARIOUS_SWAP_STATS 135
#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 103
#define VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER 104
#define VARIOUS_GET_ROTOTILLER_TARGETS 105
#define VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED 106
#define VARIOUS_TRY_ACTIVATE_BATTLE_BOND 107
#define VARIOUS_CONSUME_BERRY 108
#define VARIOUS_JUMP_IF_CANT_REVERT_TO_PRIMAL 109
#define VARIOUS_JUMP_IF_SPECIES 110
#define VARIOUS_UPDATE_ABILITY_POPUP 111
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 112
#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 113
#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 114
#define VARIOUS_TRY_NO_RETREAT 115
#define VARIOUS_CHECK_POLTERGEIST 116
#define VARIOUS_CUT_1_3_HP_RAISE_STATS 117
#define VARIOUS_TRY_END_NEUTRALIZING_GAS 118
#define VARIOUS_JUMP_IF_UNDER_200 119
#define VARIOUS_SET_SKY_DROP 120
#define VARIOUS_CLEAR_SKY_DROP 121
#define VARIOUS_SKY_DROP_YAWN 122
#define VARIOUS_CURE_CERTAIN_STATUSES 123
#define VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES 124
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_BERRY 125
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_HOLD_EFFECT 126
#define VARIOUS_SAVE_BATTLER_ITEM 127
#define VARIOUS_RESTORE_BATTLER_ITEM 128
#define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 129
#define VARIOUS_SWAP_SIDE_STATUSES 130
#define VARIOUS_SWAP_STATS 131

// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0
Expand Down
48 changes: 25 additions & 23 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -10524,12 +10524,6 @@ static void Cmd_various(void)
gBattlescriptCurrInstr = cmd->nextInstr; // can heal
return;
}
case VARIOUS_REMOVE_TERRAIN:
{
VARIOUS_ARGS();
RemoveAllTerrains();
break;
}
case VARIOUS_JUMP_IF_UNDER_200:
{
VARIOUS_ARGS(const u8 *jumpInstr);
Expand Down Expand Up @@ -10847,17 +10841,6 @@ static void Cmd_various(void)
}
return;
}
case VARIOUS_CAN_TAR_SHOT_WORK:
{
VARIOUS_ARGS(const u8 *failInstr);
// Tar Shot will fail if it's already been used on the target and its speed can't be lowered further
if (!gDisableStructs[battler].tarShot
&& CompareStat(battler, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN))
gBattlescriptCurrInstr = cmd->nextInstr;
else
gBattlescriptCurrInstr = cmd->failInstr;
return;
}
case VARIOUS_CURE_CERTAIN_STATUSES:
{
VARIOUS_ARGS();
Expand Down Expand Up @@ -10950,12 +10933,6 @@ static void Cmd_various(void)
gBattleMons[battler].item = gLastUsedItem;
break;
}
case VARIOUS_SET_BEAK_BLAST:
{
VARIOUS_ARGS();
gProtectStructs[battler].beakBlastCharge = TRUE;
break;
}
case VARIOUS_SWAP_SIDE_STATUSES:
{
VARIOUS_ARGS();
Expand Down Expand Up @@ -17311,6 +17288,17 @@ void BS_TryTarShot(void)
}
}

void BS_CanTarShotWork(void)
{
NATIVE_ARGS(const u8 *failInstr);
// Tar Shot will fail if it's already been used on the target and its speed can't be lowered further
if (!gDisableStructs[gBattlerTarget].tarShot
&& CompareStat(gBattlerTarget, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN))
gBattlescriptCurrInstr = cmd->nextInstr;
else
gBattlescriptCurrInstr = cmd->failInstr;
}

void BS_JumpIfBlockedBySoundproof(void)
{
NATIVE_ARGS(u8 battler, const u8 *jumpInstr);
Expand Down Expand Up @@ -17547,3 +17535,17 @@ void BS_WaitFanfare(void)

gBattlescriptCurrInstr = cmd->nextInstr;
}

void BS_SetBeakBlast(void)
{
NATIVE_ARGS();
gProtectStructs[gBattlerAttacker].beakBlastCharge = TRUE;
gBattlescriptCurrInstr = cmd->nextInstr;
}

void BS_RemoveTerrain(void)
{
NATIVE_ARGS();
RemoveAllTerrains();
gBattlescriptCurrInstr = cmd->nextInstr;
}
Loading