Merge 571b4ab42b into 3ed7649ce5
commit
51b58eee32
|
|
@ -20,6 +20,8 @@ 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";
|
||||
import { BattleType } from "#app/battle.js";
|
||||
|
||||
export class Ability implements Localizable {
|
||||
public id: Abilities;
|
||||
|
|
@ -2055,6 +2057,28 @@ export class PostTurnFormChangeAbAttr extends PostTurnAbAttr {
|
|||
}
|
||||
}
|
||||
|
||||
export class PreSwitchOutFormChangeAbAttr extends PreSwitchOutAbAttr {
|
||||
private formFunc: (p: Pokemon) => integer;
|
||||
|
||||
constructor(formFunc: ((p: Pokemon) => integer)) {
|
||||
super();
|
||||
|
||||
this.formFunc = formFunc;
|
||||
}
|
||||
|
||||
applyPreSwitchOut(pokemon: Pokemon, passive: boolean, args: any[]): boolean | Promise<boolean> {
|
||||
console.log(pokemon.getFormKey())
|
||||
|
||||
const formIndex = this.formFunc(pokemon);
|
||||
if (formIndex !== pokemon.formIndex) {
|
||||
pokemon.scene.triggerPokemonFormChange(pokemon, SpeciesFormChangeManualTrigger, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export class PostBiomeChangeAbAttr extends AbAttr { }
|
||||
|
||||
export class PostBiomeChangeWeatherChangeAbAttr extends PostBiomeChangeAbAttr {
|
||||
|
|
@ -3446,7 +3470,9 @@ export function initAbilities() {
|
|||
.attr(UnsuppressableAbilityAbAttr)
|
||||
.attr(NoTransformAbilityAbAttr)
|
||||
.attr(NoFusionAbilityAbAttr)
|
||||
.unimplemented(),
|
||||
.attr(PreSwitchOutFormChangeAbAttr, p => p.getFormKey() ? 1 : 0)
|
||||
.attr(PostBattleInitFormChangeAbAttr, p => p.battleData.switchesMade === 0 && p.scene.currentBattle.battleType === BattleType.TRAINER ? 0 : 1)
|
||||
.attr(PostSummonFormChangeAbAttr,p => p.battleData.switchesMade === 0 && p.scene.currentBattle.battleType === BattleType.TRAINER? 0 : 1),
|
||||
new Ability(Abilities.COMMANDER, 9)
|
||||
.attr(UncopiableAbilityAbAttr)
|
||||
.attr(UnswappableAbilityAbAttr)
|
||||
|
|
|
|||
|
|
@ -691,6 +691,10 @@ 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),
|
||||
new SpeciesFormChange(Species.PALAFIN, 'hero', 'zero', 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)),
|
||||
|
|
|
|||
|
|
@ -3106,6 +3106,7 @@ export class PokemonBattleData {
|
|||
public hitCount: integer = 0;
|
||||
public endured: boolean = false;
|
||||
public berriesEaten: BerryType[] = [];
|
||||
public switchesMade: integer = 0;
|
||||
}
|
||||
|
||||
export class PokemonBattleSummonData {
|
||||
|
|
|
|||
|
|
@ -1446,6 +1446,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