diff --git a/src/data/move.ts b/src/data/move.ts index 6849a0fe7ce..a855222a2fe 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -2778,6 +2778,47 @@ export class WeatherBallTypeAttr extends VariableMoveTypeAttr { } } +/** + * Changes the move's type to match the current terrain. + * Has no effect if the user is not grounded. + * @extends VariableMoveTypeAttr + * @see {@linkcode apply} + */ +export class TerrainPulseTypeAttr extends VariableMoveTypeAttr { + /** + * @param user {@linkcode Pokemon} using this move + * @param target N/A + * @param move N/A + * @param args [0] {@linkcode Utils.IntegerHolder} The move's type to be modified + * @returns true if the function succeeds + */ + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { + if(!user.isGrounded) + return false; + + const currentTerrain = user.scene.arena.getTerrainType(); + const type = (args[0] as Utils.IntegerHolder); + + switch (currentTerrain) { + case TerrainType.MISTY: + type.value = Type.FAIRY; + break; + case TerrainType.ELECTRIC: + type.value = Type.ELECTRIC; + break; + case TerrainType.GRASSY: + type.value = Type.GRASS; + break; + case TerrainType.PSYCHIC: + type.value = Type.PSYCHIC; + break; + default: + return false; + } + return true; + } +} + export class HiddenPowerTypeAttr extends VariableMoveTypeAttr { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { const type = (args[0] as Utils.IntegerHolder); @@ -6691,14 +6732,16 @@ export function initMoves() { .attr(SacrificialAttr) .target(MoveTarget.ALL_NEAR_OTHERS) .attr(MovePowerMultiplierAttr, (user, target, move) => user.scene.arena.getTerrainType() === TerrainType.MISTY && user.isGrounded() ? 1.5 : 1) - .condition(failIfDampCondition), + .condition(failIfDampCondition) + .makesContact(false), new AttackMove(Moves.GRASSY_GLIDE, Type.GRASS, MoveCategory.PHYSICAL, 55, 100, 20, -1, 0, 8) .partial(), new AttackMove(Moves.RISING_VOLTAGE, Type.ELECTRIC, MoveCategory.SPECIAL, 70, 100, 20, -1, 0, 8) .attr(MovePowerMultiplierAttr, (user, target, move) => user.scene.arena.getTerrainType() === TerrainType.ELECTRIC && target.isGrounded() ? 2 : 1), new AttackMove(Moves.TERRAIN_PULSE, Type.NORMAL, MoveCategory.SPECIAL, 50, 100, 10, -1, 0, 8) - .pulseMove() - .partial(), + .attr(TerrainPulseTypeAttr) + .attr(MovePowerMultiplierAttr, (user, target, move) => user.scene.arena.getTerrainType() !== TerrainType.NONE && user.isGrounded() ? 2 : 1) + .pulseMove(), new AttackMove(Moves.SKITTER_SMACK, Type.BUG, MoveCategory.PHYSICAL, 70, 90, 10, 100, 0, 8) .attr(StatChangeAttr, BattleStat.SPATK, -1), new AttackMove(Moves.BURNING_JEALOUSY, Type.FIRE, MoveCategory.SPECIAL, 70, 100, 5, 100, 0, 8)