diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index ba00b0906..dba5a7f3b 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -1,7 +1,7 @@ import { CommonAnim, CommonBattleAnim } from "./battle-anims"; import { CommonAnimPhase, MoveEffectPhase, MovePhase, PokemonHealPhase, ShowAbilityPhase, StatChangePhase } from "../phases"; import { getPokemonMessage, getPokemonPrefix } from "../messages"; -import Pokemon, { MoveResult, HitResult } from "../field/pokemon"; +import Pokemon, { MoveResult, HitResult, TurnMove } from "../field/pokemon"; import { Stat, getStatName } from "./pokemon-stat"; import { StatusEffect } from "./status-effect"; import * as Utils from "../utils"; @@ -488,6 +488,53 @@ export class EncoreTag extends BattlerTag { } } +export class TormentedTag extends BattlerTag { + public moveId: Moves; + constructor(sourceId: integer) { + super(BattlerTagType.TORMENTED, BattlerTagLapseType.TURN_END, 1, Moves.TORMENT, sourceId); + } + /** + * When given a battler tag or json representing one, load the data for it. + * @param {BattlerTag | any} source A battler tag + */ + loadTag(source: BattlerTag | any): void { + super.loadTag(source); + this.moveId = source.moveId as Moves; + } + + canAdd(pokemon: Pokemon): boolean { + if (pokemon.isMax()) + return false; + return true; + } + + onAdd(pokemon: Pokemon): void { + super.onAdd(pokemon); + pokemon.scene.queueMessage(getPokemonMessage(pokemon, ' was subjected\nto torment!')); + } + + onOverlap(pokemon: Pokemon): void { + super.onOverlap(pokemon); + //TODO: This is not official game text. Grab what the game actually says if this happens. + pokemon.scene.queueMessage(getPokemonMessage(pokemon, ' is\nalready tormented!')); + } + + //Extremely janky hack to just test sure that this works in the first place. Athebyne please don't ship this. At the end of every turn, disables the last move you've used, for one turn. + lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { + const ret = lapseType !== BattlerTagLapseType.CUSTOM || super.lapse(pokemon, lapseType); + if (ret) { + const lastMove = pokemon.getLastXMoves(1)[0]; + if (!lastMove) + return ret; + pokemon.summonData.disabledMove = lastMove.move; + pokemon.summonData.disabledTurns = 2; + + //pokemon.scene.queueMessage(disabledMove.getName(), `TORMENT TEST`); + return ret; + } + } +} + export class HelpingHandTag extends BattlerTag { constructor(sourceId: integer) { super(BattlerTagType.HELPING_HAND, BattlerTagLapseType.TURN_END, 1, Moves.HELPING_HAND, sourceId); @@ -1270,7 +1317,9 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc case BattlerTagType.CHARGING: return new ChargingTag(sourceMove, sourceId); case BattlerTagType.ENCORE: - return new EncoreTag(sourceId); + return new EncoreTag(sourceId); + case BattlerTagType.TORMENTED: + return new TormentedTag(sourceId); case BattlerTagType.HELPING_HAND: return new HelpingHandTag(sourceId); case BattlerTagType.INGRAIN: diff --git a/src/data/enums/battler-tag-type.ts b/src/data/enums/battler-tag-type.ts index d18ccf1c5..ab30aa861 100644 --- a/src/data/enums/battler-tag-type.ts +++ b/src/data/enums/battler-tag-type.ts @@ -11,6 +11,7 @@ export enum BattlerTagType { FRENZY = "FRENZY", CHARGING = "CHARGING", ENCORE = "ENCORE", + TORMENTED = "TORMENTED", HELPING_HAND = "HELPING_HAND", INGRAIN = "INGRAIN", AQUA_RING = "AQUA_RING", diff --git a/src/data/move.ts b/src/data/move.ts index 978f51091..51303f3e9 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -2819,7 +2819,8 @@ export class AddBattlerTagAttr extends MoveEffectAttr { case BattlerTagType.INFESTATION: return -3; case BattlerTagType.ENCORE: - return -2; + return -2; + case BattlerTagType.TORMENTED: case BattlerTagType.INGRAIN: case BattlerTagType.IGNORE_ACCURACY: case BattlerTagType.AQUA_RING: @@ -4825,8 +4826,10 @@ export function initMoves() { new StatusMove(Moves.HAIL, Type.ICE, -1, 10, -1, 0, 3) .attr(WeatherChangeAttr, WeatherType.HAIL) .target(MoveTarget.BOTH_SIDES), - new StatusMove(Moves.TORMENT, Type.DARK, 100, 15, -1, 0, 3) - .unimplemented(), + new StatusMove(Moves.TORMENT, Type.DARK, 100, 15, -1, 0, 3) + .attr(AddBattlerTagAttr, BattlerTagType.TORMENTED, false, true) + .condition((user, target, move) => !target.getTag(BattlerTagType.TORMENTED) && !target.isMax()) + .partial(), new StatusMove(Moves.FLATTER, Type.DARK, 100, 15, -1, 0, 3) .attr(StatChangeAttr, BattleStat.SPATK, 1) .attr(ConfuseAttr),