now properly reverts to zero form

This commit is contained in:
Luc 2024-05-02 23:29:57 -04:00
parent ca6c3448eb
commit 00a2d5bbe4
4 changed files with 13 additions and 7 deletions

View File

@ -1950,19 +1950,20 @@ 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)
export class PreSwitchOutFormChangeAbAttr extends PreSwitchOutAbAttr {
private formFunc: (p: Pokemon) => integer;
constructor(formFunc: ((p: Pokemon) => integer)) {
super();
//this.formFunc = formFunc;
this.formFunc = formFunc;
}
applyPreSwitchOut(pokemon: Pokemon, passive: boolean, args: any[]): boolean | Promise<boolean> {
console.log(pokemon.getFormKey())
if (1 !== pokemon.formIndex && pokemon.species.name == "Palafin") {
const formIndex = this.formFunc(pokemon);
if (formIndex !== pokemon.formIndex) {
pokemon.scene.triggerPokemonFormChange(pokemon, SpeciesFormChangeManualTrigger, false);
return true;
}
@ -3354,7 +3355,9 @@ export function initAbilities() {
.attr(UnsuppressableAbilityAbAttr)
.attr(NoTransformAbilityAbAttr)
.attr(NoFusionAbilityAbAttr)
.attr(ZeroToHeroAbAttr, p => true ? 1 : 0),
.attr(PreSwitchOutFormChangeAbAttr, p => p.getFormKey() ? 1 : 0)
.attr(PostBattleInitFormChangeAbAttr, p => p.battleData.switchesMade === 0 ? 0 : 1)
.attr(PostSummonFormChangeAbAttr,p => p.battleData.switchesMade === 0 ? 0 : 1),
new Ability(Abilities.COMMANDER, 9)
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)

View File

@ -683,6 +683,7 @@ export const pokemonFormChanges: PokemonFormChanges = {
],
[Species.PALAFIN]: [
new SpeciesFormChange(Species.PALAFIN, 'zero', 'hero', new SpeciesFormChangeManualTrigger(), true),
new SpeciesFormChange(Species.PALAFIN, 'hero', 'zero', new SpeciesFormChangeManualTrigger(), true),
],
[Species.OGERPON]: [
new SpeciesFormChange(Species.OGERPON, 'teal-mask', 'wellspring-mask', new SpeciesFormChangeItemTrigger(FormChangeItem.WELLSPRING_MASK)),

View File

@ -3036,6 +3036,7 @@ export class PokemonBattleData {
public hitCount: integer = 0;
public endured: boolean = false;
public berriesEaten: BerryType[] = [];
public switchesMade: integer = 0;
}
export class PokemonBattleSummonData {

View File

@ -1433,6 +1433,7 @@ export class SwitchSummonPhase extends SummonPhase {
if (this.batonPass && pokemon)
pokemon.transferSummon(this.lastPokemon);
this.lastPokemon.battleData.switchesMade++;
this.lastPokemon?.resetSummonData();
this.scene.triggerPokemonFormChange(pokemon, SpeciesFormChangeActiveTrigger, true);