Implemented Guard Dog's effect

This commit is contained in:
LOuroboros 2022-12-12 20:30:25 -03:00
parent a56cfd1aa7
commit a3e58b05c1
2 changed files with 18 additions and 6 deletions

View File

@ -2967,6 +2967,7 @@ BattleScript_EffectHitEscape:
jumpifmovehadnoeffect BattleScript_MoveEnd jumpifmovehadnoeffect BattleScript_MoveEnd
seteffectwithchance seteffectwithchance
tryfaintmon BS_TARGET tryfaintmon BS_TARGET
jumpifability BS_TARGET, ABILITY_GUARD_DOG, BattleScript_MoveEnd
moveendto MOVEEND_ATTACKER_VISIBLE moveendto MOVEEND_ATTACKER_VISIBLE
moveendfrom MOVEEND_TARGET_VISIBLE moveendfrom MOVEEND_TARGET_VISIBLE
jumpifbattleend BattleScript_HitEscapeEnd jumpifbattleend BattleScript_HitEscapeEnd
@ -8421,6 +8422,7 @@ BattleScript_IntimidateLoop:
jumpifability BS_TARGET, ABILITY_OWN_TEMPO, BattleScript_IntimidatePrevented jumpifability BS_TARGET, ABILITY_OWN_TEMPO, BattleScript_IntimidatePrevented
jumpifability BS_TARGET, ABILITY_OBLIVIOUS, BattleScript_IntimidatePrevented jumpifability BS_TARGET, ABILITY_OBLIVIOUS, BattleScript_IntimidatePrevented
.endif .endif
jumpifability BS_TARGET, ABILITY_GUARD_DOG, BattleScript_IntimidateInReverse
BattleScript_IntimidateEffect: BattleScript_IntimidateEffect:
copybyte sBATTLER, gBattlerTarget copybyte sBATTLER, gBattlerTarget
statbuffchange STAT_CHANGE_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, NULL statbuffchange STAT_CHANGE_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, NULL
@ -8447,6 +8449,14 @@ BattleScript_IntimidatePrevented:
call BattleScript_TryAdrenalineOrb call BattleScript_TryAdrenalineOrb
goto BattleScript_IntimidateLoopIncrement goto BattleScript_IntimidateLoopIncrement
BattleScript_IntimidateInReverse:
copybyte sBATTLER, gBattlerTarget
call BattleScript_AbilityPopUp
pause B_WAIT_TIME_SHORT
modifybattlerstatstage BS_TARGET, STAT_ATK, INCREASE, 1, BattleScript_IntimidateLoopIncrement, ANIM_ON
call BattleScript_TryAdrenalineOrb
goto BattleScript_IntimidateLoopIncrement
BattleScript_DroughtActivates:: BattleScript_DroughtActivates::
pause B_WAIT_TIME_SHORT pause B_WAIT_TIME_SHORT
call BattleScript_AbilityPopUp call BattleScript_AbilityPopUp

View File

@ -5760,7 +5760,8 @@ static void Cmd_moveend(void)
if (gCurrentMove != MOVE_DRAGON_TAIL if (gCurrentMove != MOVE_DRAGON_TAIL
&& gCurrentMove != MOVE_CIRCLE_THROW && gCurrentMove != MOVE_CIRCLE_THROW
&& IsBattlerAlive(gBattlerAttacker) && IsBattlerAlive(gBattlerAttacker)
&& !TestSheerForceFlag(gBattlerAttacker, gCurrentMove)) && !TestSheerForceFlag(gBattlerAttacker, gCurrentMove)
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_GUARD_DOG)
{ {
// Since we check if battler was damaged, we don't need to check move result. // Since we check if battler was damaged, we don't need to check move result.
// In fact, doing so actually prevents multi-target moves from activating red card properly // In fact, doing so actually prevents multi-target moves from activating red card properly
@ -9135,9 +9136,10 @@ static void Cmd_various(void)
break; break;
case VARIOUS_TRY_HIT_SWITCH_TARGET: case VARIOUS_TRY_HIT_SWITCH_TARGET:
if (IsBattlerAlive(gBattlerAttacker) if (IsBattlerAlive(gBattlerAttacker)
&& IsBattlerAlive(gBattlerTarget) && IsBattlerAlive(gBattlerTarget)
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& TARGET_TURN_DAMAGED) && TARGET_TURN_DAMAGED
&& GetBattlerAbility(gBattlerTarget) != ABILITY_GUARD_DOG)
{ {
gBattleScripting.switchCase = B_SWITCH_HIT; gBattleScripting.switchCase = B_SWITCH_HIT;
gBattlescriptCurrInstr = BattleScript_ForceRandomSwitch; gBattlescriptCurrInstr = BattleScript_ForceRandomSwitch;
@ -11236,8 +11238,8 @@ static void Cmd_forcerandomswitch(void)
} }
else else
{ {
// In normal wild doubles, Roar will always fail if the user's level is less than the target's. // In normal wild doubles, Roar will always fail if the user's level is less than the target's or if the target's ability is Guard Dog.
if (gBattleMons[gBattlerAttacker].level >= gBattleMons[gBattlerTarget].level) if (gBattleMons[gBattlerAttacker].level >= gBattleMons[gBattlerTarget].level && GetBattlerAbility(gBattlerTarget) != ABILITY_GUARD_DOG)
gBattlescriptCurrInstr = BattleScript_RoarSuccessEndBattle; gBattlescriptCurrInstr = BattleScript_RoarSuccessEndBattle;
else else
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);