[Ability] Added Perish Body ability (#1554)
* Added Perish Body ability * fix linting issues * Documentation + Checking if either pokemon has perish song tag * Fixed typo and improved TriggerMessage
This commit is contained in:
parent
c822a89878
commit
029175bce6
|
@ -819,6 +819,39 @@ export class PostDefendContactDamageAbAttr extends PostDefendAbAttr {
|
|||
return getPokemonMessage(pokemon, `'s ${abilityName}\nhurt its attacker!`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @description: This ability applies the Perish Song tag to the attacking pokemon
|
||||
* and the defending pokemon if the move makes physical contact and neither pokemon
|
||||
* already has the Perish Song tag.
|
||||
* @class PostDefendPerishSongAbAttr
|
||||
* @extends {PostDefendAbAttr}
|
||||
*/
|
||||
export class PostDefendPerishSongAbAttr extends PostDefendAbAttr {
|
||||
private turns: integer;
|
||||
|
||||
constructor(turns: integer) {
|
||||
super();
|
||||
|
||||
this.turns = turns;
|
||||
}
|
||||
|
||||
applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
|
||||
if (move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon)) {
|
||||
if (pokemon.getTag(BattlerTagType.PERISH_SONG) || attacker.getTag(BattlerTagType.PERISH_SONG)) {
|
||||
return false;
|
||||
} else {
|
||||
attacker.addTag(BattlerTagType.PERISH_SONG, this.turns);
|
||||
pokemon.addTag(BattlerTagType.PERISH_SONG, this.turns);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string {
|
||||
return i18next.t("abilityTriggers:perishBody", {pokemonName: `${getPokemonPrefix(pokemon)}${pokemon.name}`, abilityName: abilityName});
|
||||
}
|
||||
}
|
||||
|
||||
export class PostDefendWeatherChangeAbAttr extends PostDefendAbAttr {
|
||||
private weatherType: WeatherType;
|
||||
|
@ -4164,7 +4197,7 @@ export function initAbilities() {
|
|||
.attr(MoveTypePowerBoostAbAttr, Type.STEEL)
|
||||
.partial(),
|
||||
new Ability(Abilities.PERISH_BODY, 8)
|
||||
.unimplemented(),
|
||||
.attr(PostDefendPerishSongAbAttr, 4),
|
||||
new Ability(Abilities.WANDERING_SPIRIT, 8)
|
||||
.attr(PostDefendAbilitySwapAbAttr)
|
||||
.bypassFaint()
|
||||
|
|
|
@ -3,4 +3,5 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
|||
export const abilityTriggers: SimpleTranslationEntries = {
|
||||
"blockRecoilDamage" : "{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!",
|
||||
"badDreams": "{{pokemonName}} is tormented!",
|
||||
"perishBody": "{{pokemonName}}'s {{abilityName}}\n will faint both pokemon in 3 turns!",
|
||||
} as const;
|
||||
|
|
Loading…
Reference in New Issue