implement wish move
parent
51408a0c9d
commit
11e23d0c47
|
@ -4,7 +4,7 @@ import * as Utils from "../utils";
|
||||||
import { MoveCategory, StatChangeAttr, allMoves } from "./move";
|
import { MoveCategory, StatChangeAttr, allMoves } from "./move";
|
||||||
import { getPokemonMessage } from "../messages";
|
import { getPokemonMessage } from "../messages";
|
||||||
import Pokemon, { HitResult, PokemonMove } from "../field/pokemon";
|
import Pokemon, { HitResult, PokemonMove } from "../field/pokemon";
|
||||||
import { MoveEffectPhase, StatChangePhase } from "../phases";
|
import {MoveEffectPhase, PokemonHealPhase, StatChangePhase} from "../phases";
|
||||||
import { StatusEffect } from "./status-effect";
|
import { StatusEffect } from "./status-effect";
|
||||||
import { BattlerIndex } from "../battle";
|
import { BattlerIndex } from "../battle";
|
||||||
import { Moves } from "./enums/moves";
|
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 {
|
export class WeakenMoveTypeTag extends ArenaTag {
|
||||||
private weakenedType: Type;
|
private weakenedType: Type;
|
||||||
|
|
||||||
|
@ -472,6 +492,8 @@ export function getArenaTag(tagType: ArenaTagType, turnCount: integer, sourceMov
|
||||||
case ArenaTagType.FUTURE_SIGHT:
|
case ArenaTagType.FUTURE_SIGHT:
|
||||||
case ArenaTagType.DOOM_DESIRE:
|
case ArenaTagType.DOOM_DESIRE:
|
||||||
return new DelayedAttackTag(tagType, sourceMove, sourceId, targetIndex);
|
return new DelayedAttackTag(tagType, sourceMove, sourceId, targetIndex);
|
||||||
|
case ArenaTagType.WISH:
|
||||||
|
return new WishTag(turnCount, sourceId, side);
|
||||||
case ArenaTagType.STEALTH_ROCK:
|
case ArenaTagType.STEALTH_ROCK:
|
||||||
return new StealthRockTag(sourceId, side);
|
return new StealthRockTag(sourceId, side);
|
||||||
case ArenaTagType.STICKY_WEB:
|
case ArenaTagType.STICKY_WEB:
|
||||||
|
|
|
@ -14,5 +14,6 @@ export enum ArenaTagType {
|
||||||
GRAVITY = "GRAVITY",
|
GRAVITY = "GRAVITY",
|
||||||
REFLECT = "REFLECT",
|
REFLECT = "REFLECT",
|
||||||
LIGHT_SCREEN = "LIGHT_SCREEN",
|
LIGHT_SCREEN = "LIGHT_SCREEN",
|
||||||
AURORA_VEIL = "AURORA_VEIL"
|
AURORA_VEIL = "AURORA_VEIL",
|
||||||
|
WISH = "WISH"
|
||||||
}
|
}
|
||||||
|
|
|
@ -4481,8 +4481,8 @@ export function initMoves() {
|
||||||
.attr(AbilityCopyAttr),
|
.attr(AbilityCopyAttr),
|
||||||
new SelfStatusMove(Moves.WISH, Type.NORMAL, -1, 10, -1, 0, 3)
|
new SelfStatusMove(Moves.WISH, Type.NORMAL, -1, 10, -1, 0, 3)
|
||||||
.triageMove()
|
.triageMove()
|
||||||
.unimplemented(),
|
.attr(AddArenaTagAttr, ArenaTagType.WISH, 2, true),
|
||||||
new SelfStatusMove(Moves.ASSIST, Type.NORMAL, -1, 20, -1, 0, 3)
|
new SelfStatusMove(Moves.ASSIST, Type.NORMAL, -1, 20, -1, 0, 3)
|
||||||
.attr(RandomMovesetMoveAttr, true)
|
.attr(RandomMovesetMoveAttr, true)
|
||||||
.ignoresVirtual(),
|
.ignoresVirtual(),
|
||||||
new SelfStatusMove(Moves.INGRAIN, Type.GRASS, -1, 20, -1, 0, 3)
|
new SelfStatusMove(Moves.INGRAIN, Type.GRASS, -1, 20, -1, 0, 3)
|
||||||
|
|
Loading…
Reference in New Issue