mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-29 02:39:28 +02:00
clean up post-battle logic for Breeder ME
This commit is contained in:
parent
fd9743394a
commit
02d2b6ebce
@ -1,4 +1,4 @@
|
|||||||
import { EnemyPartyConfig, handleMysteryEncounterBattleFailed, initBattleWithEnemyConfig, setEncounterRewards, } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
import { EnemyPartyConfig, generateModifierType, handleMysteryEncounterBattleFailed, initBattleWithEnemyConfig, setEncounterRewards, } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
import { trainerConfigs } from "#app/data/trainer-config";
|
import { trainerConfigs } from "#app/data/trainer-config";
|
||||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||||
import BattleScene from "#app/battle-scene";
|
import BattleScene from "#app/battle-scene";
|
||||||
@ -21,6 +21,9 @@ import { EggTier } from "#enums/egg-type";
|
|||||||
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||||
import { achvs } from "#app/system/achv";
|
import { achvs } from "#app/system/achv";
|
||||||
|
import { modifierTypes, PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
||||||
|
import { Type } from "#app/data/type";
|
||||||
|
import { getPokeballTintColor } from "#app/data/pokeball";
|
||||||
|
|
||||||
/** the i18n namespace for the encounter */
|
/** the i18n namespace for the encounter */
|
||||||
const namespace = "mysteryEncounter:expertPokemonBreeder";
|
const namespace = "mysteryEncounter:expertPokemonBreeder";
|
||||||
@ -190,12 +193,6 @@ export const TheExpertPokemonBreederEncounter: MysteryEncounter =
|
|||||||
pokemon3RareEggs
|
pokemon3RareEggs
|
||||||
};
|
};
|
||||||
|
|
||||||
encounter.dialogue.outro = [
|
|
||||||
{
|
|
||||||
text: `${namespace}.outro`,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
.withTitle(`${namespace}.title`)
|
.withTitle(`${namespace}.title`)
|
||||||
@ -359,6 +356,7 @@ export const TheExpertPokemonBreederEncounter: MysteryEncounter =
|
|||||||
)
|
)
|
||||||
.withOutroDialogue([
|
.withOutroDialogue([
|
||||||
{
|
{
|
||||||
|
speaker: trainerNameKey,
|
||||||
text: `${namespace}.outro`,
|
text: `${namespace}.outro`,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
@ -384,6 +382,11 @@ function getPartyConfig(scene: BattleScene): EnemyPartyConfig {
|
|||||||
nature: Nature.ADAMANT,
|
nature: Nature.ADAMANT,
|
||||||
moveSet: [Moves.METEOR_MASH, Moves.FIRE_PUNCH, Moves.ICE_PUNCH, Moves.THUNDER_PUNCH],
|
moveSet: [Moves.METEOR_MASH, Moves.FIRE_PUNCH, Moves.ICE_PUNCH, Moves.THUNDER_PUNCH],
|
||||||
ivs: [31, 31, 31, 31, 31, 31],
|
ivs: [31, 31, 31, 31, 31, 31],
|
||||||
|
modifierConfigs: [
|
||||||
|
{
|
||||||
|
modifier: generateModifierType(scene, modifierTypes.TERA_SHARD, [Type.STEEL]) as PokemonHeldItemModifierType,
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
@ -537,6 +540,7 @@ function onGameOver(scene: BattleScene) {
|
|||||||
|
|
||||||
encounter.dialogue.outro = [
|
encounter.dialogue.outro = [
|
||||||
{
|
{
|
||||||
|
speaker: trainerNameKey,
|
||||||
text: `${namespace}.outro_failed`,
|
text: `${namespace}.outro_failed`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@ -552,6 +556,49 @@ function onGameOver(scene: BattleScene) {
|
|||||||
// Set flag that encounter was failed
|
// Set flag that encounter was failed
|
||||||
encounter.misc.encounterFailed = true;
|
encounter.misc.encounterFailed = true;
|
||||||
|
|
||||||
|
// Revert BGM
|
||||||
|
scene.playBgm(scene.arena.bgm);
|
||||||
|
|
||||||
|
// Return enemy Pokemon
|
||||||
|
const pokemon = scene.getEnemyPokemon();
|
||||||
|
if (pokemon) {
|
||||||
|
scene.playSound("se/pb_rel");
|
||||||
|
pokemon.hideInfo();
|
||||||
|
pokemon.tint(getPokeballTintColor(pokemon.pokeball), 1, 250, "Sine.easeIn");
|
||||||
|
scene.tweens.add({
|
||||||
|
targets: pokemon,
|
||||||
|
duration: 250,
|
||||||
|
ease: "Sine.easeIn",
|
||||||
|
scale: 0.5,
|
||||||
|
onComplete: () => {
|
||||||
|
scene.field.remove(pokemon, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show the enemy trainer
|
||||||
|
scene.time.delayedCall(250, () => {
|
||||||
|
const sprites = scene.currentBattle.trainer?.getSprites();
|
||||||
|
const tintSprites = scene.currentBattle.trainer?.getTintSprites();
|
||||||
|
if (sprites && tintSprites) {
|
||||||
|
for (let i = 0; i < sprites.length; i++) {
|
||||||
|
sprites[i].setVisible(true);
|
||||||
|
tintSprites[i].setVisible(true);
|
||||||
|
sprites[i].clearTint();
|
||||||
|
tintSprites[i].clearTint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scene.tweens.add({
|
||||||
|
targets: scene.currentBattle.trainer,
|
||||||
|
x: "-=16",
|
||||||
|
y: "+=16",
|
||||||
|
alpha: 1,
|
||||||
|
ease: "Sine.easeInOut",
|
||||||
|
duration: 750
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
handleMysteryEncounterBattleFailed(scene, true);
|
handleMysteryEncounterBattleFailed(scene, true);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -764,7 +764,7 @@ export function handleMysteryEncounterBattleFailed(scene: BattleScene, addHealPh
|
|||||||
if (encounter.continuousEncounter || doNotContinue) {
|
if (encounter.continuousEncounter || doNotContinue) {
|
||||||
return;
|
return;
|
||||||
} else if (encounter.encounterMode !== MysteryEncounterMode.NO_BATTLE) {
|
} else if (encounter.encounterMode !== MysteryEncounterMode.NO_BATTLE) {
|
||||||
scene.pushPhase(new BattleEndPhase(scene));
|
scene.pushPhase(new BattleEndPhase(scene, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.pushPhase(new MysteryEncounterRewardsPhase(scene, addHealPhase));
|
scene.pushPhase(new MysteryEncounterRewardsPhase(scene, addHealPhase));
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"selected": "Let's do this!"
|
"selected": "Let's do this!"
|
||||||
},
|
},
|
||||||
"outro": "Look how happy your {{chosenPokemon}} is now!$Here, you can have these as well.",
|
"outro": "Look how happy your {{chosenPokemon}} is now!$Here, you can have these as well.",
|
||||||
"outro_dialogue": "How disappointing...$It looks like you still have a long way\nto go to earn your Pokémon's trust!",
|
"outro_failed": "How disappointing...$It looks like you still have a long way\nto go to earn your Pokémon's trust!",
|
||||||
"gained_eggs": "@s{item_fanfare}You received {{numEggs}}!",
|
"gained_eggs": "@s{item_fanfare}You received {{numEggs}}!",
|
||||||
"eggs_tooltip": "\n(+) Earn {{eggs}}",
|
"eggs_tooltip": "\n(+) Earn {{eggs}}",
|
||||||
"numEggs_one": "{{count}} {{rarity}} Egg",
|
"numEggs_one": "{{count}} {{rarity}} Egg",
|
||||||
|
@ -2,19 +2,31 @@ import { applyPostBattleAbAttrs, PostBattleAbAttr } from "#app/data/ability";
|
|||||||
import { LapsingPersistentModifier, LapsingPokemonHeldItemModifier } from "#app/modifier/modifier";
|
import { LapsingPersistentModifier, LapsingPokemonHeldItemModifier } from "#app/modifier/modifier";
|
||||||
import { BattlePhase } from "./battle-phase";
|
import { BattlePhase } from "./battle-phase";
|
||||||
import { GameOverPhase } from "./game-over-phase";
|
import { GameOverPhase } from "./game-over-phase";
|
||||||
|
import BattleScene from "#app/battle-scene";
|
||||||
|
|
||||||
export class BattleEndPhase extends BattlePhase {
|
export class BattleEndPhase extends BattlePhase {
|
||||||
|
/** If true, will increment battles won */
|
||||||
|
isVictory: boolean;
|
||||||
|
|
||||||
|
constructor(scene: BattleScene, isVictory: boolean = true) {
|
||||||
|
super(scene);
|
||||||
|
|
||||||
|
this.isVictory = isVictory;
|
||||||
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
super.start();
|
super.start();
|
||||||
|
|
||||||
this.scene.currentBattle.addBattleScore(this.scene);
|
if (this.isVictory) {
|
||||||
|
this.scene.currentBattle.addBattleScore(this.scene);
|
||||||
|
|
||||||
this.scene.gameData.gameStats.battles++;
|
this.scene.gameData.gameStats.battles++;
|
||||||
if (this.scene.currentBattle.trainer) {
|
if (this.scene.currentBattle.trainer) {
|
||||||
this.scene.gameData.gameStats.trainersDefeated++;
|
this.scene.gameData.gameStats.trainersDefeated++;
|
||||||
}
|
}
|
||||||
if (this.scene.gameMode.isEndless && this.scene.currentBattle.waveIndex + 1 > this.scene.gameData.gameStats.highestEndlessWave) {
|
if (this.scene.gameMode.isEndless && this.scene.currentBattle.waveIndex + 1 > this.scene.gameData.gameStats.highestEndlessWave) {
|
||||||
this.scene.gameData.gameStats.highestEndlessWave = this.scene.currentBattle.waveIndex + 1;
|
this.scene.gameData.gameStats.highestEndlessWave = this.scene.currentBattle.waveIndex + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Endless graceful end
|
// Endless graceful end
|
||||||
|
Loading…
Reference in New Issue
Block a user