diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 4948fd4702..5803a02206 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -4171,6 +4171,20 @@ BattleScript_MysteriousAirCurrentBlowsOnRet: waitmessage B_WAIT_TIME_LONG return +BattleScript_BlockedByPrimalWeatherEnd3:: + call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 + end3 + +BattleScript_BlockedByPrimalWeatherRet:: + call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedRet + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainRet + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnRet + return + BattleScript_EffectDefenseUpHit:: setmoveeffect MOVE_EFFECT_DEF_PLUS_1 | MOVE_EFFECT_AFFECTS_USER goto BattleScript_EffectHit @@ -7019,9 +7033,6 @@ BattleScript_ItemSteal:: BattleScript_DrizzleActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNMADEITRAIN waitstate playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES, NULL @@ -7180,9 +7191,6 @@ BattleScript_HealerActivates:: BattleScript_SandstreamActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXWHIPPEDUPSANDSTORM waitstate playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES, NULL @@ -7192,9 +7200,6 @@ BattleScript_SandstreamActivates:: BattleScript_SandSpitActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedRet - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainRet - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnRet printstring STRINGID_ASANDSTORMKICKEDUP waitstate playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES, NULL @@ -7292,9 +7297,6 @@ BattleScript_IntimidatePrevented: BattleScript_DroughtActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXINTENSIFIEDSUN waitstate playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL @@ -7354,9 +7356,6 @@ BattleScript_AttackWeakenedByStrongWinds:: BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_SNOWWARNINGHAIL waitstate playanimation BS_BATTLER_0, B_ANIM_HAIL_CONTINUES, NULL diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 1f22cedd50..cd46005434 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -396,5 +396,7 @@ extern const u8 BattleScript_PrimordialSeaFizzlesOutFireTypeMoves[]; extern const u8 BattleScript_DeltaStreamActivates[]; extern const u8 BattleScript_MysteriousAirCurrentBlowsOn[]; extern const u8 BattleScript_AttackWeakenedByStrongWinds[]; +extern const u8 BattleScript_BlockedByPrimalWeatherEnd3[]; +extern const u8 BattleScript_BlockedByPrimalWeatherRet[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/src/battle_util.c b/src/battle_util.c index 59c936b6be..282a6ff740 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3694,8 +3694,7 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility) && GetBattlerAbility(battler) != ABILITY_PRIMORDIAL_SEA && GetBattlerAbility(battler) != ABILITY_DELTA_STREAM) { - weatherEnumId = 0; - return TRUE; + return FALSE; } else if (!(gBattleWeather & (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]))) { @@ -4167,6 +4166,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_DrizzleActivates); effect++; } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone) + { + gSpecialStatuses[battler].switchInAbilityDone = 1; + BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3); + effect++; + } break; case ABILITY_SAND_STREAM: if (TryChangeBattleWeather(battler, ENUM_WEATHER_SANDSTORM, TRUE)) @@ -4174,6 +4179,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_SandstreamActivates); effect++; } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone) + { + gSpecialStatuses[battler].switchInAbilityDone = 1; + BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3); + effect++; + } break; case ABILITY_DROUGHT: if (TryChangeBattleWeather(battler, ENUM_WEATHER_SUN, TRUE)) @@ -4181,6 +4192,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_DroughtActivates); effect++; } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone) + { + gSpecialStatuses[battler].switchInAbilityDone = 1; + BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3); + effect++; + } break; case ABILITY_SNOW_WARNING: if (TryChangeBattleWeather(battler, ENUM_WEATHER_HAIL, TRUE)) @@ -4188,6 +4205,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_SnowWarningActivates); effect++; } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone) + { + gSpecialStatuses[battler].switchInAbilityDone = 1; + BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3); + effect++; + } break; case ABILITY_ELECTRIC_SURGE: if (TryChangeBattleTerrain(battler, STATUS_FIELD_ELECTRIC_TERRAIN, &gFieldTimers.electricTerrainTimer)) @@ -4989,13 +5012,20 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED && !(WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SANDSTORM_ANY) - && TryChangeBattleWeather(battler, ENUM_WEATHER_SANDSTORM, TRUE)) + && TryChangeBattleWeather(battler, ENUM_WEATHER_SANDSTORM, TRUE) + && !(WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY)) { gBattleScripting.battler = gActiveBattler = battler; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SandSpitActivates; effect++; } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY) + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_BlockedByPrimalWeatherRet; + effect++; + } break; case ABILITY_PERISH_BODY: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)