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