From af56eee1cf23383164a2ac390afb94ba01bdde4d Mon Sep 17 00:00:00 2001 From: Tempoanon <163687446+Tempo-anon@users.noreply.github.com> Date: Tue, 6 Aug 2024 12:20:23 -0400 Subject: [PATCH] [Bug] Fix Storm moves having accuracy drops in sun/sand (#3381) --- src/data/move.ts | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index a00d81e5980..0ea4e4221c5 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -3565,6 +3565,9 @@ export class VariableAccuracyAttr extends MoveAttr { } } +/** + * Attribute used for Thunder and Hurricane that sets accuracy to 50 in sun and never miss in rain + */ export class ThunderAccuracyAttr extends VariableAccuracyAttr { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { if (!user.scene.arena.weather?.isEffectSuppressed(user.scene)) { @@ -3572,7 +3575,6 @@ export class ThunderAccuracyAttr extends VariableAccuracyAttr { const weatherType = user.scene.arena.weather?.weatherType || WeatherType.NONE; switch (weatherType) { case WeatherType.SUNNY: - case WeatherType.SANDSTORM: case WeatherType.HARSH_SUN: accuracy.value = 50; return true; @@ -3587,6 +3589,28 @@ export class ThunderAccuracyAttr extends VariableAccuracyAttr { } } +/** + * Attribute used for Bleakwind Storm, Wildbolt Storm, and Sandsear Storm that sets accuracy to never + * miss in rain + * Springtide Storm does NOT have this property + */ +export class StormAccuracyAttr extends VariableAccuracyAttr { + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { + if (!user.scene.arena.weather?.isEffectSuppressed(user.scene)) { + const accuracy = args[0] as Utils.NumberHolder; + const weatherType = user.scene.arena.weather?.weatherType || WeatherType.NONE; + switch (weatherType) { + case WeatherType.RAIN: + case WeatherType.HEAVY_RAIN: + accuracy.value = -1; + return true; + } + } + + return false; + } +} + /** * Attribute used for moves which never miss * against Pokemon with the {@linkcode BattlerTagType.MINIMIZED} @@ -8396,17 +8420,17 @@ export function initMoves() { .attr(AddArenaTrapTagHitAttr, ArenaTagType.SPIKES) .slicingMove(), new AttackMove(Moves.BLEAKWIND_STORM, Type.FLYING, MoveCategory.SPECIAL, 100, 80, 10, 30, 0, 8) - .attr(ThunderAccuracyAttr) + .attr(StormAccuracyAttr) .attr(StatChangeAttr, BattleStat.SPD, -1) .windMove() .target(MoveTarget.ALL_NEAR_ENEMIES), new AttackMove(Moves.WILDBOLT_STORM, Type.ELECTRIC, MoveCategory.SPECIAL, 100, 80, 10, 20, 0, 8) - .attr(ThunderAccuracyAttr) + .attr(StormAccuracyAttr) .attr(StatusEffectAttr, StatusEffect.PARALYSIS) .windMove() .target(MoveTarget.ALL_NEAR_ENEMIES), new AttackMove(Moves.SANDSEAR_STORM, Type.GROUND, MoveCategory.SPECIAL, 100, 80, 10, 20, 0, 8) - .attr(ThunderAccuracyAttr) + .attr(StormAccuracyAttr) .attr(StatusEffectAttr, StatusEffect.BURN) .windMove() .target(MoveTarget.ALL_NEAR_ENEMIES),