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 commit 4b084658d2.

* Revert "Serene grace implementation idea"

This reverts commit 4dd2504bc7.

* Fixes for Wish implementation

---------

Co-authored-by: Flashfyre <flashfireex@gmail.com>
This commit is contained in:
Reldnahc 2024-04-30 11:38:24 -05:00 committed by GitHub
parent 8e64eaea3f
commit 1e7c329928
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 32 additions and 4 deletions

View File

@ -1,10 +1,10 @@
import { Arena } from "../field/arena";
import { Type } from "./type";
import * as Utils from "../utils";
import { MoveCategory, StatChangeAttr, allMoves } from "./move";
import { MoveCategory, 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,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 {
private weakenedType: Type;
@ -472,6 +497,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

@ -8,6 +8,7 @@ export enum ArenaTagType {
MIST = "MIST",
FUTURE_SIGHT = "FUTURE_SIGHT",
DOOM_DESIRE = "DOOM_DESIRE",
WISH = "WISH",
STEALTH_ROCK = "STEALTH_ROCK",
STICKY_WEB = "STICKY_WEB",
TRICK_ROOM = "TRICK_ROOM",

View File

@ -4493,7 +4493,7 @@ export function initMoves() {
.attr(AbilityCopyAttr),
new SelfStatusMove(Moves.WISH, Type.NORMAL, -1, 10, -1, 0, 3)
.triageMove()
.unimplemented(),
.attr(AddArenaTagAttr, ArenaTagType.WISH, 2, true),
new SelfStatusMove(Moves.ASSIST, Type.NORMAL, -1, 20, -1, 0, 3)
.attr(RandomMovesetMoveAttr, true)
.ignoresVirtual(),