[Ability] Implement Teraform Zero ability (#5359)
* Partially implement Teraform Zero ability The functionality of the ability is all there, it just isn't limited to one use per Terastallization yet. * Add the once per battle condition This removes the partial from the ability. * Make attribute names more generic --------- Co-authored-by: damocleas <damocleas25@gmail.com>
This commit is contained in:
parent
d14f71d27a
commit
88a5c9d416
|
@ -266,6 +266,52 @@ export class PostTeraFormChangeStatChangeAbAttr extends AbAttr {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears a specified weather whenever this attribute is called.
|
||||
*/
|
||||
export class ClearWeatherAbAttr extends AbAttr {
|
||||
private weather: WeatherType[];
|
||||
|
||||
/**
|
||||
* @param weather {@linkcode WeatherType[]} - the weather to be removed
|
||||
*/
|
||||
constructor(weather: WeatherType[]) {
|
||||
super(true);
|
||||
|
||||
this.weather = weather;
|
||||
}
|
||||
|
||||
apply(pokemon: Pokemon, passive: boolean, simulated:boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||
if (!simulated) {
|
||||
globalScene.arena.trySetWeather(WeatherType.NONE, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears a specified terrain whenever this attribute is called.
|
||||
*/
|
||||
export class ClearTerrainAbAttr extends AbAttr {
|
||||
private terrain: TerrainType[];
|
||||
|
||||
/**
|
||||
* @param terrain {@linkcode TerrainType[]} - the terrain to be removed
|
||||
*/
|
||||
constructor(terrain: TerrainType[]) {
|
||||
super(true);
|
||||
|
||||
this.terrain = terrain;
|
||||
}
|
||||
|
||||
apply(pokemon: Pokemon, passive: boolean, simulated:boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||
if (!simulated) {
|
||||
globalScene.arena.trySetTerrain(TerrainType.NONE, true, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
type PreDefendAbAttrCondition = (pokemon: Pokemon, attacker: Pokemon, move: Move) => boolean;
|
||||
|
||||
export class PreDefendAbAttr extends AbAttr {
|
||||
|
@ -6993,9 +7039,11 @@ export function initAbilities() {
|
|||
.attr(UnswappableAbilityAbAttr)
|
||||
.ignorable(),
|
||||
new Ability(Abilities.TERAFORM_ZERO, 9)
|
||||
.attr(ClearWeatherAbAttr, [ WeatherType.SUNNY, WeatherType.RAIN, WeatherType.SANDSTORM, WeatherType.HAIL, WeatherType.SNOW, WeatherType.FOG, WeatherType.HEAVY_RAIN, WeatherType.HARSH_SUN, WeatherType.STRONG_WINDS ])
|
||||
.attr(ClearTerrainAbAttr, [ TerrainType.MISTY, TerrainType.ELECTRIC, TerrainType.GRASSY, TerrainType.PSYCHIC ])
|
||||
.attr(UncopiableAbilityAbAttr)
|
||||
.attr(UnswappableAbilityAbAttr)
|
||||
.unimplemented(),
|
||||
.condition(getOncePerBattleCondition(Abilities.TERAFORM_ZERO)),
|
||||
new Ability(Abilities.POISON_PUPPETEER, 9)
|
||||
.attr(UncopiableAbilityAbAttr)
|
||||
.attr(UnswappableAbilityAbAttr)
|
||||
|
|
|
@ -11,7 +11,7 @@ import { getPokemonNameWithAffix } from "#app/messages";
|
|||
import { BattlePhase } from "./battle-phase";
|
||||
import { MovePhase } from "./move-phase";
|
||||
import { PokemonHealPhase } from "./pokemon-heal-phase";
|
||||
import { applyAbAttrs, PostTeraFormChangeStatChangeAbAttr } from "#app/data/ability";
|
||||
import { applyAbAttrs, ClearTerrainAbAttr, ClearWeatherAbAttr, PostTeraFormChangeStatChangeAbAttr } from "#app/data/ability";
|
||||
|
||||
export class QuietFormChangePhase extends BattlePhase {
|
||||
protected pokemon: Pokemon;
|
||||
|
@ -148,6 +148,8 @@ export class QuietFormChangePhase extends BattlePhase {
|
|||
}
|
||||
if (this.formChange.trigger instanceof SpeciesFormChangeTeraTrigger) {
|
||||
applyAbAttrs(PostTeraFormChangeStatChangeAbAttr, this.pokemon, null);
|
||||
applyAbAttrs(ClearWeatherAbAttr, this.pokemon, null);
|
||||
applyAbAttrs(ClearTerrainAbAttr, this.pokemon, null);
|
||||
}
|
||||
|
||||
super.end();
|
||||
|
|
Loading…
Reference in New Issue