mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 09:19:31 +02:00
Changed BattlerTagImmunityAbAttr to look at lists instead
This commit is contained in:
parent
bf3a2db47c
commit
7b08366a70
@ -2023,24 +2023,6 @@ export class PostSummonAbAttr extends AbAttr {
|
||||
}
|
||||
}
|
||||
|
||||
export class ApplyArenaTagAbAttr extends PostSummonAbAttr {
|
||||
private tagType: ArenaTagType;
|
||||
|
||||
constructor(tagtype: ArenaTagType) {
|
||||
super(true);
|
||||
this.tagType = tagtype;
|
||||
}
|
||||
|
||||
applyPostSummon(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
|
||||
const tag = pokemon.scene.arena.getTag(this.tagType);
|
||||
if (!tag && !simulated) {
|
||||
pokemon.scene.arena.addTag(this.tagType, 0, undefined, pokemon.id, pokemon.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes specified arena tags when a Pokemon is summoned.
|
||||
*/
|
||||
@ -2867,17 +2849,17 @@ export class PreApplyBattlerTagAbAttr extends AbAttr {
|
||||
* Provides immunity to BattlerTags {@linkcode BattlerTag} to specified targets.
|
||||
*/
|
||||
export class PreApplyBattlerTagImmunityAbAttr extends PreApplyBattlerTagAbAttr {
|
||||
private immuneTagType: BattlerTagType;
|
||||
private immuneTagTypes: BattlerTagType[];
|
||||
private battlerTag: BattlerTag;
|
||||
|
||||
constructor(immuneTagType: BattlerTagType) {
|
||||
constructor(immuneTagTypes: BattlerTagType[]) {
|
||||
super();
|
||||
|
||||
this.immuneTagType = immuneTagType;
|
||||
this.immuneTagTypes = immuneTagTypes;
|
||||
}
|
||||
|
||||
applyPreApplyBattlerTag(pokemon: Pokemon, passive: boolean, simulated: boolean, tag: BattlerTag, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||
if (tag.tagType === this.immuneTagType) {
|
||||
if (this.immuneTagTypes.includes(tag.tagType)) {
|
||||
cancelled.value = true;
|
||||
if (!simulated) {
|
||||
this.battlerTag = tag;
|
||||
@ -4931,8 +4913,7 @@ export function initAbilities() {
|
||||
.attr(TypeImmunityHealAbAttr, Type.WATER)
|
||||
.ignorable(),
|
||||
new Ability(Abilities.OBLIVIOUS, 3)
|
||||
.attr(BattlerTagImmunityAbAttr, BattlerTagType.INFATUATED)
|
||||
.attr(BattlerTagImmunityAbAttr, BattlerTagType.TAUNT)
|
||||
.attr(BattlerTagImmunityAbAttr, [BattlerTagType.INFATUATED, BattlerTagType.TAUNT])
|
||||
.attr(IntimidateImmunityAbAttr)
|
||||
.ignorable(),
|
||||
new Ability(Abilities.CLOUD_NINE, 3)
|
||||
@ -4945,7 +4926,7 @@ export function initAbilities() {
|
||||
.attr(StatMultiplierAbAttr, Stat.ACC, 1.3),
|
||||
new Ability(Abilities.INSOMNIA, 3)
|
||||
.attr(StatusEffectImmunityAbAttr, StatusEffect.SLEEP)
|
||||
.attr(BattlerTagImmunityAbAttr, BattlerTagType.DROWSY)
|
||||
.attr(BattlerTagImmunityAbAttr, [BattlerTagType.DROWSY])
|
||||
.ignorable(),
|
||||
new Ability(Abilities.COLOR_CHANGE, 3)
|
||||
.attr(PostDefendTypeChangeAbAttr)
|
||||
@ -4960,7 +4941,7 @@ export function initAbilities() {
|
||||
.attr(IgnoreMoveEffectsAbAttr)
|
||||
.partial(),
|
||||
new Ability(Abilities.OWN_TEMPO, 3)
|
||||
.attr(BattlerTagImmunityAbAttr, BattlerTagType.CONFUSED)
|
||||
.attr(BattlerTagImmunityAbAttr, [BattlerTagType.CONFUSED])
|
||||
.attr(IntimidateImmunityAbAttr)
|
||||
.ignorable(),
|
||||
new Ability(Abilities.SUCTION_CUPS, 3)
|
||||
@ -5023,7 +5004,7 @@ export function initAbilities() {
|
||||
.attr(PostDefendContactApplyStatusEffectAbAttr, 30, StatusEffect.POISON)
|
||||
.bypassFaint(),
|
||||
new Ability(Abilities.INNER_FOCUS, 3)
|
||||
.attr(BattlerTagImmunityAbAttr, BattlerTagType.FLINCHED)
|
||||
.attr(BattlerTagImmunityAbAttr, [BattlerTagType.FLINCHED])
|
||||
.attr(IntimidateImmunityAbAttr)
|
||||
.ignorable(),
|
||||
new Ability(Abilities.MAGMA_ARMOR, 3)
|
||||
@ -5124,7 +5105,7 @@ export function initAbilities() {
|
||||
.attr(DoubleBattleChanceAbAttr),
|
||||
new Ability(Abilities.VITAL_SPIRIT, 3)
|
||||
.attr(StatusEffectImmunityAbAttr, StatusEffect.SLEEP)
|
||||
.attr(BattlerTagImmunityAbAttr, BattlerTagType.DROWSY)
|
||||
.attr(BattlerTagImmunityAbAttr, [BattlerTagType.DROWSY])
|
||||
.ignorable(),
|
||||
new Ability(Abilities.WHITE_SMOKE, 3)
|
||||
.attr(ProtectStatAbAttr)
|
||||
@ -5418,7 +5399,7 @@ export function initAbilities() {
|
||||
.attr(PostSummonMessageAbAttr, (pokemon: Pokemon) => i18next.t("abilityTriggers:postSummonTeravolt", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }))
|
||||
.attr(MoveAbilityBypassAbAttr),
|
||||
new Ability(Abilities.AROMA_VEIL, 6)
|
||||
.attr(ApplyArenaTagAbAttr, ArenaTagType.AROMA_VEIL),
|
||||
.attr(UserFieldBattlerTagImmunityAbAttr, [BattlerTagType.INFATUATED, BattlerTagType.TAUNT, BattlerTagType.DISABLED, BattlerTagType.TORMENT, BattlerTagType.HEAL_BLOCK]),
|
||||
new Ability(Abilities.FLOWER_VEIL, 6)
|
||||
.ignorable()
|
||||
.unimplemented(),
|
||||
@ -5443,7 +5424,7 @@ export function initAbilities() {
|
||||
.attr(MoveTypeChangeAbAttr, Type.ICE, 1.2, (user, target, move) => move.type === Type.NORMAL && !move.hasAttr(VariableMoveTypeAttr)),
|
||||
new Ability(Abilities.SWEET_VEIL, 6)
|
||||
.attr(UserFieldStatusEffectImmunityAbAttr, StatusEffect.SLEEP)
|
||||
.attr(UserFieldBattlerTagImmunityAbAttr, BattlerTagType.DROWSY)
|
||||
.attr(UserFieldBattlerTagImmunityAbAttr, [ BattlerTagType.DROWSY])
|
||||
.ignorable()
|
||||
.partial(), // Mold Breaker ally should not be affected by Sweet Veil
|
||||
new Ability(Abilities.STANCE_CHANGE, 6)
|
||||
@ -5597,7 +5578,7 @@ export function initAbilities() {
|
||||
.attr(UnswappableAbilityAbAttr)
|
||||
.attr(UnsuppressableAbilityAbAttr)
|
||||
.attr(StatusEffectImmunityAbAttr, ...getNonVolatileStatusEffects())
|
||||
.attr(BattlerTagImmunityAbAttr, BattlerTagType.DROWSY),
|
||||
.attr(BattlerTagImmunityAbAttr, [BattlerTagType.DROWSY]),
|
||||
new Ability(Abilities.QUEENLY_MAJESTY, 7)
|
||||
.attr(FieldPriorityMoveImmunityAbAttr)
|
||||
.ignorable(),
|
||||
|
@ -955,40 +955,6 @@ class ImprisonTag extends ArenaTrapTag {
|
||||
}
|
||||
}
|
||||
|
||||
class AromaVeilTag extends ArenaTag {
|
||||
private protectedTags: BattlerTagType[];
|
||||
private source: Pokemon;
|
||||
|
||||
constructor(turnCount: number, sourceId: number, side: ArenaTagSide) {
|
||||
super(ArenaTagType.AROMA_VEIL, turnCount, undefined, sourceId, side);
|
||||
this.protectedTags = [BattlerTagType.TAUNT, BattlerTagType.TORMENT, BattlerTagType.DISABLED, BattlerTagType.HEAL_BLOCK, BattlerTagType.ENCORE, BattlerTagType.INFATUATED];
|
||||
}
|
||||
|
||||
onAdd(arena: Arena): void {
|
||||
this.source = arena.scene.getPokemonById(this.sourceId!)!;
|
||||
const party = this.source.isPlayer() ? this.source.scene.getPlayerField() : this.source.scene.getEnemyField();
|
||||
party?.forEach((p: PlayerPokemon | EnemyPokemon ) => {
|
||||
p.findAndRemoveTags(t => this.protectedTags.includes(t.tagType));
|
||||
});
|
||||
}
|
||||
|
||||
lapse(_arena: Arena): boolean {
|
||||
return this.source.isActive(true) && this.source.hasAbility(Abilities.AROMA_VEIL);
|
||||
}
|
||||
|
||||
apply(arena: Arena, args: any[]): boolean {
|
||||
const targetPokemon = args[2];
|
||||
if (this.protectedTags.includes(args[1] as BattlerTagType) && this.lapse(arena)) {
|
||||
(args[0] as Utils.BooleanHolder).value = false;
|
||||
arena.scene.queueMessage(i18next.t("abilityTriggers:aromaVeilImmunity", {
|
||||
pokemonNameWithAffix: targetPokemon,
|
||||
}));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export function getArenaTag(tagType: ArenaTagType, turnCount: integer, sourceMove: Moves | undefined, sourceId: integer, targetIndex?: BattlerIndex, side: ArenaTagSide = ArenaTagSide.BOTH): ArenaTag | null {
|
||||
switch (tagType) {
|
||||
case ArenaTagType.MIST:
|
||||
@ -1038,8 +1004,6 @@ export function getArenaTag(tagType: ArenaTagType, turnCount: integer, sourceMov
|
||||
return new SafeguardTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.IMPRISON:
|
||||
return new ImprisonTag(sourceId, side);
|
||||
case ArenaTagType.AROMA_VEIL:
|
||||
return new AromaVeilTag(turnCount, sourceId, side);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -23,8 +23,6 @@ import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
||||
import { ShowAbilityPhase } from "#app/phases/show-ability-phase";
|
||||
import { StatStageChangePhase, StatStageChangeCallback } from "#app/phases/stat-stage-change-phase";
|
||||
import { PokemonAnimType } from "#app/enums/pokemon-anim-type";
|
||||
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
||||
import { ArenaTagSide } from "./arena-tag";
|
||||
|
||||
export enum BattlerTagLapseType {
|
||||
FAINT,
|
||||
@ -115,15 +113,6 @@ export abstract class MoveRestrictionBattlerTag extends BattlerTag {
|
||||
super(tagType, lapseType, turnCount, sourceMove, sourceId);
|
||||
}
|
||||
|
||||
override canAdd(pokemon: Pokemon): boolean {
|
||||
const validArena = new Utils.BooleanHolder(true);
|
||||
const arenaTag = pokemon.scene.arena.findTagsOnSide(t => t.tagType === ArenaTagType.AROMA_VEIL, pokemon.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY)[0];
|
||||
if (arenaTag) {
|
||||
arenaTag.apply(pokemon.scene.arena, [validArena, this.tagType, getPokemonNameWithAffix(pokemon)]);
|
||||
}
|
||||
return validArena.value;
|
||||
}
|
||||
|
||||
/** @override */
|
||||
override lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||
if (lapseType === BattlerTagLapseType.PRE_MOVE) {
|
||||
@ -704,14 +693,8 @@ export class InfatuatedTag extends BattlerTag {
|
||||
if (this.sourceId) {
|
||||
const pkm = pokemon.scene.getPokemonById(this.sourceId);
|
||||
|
||||
const validArena = new Utils.BooleanHolder(true);
|
||||
const arenaTag = pokemon.scene.arena.findTagsOnSide(t => t.tagType === ArenaTagType.AROMA_VEIL, pokemon.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY)[0];
|
||||
if (arenaTag) {
|
||||
arenaTag.apply(pokemon.scene.arena, [validArena, this.tagType, getPokemonNameWithAffix(pokemon)]);
|
||||
}
|
||||
|
||||
if (pkm) {
|
||||
return pokemon.isOppositeGender(pkm) && validArena.value;
|
||||
return pokemon.isOppositeGender(pkm);
|
||||
} else {
|
||||
console.warn("canAdd: this.sourceId is not a valid pokemon id!", this.sourceId);
|
||||
return false;
|
||||
|
@ -24,6 +24,5 @@ export enum ArenaTagType {
|
||||
HAPPY_HOUR = "HAPPY_HOUR",
|
||||
SAFEGUARD = "SAFEGUARD",
|
||||
NO_CRIT = "NO_CRIT",
|
||||
AROMA_VEIL = "AROMA_VEIL",
|
||||
IMPRISON = "IMPRISON"
|
||||
}
|
||||
|
@ -60,6 +60,5 @@
|
||||
"postSummonSwordOfRuin": "{{pokemonNameWithAffix}}'s Sword of Ruin lowered the {{statName}}\nof all surrounding Pokémon!",
|
||||
"postSummonTabletsOfRuin": "{{pokemonNameWithAffix}}'s Tablets of Ruin lowered the {{statName}}\nof all surrounding Pokémon!",
|
||||
"postSummonBeadsOfRuin": "{{pokemonNameWithAffix}}'s Beads of Ruin lowered the {{statName}}\nof all surrounding Pokémon!",
|
||||
"preventBerryUse": "{{pokemonNameWithAffix}} is too\nnervous to eat berries!",
|
||||
"aromaVeilImmunity": "{{pokemonNameWithAffix}} is protected by an aromatic veil!"
|
||||
"preventBerryUse": "{{pokemonNameWithAffix}} is too\nnervous to eat berries!"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user