diff --git a/src/data/arena-tag.ts b/src/data/arena-tag.ts index bb76a9880b3..95041501535 100644 --- a/src/data/arena-tag.ts +++ b/src/data/arena-tag.ts @@ -4,7 +4,7 @@ import * as Utils from "../utils"; import { MoveCategory, StatChangeAttr, allMoves } from "./move"; import { getPokemonMessage } from "../messages"; import Pokemon, { HitResult, PokemonMove } from "../field/pokemon"; -import { MoveEffectPhase, StatChangePhase } from "../phases"; +import {MoveEffectPhase, PokemonHealPhase, StatChangePhase} from "../phases"; import { StatusEffect } from "./status-effect"; import { BattlerIndex } from "../battle"; import { Moves } from "./enums/moves"; @@ -146,6 +146,26 @@ class AuroraVeilTag extends WeakenMoveScreenTag { } } +class WishTag extends ArenaTag { + private slot: BattlerIndex; + private userName: string; + private health: number; + constructor(turnCount: integer, sourceId: integer, side: ArenaTagSide) { + super(ArenaTagType.WISH, turnCount, Moves.WISH, sourceId, side); + } + onAdd(arena: Arena): void { + const mon = arena.scene.getPokemonById(this.sourceId); + this.slot = mon.getBattlerIndex(); + this.userName = mon.name; + this.health = mon.getMaxHp() / 2; + } + onRemove(arena: Arena): void { + const target = arena.scene.getField()[this.slot]; + arena.scene.unshiftPhase(new PokemonHealPhase(target.scene, target.getBattlerIndex(), + Math.max(Math.floor(this.health), 1), this.userName + '\'s wish\ncame true!', true, false)); + } +} + export class WeakenMoveTypeTag extends ArenaTag { private weakenedType: Type; @@ -472,6 +492,8 @@ export function getArenaTag(tagType: ArenaTagType, turnCount: integer, sourceMov case ArenaTagType.FUTURE_SIGHT: case ArenaTagType.DOOM_DESIRE: return new DelayedAttackTag(tagType, sourceMove, sourceId, targetIndex); + case ArenaTagType.WISH: + return new WishTag(turnCount, sourceId, side); case ArenaTagType.STEALTH_ROCK: return new StealthRockTag(sourceId, side); case ArenaTagType.STICKY_WEB: diff --git a/src/data/enums/arena-tag-type.ts b/src/data/enums/arena-tag-type.ts index cc08ca4fdcf..c4492012710 100644 --- a/src/data/enums/arena-tag-type.ts +++ b/src/data/enums/arena-tag-type.ts @@ -14,5 +14,6 @@ export enum ArenaTagType { GRAVITY = "GRAVITY", REFLECT = "REFLECT", LIGHT_SCREEN = "LIGHT_SCREEN", - AURORA_VEIL = "AURORA_VEIL" + AURORA_VEIL = "AURORA_VEIL", + WISH = "WISH" } diff --git a/src/data/move.ts b/src/data/move.ts index 9329d21c1d4..b2769bce6c1 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -4481,8 +4481,8 @@ export function initMoves() { .attr(AbilityCopyAttr), new SelfStatusMove(Moves.WISH, Type.NORMAL, -1, 10, -1, 0, 3) .triageMove() - .unimplemented(), - new SelfStatusMove(Moves.ASSIST, Type.NORMAL, -1, 20, -1, 0, 3) + .attr(AddArenaTagAttr, ArenaTagType.WISH, 2, true), + new SelfStatusMove(Moves.ASSIST, Type.NORMAL, -1, 20, -1, 0, 3) .attr(RandomMovesetMoveAttr, true) .ignoresVirtual(), new SelfStatusMove(Moves.INGRAIN, Type.GRASS, -1, 20, -1, 0, 3)