Partially implement Teraform Zero ability

The functionality of the ability is all there, it just isn't limited to one use per Terastallization yet.
This commit is contained in:
Madmadness65 2025-02-17 02:49:24 -06:00
parent db22354057
commit 81492fb3b1
2 changed files with 52 additions and 2 deletions

View File

@ -265,6 +265,52 @@ export class PostTeraFormChangeStatChangeAbAttr extends AbAttr {
}
}
/**
* Removes a specified weather when a Pokemon is form changed via terastallization.
*/
export class PostTeraFormChangeRemoveWeatherAbAttr 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;
}
}
/**
* Removes a specified terrain when a Pokemon is form changed via terastallization.
*/
export class PostTeraFormChangeRemoveTerrainAbAttr 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 {
@ -6373,9 +6419,11 @@ export function initAbilities() {
.attr(UnswappableAbilityAbAttr)
.ignorable(),
new Ability(Abilities.TERAFORM_ZERO, 9)
.attr(PostTeraFormChangeRemoveWeatherAbAttr, [ WeatherType.SUNNY, WeatherType.RAIN, WeatherType.SANDSTORM, WeatherType.HAIL, WeatherType.SNOW, WeatherType.FOG, WeatherType.HEAVY_RAIN, WeatherType.HARSH_SUN, WeatherType.STRONG_WINDS ])
.attr(PostTeraFormChangeRemoveTerrainAbAttr, [ TerrainType.MISTY, TerrainType.ELECTRIC, TerrainType.GRASSY, TerrainType.PSYCHIC ])
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)
.unimplemented(),
.partial(), // Does not have the one use per Tera restriction yet
new Ability(Abilities.POISON_PUPPETEER, 9)
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)

View File

@ -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, PostTeraFormChangeRemoveTerrainAbAttr, PostTeraFormChangeRemoveWeatherAbAttr, 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(PostTeraFormChangeRemoveWeatherAbAttr, this.pokemon, null);
applyAbAttrs(PostTeraFormChangeRemoveTerrainAbAttr, this.pokemon, null);
}
super.end();