mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-20 16:42:45 +02:00
[Bug] Fix Substitute sprite crash & revived Pokemon softlock (#5829)
Break `resetSummonData` into two methods Co-authored-by: damocleas <damocleas25@gmail.com> Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com> Co-authored-by: AJ Fontaine <36677462+Fontbane@users.noreply.github.com> Co-authored-by: lxy-lxy-lxy <55084073+lxy-lxy-lxy@users.noreply.github.com> Co-authored-by: Xavion3 <xavion333@gmail.com> Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Co-authored-by: Lylian BALL <131535108+PyGaVS@users.noreply.github.com>
This commit is contained in:
parent
84192cd323
commit
0c48fff14b
@ -5721,17 +5721,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset this Pokemon's {@linkcode PokemonSummonData | SummonData} and {@linkcode PokemonTempSummonData | TempSummonData}
|
* Performs miscellaneous setup for when the Pokemon is summoned, like generating the substitute sprite
|
||||||
* in preparation for switching pokemon, as well as removing any relevant on-switch tags.
|
* @param resetSummonData - Whether to additionally reset the Pokemon's summon data (default: `false`)
|
||||||
*/
|
*/
|
||||||
resetSummonData(): void {
|
public fieldSetup(resetSummonData?: boolean): void {
|
||||||
const illusion: IllusionData | null = this.summonData.illusion;
|
|
||||||
if (this.summonData.speciesForm) {
|
|
||||||
this.summonData.speciesForm = null;
|
|
||||||
this.updateFusionPalette();
|
|
||||||
}
|
|
||||||
this.summonData = new PokemonSummonData();
|
|
||||||
this.tempSummonData = new PokemonTempSummonData();
|
|
||||||
this.setSwitchOutStatus(false);
|
this.setSwitchOutStatus(false);
|
||||||
if (globalScene) {
|
if (globalScene) {
|
||||||
globalScene.triggerPokemonFormChange(
|
globalScene.triggerPokemonFormChange(
|
||||||
@ -5740,7 +5733,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this Pokemon has a Substitute when loading in, play an animation to add its sprite
|
// If this Pokemon has a Substitute when loading in, play an animation to add its sprite
|
||||||
if (this.getTag(SubstituteTag)) {
|
if (this.getTag(SubstituteTag)) {
|
||||||
globalScene.triggerPokemonBattleAnim(
|
globalScene.triggerPokemonBattleAnim(
|
||||||
@ -5758,6 +5750,24 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
) {
|
) {
|
||||||
this.setVisible(false);
|
this.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (resetSummonData) {
|
||||||
|
this.resetSummonData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset this Pokemon's {@linkcode PokemonSummonData | SummonData} and {@linkcode PokemonTempSummonData | TempSummonData}
|
||||||
|
* in preparation for switching pokemon, as well as removing any relevant on-switch tags.
|
||||||
|
*/
|
||||||
|
resetSummonData(): void {
|
||||||
|
const illusion: IllusionData | null = this.summonData.illusion;
|
||||||
|
if (this.summonData.speciesForm) {
|
||||||
|
this.summonData.speciesForm = null;
|
||||||
|
this.updateFusionPalette();
|
||||||
|
}
|
||||||
|
this.summonData = new PokemonSummonData();
|
||||||
|
this.tempSummonData = new PokemonTempSummonData();
|
||||||
this.summonData.illusion = illusion
|
this.summonData.illusion = illusion
|
||||||
this.updateInfo();
|
this.updateInfo();
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ export class EncounterPhase extends BattlePhase {
|
|||||||
const enemyPokemon = globalScene.getEnemyParty()[e];
|
const enemyPokemon = globalScene.getEnemyParty()[e];
|
||||||
if (e < (battle.double ? 2 : 1)) {
|
if (e < (battle.double ? 2 : 1)) {
|
||||||
enemyPokemon.setX(-66 + enemyPokemon.getFieldPositionOffset()[0]);
|
enemyPokemon.setX(-66 + enemyPokemon.getFieldPositionOffset()[0]);
|
||||||
enemyPokemon.resetSummonData();
|
enemyPokemon.fieldSetup(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.loaded) {
|
if (!this.loaded) {
|
||||||
|
@ -196,6 +196,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
|||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
pokemon.cry(pokemon.getHpRatio() > 0.25 ? undefined : { rate: 0.85 });
|
pokemon.cry(pokemon.getHpRatio() > 0.25 ? undefined : { rate: 0.85 });
|
||||||
pokemon.getSprite().clearTint();
|
pokemon.getSprite().clearTint();
|
||||||
|
pokemon.fieldSetup();
|
||||||
// necessary to stay transformed during wild waves
|
// necessary to stay transformed during wild waves
|
||||||
if (pokemon.summonData.speciesForm) {
|
if (pokemon.summonData.speciesForm) {
|
||||||
pokemon.loadAssets(false);
|
pokemon.loadAssets(false);
|
||||||
@ -261,6 +262,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
|||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
pokemon.cry(pokemon.getHpRatio() > 0.25 ? undefined : { rate: 0.85 });
|
pokemon.cry(pokemon.getHpRatio() > 0.25 ? undefined : { rate: 0.85 });
|
||||||
pokemon.getSprite().clearTint();
|
pokemon.getSprite().clearTint();
|
||||||
|
pokemon.fieldSetup();
|
||||||
globalScene.updateFieldScale();
|
globalScene.updateFieldScale();
|
||||||
globalScene.time.delayedCall(1000, () => this.end());
|
globalScene.time.delayedCall(1000, () => this.end());
|
||||||
},
|
},
|
||||||
|
@ -193,7 +193,7 @@ export class SwitchSummonPhase extends SummonPhase {
|
|||||||
switchedInPokemon.setAlpha(0.5);
|
switchedInPokemon.setAlpha(0.5);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switchedInPokemon.resetSummonData();
|
switchedInPokemon.fieldSetup(true);
|
||||||
}
|
}
|
||||||
this.summon();
|
this.summon();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user