From 92dc7dc58426c76cf1143ce44097364d5f690761 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sat, 6 Apr 2024 20:57:06 -0400 Subject: [PATCH] Changes for consistency --- src/data/ability.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index a663018914d..008de0fdf77 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -511,7 +511,7 @@ export class PostDefendCritStatChangeAbAttr extends PostDefendAbAttr { private levels: integer; constructor(stat: BattleStat, levels: integer) { - super(true); + super(); this.stat = stat; this.levels = levels; @@ -528,24 +528,26 @@ export class PostDefendCritStatChangeAbAttr extends PostDefendAbAttr { } } -export class PostDefendContactDamageAttackerAbAttr extends PostDefendAbAttr { - percentMaxHealthDamage: number; - abilityName: string; - constructor(percentMaxHealthDamage: number) { +export class PostDefendContactDamageAbAttr extends PostDefendAbAttr { + private damageRatio: integer; + + constructor(damageRatio: integer) { super(); - this.percentMaxHealthDamage = percentMaxHealthDamage; + + this.damageRatio = damageRatio; } applyPostDefend(pokemon: Pokemon, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean { if (move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon)) { - attacker.damageAndUpdate(attacker.getMaxHp()*(this.percentMaxHealthDamage),HitResult.EFFECTIVE,false,false,false); + attacker.damageAndUpdate(attacker.getMaxHp() * (1 / this.damageRatio), HitResult.EFFECTIVE, false, false, false); return true; } + return false; } getTriggerMessage(pokemon: Pokemon, ...args: any[]): string { - return `${pokemon.name}${(pokemon.name.endsWith('s')?`'`:`'s`)} ${pokemon.getAbility().name} hurt its attacker!`; + return getPokemonMessage(pokemon, `'s ${pokemon.getAbility().name}\nhurt its attacker!`); } } @@ -2129,7 +2131,7 @@ export function initAbilities() { new Ability(Abilities.SHADOW_TAG, "Shadow Tag", "This Pokémon steps on the opposing Pokémon's shadow to prevent it from escaping.", 3) .attr(ArenaTrapAbAttr), new Ability(Abilities.ROUGH_SKIN, "Rough Skin", "This Pokémon inflicts damage with its rough skin to the attacker on contact.", 3) - .attr(PostDefendContactDamageAttackerAbAttr,1/8) + .attr(PostDefendContactDamageAbAttr, 8) .ignorable(), new Ability(Abilities.WONDER_GUARD, "Wonder Guard", "Its mysterious power only lets supereffective moves hit the Pokémon.", 3) .attr(NonSuperEffectiveImmunityAbAttr) @@ -2435,7 +2437,7 @@ export function initAbilities() { .attr(BlockWeatherDamageAttr, WeatherType.SANDSTORM) .condition(getWeatherCondition(WeatherType.SANDSTORM)), new Ability(Abilities.IRON_BARBS, "Iron Barbs", "Inflicts damage on the attacker upon contact with iron barbs.", 5) - .attr(PostDefendContactDamageAttackerAbAttr,1/8), + .attr(PostDefendContactDamageAbAttr, 8), new Ability(Abilities.ZEN_MODE, "Zen Mode", "Changes the Pokémon's shape when HP is half or less.", 5) .attr(PostBattleInitFormChangeAbAttr, p => p.getHpRatio() >= 0.5 ? 0 : 1) .attr(PostSummonFormChangeAbAttr, p => p.getHpRatio() >= 0.5 ? 0 : 1)