mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-19 23:02:19 +02:00
Zoroark keep illusion between battles
This commit is contained in:
parent
382b0cdd0e
commit
e522ab3d31
@ -811,8 +811,20 @@ export default class BattleScene extends SceneBase {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getPlayerParty(): PlayerPokemon[] {
|
public getPlayerParty(fakeShininess: boolean = true): PlayerPokemon[] {
|
||||||
return this.party;
|
const party = this.party
|
||||||
|
if(!fakeShininess){
|
||||||
|
party.map(pokemon => {
|
||||||
|
pokemon.shiny = pokemon.isShiny()
|
||||||
|
pokemon.variant = pokemon.getVariant()
|
||||||
|
pokemon.name = pokemon.getNameToRender()
|
||||||
|
if(pokemon.isFusion()){
|
||||||
|
pokemon.fusionVariant = pokemon.battleData?.illusion.basePokemon!.fusionVariant ?? pokemon.fusionVariant;
|
||||||
|
pokemon.fusionShiny = pokemon.battleData?.illusion.basePokemon!.fusionShiny ?? pokemon.fusionShiny;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return party;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4778,28 +4778,13 @@ export class IllusionPostBattleAbAttr extends PostBattleAbAttr {
|
|||||||
* @returns {boolean} - Whether the illusion was applied.
|
* @returns {boolean} - Whether the illusion was applied.
|
||||||
*/
|
*/
|
||||||
applyPostBattle(pokemon: Pokemon, passive: boolean, simulated:boolean, args: any[]): boolean {
|
applyPostBattle(pokemon: Pokemon, passive: boolean, simulated:boolean, args: any[]): boolean {
|
||||||
|
console.log("POSTBATTLE")
|
||||||
pokemon.breakIllusion();
|
pokemon.breakIllusion();
|
||||||
pokemon.battleData.illusion.available = true;
|
pokemon.battleData.illusion.available = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class IllusionDisableAbAttr extends PostSummonAbAttr {
|
|
||||||
/**
|
|
||||||
* Illusion will be disabled if the pokemon is summoned with an illusion.
|
|
||||||
* So the pokemon can use 1 illusion per battle.
|
|
||||||
*
|
|
||||||
* @param {Pokemon} pokemon - The Pokémon with the Illusion ability.
|
|
||||||
* @param {boolean} passive - N/A
|
|
||||||
* @param {...any} args - N/A
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
applyPostSummon(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
|
|
||||||
pokemon.battleData.illusion.available = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If a Pokémon with this Ability selects a damaging move, it has a 30% chance of going first in its priority bracket. If the Ability activates, this is announced at the start of the turn (after move selection).
|
* If a Pokémon with this Ability selects a damaging move, it has a 30% chance of going first in its priority bracket. If the Ability activates, this is announced at the start of the turn (after move selection).
|
||||||
@ -5905,8 +5890,6 @@ export function initAbilities() {
|
|||||||
.conditionalAttr((pokemon) => pokemon.battleData.illusion.active, IllusionBreakAbAttr, true)
|
.conditionalAttr((pokemon) => pokemon.battleData.illusion.active, IllusionBreakAbAttr, true)
|
||||||
//Illusion is available again after a battle
|
//Illusion is available again after a battle
|
||||||
.conditionalAttr((pokemon) => pokemon.isAllowedInBattle(), IllusionPostBattleAbAttr, false)
|
.conditionalAttr((pokemon) => pokemon.isAllowedInBattle(), IllusionPostBattleAbAttr, false)
|
||||||
//Illusion is not available after summon
|
|
||||||
.attr(IllusionDisableAbAttr, false)
|
|
||||||
.bypassFaint(),
|
.bypassFaint(),
|
||||||
new Ability(Abilities.IMPOSTER, 5)
|
new Ability(Abilities.IMPOSTER, 5)
|
||||||
.attr(PostSummonTransformAbAttr)
|
.attr(PostSummonTransformAbAttr)
|
||||||
|
@ -437,7 +437,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
const lastPokemon: Pokemon = party.filter(p => p !== this).at(-1) || this;
|
const lastPokemon: Pokemon = party.filter(p => p !== this).at(-1) || this;
|
||||||
const speciesId = lastPokemon.species.speciesId;
|
const speciesId = lastPokemon.species.speciesId;
|
||||||
|
|
||||||
if ( lastPokemon === this || this.battleData?.illusion.active ||
|
if ( lastPokemon === this || this.battleData.illusion.active ||
|
||||||
((speciesId === Species.OGERPON || speciesId === Species.TERAPAGOS) && (lastPokemon.isTerastallized() || this.isTerastallized()))) {
|
((speciesId === Species.OGERPON || speciesId === Species.TERAPAGOS) && (lastPokemon.isTerastallized() || this.isTerastallized()))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -455,6 +455,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
fusionGender: lastPokemon.fusionGender
|
fusionGender: lastPokemon.fusionGender
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log("GENERATE ILLUSION ", this.battleData.illusion.basePokemon!.name)
|
||||||
|
|
||||||
this.name = lastPokemon.name;
|
this.name = lastPokemon.name;
|
||||||
this.nickname = lastPokemon.nickname;
|
this.nickname = lastPokemon.nickname;
|
||||||
this.shiny = lastPokemon.shiny;
|
this.shiny = lastPokemon.shiny;
|
||||||
@ -465,6 +467,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
this.initShinySparkle();
|
this.initShinySparkle();
|
||||||
}
|
}
|
||||||
this.loadAssets(false, true).then(() => this.playAnim());
|
this.loadAssets(false, true).then(() => this.playAnim());
|
||||||
|
this.updateInfo();
|
||||||
} else {
|
} else {
|
||||||
let availables: Species[] = [];
|
let availables: Species[] = [];
|
||||||
let randomIllusion: PokemonSpecies = globalScene.arena.randomSpecies(globalScene.currentBattle.waveIndex, this.level);
|
let randomIllusion: PokemonSpecies = globalScene.arena.randomSpecies(globalScene.currentBattle.waveIndex, this.level);
|
||||||
@ -488,11 +491,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
breakIllusion(): boolean {
|
breakIllusion(toSave: boolean = false): boolean {
|
||||||
|
console.log("breakIllusion");
|
||||||
if (!this.battleData?.illusion.active) {
|
if (!this.battleData?.illusion.active) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.name = this.battleData?.illusion.basePokemon!.name;
|
this.name = this.battleData?.illusion.basePokemon!.name;
|
||||||
this.nickname = this.battleData?.illusion.basePokemon!.nickname;
|
this.nickname = this.battleData?.illusion.basePokemon!.nickname;
|
||||||
this.shiny = this.battleData?.illusion.basePokemon!.shiny;
|
this.shiny = this.battleData?.illusion.basePokemon!.shiny;
|
||||||
@ -506,8 +509,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
if (this.shiny) {
|
if (this.shiny) {
|
||||||
this.initShinySparkle();
|
this.initShinySparkle();
|
||||||
}
|
}
|
||||||
|
if(!toSave){
|
||||||
this.loadAssets(false).then(() => this.playAnim());
|
this.loadAssets(false).then(() => this.playAnim());
|
||||||
this.updateInfo(true);
|
this.updateInfo(true);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3961,10 +3966,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resetBattleData(): void {
|
resetBattleData(): void {
|
||||||
const illusionActive: boolean = this.battleData?.illusion.active ?? false;
|
console.log("RESETBATTLEDATA : ", this.getNameToRender(false))
|
||||||
|
const illusionActive: boolean = this.battleData?.illusion.active;
|
||||||
this.breakIllusion();
|
this.breakIllusion();
|
||||||
this.battleData = new PokemonBattleData();
|
this.battleData = new PokemonBattleData();
|
||||||
illusionActive ? this.generateIllusion() : null;
|
if(illusionActive){
|
||||||
|
this.generateIllusion()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resetBattleSummonData(): void {
|
resetBattleSummonData(): void {
|
||||||
|
@ -11,7 +11,7 @@ import { TrainerSlot } from "#app/data/trainer-config";
|
|||||||
import { getRandomWeatherType } from "#app/data/weather";
|
import { getRandomWeatherType } from "#app/data/weather";
|
||||||
import { EncounterPhaseEvent } from "#app/events/battle-scene";
|
import { EncounterPhaseEvent } from "#app/events/battle-scene";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { FieldPosition } from "#app/field/pokemon";
|
import { FieldPosition, PlayerPokemon } from "#app/field/pokemon";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import { BoostBugSpawnModifier, IvScannerModifier, TurnHeldItemTransferModifier } from "#app/modifier/modifier";
|
import { BoostBugSpawnModifier, IvScannerModifier, TurnHeldItemTransferModifier } from "#app/modifier/modifier";
|
||||||
import { ModifierPoolType, regenerateModifierPoolThresholds } from "#app/modifier/modifier-type";
|
import { ModifierPoolType, regenerateModifierPoolThresholds } from "#app/modifier/modifier-type";
|
||||||
@ -203,6 +203,9 @@ export class EncounterPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
if (e < (battle.double ? 2 : 1)) {
|
if (e < (battle.double ? 2 : 1)) {
|
||||||
if (battle.battleType === BattleType.WILD) {
|
if (battle.battleType === BattleType.WILD) {
|
||||||
|
for(const pokemon of globalScene.getPlayerField()){
|
||||||
|
applyPreSummonAbAttrs(PreSummonAbAttr, pokemon, []);
|
||||||
|
}
|
||||||
applyPreSummonAbAttrs(PreSummonAbAttr, enemyPokemon, []);
|
applyPreSummonAbAttrs(PreSummonAbAttr, enemyPokemon, []);
|
||||||
globalScene.field.add(enemyPokemon);
|
globalScene.field.add(enemyPokemon);
|
||||||
battle.seenEnemyPartyMemberIds.add(enemyPokemon.id);
|
battle.seenEnemyPartyMemberIds.add(enemyPokemon.id);
|
||||||
|
@ -949,7 +949,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().map(p => new PokemonData(p)),
|
party: globalScene.getPlayerParty(false).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)),
|
||||||
|
Loading…
Reference in New Issue
Block a user