mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 16:32:16 +02:00
Fixes for Wish implementation
This commit is contained in:
parent
bed5e4f98f
commit
77d8139437
@ -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, PokemonHealPhase, 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";
|
||||||
@ -147,22 +147,27 @@ class AuroraVeilTag extends WeakenMoveScreenTag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class WishTag extends ArenaTag {
|
class WishTag extends ArenaTag {
|
||||||
private slot: BattlerIndex;
|
private battlerIndex: BattlerIndex;
|
||||||
private userName: string;
|
private triggerMessage: string;
|
||||||
private health: number;
|
private healHp: number;
|
||||||
|
|
||||||
constructor(turnCount: integer, sourceId: integer, side: ArenaTagSide) {
|
constructor(turnCount: integer, sourceId: integer, side: ArenaTagSide) {
|
||||||
super(ArenaTagType.WISH, turnCount, Moves.WISH, sourceId, side);
|
super(ArenaTagType.WISH, turnCount, Moves.WISH, sourceId, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
onAdd(arena: Arena): void {
|
onAdd(arena: Arena): void {
|
||||||
const mon = arena.scene.getPokemonById(this.sourceId);
|
const user = arena.scene.getPokemonById(this.sourceId);
|
||||||
this.slot = mon.getBattlerIndex();
|
this.battlerIndex = user.getBattlerIndex();
|
||||||
this.userName = mon.name;
|
this.triggerMessage = getPokemonMessage(user, '\'s wish\ncame true!');
|
||||||
this.health = mon.getMaxHp() / 2;
|
this.healHp = Math.max(Math.floor(user.getMaxHp() / 2), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
onRemove(arena: Arena): void {
|
onRemove(arena: Arena): void {
|
||||||
const target = arena.scene.getField()[this.slot];
|
const target = arena.scene.getField()[this.battlerIndex];
|
||||||
arena.scene.unshiftPhase(new PokemonHealPhase(target.scene, target.getBattlerIndex(),
|
if (target?.isActive(true)) {
|
||||||
Math.max(Math.floor(this.health), 1), this.userName + '\'s wish\ncame true!', true, false));
|
arena.scene.queueMessage(this.triggerMessage);
|
||||||
|
arena.scene.unshiftPhase(new PokemonHealPhase(target.scene, target.getBattlerIndex(), this.healHp, null, true, false));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,12 +8,12 @@ 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",
|
||||||
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"
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user