Changes for consistency

This commit is contained in:
Flashfyre 2024-04-06 20:57:06 -04:00
parent 2bd505a2e6
commit 92dc7dc584

View File

@ -511,7 +511,7 @@ export class PostDefendCritStatChangeAbAttr extends PostDefendAbAttr {
private levels: integer; private levels: integer;
constructor(stat: BattleStat, levels: integer) { constructor(stat: BattleStat, levels: integer) {
super(true); super();
this.stat = stat; this.stat = stat;
this.levels = levels; this.levels = levels;
@ -528,24 +528,26 @@ export class PostDefendCritStatChangeAbAttr extends PostDefendAbAttr {
} }
} }
export class PostDefendContactDamageAttackerAbAttr extends PostDefendAbAttr { export class PostDefendContactDamageAbAttr extends PostDefendAbAttr {
percentMaxHealthDamage: number; private damageRatio: integer;
abilityName: string;
constructor(percentMaxHealthDamage: number) { constructor(damageRatio: integer) {
super(); super();
this.percentMaxHealthDamage = percentMaxHealthDamage;
this.damageRatio = damageRatio;
} }
applyPostDefend(pokemon: Pokemon, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean { applyPostDefend(pokemon: Pokemon, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
if (move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon)) { 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 true;
} }
return false; return false;
} }
getTriggerMessage(pokemon: Pokemon, ...args: any[]): string { 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) 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), .attr(ArenaTrapAbAttr),
new Ability(Abilities.ROUGH_SKIN, "Rough Skin", "This Pokémon inflicts damage with its rough skin to the attacker on contact.", 3) 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(), .ignorable(),
new Ability(Abilities.WONDER_GUARD, "Wonder Guard", "Its mysterious power only lets supereffective moves hit the Pokémon.", 3) new Ability(Abilities.WONDER_GUARD, "Wonder Guard", "Its mysterious power only lets supereffective moves hit the Pokémon.", 3)
.attr(NonSuperEffectiveImmunityAbAttr) .attr(NonSuperEffectiveImmunityAbAttr)
@ -2435,7 +2437,7 @@ export function initAbilities() {
.attr(BlockWeatherDamageAttr, WeatherType.SANDSTORM) .attr(BlockWeatherDamageAttr, WeatherType.SANDSTORM)
.condition(getWeatherCondition(WeatherType.SANDSTORM)), .condition(getWeatherCondition(WeatherType.SANDSTORM)),
new Ability(Abilities.IRON_BARBS, "Iron Barbs", "Inflicts damage on the attacker upon contact with iron barbs.", 5) 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) 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(PostBattleInitFormChangeAbAttr, p => p.getHpRatio() >= 0.5 ? 0 : 1)
.attr(PostSummonFormChangeAbAttr, p => p.getHpRatio() >= 0.5 ? 0 : 1) .attr(PostSummonFormChangeAbAttr, p => p.getHpRatio() >= 0.5 ? 0 : 1)