diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 4fa360db03..a45b9967ba 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1976,8 +1976,9 @@ various BS_ATTACKER, VARIOUS_SWAP_SIDE_STATUSES .endm - .macro isparentalbondlaststrike ptr:req - various BS_ATTACKER, VARIOUS_IS_PARENTAL_BOND_LAST_STRIKE + .macro checkparentalbondcounter counter:req, ptr:req + various BS_ATTACKER, VARIOUS_CHECK_PARENTAL_BOND_COUNTER + .byte \counter .4byte \ptr .endm diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 95a279f28e..52eaf89f1f 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -306,7 +306,7 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectCloseCombat @ EFFECT_CLOSE_COMBAT .4byte BattleScript_EffectLastResort @ EFFECT_LAST_RESORT .4byte BattleScript_EffectHit @ EFFECT_RECOIL_33_STATUS - .4byte BattleScript_EffectFlinchWithStatus @ EFFECT_FLINCH_STATUS + .4byte BattleScript_EffectFlinchStatus @ EFFECT_FLINCH_STATUS .4byte BattleScript_EffectHit @ EFFECT_RECOIL_50 .4byte BattleScript_EffectShellSmash @ EFFECT_SHELL_SMASH .4byte BattleScript_EffectShiftGear @ EFFECT_SHIFT_GEAR @@ -1907,7 +1907,7 @@ BattleScript_EffectHitSwitchTarget: resultmessage waitmessage B_WAIT_TIME_LONG tryfaintmon BS_TARGET - isparentalbondlaststrike BattleScript_EffectHitSwitchTargetMoveEnd + checkparentalbondcounter 2, BattleScript_EffectHitSwitchTargetMoveEnd moveendcase MOVEEND_MAGICIAN @ possibly others? jumpifability BS_TARGET, ABILITY_SUCTION_CUPS, BattleScript_AbilityPreventsPhasingOut jumpifstatus3 BS_TARGET, STATUS3_ROOTED, BattleScript_PrintMonIsRooted @@ -2913,7 +2913,7 @@ BattleScript_EffectNaturalGift: waitmessage B_WAIT_TIME_LONG seteffectwithchance jumpifmovehadnoeffect BattleScript_EffectNaturalGiftEnd - isparentalbondlaststrike BattleScript_EffectNaturalGiftEnd + checkparentalbondcounter 2, BattleScript_EffectNaturalGiftEnd removeitem BS_ATTACKER BattleScript_EffectNaturalGiftEnd: tryfaintmon BS_TARGET @@ -4380,11 +4380,11 @@ BattleScript_EffectTripleKick:: attackstring ppreduce jumpifmove MOVE_TRIPLE_AXEL BS_TripleAxel - addbyte sTRIPLE_KICK_POWER 10 @ triple kick gets +10 power + addbyte sTRIPLE_KICK_POWER, 10 @ triple kick gets +10 power goto BattleScript_HitFromAtkString BS_TripleAxel: - addbyte sTRIPLE_KICK_POWER 20 @ triple axel gets +20 power + addbyte sTRIPLE_KICK_POWER, 20 @ triple axel gets +20 power goto BattleScript_HitFromAtkString BattleScript_EffectThief:: @@ -5193,7 +5193,7 @@ BattleScript_EffectSpitUp:: stockpiletobasedamage BattleScript_SpitUpFail goto BattleScript_HitFromAtkAnimation BattleScript_SpitUpFail:: - isparentalbondlaststrike BattleScript_SpitUpEnd + checkparentalbondcounter 2, BattleScript_SpitUpEnd pause B_WAIT_TIME_SHORT printstring STRINGID_FAILEDTOSPITUP waitmessage B_WAIT_TIME_LONG diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 35966c13f1..78c36a662f 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -241,7 +241,7 @@ #define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 150 #define VARIOUS_SET_BEAK_BLAST 151 #define VARIOUS_SWAP_SIDE_STATUSES 152 -#define VARIOUS_IS_PARENTAL_BOND_LAST_STRIKE 153 +#define VARIOUS_CHECK_PARENTAL_BOND_COUNTER 153 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index cc19a9da6f..7f2ba2b899 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9727,12 +9727,17 @@ static void Cmd_various(void) case VARIOUS_SWAP_SIDE_STATUSES: CourtChangeSwapSideStatuses(); break; - case VARIOUS_IS_PARENTAL_BOND_LAST_STRIKE: - if (gSpecialStatuses[gBattlerAttacker].parentalBondOn == 2 && gBattleMons[gBattlerTarget].hp != 0) - gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); + case VARIOUS_CHECK_PARENTAL_BOND_COUNTER: + { + // Some effects should only happen on the first or second strike of Parental Bond, + // so a way to check this in battle scripts is useful + u8 counter = T1_READ_8(gBattlescriptCurrInstr + 3); + if (gSpecialStatuses[gBattlerAttacker].parentalBondOn == counter && gBattleMons[gBattlerTarget].hp != 0) + gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 4); else - gBattlescriptCurrInstr += 7; + gBattlescriptCurrInstr += 8; return; + } } // End of switch (gBattlescriptCurrInstr[2]) gBattlescriptCurrInstr += 3; @@ -14468,8 +14473,7 @@ static bool32 CriticalCapture(u32 odds) bool8 IsMoveAffectedByParentalBond(u16 move, u8 battlerId) { if (gBattleMoves[move].split != SPLIT_STATUS - && !(sForbiddenMoves[move] & FORBIDDEN_PARENTAL_BOND) - && gBattleMons[gBattlerAttacker].status2 & STATUS2_BIDE) + && !(sForbiddenMoves[move] & FORBIDDEN_PARENTAL_BOND)) { if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) {