mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-18 06:12:19 +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),
|
.attr(MoveAbilityBypassAbAttr),
|
||||||
new Ability(Abilities.AROMA_VEIL, 6)
|
new Ability(Abilities.AROMA_VEIL, 6)
|
||||||
.ignorable()
|
.ignorable()
|
||||||
.unimplemented(),
|
.partial(),
|
||||||
new Ability(Abilities.FLOWER_VEIL, 6)
|
new Ability(Abilities.FLOWER_VEIL, 6)
|
||||||
.ignorable()
|
.ignorable()
|
||||||
.unimplemented(),
|
.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 {
|
export class HelpingHandTag extends BattlerTag {
|
||||||
constructor(sourceId: integer) {
|
constructor(sourceId: integer) {
|
||||||
super(BattlerTagType.HELPING_HAND, BattlerTagLapseType.TURN_END, 1, Moves.HELPING_HAND, sourceId);
|
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);
|
return new ChargingTag(sourceMove, sourceId);
|
||||||
case BattlerTagType.ENCORE:
|
case BattlerTagType.ENCORE:
|
||||||
return new EncoreTag(sourceId);
|
return new EncoreTag(sourceId);
|
||||||
|
case BattlerTagType.TORMENT:
|
||||||
|
return new TormentTag();
|
||||||
case BattlerTagType.HELPING_HAND:
|
case BattlerTagType.HELPING_HAND:
|
||||||
return new HelpingHandTag(sourceId);
|
return new HelpingHandTag(sourceId);
|
||||||
case BattlerTagType.INGRAIN:
|
case BattlerTagType.INGRAIN:
|
||||||
|
@ -11,6 +11,7 @@ export enum BattlerTagType {
|
|||||||
FRENZY = "FRENZY",
|
FRENZY = "FRENZY",
|
||||||
CHARGING = "CHARGING",
|
CHARGING = "CHARGING",
|
||||||
ENCORE = "ENCORE",
|
ENCORE = "ENCORE",
|
||||||
|
TORMENT = "TORMENT",
|
||||||
HELPING_HAND = "HELPING_HAND",
|
HELPING_HAND = "HELPING_HAND",
|
||||||
INGRAIN = "INGRAIN",
|
INGRAIN = "INGRAIN",
|
||||||
AQUA_RING = "AQUA_RING",
|
AQUA_RING = "AQUA_RING",
|
||||||
|
@ -2,7 +2,7 @@ import { Moves } from "./enums/moves";
|
|||||||
import { ChargeAnim, MoveChargeAnim, initMoveAnim, loadMoveAnimAssets } from "./battle-anims";
|
import { ChargeAnim, MoveChargeAnim, initMoveAnim, loadMoveAnimAssets } from "./battle-anims";
|
||||||
import { BattleEndPhase, MoveEffectPhase, MovePhase, NewBattlePhase, PartyStatusCurePhase, PokemonHealPhase, StatChangePhase, SwitchSummonPhase, ToggleDoublePositionPhase } from "../phases";
|
import { BattleEndPhase, MoveEffectPhase, MovePhase, NewBattlePhase, PartyStatusCurePhase, PokemonHealPhase, StatChangePhase, SwitchSummonPhase, ToggleDoublePositionPhase } from "../phases";
|
||||||
import { BattleStat, getBattleStatName } from "./battle-stat";
|
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 { BattlerTagType } from "./enums/battler-tag-type";
|
||||||
import { getPokemonMessage } from "../messages";
|
import { getPokemonMessage } from "../messages";
|
||||||
import Pokemon, { AttackMoveResult, EnemyPokemon, HitResult, MoveResult, PlayerPokemon, PokemonMove, TurnMove } from "../field/pokemon";
|
import Pokemon, { AttackMoveResult, EnemyPokemon, HitResult, MoveResult, PlayerPokemon, PokemonMove, TurnMove } from "../field/pokemon";
|
||||||
@ -3279,15 +3279,30 @@ export class TormentAttr extends MoveEffectAttr {
|
|||||||
super(false);
|
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[]) {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]) {
|
||||||
const ret = this.canApply(user, target, move, args);
|
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) {
|
if (ret) {
|
||||||
target.summonData.justTormented = true;
|
target.addTag(BattlerTagType.TORMENT);
|
||||||
user.scene.queueMessage(getPokemonMessage(target, ' was subjected to torment!'));
|
} else if (hasAromaVeil || hasAromaVeilPassive) {
|
||||||
|
target.scene.abilityBar.showAbility(target, hasAromaVeilPassive);
|
||||||
|
target.scene.queueMessage(getPokemonMessage(target, ' is protected by an aromatic veil!'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// copied from disable
|
||||||
|
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
||||||
|
return -5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TauntAttr extends MoveEffectAttr {
|
export class TauntAttr extends MoveEffectAttr {
|
||||||
@ -5495,7 +5510,7 @@ export function initMoves() {
|
|||||||
.target(MoveTarget.BOTH_SIDES),
|
.target(MoveTarget.BOTH_SIDES),
|
||||||
new StatusMove(Moves.TORMENT, Type.DARK, 100, 15, -1, 0, 3)
|
new StatusMove(Moves.TORMENT, Type.DARK, 100, 15, -1, 0, 3)
|
||||||
.attr(TormentAttr)
|
.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(),
|
.partial(),
|
||||||
new StatusMove(Moves.FLATTER, Type.DARK, 100, 15, -1, 0, 3)
|
new StatusMove(Moves.FLATTER, Type.DARK, 100, 15, -1, 0, 3)
|
||||||
.attr(StatChangeAttr, BattleStat.SPATK, 1)
|
.attr(StatChangeAttr, BattleStat.SPATK, 1)
|
||||||
|
@ -3387,13 +3387,12 @@ export class PokemonSummonData {
|
|||||||
public moveQueue: QueuedMove[] = [];
|
public moveQueue: QueuedMove[] = [];
|
||||||
public disabledMove: Moves = Moves.NONE;
|
public disabledMove: Moves = Moves.NONE;
|
||||||
public disabledTurns: integer = 0;
|
public disabledTurns: integer = 0;
|
||||||
public tags: BattlerTag[] = [];
|
public tormented = false;
|
||||||
public abilitySuppressed: boolean = false;
|
|
||||||
public justTormented: boolean = false;
|
|
||||||
public tormented: boolean = false;
|
|
||||||
public justTaunted: boolean = false;
|
public justTaunted: boolean = false;
|
||||||
public taunted: boolean = false;
|
public taunted: boolean = false;
|
||||||
public tauntedTurns: integer = 0;
|
public tauntedTurns: integer = 0;
|
||||||
|
public tags: BattlerTag[] = [];
|
||||||
|
public abilitySuppressed: boolean = false;
|
||||||
|
|
||||||
public speciesForm: PokemonSpeciesForm;
|
public speciesForm: PokemonSpeciesForm;
|
||||||
public fusionSpeciesForm: 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
|
// Decides between a Disabled, Not Implemented, Taunted, Tormented, or No PP translation message
|
||||||
var errorMessage;
|
var errorMessage;
|
||||||
var canTranslate = true;
|
var canTranslate = true;
|
||||||
|
|
||||||
if (playerPokemon.summonData.disabledMove === move.moveId)
|
if (playerPokemon.summonData.disabledMove === move.moveId)
|
||||||
errorMessage = 'battle:moveDisabled';
|
errorMessage = 'battle:moveDisabled';
|
||||||
else if (move.getName().endsWith(' (N)'))
|
else if (move.getName().endsWith(' (N)'))
|
||||||
@ -2109,12 +2110,6 @@ export class TurnEndPhase extends FieldPhase {
|
|||||||
const handlePokemon = (pokemon: Pokemon) => {
|
const handlePokemon = (pokemon: Pokemon) => {
|
||||||
pokemon.lapseTags(BattlerTagLapseType.TURN_END);
|
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) {
|
if (pokemon.summonData.justTaunted) {
|
||||||
pokemon.summonData.justTaunted = false;
|
pokemon.summonData.justTaunted = false;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,6 @@ export default class PokemonData {
|
|||||||
this.summonData.disabledMove = source.summonData.disabledMove;
|
this.summonData.disabledMove = source.summonData.disabledMove;
|
||||||
this.summonData.disabledTurns = source.summonData.disabledTurns;
|
this.summonData.disabledTurns = source.summonData.disabledTurns;
|
||||||
this.summonData.abilitySuppressed = source.summonData.abilitySuppressed;
|
this.summonData.abilitySuppressed = source.summonData.abilitySuppressed;
|
||||||
this.summonData.justTormented = source.summonData.justTormented;
|
|
||||||
this.summonData.tormented = source.summonData.tormented;
|
this.summonData.tormented = source.summonData.tormented;
|
||||||
this.summonData.justTaunted = source.summonData.justTaunted;
|
this.summonData.justTaunted = source.summonData.justTaunted;
|
||||||
this.summonData.taunted = source.summonData.taunted;
|
this.summonData.taunted = source.summonData.taunted;
|
||||||
|
Loading…
Reference in New Issue
Block a user