Magic Guard protects from stuff

This commit is contained in:
DizzyEggg 2020-04-13 15:49:40 +02:00
parent 2c9ee80004
commit 51e1639513
2 changed files with 10 additions and 5 deletions

View File

@ -2709,6 +2709,7 @@ BattleScript_EffectRecoilIfMiss::
accuracycheck BattleScript_MoveMissedDoDamage, ACC_CURR_MOVE
goto BattleScript_HitFromAtkString
BattleScript_MoveMissedDoDamage::
jumpifability BS_ATTACKER, ABILITY_MAGIC_GUARD, BattleScript_PrintMoveMissed
attackstring
ppreduce
pause 0x40
@ -5969,13 +5970,13 @@ BattleScript_PoisonTurnDmg::
waitmessage 0x40
BattleScript_DoStatusTurnDmg::
statusanimation BS_ATTACKER
BattleScript_DoTurnDmg::
BattleScript_DoTurnDmg:
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000
healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER
tryfaintmon BS_ATTACKER, FALSE, NULL
atk24 BattleScript_DoTurnDmgEnd
BattleScript_DoTurnDmgEnd::
BattleScript_DoTurnDmgEnd:
end2
BattleScript_PoisonHealActivates::
@ -6120,6 +6121,7 @@ BattleScript_PrintPayDayMoneyString::
return
BattleScript_WrapTurnDmg::
jumpifability BS_ATTACKER, ABILITY_MAGIC_GUARD, BattleScript_DoTurnDmgEnd
playanimation BS_ATTACKER, B_ANIM_TURN_TRAP, sB_ANIM_ARG1
printstring STRINGID_PKMNHURTBY
waitmessage 0x40

View File

@ -5518,6 +5518,7 @@ static void Cmd_switchineffects(void)
if (!(gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_SPIKES_DAMAGED)
&& (gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_SPIKES)
&& GetBattlerAbility(gActiveBattler) != ABILITY_MAGIC_GUARD
&& IsBattlerGrounded(gActiveBattler))
{
u8 spikesDmg = (5 - gSideTimers[GetBattlerSide(gActiveBattler)].spikesAmount) * 2;
@ -5529,7 +5530,8 @@ static void Cmd_switchineffects(void)
SetDmgHazardsBattlescript(gActiveBattler, 0);
}
else if (!(gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_STEALTH_ROCK_DAMAGED)
&& (gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_STEALTH_ROCK))
&& (gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_STEALTH_ROCK)
&& GetBattlerAbility(gActiveBattler) != ABILITY_MAGIC_GUARD)
{
gSideStatuses[GetBattlerSide(gActiveBattler)] |= SIDE_STATUS_STEALTH_ROCK_DAMAGED;
gBattleMoveDamage = GetStealthHazardDamage(gBattleMoves[MOVE_STEALTH_ROCK].type, gActiveBattler);
@ -8991,10 +8993,11 @@ static void Cmd_setsandstorm(void)
static void Cmd_weatherdamage(void)
{
u32 ability = GetBattlerAbility(gBattlerAttacker);
gBattleMoveDamage = 0;
if (IsBattlerAlive(gBattlerAttacker) && WEATHER_HAS_EFFECT)
if (IsBattlerAlive(gBattlerAttacker) && WEATHER_HAS_EFFECT && ability != ABILITY_MAGIC_GUARD)
{
u32 ability = GetBattlerAbility(gBattlerAttacker);
if (gBattleWeather & WEATHER_SANDSTORM_ANY)
{
if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ROCK)