Update battler-tags.ts (#1030)
Corrected the TrappedTag class so no Ghosts can be trapped Added special canAdd function to IngrainTag so all Ghosts can use Ingrain not just Trevenant and Phantump.
This commit is contained in:
parent
bfa12fd48d
commit
03c4b1b821
|
@ -15,7 +15,6 @@ import { TerrainType } from "./terrain";
|
|||
import { WeatherType } from "./weather";
|
||||
import { BattleStat } from "./battle-stat";
|
||||
import { allAbilities } from "./ability";
|
||||
import { Species } from "./enums/species";
|
||||
|
||||
export enum BattlerTagLapseType {
|
||||
FAINT,
|
||||
|
@ -120,9 +119,8 @@ export class TrappedTag extends BattlerTag {
|
|||
canAdd(pokemon: Pokemon): boolean {
|
||||
const isGhost = pokemon.isOfType(Type.GHOST);
|
||||
const isTrapped = pokemon.getTag(BattlerTagType.TRAPPED);
|
||||
const isAllowedGhostType = pokemon.species.speciesId === Species.PHANTUMP || pokemon.species.speciesId === Species.TREVENANT;
|
||||
|
||||
return !isTrapped && (!isGhost || isAllowedGhostType);
|
||||
return !isTrapped && !isGhost;
|
||||
}
|
||||
|
||||
onAdd(pokemon: Pokemon): void {
|
||||
|
@ -503,11 +501,26 @@ export class HelpingHandTag extends BattlerTag {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the Ingrain tag to a pokemon
|
||||
* @extends TrappedTag
|
||||
*/
|
||||
export class IngrainTag extends TrappedTag {
|
||||
constructor(sourceId: integer) {
|
||||
super(BattlerTagType.INGRAIN, BattlerTagLapseType.TURN_END, 1, Moves.INGRAIN, sourceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the Ingrain tag can be added to the pokemon
|
||||
* @param pokemon {@linkcode Pokemon} The pokemon to check if the tag can be added to
|
||||
* @returns boolean True if the tag can be added, false otherwise
|
||||
*/
|
||||
canAdd(pokemon: Pokemon): boolean {
|
||||
const isTrapped = pokemon.getTag(BattlerTagType.TRAPPED);
|
||||
|
||||
return !isTrapped;
|
||||
}
|
||||
|
||||
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||
const ret = lapseType !== BattlerTagLapseType.CUSTOM || super.lapse(pokemon, lapseType);
|
||||
|
||||
|
|
Loading…
Reference in New Issue