diff --git a/src/data/ability.ts b/src/data/ability.ts index 41b1dade63b..7be9f5365f0 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2498,11 +2498,11 @@ export function initAbilities() { new Ability(Abilities.DELTA_STREAM, "Delta Stream", "The Pokémon changes the weather to eliminate all of the Flying type's weaknesses.", 6) .attr(PostSummonWeatherChangeAbAttr, WeatherType.STRONG_WINDS), new Ability(Abilities.STAMINA, "Stamina", "Boosts the Defense stat when hit by an attack.", 7) - .attr(PostDefendStatChangeAbAttr, (target, user, move) => move.category != MoveCategory.STATUS, BattleStat.DEF, 1), + .attr(PostDefendStatChangeAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, BattleStat.DEF, 1), new Ability(Abilities.WIMP_OUT, "Wimp Out (N)", "The Pokémon cowardly switches out when its HP becomes half or less.", 7), new Ability(Abilities.EMERGENCY_EXIT, "Emergency Exit (N)", "The Pokémon, sensing danger, switches out when its HP becomes half or less.", 7), new Ability(Abilities.WATER_COMPACTION, "Water Compaction", "Boosts the Pokémon's Defense stat sharply when hit by a Water-type move.", 7) - .attr(PostDefendStatChangeAbAttr, (target, user, move) => move.type === Type.WATER , BattleStat.DEF, 2), + .attr(PostDefendStatChangeAbAttr, (target, user, move) => move.type === Type.WATER, BattleStat.DEF, 2), new Ability(Abilities.MERCILESS, "Merciless (N)", "The Pokémon's attacks become critical hits if the target is poisoned.", 7), new Ability(Abilities.SHIELDS_DOWN, "Shields Down (N)", "When its HP becomes half or less, the Pokémon's shell breaks and it becomes aggressive.", 7) .attr(ProtectAbilityAbAttr), diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 81ea8093858..6c3c12dc263 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -634,6 +634,30 @@ export class ProtectedTag extends BattlerTag { } } +export class ContactDamageProtectedTag extends ProtectedTag { + private damageRatio: integer; + + constructor(sourceMove: Moves, damageRatio: integer) { + super(sourceMove, BattlerTagType.SPIKY_SHIELD); + + this.damageRatio = damageRatio; + } + + lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { + const ret = super.lapse(pokemon, lapseType); + + if (lapseType === BattlerTagLapseType.CUSTOM) { + const effectPhase = pokemon.scene.getCurrentPhase(); + if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) { + const attacker = effectPhase.getPokemon(); + attacker.damageAndUpdate(Math.ceil(attacker.getMaxHp() * (1 / this.damageRatio)), HitResult.OTHER); + } + } + + return ret; + } +} + export class ContactStatChangeProtectedTag extends ProtectedTag { private stat: BattleStat; private levels: integer; @@ -1016,6 +1040,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc return new ThunderCageTag(turnCount, sourceId); case BattlerTagType.PROTECTED: return new ProtectedTag(sourceMove); + case BattlerTagType.SPIKY_SHIELD: + return new ContactDamageProtectedTag(sourceMove, 8); case BattlerTagType.KINGS_SHIELD: return new ContactStatChangeProtectedTag(sourceMove, tagType, BattleStat.ATK, -1); case BattlerTagType.OBSTRUCT: diff --git a/src/data/enums/battler-tag-type.ts b/src/data/enums/battler-tag-type.ts index 0ce1061879d..4aecd5195db 100644 --- a/src/data/enums/battler-tag-type.ts +++ b/src/data/enums/battler-tag-type.ts @@ -23,6 +23,7 @@ export enum BattlerTagType { MAGMA_STORM = "MAGMA_STORM", THUNDER_CAGE = "THUNDER_CAGE", PROTECTED = "PROTECTED", + SPIKY_SHIELD = "SPIKY_SHIELD", KINGS_SHIELD = "KINGS_SHIELD", OBSTRUCT = "OBSTRUCT", SILK_TRAP = "SILK_TRAP", diff --git a/src/data/move.ts b/src/data/move.ts index f552e601743..b7363fa8cc2 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -4255,8 +4255,8 @@ export function initMoves() { .attr(MultiHitAttr), new AttackMove(Moves.MYSTICAL_FIRE, "Mystical Fire", Type.FIRE, MoveCategory.SPECIAL, 75, 100, 10, "The user attacks by breathing a special, hot fire. This also lowers the target's Sp. Atk stat.", 100, 0, 6) .attr(StatChangeAttr, BattleStat.SPATK, -1), - new SelfStatusMove(Moves.SPIKY_SHIELD, "Spiky Shield (P)", Type.GRASS, -1, 10, "In addition to protecting the user from attacks, this move also damages any attacker that makes direct contact.", -1, 4, 6) - .attr(ProtectAttr), + new SelfStatusMove(Moves.SPIKY_SHIELD, "Spiky Shield", Type.GRASS, -1, 10, "In addition to protecting the user from attacks, this move also damages any attacker that makes direct contact.", -1, 4, 6) + .attr(ProtectAttr, BattlerTagType.SPIKY_SHIELD), new StatusMove(Moves.AROMATIC_MIST, "Aromatic Mist", Type.FAIRY, -1, 20, "The user raises the Sp. Def stat of an ally Pokémon by using a mysterious aroma.", -1, 0, 6) .attr(StatChangeAttr, BattleStat.SPDEF, 1) .target(MoveTarget.NEAR_ALLY),