Implement Toxic Debris
parent
291f8570e9
commit
0737827bbc
|
@ -10,6 +10,7 @@ import { BattlerTagType } from "./enums/battler-tag-type";
|
|||
import { StatusEffect, getStatusEffectDescriptor, getStatusEffectHealText } from "./status-effect";
|
||||
import { Gender } from "./gender";
|
||||
import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, RecoilAttr, StatusMoveTypeImmunityAttr, FlinchAttr, allMoves } from "./move";
|
||||
import { ArenaTagSide } from "./arena-tag";
|
||||
import { ArenaTagType } from "./enums/arena-tag-type";
|
||||
import { Stat } from "./pokemon-stat";
|
||||
import { PokemonHeldItemModifier } from "../modifier/modifier";
|
||||
|
@ -545,6 +546,29 @@ export class PostDefendStatChangeAbAttr extends PostDefendAbAttr {
|
|||
}
|
||||
}
|
||||
|
||||
export class PostDefendApplyArenaTrapTagAbAttr extends PostDefendAbAttr {
|
||||
private condition: PokemonDefendCondition;
|
||||
private tagType: ArenaTrapTag;
|
||||
|
||||
constructor(condition: PokemonDefendCondition, tagType: ArenaTagType) {
|
||||
super(true);
|
||||
|
||||
this.condition = condition;
|
||||
this.tagType = tagType;
|
||||
}
|
||||
|
||||
applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
|
||||
if (this.condition(pokemon, attacker, move.getMove())) {
|
||||
const tag = pokemon.scene.arena.getTag(this.tagType) as ArenaTrapTag;
|
||||
if (!pokemon.scene.arena.getTag(this.tagType) || tag.layers < tag.maxLayers) {
|
||||
pokemon.scene.arena.addTag(this.tagType, 0, undefined, pokemon.id, pokemon.isPlayer() ? ArenaTagSide.ENEMY : ArenaTagSide.PLAYER);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export class PostDefendApplyBattlerTagAbAttr extends PostDefendAbAttr {
|
||||
private condition: PokemonDefendCondition;
|
||||
private tagType: BattlerTagType;
|
||||
|
@ -3098,7 +3122,9 @@ export function initAbilities() {
|
|||
.attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.SLICING_MOVE), 1.5),
|
||||
new Ability(Abilities.SUPREME_OVERLORD, "Supreme Overlord (N)", "When the Pokémon enters a battle, its Attack and Sp. Atk stats are slightly boosted for each of the allies in its party that have already been defeated.", 9),
|
||||
new Ability(Abilities.COSTAR, "Costar (N)", "When the Pokémon enters a battle, it copies an ally's stat changes.", 9),
|
||||
new Ability(Abilities.TOXIC_DEBRIS, "Toxic Debris (N)", "Scatters poison spikes at the feet of the opposing team when the Pokémon takes damage from physical moves.", 9),
|
||||
new Ability(Abilities.TOXIC_DEBRIS, "Toxic Debris", "Scatters poison spikes at the feet of the opposing team when the Pokémon takes damage from physical moves.", 9)
|
||||
.attr(PostDefendApplyArenaTrapTagAbAttr, (target, user, move) => move.category === MoveCategory.PHYSICAL, ArenaTagType.TOXIC_SPIKES)
|
||||
.bypassFaint(),
|
||||
new Ability(Abilities.ARMOR_TAIL, "Armor Tail", "The mysterious tail covering the Pokémon's head makes opponents unable to use priority moves against the Pokémon or its allies.", 9)
|
||||
.attr(FieldPriorityMoveImmunityAbAttr)
|
||||
.ignorable(),
|
||||
|
|
Loading…
Reference in New Issue