From 9d8f7ddcf0b8afb07df95a10ec7839b8f83b1594 Mon Sep 17 00:00:00 2001 From: Benjamin Odom Date: Thu, 2 May 2024 14:10:21 -0500 Subject: [PATCH] Implement Tailwind (#398) Added a new ArenaTagType for Tailwind. Lasts 4 turns including the turn used. --- src/data/arena-tag.ts | 16 ++++++++++++++++ src/data/enums/arena-tag-type.ts | 3 ++- src/data/move.ts | 4 ++-- src/field/pokemon.ts | 5 +++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/data/arena-tag.ts b/src/data/arena-tag.ts index a879c68d4..8942cfe4b 100644 --- a/src/data/arena-tag.ts +++ b/src/data/arena-tag.ts @@ -482,6 +482,20 @@ export class GravityTag extends ArenaTag { } } +class TailwindTag extends ArenaTag { + constructor(turnCount: integer, sourceId: integer, side: ArenaTagSide) { + super(ArenaTagType.TAILWIND, turnCount, Moves.TAILWIND, sourceId, side); + } + + onAdd(arena: Arena): void { + arena.scene.queueMessage(`The Tailwind blew from behind${this.side === ArenaTagSide.PLAYER ? '\nyour' : this.side === ArenaTagSide.ENEMY ? '\nthe opposing' : ''} team!`); + } + + onRemove(arena: Arena): void { + arena.scene.queueMessage(`${this.side === ArenaTagSide.PLAYER ? 'Your' : this.side === ArenaTagSide.ENEMY ? 'The opposing' : ''} team's Tailwind petered out!`); + } +} + export function getArenaTag(tagType: ArenaTagType, turnCount: integer, sourceMove: Moves, sourceId: integer, targetIndex?: BattlerIndex, side: ArenaTagSide = ArenaTagSide.BOTH): ArenaTag { switch (tagType) { case ArenaTagType.MIST: @@ -513,5 +527,7 @@ export function getArenaTag(tagType: ArenaTagType, turnCount: integer, sourceMov return new LightScreenTag(turnCount, sourceId, side); case ArenaTagType.AURORA_VEIL: return new AuroraVeilTag(turnCount, sourceId, side); + case ArenaTagType.TAILWIND: + return new TailwindTag(turnCount, sourceId, side); } } diff --git a/src/data/enums/arena-tag-type.ts b/src/data/enums/arena-tag-type.ts index 8478b6f3f..2ecac8b56 100644 --- a/src/data/enums/arena-tag-type.ts +++ b/src/data/enums/arena-tag-type.ts @@ -15,5 +15,6 @@ export enum ArenaTagType { GRAVITY = "GRAVITY", REFLECT = "REFLECT", LIGHT_SCREEN = "LIGHT_SCREEN", - AURORA_VEIL = "AURORA_VEIL" + AURORA_VEIL = "AURORA_VEIL", + TAILWIND = "TAILWIND" } diff --git a/src/data/move.ts b/src/data/move.ts index e300b3ae2..b26af03fc 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -4805,8 +4805,8 @@ export function initMoves() { .partial(), new StatusMove(Moves.TAILWIND, Type.FLYING, -1, 15, -1, 0, 4) .windMove() - .target(MoveTarget.USER_SIDE) - .unimplemented(), + .attr(AddArenaTagAttr, ArenaTagType.TAILWIND, 4, true) + .target(MoveTarget.USER_SIDE), new StatusMove(Moves.ACUPRESSURE, Type.NORMAL, -1, 30, -1, 0, 4) .attr(StatChangeAttr, BattleStat.RAND, 2) .target(MoveTarget.USER_OR_NEAR_ALLY), diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index a966a2430..daa787685 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -589,6 +589,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { ret *= 1.5; break; case Stat.SPD: + // Check both the player and enemy to see if Tailwind should be multiplying the speed of the Pokemon + if ((this.isPlayer() && this.scene.arena.getTagOnSide(ArenaTagType.TAILWIND, ArenaTagSide.PLAYER)) + || (!this.isPlayer() && this.scene.arena.getTagOnSide(ArenaTagType.TAILWIND, ArenaTagSide.ENEMY))) + ret *= 2; + if (this.getTag(BattlerTagType.SLOW_START)) ret >>= 1; if (this.status && this.status.effect === StatusEffect.PARALYSIS)