Rework VARIOUS_IS_PARENTAL_BOND_LAST_STRIKE

Make this more versatile by allowing it to check parentalBondOn instead of only checking if parentalBondOn == 2. Also, fix Dragon Tail/Circle Throw switching the target on the first hit.
This commit is contained in:
BuffelSaft 2022-05-07 14:20:37 +12:00
parent 8693db632b
commit 3e1934ebe3
4 changed files with 20 additions and 15 deletions

View File

@ -1976,8 +1976,9 @@
various BS_ATTACKER, VARIOUS_SWAP_SIDE_STATUSES various BS_ATTACKER, VARIOUS_SWAP_SIDE_STATUSES
.endm .endm
.macro isparentalbondlaststrike ptr:req .macro checkparentalbondcounter counter:req, ptr:req
various BS_ATTACKER, VARIOUS_IS_PARENTAL_BOND_LAST_STRIKE various BS_ATTACKER, VARIOUS_CHECK_PARENTAL_BOND_COUNTER
.byte \counter
.4byte \ptr .4byte \ptr
.endm .endm

View File

@ -306,7 +306,7 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectCloseCombat @ EFFECT_CLOSE_COMBAT .4byte BattleScript_EffectCloseCombat @ EFFECT_CLOSE_COMBAT
.4byte BattleScript_EffectLastResort @ EFFECT_LAST_RESORT .4byte BattleScript_EffectLastResort @ EFFECT_LAST_RESORT
.4byte BattleScript_EffectHit @ EFFECT_RECOIL_33_STATUS .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_EffectHit @ EFFECT_RECOIL_50
.4byte BattleScript_EffectShellSmash @ EFFECT_SHELL_SMASH .4byte BattleScript_EffectShellSmash @ EFFECT_SHELL_SMASH
.4byte BattleScript_EffectShiftGear @ EFFECT_SHIFT_GEAR .4byte BattleScript_EffectShiftGear @ EFFECT_SHIFT_GEAR
@ -1907,7 +1907,7 @@ BattleScript_EffectHitSwitchTarget:
resultmessage resultmessage
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
tryfaintmon BS_TARGET tryfaintmon BS_TARGET
isparentalbondlaststrike BattleScript_EffectHitSwitchTargetMoveEnd checkparentalbondcounter 2, BattleScript_EffectHitSwitchTargetMoveEnd
moveendcase MOVEEND_MAGICIAN @ possibly others? moveendcase MOVEEND_MAGICIAN @ possibly others?
jumpifability BS_TARGET, ABILITY_SUCTION_CUPS, BattleScript_AbilityPreventsPhasingOut jumpifability BS_TARGET, ABILITY_SUCTION_CUPS, BattleScript_AbilityPreventsPhasingOut
jumpifstatus3 BS_TARGET, STATUS3_ROOTED, BattleScript_PrintMonIsRooted jumpifstatus3 BS_TARGET, STATUS3_ROOTED, BattleScript_PrintMonIsRooted
@ -2913,7 +2913,7 @@ BattleScript_EffectNaturalGift:
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
seteffectwithchance seteffectwithchance
jumpifmovehadnoeffect BattleScript_EffectNaturalGiftEnd jumpifmovehadnoeffect BattleScript_EffectNaturalGiftEnd
isparentalbondlaststrike BattleScript_EffectNaturalGiftEnd checkparentalbondcounter 2, BattleScript_EffectNaturalGiftEnd
removeitem BS_ATTACKER removeitem BS_ATTACKER
BattleScript_EffectNaturalGiftEnd: BattleScript_EffectNaturalGiftEnd:
tryfaintmon BS_TARGET tryfaintmon BS_TARGET
@ -4380,11 +4380,11 @@ BattleScript_EffectTripleKick::
attackstring attackstring
ppreduce ppreduce
jumpifmove MOVE_TRIPLE_AXEL BS_TripleAxel 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 goto BattleScript_HitFromAtkString
BS_TripleAxel: 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 goto BattleScript_HitFromAtkString
BattleScript_EffectThief:: BattleScript_EffectThief::
@ -5193,7 +5193,7 @@ BattleScript_EffectSpitUp::
stockpiletobasedamage BattleScript_SpitUpFail stockpiletobasedamage BattleScript_SpitUpFail
goto BattleScript_HitFromAtkAnimation goto BattleScript_HitFromAtkAnimation
BattleScript_SpitUpFail:: BattleScript_SpitUpFail::
isparentalbondlaststrike BattleScript_SpitUpEnd checkparentalbondcounter 2, BattleScript_SpitUpEnd
pause B_WAIT_TIME_SHORT pause B_WAIT_TIME_SHORT
printstring STRINGID_FAILEDTOSPITUP printstring STRINGID_FAILEDTOSPITUP
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG

View File

@ -241,7 +241,7 @@
#define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 150 #define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 150
#define VARIOUS_SET_BEAK_BLAST 151 #define VARIOUS_SET_BEAK_BLAST 151
#define VARIOUS_SWAP_SIDE_STATUSES 152 #define VARIOUS_SWAP_SIDE_STATUSES 152
#define VARIOUS_IS_PARENTAL_BOND_LAST_STRIKE 153 #define VARIOUS_CHECK_PARENTAL_BOND_COUNTER 153
// Cmd_manipulatedamage // Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0 #define DMG_CHANGE_SIGN 0

View File

@ -9727,12 +9727,17 @@ static void Cmd_various(void)
case VARIOUS_SWAP_SIDE_STATUSES: case VARIOUS_SWAP_SIDE_STATUSES:
CourtChangeSwapSideStatuses(); CourtChangeSwapSideStatuses();
break; break;
case VARIOUS_IS_PARENTAL_BOND_LAST_STRIKE: case VARIOUS_CHECK_PARENTAL_BOND_COUNTER:
if (gSpecialStatuses[gBattlerAttacker].parentalBondOn == 2 && gBattleMons[gBattlerTarget].hp != 0) {
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); // 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 else
gBattlescriptCurrInstr += 7; gBattlescriptCurrInstr += 8;
return; return;
}
} // End of switch (gBattlescriptCurrInstr[2]) } // End of switch (gBattlescriptCurrInstr[2])
gBattlescriptCurrInstr += 3; gBattlescriptCurrInstr += 3;
@ -14468,8 +14473,7 @@ static bool32 CriticalCapture(u32 odds)
bool8 IsMoveAffectedByParentalBond(u16 move, u8 battlerId) bool8 IsMoveAffectedByParentalBond(u16 move, u8 battlerId)
{ {
if (gBattleMoves[move].split != SPLIT_STATUS if (gBattleMoves[move].split != SPLIT_STATUS
&& !(sForbiddenMoves[move] & FORBIDDEN_PARENTAL_BOND) && !(sForbiddenMoves[move] & FORBIDDEN_PARENTAL_BOND))
&& gBattleMons[gBattlerAttacker].status2 & STATUS2_BIDE)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{ {