Fully implement Spiky Shield move

This commit is contained in:
Madmadness65 2024-04-06 21:50:17 -05:00
parent 570f10345b
commit 8446130728
4 changed files with 31 additions and 4 deletions

View File

@ -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),

View File

@ -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:

View File

@ -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",

View File

@ -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),