mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 00:12:16 +02:00
now properly reverts to zero form
This commit is contained in:
parent
ca6c3448eb
commit
00a2d5bbe4
@ -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)
|
||||
|
@ -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)),
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user