re-implement torment using AddBattlerTagAttr, implement aroma veil using BattlerTagImmunityAbAttr, and fix BattlerTagImmunityAbAttr's message and ability popping up when activated

This commit is contained in:
jatinkohli 2024-05-21 00:20:58 -07:00
parent 6d099cde96
commit dce73f6d7e
4 changed files with 15 additions and 60 deletions

View File

@ -1790,7 +1790,7 @@ export class BattlerTagImmunityAbAttr extends PreApplyBattlerTagAbAttr {
}
getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string {
return getPokemonMessage(pokemon, `'s ${abilityName}\nprevents ${(args[0] as BattlerTag).getDescriptor()}!`);
return getPokemonMessage(pokemon, `'s ${abilityName}\nprevents ${(args[0] as BattlerTag)[0].getDescriptor()}!`);
}
}
@ -3450,6 +3450,7 @@ export function initAbilities() {
.attr(PostSummonMessageAbAttr, (pokemon: Pokemon) => getPokemonMessage(pokemon, ' is radiating a bursting aura!'))
.attr(MoveAbilityBypassAbAttr),
new Ability(Abilities.AROMA_VEIL, 6)
.attr(BattlerTagImmunityAbAttr, BattlerTagType.TORMENT)
.ignorable()
.partial(),
new Ability(Abilities.FLOWER_VEIL, 6)

View File

@ -496,13 +496,11 @@ export class TormentTag extends BattlerTag {
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();
canAdd(pokemon: Pokemon) {
return !pokemon.isMax();
}
onAdd(pokemon: Pokemon): void {
onAdd(pokemon: Pokemon) {
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ' was subjected to torment!'));
}
@ -510,6 +508,10 @@ export class TormentTag extends BattlerTag {
pokemon.summonData.tormented = true;
return true;
}
getDescriptor(): string {
return 'torment';
}
}
export class HelpingHandTag extends BattlerTag {

View File

@ -3274,56 +3274,6 @@ export class DisableMoveAttr extends MoveEffectAttr {
}
}
export class TormentAttr extends MoveEffectAttr {
constructor() {
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.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;
}
// modified from disable, score of -5 is target is not already tormented
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
const isTormented = target.summonData.tormented && (target.findTag(t => t instanceof TormentTag) !== undefined);
return isTormented ? 0 : -5;
}
}
export class TauntAttr extends MoveEffectAttr {
constructor() {
super(false);
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]) {
const ret = this.canApply(user, target, move, args);
if (ret) {
target.summonData.justTaunted = true;
target.summonData.taunted = true;
target.summonData.tauntedTurns = 4;
user.scene.queueMessage(getPokemonMessage(target, ' fell for the taunt!'));
}
return ret;
}
}
export class FrenzyAttr extends MoveEffectAttr {
constructor() {
super(true, MoveEffectTrigger.HIT);
@ -3382,7 +3332,7 @@ export class AddBattlerTagAttr extends MoveEffectAttr {
const chance = this.getTagChance(user, target, move);
if (chance < 0 || chance === 100 || user.randSeedInt(100) < chance)
return (this.selfTarget ? user : target).addTag(this.tagType, user.randSeedInt(this.turnCountMax - this.turnCountMin, this.turnCountMin), move.id, user.id);
return (this.selfTarget ? user : target).addTag(this.tagType, user.randSeedInt(this.turnCountMax - this.turnCountMin, this.turnCountMin), move.id, user.id);
return false;
}
@ -3408,6 +3358,7 @@ export class AddBattlerTagAttr extends MoveEffectAttr {
case BattlerTagType.NIGHTMARE:
case BattlerTagType.DROWSY:
case BattlerTagType.NO_CRIT:
case BattlerTagType.TORMENT:
return -5;
case BattlerTagType.SEEDED:
case BattlerTagType.SALT_CURED:
@ -5510,8 +5461,9 @@ export function initMoves() {
.attr(WeatherChangeAttr, WeatherType.HAIL)
.target(MoveTarget.BOTH_SIDES),
new StatusMove(Moves.TORMENT, Type.DARK, 100, 15, -1, 0, 3)
.attr(TormentAttr)
.attr(AddBattlerTagAttr, BattlerTagType.TORMENT)
.condition((user, target, move) => (!target.summonData.tormented && (target.findTag(t => t instanceof TormentTag) === undefined)))
.condition((user, target, move) => (!target.isMax()))
.partial(),
new StatusMove(Moves.FLATTER, Type.DARK, 100, 15, -1, 0, 3)
.attr(StatChangeAttr, BattleStat.SPATK, 1)
@ -5541,7 +5493,7 @@ export function initMoves() {
.attr(StatChangeAttr, BattleStat.SPDEF, 1, true)
.attr(AddBattlerTagAttr, BattlerTagType.CHARGED, true, false),
new StatusMove(Moves.TAUNT, Type.DARK, 100, 20, -1, 0, 3)
.attr(TauntAttr)
// .attr(TauntAttr)
.condition((user, target, move) => (!target.summonData.taunted))
.partial(),
new StatusMove(Moves.HELPING_HAND, Type.NORMAL, -1, 20, -1, 5, 3)

View File

@ -1768,7 +1768,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
const newTag = getBattlerTag(tagType, turnCount, sourceMove, sourceId);
const cancelled = new Utils.BooleanHolder(false);
applyPreApplyBattlerTagAbAttrs(PreApplyBattlerTagAbAttr, this, newTag, cancelled);
applyPreApplyBattlerTagAbAttrs(PreApplyBattlerTagAbAttr, this, newTag, cancelled, newTag);
if (!cancelled.value && newTag.canAdd(this)) {
this.summonData.tags.push(newTag);