mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-18 06:12:19 +02:00
bug fix
This commit is contained in:
parent
83018a558a
commit
e06684a6d4
@ -887,19 +887,8 @@ export default class BattleScene extends SceneBase {
|
||||
return true;
|
||||
}
|
||||
|
||||
public getPlayerParty(useIllusion = true): PlayerPokemon[] {
|
||||
public getPlayerParty(): PlayerPokemon[] {
|
||||
const party = this.party;
|
||||
if (!useIllusion) {
|
||||
party.map(pokemon => {
|
||||
pokemon.shiny = pokemon.isShiny();
|
||||
pokemon.variant = pokemon.getVariant();
|
||||
pokemon.name = pokemon.getNameToRender();
|
||||
if (pokemon.isFusion()) {
|
||||
pokemon.fusionVariant = pokemon.summonData?.illusion?.basePokemon.fusionVariant ?? pokemon.fusionVariant;
|
||||
pokemon.fusionShiny = pokemon.summonData?.illusion?.basePokemon.fusionShiny ?? pokemon.fusionShiny;
|
||||
}
|
||||
});
|
||||
}
|
||||
return party;
|
||||
}
|
||||
|
||||
|
@ -5244,7 +5244,7 @@ export class IllusionPreSummonAbAttr extends PreSummonAbAttr {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return pokemon.canApplyAbility();
|
||||
return !pokemon.summonData.illusionBroken;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5262,6 +5262,7 @@ export class IllusionBreakAbAttr extends PostDefendAbAttr {
|
||||
*/
|
||||
override applyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult, args: any[]): void {
|
||||
pokemon.breakIllusion();
|
||||
pokemon.summonData.illusionBroken = true;
|
||||
}
|
||||
|
||||
override canApplyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult, args: any[]): boolean {
|
||||
|
@ -560,7 +560,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
|
||||
init(): void {
|
||||
this.fieldPosition = FieldPosition.CENTER;
|
||||
this.summonData = new PokemonSummonData();
|
||||
this.summonData = new PokemonSummonData(); // Need to be init for illusion to work
|
||||
this.initBattleInfo();
|
||||
|
||||
globalScene.fieldUI.addAt(this.battleInfo, 0);
|
||||
@ -696,12 +696,22 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
* Generate an illusion of the last pokemon in the party, as other wild pokemon in the area.
|
||||
*/
|
||||
setIllusion(pokemon: Pokemon): boolean {
|
||||
if(!!this.summonData?.illusion){
|
||||
this.breakIllusion();
|
||||
}
|
||||
if (this.hasTrainer()) {
|
||||
const speciesId = pokemon.species.speciesId;
|
||||
|
||||
this.summonData.illusion = {
|
||||
basePokemon: { ...this },
|
||||
species: getPokemonSpecies(speciesId),
|
||||
basePokemon: {
|
||||
name: this.name,
|
||||
nickname: this.nickname,
|
||||
shiny: this.shiny,
|
||||
variant: this.variant,
|
||||
fusionShiny: this.fusionShiny,
|
||||
fusionVariant: this.fusionVariant
|
||||
},
|
||||
species: speciesId,
|
||||
formIndex: pokemon.formIndex,
|
||||
gender: pokemon.gender,
|
||||
pokeball: pokemon.pokeball,
|
||||
@ -725,8 +735,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
const randomIllusion: PokemonSpecies = globalScene.arena.randomSpecies(globalScene.currentBattle.waveIndex, this.level);
|
||||
|
||||
this.summonData.illusion = {
|
||||
basePokemon: { ...this },
|
||||
species: randomIllusion,
|
||||
basePokemon: {
|
||||
name: this.name,
|
||||
nickname: this.nickname,
|
||||
shiny: this.shiny,
|
||||
variant: this.variant,
|
||||
fusionShiny: this.fusionShiny,
|
||||
fusionVariant: this.fusionVariant
|
||||
},
|
||||
species: randomIllusion.speciesId,
|
||||
formIndex: randomIllusion.formIndex,
|
||||
gender: this.gender,
|
||||
pokeball: this.pokeball
|
||||
@ -742,12 +759,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
if (!this.summonData?.illusion) {
|
||||
return false;
|
||||
} else {
|
||||
this.name = this.summonData?.illusion.basePokemon.name ?? this.name;
|
||||
this.nickname = this.summonData?.illusion.basePokemon.nickname ?? this.nickname;
|
||||
this.shiny = this.summonData?.illusion.basePokemon.shiny ?? this.shiny;
|
||||
this.variant = this.summonData?.illusion.basePokemon.variant ?? this.variant;
|
||||
this.fusionVariant = this.summonData?.illusion.basePokemon.fusionVariant ?? this.fusionVariant;
|
||||
this.fusionShiny = this.summonData?.illusion.basePokemon.fusionShiny ?? this.fusionShiny;
|
||||
this.name = this.summonData?.illusion.basePokemon.name;
|
||||
this.nickname = this.summonData?.illusion.basePokemon.nickname;
|
||||
this.shiny = this.summonData?.illusion.basePokemon.shiny;
|
||||
this.variant = this.summonData?.illusion.basePokemon.variant;
|
||||
this.fusionVariant = this.summonData?.illusion.basePokemon.fusionVariant;
|
||||
this.fusionShiny = this.summonData?.illusion.basePokemon.fusionShiny;
|
||||
this.summonData.illusion = null;
|
||||
}
|
||||
if (this.isOnField()) {
|
||||
@ -756,7 +773,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
if (this.shiny) {
|
||||
this.initShinySparkle();
|
||||
}
|
||||
|
||||
this.loadAssets(false).then(() => this.playAnim());
|
||||
this.updateInfo(true);
|
||||
return true;
|
||||
@ -1072,7 +1088,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
getIconAtlasKey(ignoreOverride?: boolean): string {
|
||||
const formIndex: integer = !!this.summonData?.illusion ? this.summonData?.illusion.formIndex! : this.formIndex;
|
||||
const formIndex: integer = !!this.summonData?.illusion ? this.summonData?.illusion.formIndex : this.formIndex;
|
||||
return this.getSpeciesForm(ignoreOverride, true).getIconAtlasKey(
|
||||
formIndex,
|
||||
this.shiny,
|
||||
@ -1089,7 +1105,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
getIconId(ignoreOverride?: boolean): string {
|
||||
const formIndex: integer = !!this.summonData?.illusion ? this.summonData?.illusion.formIndex! : this.formIndex;
|
||||
const formIndex: integer = !!this.summonData?.illusion ? this.summonData?.illusion.formIndex : this.formIndex;
|
||||
return this.getSpeciesForm(ignoreOverride, true).getIconId(
|
||||
this.getGender(ignoreOverride, true) === Gender.FEMALE,
|
||||
formIndex,
|
||||
@ -1112,7 +1128,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
* @param {boolean} useIllusion - Whether we want the speciesForm of the illusion or not.
|
||||
*/
|
||||
getSpeciesForm(ignoreOverride?: boolean, useIllusion: boolean = false): PokemonSpeciesForm {
|
||||
const species: PokemonSpecies = useIllusion && !!this.summonData?.illusion ? this.summonData?.illusion.species : this.species;
|
||||
const species: PokemonSpecies = useIllusion && !!this.summonData?.illusion ? getPokemonSpecies(this.summonData?.illusion.species) : this.species;
|
||||
|
||||
const formIndex: integer = useIllusion && !!this.summonData?.illusion ? this.summonData?.illusion.formIndex : this.formIndex;
|
||||
|
||||
@ -1847,7 +1863,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
*/
|
||||
isDoubleShiny(useIllusion: boolean = false): boolean {
|
||||
if (!useIllusion && !!this.summonData?.illusion) {
|
||||
return this.isFusion(false) && this.summonData?.illusion.basePokemon!.shiny && this.summonData?.illusion.basePokemon.fusionShiny;
|
||||
return this.isFusion(false) && this.summonData?.illusion.basePokemon.shiny && this.summonData?.illusion.basePokemon.fusionShiny;
|
||||
} else {
|
||||
return this.isFusion(useIllusion) && this.shiny && this.fusionShiny;
|
||||
}
|
||||
@ -5781,7 +5797,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
resetSummonData(): void {
|
||||
const illusion: Illusion | null = this.summonData?.illusion;
|
||||
const illusion: IllusionData | null = this.summonData?.illusion;
|
||||
if (this.summonData?.speciesForm) {
|
||||
this.summonData.speciesForm = null;
|
||||
this.updateFusionPalette();
|
||||
@ -7786,27 +7802,44 @@ export class EnemyPokemon extends Pokemon {
|
||||
/**
|
||||
* Illusion property
|
||||
*/
|
||||
interface Illusion {
|
||||
interface IllusionData {
|
||||
basePokemon: {
|
||||
/**
|
||||
* Whether the illusion is active or not.
|
||||
* The actual name of the Pokemon.
|
||||
* @type {string}
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The actual nickname of the Pokemon.
|
||||
* @type {string}
|
||||
*/
|
||||
nickname: string;
|
||||
/**
|
||||
* Store whether the base pokemon is shiny or not.
|
||||
* @type {boolean}
|
||||
*/
|
||||
//active: boolean;
|
||||
shiny: boolean;
|
||||
/**
|
||||
* Whether the pokemon can generate an illusion or not.
|
||||
* @type {boolean}
|
||||
* The shiny variant of the base pokemon.
|
||||
* @type {Variant}
|
||||
*/
|
||||
//available: boolean;
|
||||
variant: Variant;
|
||||
/**
|
||||
* The actual Pokemon.
|
||||
* @type {Pokemon}
|
||||
* Whether the fusionned species of the base pokemon is shiny or not.
|
||||
* @type {PokemonSpecies}
|
||||
*/
|
||||
basePokemon: Pokemon;
|
||||
fusionShiny: boolean;
|
||||
/**
|
||||
* The variant of the fusionned species of the base pokemon.
|
||||
* @type {Variant}
|
||||
*/
|
||||
fusionVariant: Variant;
|
||||
};
|
||||
/**
|
||||
* The species of the illusion.
|
||||
* @type {PokemonSpecies}
|
||||
*/
|
||||
species: PokemonSpecies;
|
||||
species: Species;
|
||||
/**
|
||||
* The formIndex of the illusion
|
||||
* @type {integer}
|
||||
@ -7837,7 +7870,7 @@ interface Illusion {
|
||||
*/
|
||||
fusionGender?: Gender;
|
||||
/**
|
||||
* The level of the illusion
|
||||
* The level of the illusion (not used currently)
|
||||
* @type {integer}
|
||||
*/
|
||||
level?: number
|
||||
@ -7876,10 +7909,12 @@ export class PokemonSummonData {
|
||||
public fusionGender: Gender;
|
||||
public stats: number[] = [0, 0, 0, 0, 0, 0];
|
||||
public moveset: PokemonMove[];
|
||||
public illusionBroken: boolean = false;
|
||||
|
||||
// If not initialized this value will not be populated from save data.
|
||||
public types: PokemonType[] = [];
|
||||
public addedType: PokemonType | null = null;
|
||||
public illusion: Illusion | null = null;
|
||||
public illusion: IllusionData | null = null;
|
||||
}
|
||||
|
||||
export class PokemonBattleData {
|
||||
|
@ -1011,7 +1011,7 @@ export class GameData {
|
||||
seed: globalScene.seed,
|
||||
playTime: globalScene.sessionPlayTime,
|
||||
gameMode: globalScene.gameMode.modeId,
|
||||
party: globalScene.getPlayerParty(false).map(p => new PokemonData(p)),
|
||||
party: globalScene.getPlayerParty().map(p => new PokemonData(p)),
|
||||
enemyParty: globalScene.getEnemyParty().map(p => new PokemonData(p)),
|
||||
modifiers: globalScene.findModifiers(() => true).map(m => new PersistentModifierData(m, true)),
|
||||
enemyModifiers: globalScene.findModifiers(() => true, false).map(m => new PersistentModifierData(m, false)),
|
||||
@ -1423,7 +1423,6 @@ export class GameData {
|
||||
),
|
||||
) // TODO: is this bang correct?
|
||||
: this.getSessionSaveData();
|
||||
|
||||
const maxIntAttrValue = 0x80000000;
|
||||
const systemData = useCachedSystem
|
||||
? this.parseSystemData(decrypt(localStorage.getItem(`data_${loggedInUser?.username}`)!, bypassLogin))
|
||||
@ -1445,7 +1444,6 @@ export class GameData {
|
||||
bypassLogin,
|
||||
),
|
||||
);
|
||||
|
||||
localStorage.setItem(
|
||||
`sessionData${globalScene.sessionSlotId ? globalScene.sessionSlotId : ""}_${loggedInUser?.username}`,
|
||||
encrypt(JSON.stringify(sessionData), bypassLogin),
|
||||
|
@ -79,12 +79,14 @@ export default class PokemonData {
|
||||
this.id = source.id;
|
||||
this.player = sourcePokemon ? sourcePokemon.isPlayer() : source.player;
|
||||
this.species = sourcePokemon ? sourcePokemon.species.speciesId : source.species;
|
||||
this.nickname = sourcePokemon ? sourcePokemon.nickname : source.nickname;
|
||||
this.nickname = sourcePokemon
|
||||
? (!!sourcePokemon.summonData?.illusion ? sourcePokemon.summonData.illusion.basePokemon.nickname : sourcePokemon.nickname)
|
||||
: source.nickname;
|
||||
this.formIndex = Math.max(Math.min(source.formIndex, getPokemonSpecies(this.species).forms.length - 1), 0);
|
||||
this.abilityIndex = source.abilityIndex;
|
||||
this.passive = source.passive;
|
||||
this.shiny = source.shiny;
|
||||
this.variant = source.variant;
|
||||
this.shiny = sourcePokemon ? sourcePokemon.isShiny() : source.shiny;
|
||||
this.variant = sourcePokemon ? sourcePokemon.getVariant() : source.variant;
|
||||
this.pokeball = source.pokeball;
|
||||
this.level = source.level;
|
||||
this.exp = source.exp;
|
||||
@ -117,8 +119,12 @@ export default class PokemonData {
|
||||
this.fusionSpecies = sourcePokemon ? sourcePokemon.fusionSpecies?.speciesId : source.fusionSpecies;
|
||||
this.fusionFormIndex = source.fusionFormIndex;
|
||||
this.fusionAbilityIndex = source.fusionAbilityIndex;
|
||||
this.fusionShiny = source.fusionShiny;
|
||||
this.fusionVariant = source.fusionVariant;
|
||||
this.fusionShiny = sourcePokemon
|
||||
? (!!sourcePokemon.summonData?.illusion ? sourcePokemon.summonData.illusion.basePokemon.fusionShiny : sourcePokemon.fusionShiny)
|
||||
: source.fusionShiny;
|
||||
this.fusionVariant = sourcePokemon
|
||||
? (!!sourcePokemon.summonData?.illusion ? sourcePokemon.summonData.illusion.basePokemon.fusionVariant : sourcePokemon.fusionVariant)
|
||||
: source.fusionVariant;
|
||||
this.fusionGender = source.fusionGender;
|
||||
this.fusionLuck =
|
||||
source.fusionLuck !== undefined ? source.fusionLuck : source.fusionShiny ? source.fusionVariant + 1 : 0;
|
||||
|
Loading…
Reference in New Issue
Block a user