add savedBattlerAttacker and stack for saved target/attacker (#4061)

* add saveattacker/savetarget stack

* add safety checks to savedAttackerCount/savedTargetCount

* add testing warnings for saveattacker/savetarget

* update frisk with saveattacker

* restoretarget at end of red card battle scripts, remove testing checks on SaveAttacker,SaveTarget

---------

Co-authored-by: ghoulslash <pokevoyager0@gmail.com>
This commit is contained in:
ghoulslash 2024-05-29 15:50:24 -04:00 committed by GitHub
parent a0006d8dfb
commit 7b1248b167
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 236 additions and 145 deletions

View file

@ -1352,6 +1352,22 @@
.endm
@ callnative macros
.macro savetarget
callnative BS_SaveTarget
.endm
.macro restoretarget
callnative BS_RestoreTarget
.endm
.macro saveattacker
callnative BS_SaveAttacker
.endm
.macro restoreattacker
callnative BS_RestoreAttacker
.endm
.macro metalburstdamagecalculator failInstr:req
callnative BS_CalcMetalBurstDmg
.4byte \failInstr
@ -1774,14 +1790,6 @@
various \battler, VARIOUS_SWITCHIN_ABILITIES
.endm
.macro savetarget
various BS_TARGET, VARIOUS_SAVE_TARGET
.endm
.macro restoretarget
various BS_TARGET, VARIOUS_RESTORE_TARGET
.endm
.macro instanthpdrop battler:req
various \battler, VARIOUS_INSTANT_HP_DROP
.endm

View file

@ -8566,7 +8566,10 @@ BattleScript_FriskMsg::
return
BattleScript_FriskActivates::
saveattacker
copybyte gBattlerAttacker, sBATTLER
tryfriskmsg BS_ATTACKER
restoreattacker
end3
BattleScript_ImposterActivates::
@ -9559,19 +9562,19 @@ BattleScript_RedCardIngrain:
printstring STRINGID_PKMNANCHOREDITSELF
waitmessage B_WAIT_TIME_LONG
removeitem BS_SCRIPTING
swapattackerwithtarget
restoretarget
return
BattleScript_RedCardSuctionCups:
printstring STRINGID_PKMNANCHORSITSELFWITH
waitmessage B_WAIT_TIME_LONG
removeitem BS_SCRIPTING
swapattackerwithtarget
restoretarget
return
BattleScript_RedCardDynamaxed:
printstring STRINGID_MOVEBLOCKEDBYDYNAMAX
waitmessage B_WAIT_TIME_LONG
removeitem BS_SCRIPTING
swapattackerwithtarget
restoretarget
return
BattleScript_EjectButtonActivates::

View file

@ -738,7 +738,10 @@ struct BattleStruct
u8 magnitudeBasePower;
u8 presentBasePower;
u8 roostTypes[MAX_BATTLERS_COUNT][2];
u8 savedBattlerTarget;
u8 savedBattlerTarget[5];
u8 savedBattlerAttacker[5];
u8 savedTargetCount:4;
u8 savedAttackerCount:4;
bool8 ateBoost[MAX_BATTLERS_COUNT];
u8 activeAbilityPopUps; // as bits for each battler
u8 abilityPopUpSpriteIds[MAX_BATTLERS_COUNT][2]; // two per battler

View file

@ -118,125 +118,123 @@
#define VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC 26
#define VARIOUS_STAT_TEXT_BUFFER 27
#define VARIOUS_SWITCHIN_ABILITIES 28
#define VARIOUS_SAVE_TARGET 29
#define VARIOUS_RESTORE_TARGET 30
#define VARIOUS_INSTANT_HP_DROP 31
#define VARIOUS_CLEAR_STATUS 32
#define VARIOUS_RESTORE_PP 33
#define VARIOUS_TRY_ACTIVATE_MOXIE 34
#define VARIOUS_TRY_ACTIVATE_FELL_STINGER 35
#define VARIOUS_PLAY_MOVE_ANIMATION 36
#define VARIOUS_SET_LUCKY_CHANT 37
#define VARIOUS_SUCKER_PUNCH_CHECK 38
#define VARIOUS_SET_SIMPLE_BEAM 39
#define VARIOUS_TRY_ENTRAINMENT 40
#define VARIOUS_SET_LAST_USED_ABILITY 41
#define VARIOUS_INVERT_STAT_STAGES 42
#define VARIOUS_TRY_ME_FIRST 43
#define VARIOUS_JUMP_IF_BATTLE_END 44
#define VARIOUS_TRY_ELECTRIFY 45
#define VARIOUS_TRY_REFLECT_TYPE 46
#define VARIOUS_TRY_SOAK 47
#define VARIOUS_HANDLE_MEGA_EVO 48
#define VARIOUS_TRY_LAST_RESORT 49
#define VARIOUS_SET_ARG_TO_BATTLE_DAMAGE 50
#define VARIOUS_TRY_HIT_SWITCH_TARGET 51
#define VARIOUS_TRY_AUTOTOMIZE 52
#define VARIOUS_ABILITY_POPUP 53
#define VARIOUS_JUMP_IF_TARGET_ALLY 54
#define VARIOUS_TRY_SYNCHRONOISE 55
#define VARIOUS_PSYCHO_SHIFT 56
#define VARIOUS_CURE_STATUS 57
#define VARIOUS_POWER_TRICK 58
#define VARIOUS_AFTER_YOU 59
#define VARIOUS_BESTOW 60
#define VARIOUS_JUMP_IF_NOT_GROUNDED 61
#define VARIOUS_HANDLE_TRAINER_SLIDE_MSG 62
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_FIRST_OFF 63
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_LAST_ON 64
#define VARIOUS_SET_AURORA_VEIL 65
#define VARIOUS_TRY_THIRD_TYPE 66
#define VARIOUS_ACUPRESSURE 67
#define VARIOUS_SET_POWDER 68
#define VARIOUS_SPECTRAL_THIEF 69
#define VARIOUS_GRAVITY_ON_AIRBORNE_MONS 70
#define VARIOUS_CHECK_IF_GRASSY_TERRAIN_HEALS 71
#define VARIOUS_JUMP_IF_ROAR_FAILS 72
#define VARIOUS_TRY_INSTRUCT 73
#define VARIOUS_JUMP_IF_NOT_BERRY 74
#define VARIOUS_TRACE_ABILITY 75
#define VARIOUS_UPDATE_NICK 76
#define VARIOUS_TRY_ILLUSION_OFF 77
#define VARIOUS_SET_SPRITEIGNORE0HP 78
#define VARIOUS_HANDLE_FORM_CHANGE 79
#define VARIOUS_GET_STAT_VALUE 80
#define VARIOUS_JUMP_IF_FULL_HP 81
#define VARIOUS_LOSE_TYPE 82
#define VARIOUS_TRY_ACTIVATE_SOULHEART 83
#define VARIOUS_TRY_ACTIVATE_RECEIVER 84
#define VARIOUS_TRY_ACTIVATE_BEAST_BOOST 85
#define VARIOUS_TRY_FRISK 86
#define VARIOUS_JUMP_IF_SHIELDS_DOWN_PROTECTED 87
#define VARIOUS_TRY_FAIRY_LOCK 88
#define VARIOUS_JUMP_IF_NO_ALLY 89
#define VARIOUS_POISON_TYPE_IMMUNITY 90
#define VARIOUS_JUMP_IF_HOLD_EFFECT 91
#define VARIOUS_INFATUATE_WITH_BATTLER 92
#define VARIOUS_SET_LAST_USED_ITEM 93
#define VARIOUS_PARALYZE_TYPE_IMMUNITY 94
#define VARIOUS_JUMP_IF_ABSENT 95
#define VARIOUS_DESTROY_ABILITY_POPUP 96
#define VARIOUS_TOTEM_BOOST 97
#define VARIOUS_TRY_ACTIVATE_GRIM_NEIGH 98
#define VARIOUS_MOVEEND_ITEM_EFFECTS 99
#define VARIOUS_TERRAIN_SEED 100
#define VARIOUS_MAKE_INVISIBLE 101
#define VARIOUS_ROOM_SERVICE 102
#define VARIOUS_EERIE_SPELL_PP_REDUCE 103
#define VARIOUS_JUMP_IF_TEAM_HEALTHY 104
#define VARIOUS_TRY_HEAL_QUARTER_HP 105
#define VARIOUS_REMOVE_TERRAIN 106
#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 107
#define VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER 108
#define VARIOUS_GET_ROTOTILLER_TARGETS 109
#define VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED 110
#define VARIOUS_TRY_ACTIVATE_BATTLE_BOND 111
#define VARIOUS_CONSUME_BERRY 112
#define VARIOUS_JUMP_IF_CANT_REVERT_TO_PRIMAL 113
#define VARIOUS_JUMP_IF_SPECIES 114
#define VARIOUS_UPDATE_ABILITY_POPUP 115
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 116
#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 117
#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 118
#define VARIOUS_SHELL_SIDE_ARM_CHECK 119
#define VARIOUS_TRY_NO_RETREAT 120
#define VARIOUS_TRY_TAR_SHOT 121
#define VARIOUS_CAN_TAR_SHOT_WORK 122
#define VARIOUS_CHECK_POLTERGEIST 123
#define VARIOUS_CUT_1_3_HP_RAISE_STATS 124
#define VARIOUS_TRY_END_NEUTRALIZING_GAS 125
#define VARIOUS_JUMP_IF_UNDER_200 126
#define VARIOUS_SET_SKY_DROP 127
#define VARIOUS_CLEAR_SKY_DROP 128
#define VARIOUS_SKY_DROP_YAWN 129
#define VARIOUS_CURE_CERTAIN_STATUSES 130
#define VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES 131
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_BERRY 132
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_HOLD_EFFECT 133
#define VARIOUS_SAVE_BATTLER_ITEM 134
#define VARIOUS_RESTORE_BATTLER_ITEM 135
#define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 136
#define VARIOUS_SET_BEAK_BLAST 137
#define VARIOUS_SWAP_SIDE_STATUSES 138
#define VARIOUS_SWAP_STATS 139
#define VARIOUS_TEATIME_INVUL 140
#define VARIOUS_TEATIME_TARGETS 141
#define VARIOUS_TRY_WIND_RIDER_POWER 142
#define VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES 143
#define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 144
#define VARIOUS_STORE_HEALING_WISH 145
#define VARIOUS_HIT_SWITCH_TARGET_FAILED 146
#define VARIOUS_TRY_REVIVAL_BLESSING 147
#define VARIOUS_INSTANT_HP_DROP 29
#define VARIOUS_CLEAR_STATUS 30
#define VARIOUS_RESTORE_PP 31
#define VARIOUS_TRY_ACTIVATE_MOXIE 32
#define VARIOUS_TRY_ACTIVATE_FELL_STINGER 33
#define VARIOUS_PLAY_MOVE_ANIMATION 34
#define VARIOUS_SET_LUCKY_CHANT 35
#define VARIOUS_SUCKER_PUNCH_CHECK 36
#define VARIOUS_SET_SIMPLE_BEAM 37
#define VARIOUS_TRY_ENTRAINMENT 38
#define VARIOUS_SET_LAST_USED_ABILITY 39
#define VARIOUS_INVERT_STAT_STAGES 40
#define VARIOUS_TRY_ME_FIRST 41
#define VARIOUS_JUMP_IF_BATTLE_END 42
#define VARIOUS_TRY_ELECTRIFY 43
#define VARIOUS_TRY_REFLECT_TYPE 44
#define VARIOUS_TRY_SOAK 45
#define VARIOUS_HANDLE_MEGA_EVO 46
#define VARIOUS_TRY_LAST_RESORT 47
#define VARIOUS_SET_ARG_TO_BATTLE_DAMAGE 48
#define VARIOUS_TRY_HIT_SWITCH_TARGET 49
#define VARIOUS_TRY_AUTOTOMIZE 50
#define VARIOUS_ABILITY_POPUP 51
#define VARIOUS_JUMP_IF_TARGET_ALLY 52
#define VARIOUS_TRY_SYNCHRONOISE 53
#define VARIOUS_PSYCHO_SHIFT 54
#define VARIOUS_CURE_STATUS 55
#define VARIOUS_POWER_TRICK 56
#define VARIOUS_AFTER_YOU 57
#define VARIOUS_BESTOW 58
#define VARIOUS_JUMP_IF_NOT_GROUNDED 59
#define VARIOUS_HANDLE_TRAINER_SLIDE_MSG 60
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_FIRST_OFF 61
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_LAST_ON 62
#define VARIOUS_SET_AURORA_VEIL 63
#define VARIOUS_TRY_THIRD_TYPE 64
#define VARIOUS_ACUPRESSURE 65
#define VARIOUS_SET_POWDER 66
#define VARIOUS_SPECTRAL_THIEF 67
#define VARIOUS_GRAVITY_ON_AIRBORNE_MONS 68
#define VARIOUS_CHECK_IF_GRASSY_TERRAIN_HEALS 69
#define VARIOUS_JUMP_IF_ROAR_FAILS 70
#define VARIOUS_TRY_INSTRUCT 71
#define VARIOUS_JUMP_IF_NOT_BERRY 72
#define VARIOUS_TRACE_ABILITY 73
#define VARIOUS_UPDATE_NICK 74
#define VARIOUS_TRY_ILLUSION_OFF 75
#define VARIOUS_SET_SPRITEIGNORE0HP 76
#define VARIOUS_HANDLE_FORM_CHANGE 77
#define VARIOUS_GET_STAT_VALUE 78
#define VARIOUS_JUMP_IF_FULL_HP 79
#define VARIOUS_LOSE_TYPE 80
#define VARIOUS_TRY_ACTIVATE_SOULHEART 81
#define VARIOUS_TRY_ACTIVATE_RECEIVER 82
#define VARIOUS_TRY_ACTIVATE_BEAST_BOOST 83
#define VARIOUS_TRY_FRISK 84
#define VARIOUS_JUMP_IF_SHIELDS_DOWN_PROTECTED 85
#define VARIOUS_TRY_FAIRY_LOCK 86
#define VARIOUS_JUMP_IF_NO_ALLY 87
#define VARIOUS_POISON_TYPE_IMMUNITY 88
#define VARIOUS_JUMP_IF_HOLD_EFFECT 89
#define VARIOUS_INFATUATE_WITH_BATTLER 90
#define VARIOUS_SET_LAST_USED_ITEM 91
#define VARIOUS_PARALYZE_TYPE_IMMUNITY 92
#define VARIOUS_JUMP_IF_ABSENT 93
#define VARIOUS_DESTROY_ABILITY_POPUP 94
#define VARIOUS_TOTEM_BOOST 95
#define VARIOUS_TRY_ACTIVATE_GRIM_NEIGH 96
#define VARIOUS_MOVEEND_ITEM_EFFECTS 97
#define VARIOUS_TERRAIN_SEED 98
#define VARIOUS_MAKE_INVISIBLE 99
#define VARIOUS_ROOM_SERVICE 100
#define VARIOUS_EERIE_SPELL_PP_REDUCE 101
#define VARIOUS_JUMP_IF_TEAM_HEALTHY 102
#define VARIOUS_TRY_HEAL_QUARTER_HP 103
#define VARIOUS_REMOVE_TERRAIN 104
#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 105
#define VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER 106
#define VARIOUS_GET_ROTOTILLER_TARGETS 107
#define VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED 108
#define VARIOUS_TRY_ACTIVATE_BATTLE_BOND 109
#define VARIOUS_CONSUME_BERRY 110
#define VARIOUS_JUMP_IF_CANT_REVERT_TO_PRIMAL 111
#define VARIOUS_JUMP_IF_SPECIES 112
#define VARIOUS_UPDATE_ABILITY_POPUP 113
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 114
#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 115
#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 116
#define VARIOUS_SHELL_SIDE_ARM_CHECK 117
#define VARIOUS_TRY_NO_RETREAT 118
#define VARIOUS_TRY_TAR_SHOT 119
#define VARIOUS_CAN_TAR_SHOT_WORK 120
#define VARIOUS_CHECK_POLTERGEIST 121
#define VARIOUS_CUT_1_3_HP_RAISE_STATS 122
#define VARIOUS_TRY_END_NEUTRALIZING_GAS 123
#define VARIOUS_JUMP_IF_UNDER_200 124
#define VARIOUS_SET_SKY_DROP 125
#define VARIOUS_CLEAR_SKY_DROP 126
#define VARIOUS_SKY_DROP_YAWN 127
#define VARIOUS_CURE_CERTAIN_STATUSES 128
#define VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES 129
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_BERRY 130
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_HOLD_EFFECT 131
#define VARIOUS_SAVE_BATTLER_ITEM 132
#define VARIOUS_RESTORE_BATTLER_ITEM 133
#define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 134
#define VARIOUS_SET_BEAK_BLAST 135
#define VARIOUS_SWAP_SIDE_STATUSES 136
#define VARIOUS_SWAP_STATS 137
#define VARIOUS_TEATIME_INVUL 138
#define VARIOUS_TEATIME_TARGETS 139
#define VARIOUS_TRY_WIND_RIDER_POWER 140
#define VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES 141
#define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 142
#define VARIOUS_STORE_HEALING_WISH 143
#define VARIOUS_HIT_SWITCH_TARGET_FAILED 144
#define VARIOUS_TRY_REVIVAL_BLESSING 145
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View file

@ -337,6 +337,8 @@ static bool8 CanBurnHitThaw(u16 move);
static u32 GetNextTarget(u32 moveTarget, bool32 excludeCurrent);
static void TryUpdateEvolutionTracker(u32 evolutionMethod, u32 upAmount, u16 usedMove);
static void AccuracyCheck(bool32 recalcDragonDarts, const u8 *nextInstr, const u8 *failInstr, u16 move);
static void SaveBattlerAttacker(u32 battler);
static void SaveBattlerTarget(u32 battler);
static void Cmd_attackcanceler(void);
static void Cmd_accuracycheck(void);
@ -6168,7 +6170,8 @@ static void Cmd_moveend(void)
&& CanBattlerSwitch(gBattlerAttacker))
{
gLastUsedItem = gBattleMons[battler].item;
gBattleStruct->savedBattlerTarget = gBattleScripting.battler = battler; // Battler with red card
SaveBattlerTarget(battler); // save battler with red card
gBattleScripting.battler = battler;
gEffectBattler = gBattlerAttacker;
if (gMovesInfo[gCurrentMove].effect == EFFECT_HIT_ESCAPE)
gBattlescriptCurrInstr = BattleScript_MoveEnd; // Prevent user switch-in selection
@ -6325,6 +6328,25 @@ static void Cmd_moveend(void)
&& (gMoveResultFlags & MOVE_RESULT_NO_EFFECT) // And it is unusable
&& (gBattleMons[gBattlerAttacker].status2 & STATUS2_LOCK_CONFUSE) != STATUS2_LOCK_CONFUSE_TURN(1)) // And won't end this turn
CancelMultiTurnMoves(gBattlerAttacker); // Cancel it
if (gBattleStruct->savedAttackerCount > 0)
{
// #if TESTING
// Test_ExitWithResult(TEST_RESULT_ERROR, "savedAttackerCount is greater than 0! More calls to SaveBattlerAttacker than RestoreBattlerAttacker!");
// #else
DebugPrintfLevel(MGBA_LOG_WARN, "savedAttackerCount is greater than 0! More calls to SaveBattlerAttacker than RestoreBattlerAttacker!");
// #endif
}
if (gBattleStruct->savedTargetCount > 0)
{
// #if TESTING
// Test_ExitWithResult(TEST_RESULT_ERROR, "savedTargetCount is greater than 0! More calls to SaveBattlerTarget than RestoreBattlerTarget!");
// #else
DebugPrintfLevel(MGBA_LOG_WARN, "savedTargetCount is greater than 0! More calls to SaveBattlerTarget than RestoreBattlerTarget!");
// #endif
}
gBattleStruct->targetsDone[gBattlerAttacker] = 0;
gProtectStructs[gBattlerAttacker].targetAffected = FALSE;
@ -9379,18 +9401,6 @@ static void Cmd_various(void)
AbilityBattleEffects(ABILITYEFFECT_OPPORTUNIST, battler, 0, 0, 0);
return;
}
case VARIOUS_SAVE_TARGET:
{
VARIOUS_ARGS();
gBattleStruct->savedBattlerTarget = gBattlerTarget;
break;
}
case VARIOUS_RESTORE_TARGET:
{
VARIOUS_ARGS();
gBattlerTarget = gBattleStruct->savedBattlerTarget;
break;
}
case VARIOUS_INSTANT_HP_DROP:
{
VARIOUS_ARGS();
@ -15655,6 +15665,75 @@ static void Cmd_callnative(void)
}
// Callnative Funcs
static void SaveBattlerTarget(u32 battler)
{
if (gBattleStruct->savedTargetCount < NELEMS(gBattleStruct->savedBattlerTarget))
gBattleStruct->savedBattlerTarget[gBattleStruct->savedTargetCount++] = battler;
else
DebugPrintfLevel(MGBA_LOG_WARN, "Attempting to exceed savedBattlerTarget array size!");
}
static void SaveBattlerAttacker(u32 battler)
{
if (gBattleStruct->savedAttackerCount < NELEMS(gBattleStruct->savedBattlerAttacker))
gBattleStruct->savedBattlerAttacker[gBattleStruct->savedAttackerCount++] = battler;
else
DebugPrintfLevel(MGBA_LOG_WARN, "Attempting to exceed savedBattlerAttacker array size!");
}
void BS_SaveTarget(void)
{
NATIVE_ARGS();
SaveBattlerTarget(gBattlerTarget);
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_RestoreTarget(void)
{
NATIVE_ARGS();
if (gBattleStruct->savedTargetCount > 0)
{
gBattleStruct->savedTargetCount--;
gBattlerTarget = gBattleStruct->savedBattlerTarget[gBattleStruct->savedTargetCount];
}
else
{
// #if TESTING
// Test_ExitWithResult(TEST_RESULT_ERROR, "BS_RestoreTarget attempting to restore an empty target!");
// #else
DebugPrintfLevel(MGBA_LOG_WARN, "BS_RestoreTarget attempting to restore an empty target!");
// #endif
}
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_SaveAttacker(void)
{
NATIVE_ARGS();
SaveBattlerAttacker(gBattlerAttacker);
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_RestoreAttacker(void)
{
NATIVE_ARGS();
if (gBattleStruct->savedAttackerCount > 0)
{
gBattleStruct->savedAttackerCount--;
gBattlerAttacker = gBattleStruct->savedBattlerAttacker[gBattleStruct->savedAttackerCount];
}
else
{
// #if TESTING
// Test_ExitWithResult(TEST_RESULT_ERROR, "BS_RestoreAttacker attempting to restore an empty attacker!");
// #else
DebugPrintfLevel(MGBA_LOG_WARN, "BS_RestoreAttacker attempting to restore an empty attacker!");
// #endif
}
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_CalcMetalBurstDmg(void)
{
NATIVE_ARGS(const u8 *failInstr);

View file

@ -4408,7 +4408,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
if (!gSpecialStatuses[battler].switchInAbilityDone)
{
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
gBattlerAttacker = battler;
gBattleScripting.battler = battler;
BattleScriptPushCursorAndCallback(BattleScript_FriskActivates); // Try activate
effect++;
}