Abilities affected by weather conditions

This commit is contained in:
DizzyEggg 2018-07-22 22:41:13 +02:00
parent 831816e9b2
commit 194adf0ab2
2 changed files with 26 additions and 10 deletions

View File

@ -3486,11 +3486,17 @@ BattleScript_DamagingWeatherLoop::
copyarraywithindex gBattlerAttacker, gBattlerByTurnOrder, gBattleCommunication, 0x1 copyarraywithindex gBattlerAttacker, gBattlerByTurnOrder, gBattleCommunication, 0x1
weatherdamage weatherdamage
jumpifword CMP_EQUAL, gBattleMoveDamage, 0x0, BattleScript_DamagingWeatherLoopIncrement jumpifword CMP_EQUAL, gBattleMoveDamage, 0x0, BattleScript_DamagingWeatherLoopIncrement
jumpifword CMP_COMMON_BITS gBattleMoveDamage, 1 << 31, BattleScript_DamagingWeatherHeal
printfromtable gSandStormHailDmgStringIds printfromtable gSandStormHailDmgStringIds
waitmessage 0x40 waitmessage 0x40
orword gHitMarker, HITMARKER_x20 | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 | HITMARKER_GRUDGE
effectivenesssound effectivenesssound
hitanimation BS_ATTACKER hitanimation BS_ATTACKER
goto BattleScript_DamagingWeatherHpChange
BattleScript_DamagingWeatherHeal:
printstring STRINGID_ICEBODYHPGAIN
waitmessage 0x40
BattleScript_DamagingWeatherHpChange:
orword gHitMarker, HITMARKER_x20 | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 | HITMARKER_GRUDGE
healthbarupdate BS_ATTACKER healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER datahpupdate BS_ATTACKER
tryfaintmon BS_ATTACKER, FALSE, NULL tryfaintmon BS_ATTACKER, FALSE, NULL

View File

@ -7608,15 +7608,15 @@ static void atk96_weatherdamage(void)
{ {
if (WEATHER_HAS_EFFECT) if (WEATHER_HAS_EFFECT)
{ {
u32 ability = GetBattlerAbility(gBattlerAttacker);
if (gBattleWeather & WEATHER_SANDSTORM_ANY) if (gBattleWeather & WEATHER_SANDSTORM_ANY)
{ {
if (gBattleMons[gBattlerAttacker].type1 != TYPE_ROCK if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ROCK)
&& gBattleMons[gBattlerAttacker].type1 != TYPE_STEEL && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_GROUND)
&& gBattleMons[gBattlerAttacker].type1 != TYPE_GROUND && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_STEEL)
&& gBattleMons[gBattlerAttacker].type2 != TYPE_ROCK && ability != ABILITY_SAND_VEIL
&& gBattleMons[gBattlerAttacker].type2 != TYPE_STEEL && ability != ABILITY_SAND_FORCE
&& gBattleMons[gBattlerAttacker].type2 != TYPE_GROUND && ability != ABILITY_SAND_RUSH
&& gBattleMons[gBattlerAttacker].ability != ABILITY_SAND_VEIL
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND) && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND)
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER)) && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER))
{ {
@ -7629,9 +7629,19 @@ static void atk96_weatherdamage(void)
gBattleMoveDamage = 0; gBattleMoveDamage = 0;
} }
} }
if (gBattleWeather & WEATHER_HAIL) if (gBattleWeather & WEATHER_HAIL_ANY)
{ {
if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE) if (ability == ABILITY_ICE_BODY
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND)
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER))
{
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
gBattleMoveDamage *= -1;
}
else if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)
&& ability != ABILITY_SNOW_CLOAK
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND) && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND)
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER)) && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER))
{ {