Implement move wish (#323)
* implement wish move * Serene grace implementation idea * only do the thingy if it actually gets effected. * Revert "only do the thingy if it actually gets effected." This reverts commit4b084658d2
. * Revert "Serene grace implementation idea" This reverts commit4dd2504bc7
. * Fixes for Wish implementation --------- Co-authored-by: Flashfyre <flashfireex@gmail.com>
This commit is contained in:
parent
8e64eaea3f
commit
1e7c329928
|
@ -1,10 +1,10 @@
|
||||||
import { Arena } from "../field/arena";
|
import { Arena } from "../field/arena";
|
||||||
import { Type } from "./type";
|
import { Type } from "./type";
|
||||||
import * as Utils from "../utils";
|
import * as Utils from "../utils";
|
||||||
import { MoveCategory, StatChangeAttr, allMoves } from "./move";
|
import { MoveCategory, 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,31 @@ class AuroraVeilTag extends WeakenMoveScreenTag {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class WishTag extends ArenaTag {
|
||||||
|
private battlerIndex: BattlerIndex;
|
||||||
|
private triggerMessage: string;
|
||||||
|
private healHp: number;
|
||||||
|
|
||||||
|
constructor(turnCount: integer, sourceId: integer, side: ArenaTagSide) {
|
||||||
|
super(ArenaTagType.WISH, turnCount, Moves.WISH, sourceId, side);
|
||||||
|
}
|
||||||
|
|
||||||
|
onAdd(arena: Arena): void {
|
||||||
|
const user = arena.scene.getPokemonById(this.sourceId);
|
||||||
|
this.battlerIndex = user.getBattlerIndex();
|
||||||
|
this.triggerMessage = getPokemonMessage(user, '\'s wish\ncame true!');
|
||||||
|
this.healHp = Math.max(Math.floor(user.getMaxHp() / 2), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
onRemove(arena: Arena): void {
|
||||||
|
const target = arena.scene.getField()[this.battlerIndex];
|
||||||
|
if (target?.isActive(true)) {
|
||||||
|
arena.scene.queueMessage(this.triggerMessage);
|
||||||
|
arena.scene.unshiftPhase(new PokemonHealPhase(target.scene, target.getBattlerIndex(), this.healHp, null, true, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class WeakenMoveTypeTag extends ArenaTag {
|
export class WeakenMoveTypeTag extends ArenaTag {
|
||||||
private weakenedType: Type;
|
private weakenedType: Type;
|
||||||
|
|
||||||
|
@ -472,6 +497,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:
|
||||||
|
|
|
@ -8,6 +8,7 @@ export enum ArenaTagType {
|
||||||
MIST = "MIST",
|
MIST = "MIST",
|
||||||
FUTURE_SIGHT = "FUTURE_SIGHT",
|
FUTURE_SIGHT = "FUTURE_SIGHT",
|
||||||
DOOM_DESIRE = "DOOM_DESIRE",
|
DOOM_DESIRE = "DOOM_DESIRE",
|
||||||
|
WISH = "WISH",
|
||||||
STEALTH_ROCK = "STEALTH_ROCK",
|
STEALTH_ROCK = "STEALTH_ROCK",
|
||||||
STICKY_WEB = "STICKY_WEB",
|
STICKY_WEB = "STICKY_WEB",
|
||||||
TRICK_ROOM = "TRICK_ROOM",
|
TRICK_ROOM = "TRICK_ROOM",
|
||||||
|
|
|
@ -4493,7 +4493,7 @@ 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(),
|
||||||
|
|
Loading…
Reference in New Issue