pull/406/merge
lucfd 2024-05-05 15:10:32 +02:00 committed by GitHub
commit 51b58eee32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 33 additions and 1 deletions

View File

@ -20,6 +20,8 @@ import { SpeciesFormChangeManualTrigger } from "./pokemon-forms";
import { Abilities } from "./enums/abilities"; import { Abilities } from "./enums/abilities";
import i18next, { Localizable } from "#app/plugins/i18n.js"; import i18next, { Localizable } from "#app/plugins/i18n.js";
import { Command } from "../ui/command-ui-handler"; import { Command } from "../ui/command-ui-handler";
import PokemonSpecies from "./pokemon-species";
import { BattleType } from "#app/battle.js";
export class Ability implements Localizable { export class Ability implements Localizable {
public id: Abilities; 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 PostBiomeChangeAbAttr extends AbAttr { }
export class PostBiomeChangeWeatherChangeAbAttr extends PostBiomeChangeAbAttr { export class PostBiomeChangeWeatherChangeAbAttr extends PostBiomeChangeAbAttr {
@ -3446,7 +3470,9 @@ export function initAbilities() {
.attr(UnsuppressableAbilityAbAttr) .attr(UnsuppressableAbilityAbAttr)
.attr(NoTransformAbilityAbAttr) .attr(NoTransformAbilityAbAttr)
.attr(NoFusionAbilityAbAttr) .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) new Ability(Abilities.COMMANDER, 9)
.attr(UncopiableAbilityAbAttr) .attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr) .attr(UnswappableAbilityAbAttr)

View File

@ -691,6 +691,10 @@ export const pokemonFormChanges: PokemonFormChanges = {
[Species.ENAMORUS]: [ [Species.ENAMORUS]: [
new SpeciesFormChange(Species.ENAMORUS, SpeciesFormKey.INCARNATE, SpeciesFormKey.THERIAN, new SpeciesFormChangeItemTrigger(FormChangeItem.REVEAL_GLASS)) 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]: [ [Species.OGERPON]: [
new SpeciesFormChange(Species.OGERPON, 'teal-mask', 'wellspring-mask', new SpeciesFormChangeItemTrigger(FormChangeItem.WELLSPRING_MASK)), 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)), new SpeciesFormChange(Species.OGERPON, 'teal-mask', 'hearthflame-mask', new SpeciesFormChangeItemTrigger(FormChangeItem.HEARTHFLAME_MASK)),

View File

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

View File

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