Fix several move effects

Dragon Tail, Natural Gift, Spit Up all hit twice now. Could maybe use isparentalbondlaststrike instead of some of the other checks too.
This commit is contained in:
BuffelSaft 2021-11-13 16:29:12 +13:00
parent 2bf72fc51e
commit 55b279ba0a
4 changed files with 23 additions and 4 deletions

View File

@ -1891,6 +1891,11 @@
various BS_ATTACKER, VARIOUS_SHELL_SIDE_ARM_CHECK
.endm
.macro isparentalbondlaststrike ptr:req
various BS_ATTACKER, VARIOUS_IS_PARENTAL_BOND_LAST_STRIKE
.4byte \ptr
.endm
@ helpful macros
.macro setstatchanger stat:req, stages:req, down:req
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7

View File

@ -1534,6 +1534,7 @@ BattleScript_EffectHitSwitchTarget:
resultmessage
waitmessage B_WAIT_TIME_LONG
tryfaintmon BS_TARGET, FALSE, NULL
isparentalbondlaststrike BattleScript_EffectHitSwitchTargetMoveEnd
jumpifability BS_TARGET, ABILITY_SUCTION_CUPS, BattleScript_AbilityPreventsPhasingOut
jumpifstatus3 BS_TARGET, STATUS3_ROOTED, BattleScript_PrintMonIsRooted
tryhitswitchtarget BattleScript_EffectHitSwitchTargetMoveEnd
@ -2536,6 +2537,7 @@ BattleScript_EffectNaturalGift:
waitmessage B_WAIT_TIME_LONG
seteffectwithchance
jumpifmovehadnoeffect BattleScript_EffectNaturalGiftEnd
isparentalbondlaststrike BattleScript_EffectNaturalGiftEnd
removeitem BS_ATTACKER
BattleScript_EffectNaturalGiftEnd:
tryfaintmon BS_TARGET, FALSE, NULL
@ -4817,9 +4819,11 @@ BattleScript_EffectSpitUp::
stockpiletobasedamage BattleScript_SpitUpFail
goto BattleScript_HitFromAtkAnimation
BattleScript_SpitUpFail::
isparentalbondlaststrike BattleScript_SpitUpEnd
pause B_WAIT_TIME_SHORT
printstring STRINGID_FAILEDTOSPITUP
waitmessage B_WAIT_TIME_LONG
BattleScript_SpitUpEnd:
goto BattleScript_MoveEnd
BattleScript_SpitUpFailProtect::

View File

@ -201,6 +201,7 @@
#define VARIOUS_TRY_TO_APPLY_MIMICRY 128
#define VARIOUS_PHOTON_GEYSER_CHECK 129
#define VARIOUS_SHELL_SIDE_ARM_CHECK 130
#define VARIOUS_IS_PARENTAL_BOND_LAST_STRIKE 131
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View File

@ -9275,6 +9275,12 @@ static void Cmd_various(void)
gBattlescriptCurrInstr += 7;
return;
}
case VARIOUS_IS_PARENTAL_BOND_LAST_STRIKE:
if (gSpecialStatuses[gBattlerAttacker].parentalBondOn == 2 && gBattleMons[gBattlerTarget].hp != 0)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else
gBattlescriptCurrInstr += 7;
return;
}
gBattlescriptCurrInstr += 3;
@ -9743,10 +9749,13 @@ static void Cmd_stockpiletobasedamage(void)
if (gBattleCommunication[MISS_TYPE] != B_MSG_PROTECTED)
gBattleScripting.animTurn = gDisableStructs[gBattlerAttacker].stockpileCounter;
gDisableStructs[gBattlerAttacker].stockpileCounter = 0;
// Restore stat changes from stockpile.
gBattleMons[gBattlerAttacker].statStages[STAT_DEF] -= gDisableStructs[gBattlerAttacker].stockpileDef;
gBattleMons[gBattlerAttacker].statStages[STAT_SPDEF] -= gDisableStructs[gBattlerAttacker].stockpileSpDef;
if (!(gSpecialStatuses[gBattlerAttacker].parentalBondOn == 2 && gBattleMons[gBattlerTarget].hp != 0))
{
gDisableStructs[gBattlerAttacker].stockpileCounter = 0;
// Restore stat changes from stockpile.
gBattleMons[gBattlerAttacker].statStages[STAT_DEF] -= gDisableStructs[gBattlerAttacker].stockpileDef;
gBattleMons[gBattlerAttacker].statStages[STAT_SPDEF] -= gDisableStructs[gBattlerAttacker].stockpileSpDef;
}
gBattlescriptCurrInstr += 5;
}
}