mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 17:12:44 +02:00
Fixed summondata being cleared inside summonPhase, removed summonDataPrimer
like seriously how come no-one checked this
This commit is contained in:
parent
6374f38b11
commit
02b6bf732b
@ -5241,7 +5241,6 @@ 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;
|
||||||
|
@ -385,14 +385,11 @@ export async function initBattleWithEnemyConfig(partyConfig: EnemyPartyConfig):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// mysteryEncounterBattleEffects will only be used IFF MYSTERY_ENCOUNTER_POST_SUMMON tag is applied
|
// mysteryEncounterBattleEffects will only be used if MYSTERY_ENCOUNTER_POST_SUMMON tag is applied
|
||||||
if (config.mysteryEncounterBattleEffects) {
|
if (config.mysteryEncounterBattleEffects) {
|
||||||
enemyPokemon.mysteryEncounterBattleEffects = config.mysteryEncounterBattleEffects;
|
enemyPokemon.mysteryEncounterBattleEffects = config.mysteryEncounterBattleEffects;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Requires re-priming summon data to update everything properly
|
|
||||||
enemyPokemon.primeSummonData(enemyPokemon.summonData);
|
|
||||||
|
|
||||||
if (enemyPokemon.isShiny() && !enemyPokemon["shinySparkle"]) {
|
if (enemyPokemon.isShiny() && !enemyPokemon["shinySparkle"]) {
|
||||||
enemyPokemon.initShinySparkle();
|
enemyPokemon.initShinySparkle();
|
||||||
}
|
}
|
||||||
|
@ -332,11 +332,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
public customPokemonData: CustomPokemonData = new CustomPokemonData;
|
public customPokemonData: CustomPokemonData = new CustomPokemonData;
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Figure out if we can remove this thing
|
|
||||||
*/
|
|
||||||
private summonDataPrimer: PokemonSummonData | null;
|
|
||||||
|
|
||||||
/* Pokemon data types, in vaguely decreasing order of precedence */
|
/* Pokemon data types, in vaguely decreasing order of precedence */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1130,17 +1125,18 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get this {@linkcode Pokemon}'s {@linkcode PokemonSpeciesForm}.
|
* Get this {@linkcode Pokemon}'s {@linkcode PokemonSpeciesForm}.
|
||||||
* @param ignoreOverride - ?????; default `false`.
|
* @param ignoreOverride - Whether to ignore overridden species from {@linkcode Moves.TRANSFORM}, default `false`.
|
||||||
|
* This overrides `useIllusion` if `true`.
|
||||||
* @param useIllusion - `true` to use the speciesForm of the illusion; default `false`.
|
* @param useIllusion - `true` to use the speciesForm of the illusion; default `false`.
|
||||||
*/
|
*/
|
||||||
getSpeciesForm(ignoreOverride: boolean = false, useIllusion: boolean = false): PokemonSpeciesForm {
|
getSpeciesForm(ignoreOverride: boolean = false, useIllusion: boolean = false): PokemonSpeciesForm {
|
||||||
const species: PokemonSpecies = useIllusion && this.summonData.illusion ? getPokemonSpecies(this.summonData.illusion.species) : this.species;
|
|
||||||
const formIndex = useIllusion && this.summonData.illusion ? this.summonData.illusion.formIndex : this.formIndex;
|
|
||||||
|
|
||||||
if (!ignoreOverride && this.summonData.speciesForm) {
|
if (!ignoreOverride && this.summonData.speciesForm) {
|
||||||
return this.summonData.speciesForm;
|
return this.summonData.speciesForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const species: PokemonSpecies = useIllusion && this.summonData.illusion ? getPokemonSpecies(this.summonData.illusion.species) : this.species;
|
||||||
|
const formIndex = useIllusion && this.summonData.illusion ? this.summonData.illusion.formIndex : this.formIndex;
|
||||||
|
|
||||||
if (species.forms && species.forms.length > 0) {
|
if (species.forms && species.forms.length > 0) {
|
||||||
return species.forms[formIndex];
|
return species.forms[formIndex];
|
||||||
}
|
}
|
||||||
@ -5780,14 +5776,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
primeSummonData(summonDataPrimer: PokemonSummonData): void {
|
|
||||||
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;
|
||||||
@ -5797,9 +5785,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
this.summonData = new PokemonSummonData();
|
this.summonData = new PokemonSummonData();
|
||||||
this.setSwitchOutStatus(false);
|
this.setSwitchOutStatus(false);
|
||||||
if (!this.battleData) {
|
|
||||||
this.resetBattleAndWaveData();
|
|
||||||
}
|
|
||||||
if (this.getTag(BattlerTagType.SEEDED)) {
|
if (this.getTag(BattlerTagType.SEEDED)) {
|
||||||
this.lapseTag(BattlerTagType.SEEDED);
|
this.lapseTag(BattlerTagType.SEEDED);
|
||||||
}
|
}
|
||||||
@ -5811,30 +5796,22 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.summonDataPrimer) {
|
// If this Pokemon has a Substitute when loading in, play an animation to add its sprite
|
||||||
for (const k of Object.keys(this.summonDataPrimer)) {
|
if (this.getTag(SubstituteTag)) {
|
||||||
if (this.summonDataPrimer[k]) {
|
globalScene.triggerPokemonBattleAnim(
|
||||||
this.summonData[k] = this.summonDataPrimer[k];
|
this,
|
||||||
}
|
PokemonAnimType.SUBSTITUTE_ADD,
|
||||||
}
|
);
|
||||||
// If this Pokemon has a Substitute when loading in, play an animation to add its sprite
|
this.getTag(SubstituteTag)!.sourceInFocus = false;
|
||||||
if (this.getTag(SubstituteTag)) {
|
}
|
||||||
globalScene.triggerPokemonBattleAnim(
|
|
||||||
this,
|
|
||||||
PokemonAnimType.SUBSTITUTE_ADD,
|
|
||||||
);
|
|
||||||
this.getTag(SubstituteTag)!.sourceInFocus = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If this Pokemon has Commander and Dondozo as an active ally, hide this Pokemon's sprite.
|
// If this Pokemon has Commander and Dondozo as an active ally, hide this Pokemon's sprite.
|
||||||
if (
|
if (
|
||||||
this.hasAbilityWithAttr(CommanderAbAttr) &&
|
this.hasAbilityWithAttr(CommanderAbAttr) &&
|
||||||
globalScene.currentBattle.double &&
|
globalScene.currentBattle.double &&
|
||||||
this.getAlly()?.species.speciesId === Species.DONDOZO
|
this.getAlly()?.species.speciesId === Species.DONDOZO
|
||||||
) {
|
) {
|
||||||
this.setVisible(false);
|
this.setVisible(false);
|
||||||
}
|
|
||||||
this.summonDataPrimer = null;
|
|
||||||
}
|
}
|
||||||
this.summonData.illusion = illusion
|
this.summonData.illusion = illusion
|
||||||
this.updateInfo();
|
this.updateInfo();
|
||||||
@ -7942,8 +7919,8 @@ export class PokemonBattleData {
|
|||||||
constructor(source?: PokemonBattleData | Partial<PokemonBattleData>) {
|
constructor(source?: PokemonBattleData | Partial<PokemonBattleData>) {
|
||||||
if (!isNullOrUndefined(source)) {
|
if (!isNullOrUndefined(source)) {
|
||||||
this.hitCount = source.hitCount ?? 0;
|
this.hitCount = source.hitCount ?? 0;
|
||||||
this.hasEatenBerry = source.hasEatenBerry ?? this.hasEatenBerry;
|
this.hasEatenBerry = source.hasEatenBerry ?? false;
|
||||||
this.berriesEaten = source.berriesEaten ?? this.berriesEaten;
|
this.berriesEaten = source.berriesEaten ?? [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,6 @@ 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.resetSummonData();
|
|
||||||
// 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);
|
||||||
@ -262,7 +261,6 @@ 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.resetSummonData();
|
|
||||||
globalScene.updateFieldScale();
|
globalScene.updateFieldScale();
|
||||||
globalScene.time.delayedCall(1000, () => this.end());
|
globalScene.time.delayedCall(1000, () => this.end());
|
||||||
},
|
},
|
||||||
|
@ -167,17 +167,14 @@ export default class PokemonData {
|
|||||||
false,
|
false,
|
||||||
this,
|
this,
|
||||||
);
|
);
|
||||||
if (this.summonData) {
|
|
||||||
// when loading from saved session, recover summonData.speciesFrom and form index species object
|
|
||||||
// used to stay transformed on reload session
|
|
||||||
|
|
||||||
if (this.summonData.speciesForm) {
|
// when loading from saved session, recover summonData.speciesFrom and form index species object
|
||||||
this.summonData.speciesForm = getPokemonSpeciesForm(
|
// used to stay transformed on reload session
|
||||||
this.summonData.speciesForm.speciesId,
|
if (this.summonData.speciesForm) {
|
||||||
this.summonDataSpeciesFormIndex,
|
this.summonData.speciesForm = getPokemonSpeciesForm(
|
||||||
);
|
this.summonData.speciesForm.speciesId,
|
||||||
}
|
this.summonDataSpeciesFormIndex,
|
||||||
ret.primeSummonData(this.summonData);
|
);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user