diff --git a/src/data/ability.ts b/src/data/ability.ts index 7c350f025be..21e171fc25b 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -20,6 +20,7 @@ import { SpeciesFormChangeManualTrigger } from "./pokemon-forms"; import { Abilities } from "./enums/abilities"; import i18next, { Localizable } from "#app/plugins/i18n.js"; import { Command } from "../ui/command-ui-handler"; +import PokemonSpecies from "./pokemon-species"; export class Ability implements Localizable { public id: Abilities; @@ -1949,6 +1950,27 @@ export class PostTurnFormChangeAbAttr extends PostTurnAbAttr { } } +export class ZeroToHeroAbAttr extends PreSwitchOutAbAttr { + // .attr(PostBattleInitFormChangeAbAttr, p => p.getHpRatio() <= 0.9 ? 1 : 0) + //.attr(PostSummonFormChangeAbAttr, p => p.getHpRatio() <= 0.9 ? 1 : 0) + //.attr(PostTurnFormChangeAbAttr, p => p.getHpRatio() <= 0.9 ? 1 : 0) + constructor(formFunc: ((p: Pokemon) => integer)) { + super(); + + //this.formFunc = formFunc; + } + + applyPreSwitchOut(pokemon: Pokemon, passive: boolean, args: any[]): boolean | Promise { + + if (1 !== pokemon.formIndex && pokemon.species.name == "Palafin") { + pokemon.scene.triggerPokemonFormChange(pokemon, SpeciesFormChangeManualTrigger, false); + return true; + } + + return false; + } +} + export class PostBiomeChangeAbAttr extends AbAttr { } export class PostBiomeChangeWeatherChangeAbAttr extends PostBiomeChangeAbAttr { @@ -3332,7 +3354,7 @@ export function initAbilities() { .attr(UnsuppressableAbilityAbAttr) .attr(NoTransformAbilityAbAttr) .attr(NoFusionAbilityAbAttr) - .unimplemented(), + .attr(ZeroToHeroAbAttr, p => true ? 1 : 0), new Ability(Abilities.COMMANDER, 9) .attr(UncopiableAbilityAbAttr) .attr(UnswappableAbilityAbAttr) diff --git a/src/data/pokemon-forms.ts b/src/data/pokemon-forms.ts index 87094af2028..445d79d8d28 100644 --- a/src/data/pokemon-forms.ts +++ b/src/data/pokemon-forms.ts @@ -681,6 +681,9 @@ export const pokemonFormChanges: PokemonFormChanges = { [Species.ENAMORUS]: [ new SpeciesFormChange(Species.ENAMORUS, SpeciesFormKey.INCARNATE, SpeciesFormKey.THERIAN, new SpeciesFormChangeItemTrigger(FormChangeItem.REVEAL_GLASS)) ], + [Species.PALAFIN]: [ + new SpeciesFormChange(Species.PALAFIN, 'zero', 'hero', new SpeciesFormChangeManualTrigger(), true), + ], [Species.OGERPON]: [ new SpeciesFormChange(Species.OGERPON, 'teal-mask', 'wellspring-mask', new SpeciesFormChangeItemTrigger(FormChangeItem.WELLSPRING_MASK)), new SpeciesFormChange(Species.OGERPON, 'teal-mask', 'hearthflame-mask', new SpeciesFormChangeItemTrigger(FormChangeItem.HEARTHFLAME_MASK)),