implement wish move

pull/325/head
Reldnahc 2024-04-27 17:11:35 -05:00
parent 51408a0c9d
commit 11e23d0c47
3 changed files with 27 additions and 4 deletions

View File

@ -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:

View File

@ -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"
}

View File

@ -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)