From b000e11c76223cc64fe901831f0935dbb7d41659 Mon Sep 17 00:00:00 2001 From: torranx Date: Fri, 6 Sep 2024 03:07:56 +0800 Subject: [PATCH] make tag specific, add message on tag add --- src/data/battler-tags.ts | 19 +++++++++---------- src/field/pokemon.ts | 5 ++--- src/locales/en/battler-tags.json | 3 ++- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 5ccc808d7b9..5c52fa22e1d 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -1985,18 +1985,13 @@ export class ExposedTag extends BattlerTag { } /** - * Tag that doubles the type effectiveness of a move. + * Tag that doubles the type effectiveness of a Fire-type moves. * This is used by Tar Shot. * @extends BattlerTag */ -export class DoubleMoveTypeEffectivenessTag extends BattlerTag { - /** The move's type effectiveness to be doubled. */ - public moveType: Type; - - constructor(moveType: Type, tagType: BattlerTagType, lapseType: BattlerTagLapseType, sourceMove: Moves) { - super(tagType, lapseType, 1, sourceMove); - - this.moveType = moveType; +export class TarShotTag extends BattlerTag { + constructor() { + super(BattlerTagType.TAR_SHOT, BattlerTagLapseType.CUSTOM, 0); } /** @@ -2007,6 +2002,10 @@ export class DoubleMoveTypeEffectivenessTag extends BattlerTag { canAdd(pokemon: Pokemon): boolean { return !pokemon.isTerastallized(); } + + onAdd(pokemon: Pokemon): void { + pokemon.scene.queueMessage(i18next.t("battlerTags:tarShotOnAdd", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) })); + } } @@ -2151,7 +2150,7 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: number, source case BattlerTagType.GULP_MISSILE_PIKACHU: return new GulpMissileTag(tagType, sourceMove); case BattlerTagType.TAR_SHOT: - return new DoubleMoveTypeEffectivenessTag(Type.FIRE, tagType, BattlerTagLapseType.CUSTOM, sourceMove); + return new TarShotTag(); case BattlerTagType.NONE: default: return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId); diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 0c5260c23c4..6f8a120da40 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -17,7 +17,7 @@ import { initMoveAnim, loadMoveAnimAssets } from "../data/battle-anims"; import { Status, StatusEffect, getRandomStatus } from "../data/status-effect"; import { pokemonEvolutions, pokemonPrevolutions, SpeciesFormEvolution, SpeciesEvolutionCondition, FusionSpeciesFormEvolution } from "../data/pokemon-evolutions"; import { reverseCompatibleTms, tmSpecies, tmPoolTiers } from "../data/tms"; -import { BattlerTag, BattlerTagLapseType, EncoreTag, GroundedTag, HighestStatBoostTag, TypeImmuneTag, getBattlerTag, SemiInvulnerableTag, TypeBoostTag, MoveRestrictionBattlerTag, ExposedTag, DragonCheerTag, CritBoostTag, TrappedTag, DoubleMoveTypeEffectivenessTag } from "../data/battler-tags"; +import { BattlerTag, BattlerTagLapseType, EncoreTag, GroundedTag, HighestStatBoostTag, TypeImmuneTag, getBattlerTag, SemiInvulnerableTag, TypeBoostTag, MoveRestrictionBattlerTag, ExposedTag, DragonCheerTag, CritBoostTag, TrappedTag, TarShotTag } from "../data/battler-tags"; import { WeatherType } from "../data/weather"; import { ArenaTagSide, NoCritTag, WeakenMoveScreenTag } from "../data/arena-tag"; import { Ability, AbAttr, StatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, IgnoreOpponentStatStagesAbAttr, MoveImmunityAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyStatMultiplierAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr, DamageBoostAbAttr, IgnoreTypeStatusEffectImmunityAbAttr, ConditionalCritAbAttr, applyFieldStatMultiplierAbAttrs, FieldMultiplyStatAbAttr, AddSecondStrikeAbAttr, UserFieldStatusEffectImmunityAbAttr, UserFieldBattlerTagImmunityAbAttr, BattlerTagImmunityAbAttr, MoveTypeChangeAbAttr, FullHpResistTypeAbAttr, applyCheckTrappedAbAttrs, CheckTrappedAbAttr } from "../data/ability"; @@ -1372,8 +1372,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { typeMultiplier.value = 0; } - const doubleMoveTypeEffectiveness = this.getTag(DoubleMoveTypeEffectivenessTag); - if (doubleMoveTypeEffectiveness && doubleMoveTypeEffectiveness.moveType === this.getMoveType(move)) { + if (this.getTag(TarShotTag) && (this.getMoveType(move) === Type.FIRE)) { typeMultiplier.value *= 2; } diff --git a/src/locales/en/battler-tags.json b/src/locales/en/battler-tags.json index 222aee4087c..3e1f695782a 100644 --- a/src/locales/en/battler-tags.json +++ b/src/locales/en/battler-tags.json @@ -69,5 +69,6 @@ "cursedLapse": "{{pokemonNameWithAffix}} is afflicted by the Curse!", "stockpilingOnAdd": "{{pokemonNameWithAffix}} stockpiled {{stockpiledCount}}!", "disabledOnAdd": "{{pokemonNameWithAffix}}'s {{moveName}}\nwas disabled!", - "disabledLapse": "{{pokemonNameWithAffix}}'s {{moveName}}\nis no longer disabled." + "disabledLapse": "{{pokemonNameWithAffix}}'s {{moveName}}\nis no longer disabled.", + "tarShotOnAdd": "The {{pokemonNameWithAffix}} became weaker to fire!" }