mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-17 22:02:18 +02:00
Re-implement torment as BattleTag
This commit is contained in:
parent
b3ba27bedc
commit
32c2d526fa
@ -3451,7 +3451,7 @@ export function initAbilities() {
|
||||
.attr(MoveAbilityBypassAbAttr),
|
||||
new Ability(Abilities.AROMA_VEIL, 6)
|
||||
.ignorable()
|
||||
.unimplemented(),
|
||||
.partial(),
|
||||
new Ability(Abilities.FLOWER_VEIL, 6)
|
||||
.ignorable()
|
||||
.unimplemented(),
|
||||
|
@ -491,6 +491,27 @@ export class EncoreTag extends BattlerTag {
|
||||
}
|
||||
}
|
||||
|
||||
export class TormentTag extends BattlerTag {
|
||||
constructor() {
|
||||
super(BattlerTagType.TORMENT, BattlerTagLapseType.TURN_END, -1, Moves.TORMENT);
|
||||
}
|
||||
|
||||
// redundant due to TormentAttr (MoveEffectAttr) performing these checks before adding the tag
|
||||
canAdd(pokemon: Pokemon): boolean {
|
||||
const hasAromaVeil = (pokemon.getAbility().id === Abilities.AROMA_VEIL) || (pokemon.getPassiveAbility().id === Abilities.AROMA_VEIL);
|
||||
return !hasAromaVeil && !pokemon.isMax();
|
||||
}
|
||||
|
||||
onAdd(pokemon: Pokemon): void {
|
||||
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ' was subjected to torment!'));
|
||||
}
|
||||
|
||||
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType) {
|
||||
pokemon.summonData.tormented = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export class HelpingHandTag extends BattlerTag {
|
||||
constructor(sourceId: integer) {
|
||||
super(BattlerTagType.HELPING_HAND, BattlerTagLapseType.TURN_END, 1, Moves.HELPING_HAND, sourceId);
|
||||
@ -1316,6 +1337,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc
|
||||
return new ChargingTag(sourceMove, sourceId);
|
||||
case BattlerTagType.ENCORE:
|
||||
return new EncoreTag(sourceId);
|
||||
case BattlerTagType.TORMENT:
|
||||
return new TormentTag();
|
||||
case BattlerTagType.HELPING_HAND:
|
||||
return new HelpingHandTag(sourceId);
|
||||
case BattlerTagType.INGRAIN:
|
||||
|
@ -11,6 +11,7 @@ export enum BattlerTagType {
|
||||
FRENZY = "FRENZY",
|
||||
CHARGING = "CHARGING",
|
||||
ENCORE = "ENCORE",
|
||||
TORMENT = "TORMENT",
|
||||
HELPING_HAND = "HELPING_HAND",
|
||||
INGRAIN = "INGRAIN",
|
||||
AQUA_RING = "AQUA_RING",
|
||||
|
@ -2,7 +2,7 @@ import { Moves } from "./enums/moves";
|
||||
import { ChargeAnim, MoveChargeAnim, initMoveAnim, loadMoveAnimAssets } from "./battle-anims";
|
||||
import { BattleEndPhase, MoveEffectPhase, MovePhase, NewBattlePhase, PartyStatusCurePhase, PokemonHealPhase, StatChangePhase, SwitchSummonPhase, ToggleDoublePositionPhase } from "../phases";
|
||||
import { BattleStat, getBattleStatName } from "./battle-stat";
|
||||
import { EncoreTag } from "./battler-tags";
|
||||
import { EncoreTag, TormentTag } from "./battler-tags";
|
||||
import { BattlerTagType } from "./enums/battler-tag-type";
|
||||
import { getPokemonMessage } from "../messages";
|
||||
import Pokemon, { AttackMoveResult, EnemyPokemon, HitResult, MoveResult, PlayerPokemon, PokemonMove, TurnMove } from "../field/pokemon";
|
||||
@ -3279,15 +3279,30 @@ export class TormentAttr extends MoveEffectAttr {
|
||||
super(false);
|
||||
}
|
||||
|
||||
canApply(user: Pokemon, target: Pokemon, move: Move, args: any[]) {
|
||||
const hasAromaVeil = (target.getAbility().id === Abilities.AROMA_VEIL) || (target.getPassiveAbility().id === Abilities.AROMA_VEIL);
|
||||
return super.canApply(user, target, move, args) && !hasAromaVeil && !target.isMax();
|
||||
}
|
||||
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]) {
|
||||
const ret = this.canApply(user, target, move, args);
|
||||
const hasAromaVeil = (target.getAbility().id === Abilities.AROMA_VEIL);
|
||||
const hasAromaVeilPassive = (target.getPassiveAbility().id === Abilities.AROMA_VEIL)
|
||||
|
||||
if (ret) {
|
||||
target.summonData.justTormented = true;
|
||||
user.scene.queueMessage(getPokemonMessage(target, ' was subjected to torment!'));
|
||||
target.addTag(BattlerTagType.TORMENT);
|
||||
} else if (hasAromaVeil || hasAromaVeilPassive) {
|
||||
target.scene.abilityBar.showAbility(target, hasAromaVeilPassive);
|
||||
target.scene.queueMessage(getPokemonMessage(target, ' is protected by an aromatic veil!'));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// copied from disable
|
||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
||||
return -5;
|
||||
}
|
||||
}
|
||||
|
||||
export class TauntAttr extends MoveEffectAttr {
|
||||
@ -5495,7 +5510,7 @@ export function initMoves() {
|
||||
.target(MoveTarget.BOTH_SIDES),
|
||||
new StatusMove(Moves.TORMENT, Type.DARK, 100, 15, -1, 0, 3)
|
||||
.attr(TormentAttr)
|
||||
.condition((user, target, move) => (!target.summonData.justTormented && !target.summonData.tormented))
|
||||
.condition((user, target, move) => (!target.summonData.tormented && (target.findTag(t => t instanceof TormentTag) === undefined)))
|
||||
.partial(),
|
||||
new StatusMove(Moves.FLATTER, Type.DARK, 100, 15, -1, 0, 3)
|
||||
.attr(StatChangeAttr, BattleStat.SPATK, 1)
|
||||
|
@ -3387,13 +3387,12 @@ export class PokemonSummonData {
|
||||
public moveQueue: QueuedMove[] = [];
|
||||
public disabledMove: Moves = Moves.NONE;
|
||||
public disabledTurns: integer = 0;
|
||||
public tags: BattlerTag[] = [];
|
||||
public abilitySuppressed: boolean = false;
|
||||
public justTormented: boolean = false;
|
||||
public tormented: boolean = false;
|
||||
public tormented = false;
|
||||
public justTaunted: boolean = false;
|
||||
public taunted: boolean = false;
|
||||
public tauntedTurns: integer = 0;
|
||||
public tags: BattlerTag[] = [];
|
||||
public abilitySuppressed: boolean = false;
|
||||
|
||||
public speciesForm: PokemonSpeciesForm;
|
||||
public fusionSpeciesForm: PokemonSpeciesForm;
|
||||
|
@ -1735,6 +1735,7 @@ export class CommandPhase extends FieldPhase {
|
||||
// Decides between a Disabled, Not Implemented, Taunted, Tormented, or No PP translation message
|
||||
var errorMessage;
|
||||
var canTranslate = true;
|
||||
|
||||
if (playerPokemon.summonData.disabledMove === move.moveId)
|
||||
errorMessage = 'battle:moveDisabled';
|
||||
else if (move.getName().endsWith(' (N)'))
|
||||
@ -2109,12 +2110,6 @@ export class TurnEndPhase extends FieldPhase {
|
||||
const handlePokemon = (pokemon: Pokemon) => {
|
||||
pokemon.lapseTags(BattlerTagLapseType.TURN_END);
|
||||
|
||||
// transition from just tormented (tormented status does not apply on same turn it's given) and tormented
|
||||
if (pokemon.summonData.justTormented && !pokemon.summonData.tormented) {
|
||||
pokemon.summonData.justTormented = false;
|
||||
pokemon.summonData.tormented = true;
|
||||
}
|
||||
|
||||
if (pokemon.summonData.justTaunted) {
|
||||
pokemon.summonData.justTaunted = false;
|
||||
}
|
||||
|
@ -116,7 +116,6 @@ export default class PokemonData {
|
||||
this.summonData.disabledMove = source.summonData.disabledMove;
|
||||
this.summonData.disabledTurns = source.summonData.disabledTurns;
|
||||
this.summonData.abilitySuppressed = source.summonData.abilitySuppressed;
|
||||
this.summonData.justTormented = source.summonData.justTormented;
|
||||
this.summonData.tormented = source.summonData.tormented;
|
||||
this.summonData.justTaunted = source.summonData.justTaunted;
|
||||
this.summonData.taunted = source.summonData.taunted;
|
||||
|
Loading…
Reference in New Issue
Block a user