mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-18 14:22:19 +02:00
bug fix to save illusion status
This commit is contained in:
parent
83491b0c3c
commit
f2a120a848
@ -888,8 +888,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getPlayerParty(): PlayerPokemon[] {
|
public getPlayerParty(): PlayerPokemon[] {
|
||||||
const party = this.party;
|
return this.party;
|
||||||
return party;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5232,6 +5232,7 @@ export class IllusionPreSummonAbAttr extends PreSummonAbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override canApplyPreSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
override canApplyPreSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
||||||
|
pokemon.initSummondata()
|
||||||
if(pokemon.hasTrainer()){
|
if(pokemon.hasTrainer()){
|
||||||
const party: Pokemon[] = (pokemon.isPlayer() ? globalScene.getPlayerParty() : globalScene.getEnemyParty()).filter(p => p.isAllowedInBattle());
|
const party: Pokemon[] = (pokemon.isPlayer() ? globalScene.getPlayerParty() : globalScene.getEnemyParty()).filter(p => p.isAllowedInBattle());
|
||||||
const lastPokemon: Pokemon = party.filter(p => p !==pokemon).at(-1) || pokemon;
|
const lastPokemon: Pokemon = party.filter(p => p !==pokemon).at(-1) || pokemon;
|
||||||
|
@ -560,7 +560,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
init(): void {
|
init(): void {
|
||||||
this.fieldPosition = FieldPosition.CENTER;
|
this.fieldPosition = FieldPosition.CENTER;
|
||||||
this.summonData = new PokemonSummonData(); // Need to be init for illusion to work
|
|
||||||
this.initBattleInfo();
|
this.initBattleInfo();
|
||||||
|
|
||||||
globalScene.fieldUI.addAt(this.battleInfo, 0);
|
globalScene.fieldUI.addAt(this.battleInfo, 0);
|
||||||
@ -5797,6 +5796,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
this.summonDataPrimer = summonDataPrimer;
|
this.summonDataPrimer = summonDataPrimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For PreSummonAbAttr to get access to summonData
|
||||||
|
initSummondata(): void {
|
||||||
|
this.summonData = this.summonData ?? this.summonDataPrimer ?? new PokemonSummonData()
|
||||||
|
}
|
||||||
|
|
||||||
resetSummonData(): void {
|
resetSummonData(): void {
|
||||||
const illusion: IllusionData | null = this.summonData?.illusion;
|
const illusion: IllusionData | null = this.summonData?.illusion;
|
||||||
if (this.summonData?.speciesForm) {
|
if (this.summonData?.speciesForm) {
|
||||||
|
@ -180,6 +180,7 @@ export default class PokemonData {
|
|||||||
this.summonData.types = source.summonData.types;
|
this.summonData.types = source.summonData.types;
|
||||||
this.summonData.speciesForm = source.summonData.speciesForm;
|
this.summonData.speciesForm = source.summonData.speciesForm;
|
||||||
this.summonDataSpeciesFormIndex = source.summonDataSpeciesFormIndex;
|
this.summonDataSpeciesFormIndex = source.summonDataSpeciesFormIndex;
|
||||||
|
this.summonData.illusionBroken = source.summonData.illusionBroken;
|
||||||
|
|
||||||
if (source.summonData.tags) {
|
if (source.summonData.tags) {
|
||||||
this.summonData.tags = source.summonData.tags?.map(t => loadBattlerTag(t));
|
this.summonData.tags = source.summonData.tags?.map(t => loadBattlerTag(t));
|
||||||
@ -225,6 +226,7 @@ export default class PokemonData {
|
|||||||
if (this.summonData) {
|
if (this.summonData) {
|
||||||
// when loading from saved session, recover summonData.speciesFrom and form index species object
|
// when loading from saved session, recover summonData.speciesFrom and form index species object
|
||||||
// used to stay transformed on reload session
|
// used to stay transformed on reload session
|
||||||
|
|
||||||
if (this.summonData.speciesForm) {
|
if (this.summonData.speciesForm) {
|
||||||
this.summonData.speciesForm = getPokemonSpeciesForm(
|
this.summonData.speciesForm = getPokemonSpeciesForm(
|
||||||
this.summonData.speciesForm.speciesId,
|
this.summonData.speciesForm.speciesId,
|
||||||
|
Loading…
Reference in New Issue
Block a user