mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-25 00:06:18 +00:00
[Enhancement] Add option for egg skip to settings (#4193)
* add option for egg skip * change eggSkip variable name more descriptive to eggSkipPreference * update requested changes from opaquer and tinylad and walker * update requested change from tinylad * update comment
This commit is contained in:
parent
c294e0846d
commit
5724ed4a5c
@ -161,6 +161,13 @@ export default class BattleScene extends SceneBase {
|
||||
public moveAnimations: boolean = true;
|
||||
public expGainsSpeed: integer = 0;
|
||||
public skipSeenDialogues: boolean = false;
|
||||
/**
|
||||
* Determines if the egg hatching animation should be skipped
|
||||
* - 0 = Never (never skip animation)
|
||||
* - 1 = Ask (ask to skip animation when hatching 2 or more eggs)
|
||||
* - 2 = Always (automatically skip animation when hatching 2 or more eggs)
|
||||
*/
|
||||
public eggSkipPreference: number = 0;
|
||||
|
||||
/**
|
||||
* Defines the experience gain display mode.
|
||||
|
@ -11,6 +11,10 @@
|
||||
"expGainsSpeed": "EXP Gains Speed",
|
||||
"expPartyDisplay": "Show EXP Party",
|
||||
"skipSeenDialogues": "Skip Seen Dialogues",
|
||||
"eggSkip": "Egg Skip",
|
||||
"never": "Never",
|
||||
"always": "Always",
|
||||
"ask": "Ask",
|
||||
"battleStyle": "Battle Style",
|
||||
"enableRetries": "Enable Retries",
|
||||
"hideIvs": "Hide IV scanner",
|
||||
|
@ -17,14 +17,13 @@ import { EggHatchData } from "#app/data/egg-hatch-data";
|
||||
export class EggLapsePhase extends Phase {
|
||||
|
||||
private eggHatchData: EggHatchData[] = [];
|
||||
private readonly minEggsToPromptSkip: number = 5;
|
||||
private readonly minEggsToSkip: number = 2;
|
||||
constructor(scene: BattleScene) {
|
||||
super(scene);
|
||||
}
|
||||
|
||||
start() {
|
||||
super.start();
|
||||
|
||||
const eggsToHatch: Egg[] = this.scene.gameData.eggs.filter((egg: Egg) => {
|
||||
return Overrides.EGG_IMMEDIATE_HATCH_OVERRIDE ? true : --egg.hatchWaves < 1;
|
||||
});
|
||||
@ -32,8 +31,7 @@ export class EggLapsePhase extends Phase {
|
||||
this.eggHatchData= [];
|
||||
|
||||
if (eggsToHatchCount > 0) {
|
||||
|
||||
if (eggsToHatchCount >= this.minEggsToPromptSkip) {
|
||||
if (eggsToHatchCount >= this.minEggsToSkip && this.scene.eggSkipPreference === 1) {
|
||||
this.scene.ui.showText(i18next.t("battle:eggHatching"), 0, () => {
|
||||
// show prompt for skip
|
||||
this.scene.ui.showText(i18next.t("battle:eggSkipPrompt"), 0);
|
||||
@ -46,6 +44,10 @@ export class EggLapsePhase extends Phase {
|
||||
}
|
||||
);
|
||||
}, 100, true);
|
||||
} else if (eggsToHatchCount >= this.minEggsToSkip && this.scene.eggSkipPreference === 2) {
|
||||
this.scene.queueMessage(i18next.t("battle:eggHatching"));
|
||||
this.hatchEggsSkipped(eggsToHatch);
|
||||
this.showSummary();
|
||||
} else {
|
||||
// regular hatches, no summary
|
||||
this.scene.queueMessage(i18next.t("battle:eggHatching"));
|
||||
|
@ -126,6 +126,7 @@ export const SettingKeys = {
|
||||
EXP_Gains_Speed: "EXP_GAINS_SPEED",
|
||||
EXP_Party_Display: "EXP_PARTY_DISPLAY",
|
||||
Skip_Seen_Dialogues: "SKIP_SEEN_DIALOGUES",
|
||||
Egg_Skip: "EGG_SKIP",
|
||||
Battle_Style: "BATTLE_STYLE",
|
||||
Enable_Retries: "ENABLE_RETRIES",
|
||||
Hide_IVs: "HIDE_IVS",
|
||||
@ -281,6 +282,26 @@ export const Setting: Array<Setting> = [
|
||||
default: 0,
|
||||
type: SettingType.GENERAL
|
||||
},
|
||||
{
|
||||
key: SettingKeys.Egg_Skip,
|
||||
label: i18next.t("settings:eggSkip"),
|
||||
options: [
|
||||
{
|
||||
value: "Never",
|
||||
label: i18next.t("settings:never")
|
||||
},
|
||||
{
|
||||
value: "Ask",
|
||||
label: i18next.t("settings:ask")
|
||||
},
|
||||
{
|
||||
value: "Always",
|
||||
label: i18next.t("settings:always")
|
||||
}
|
||||
],
|
||||
default: 1,
|
||||
type: SettingType.GENERAL
|
||||
},
|
||||
{
|
||||
key: SettingKeys.Battle_Style,
|
||||
label: i18next.t("settings:battleStyle"),
|
||||
@ -727,6 +748,9 @@ export function setSetting(scene: BattleScene, setting: string, value: integer):
|
||||
case SettingKeys.Skip_Seen_Dialogues:
|
||||
scene.skipSeenDialogues = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Egg_Skip:
|
||||
scene.eggSkipPreference = value;
|
||||
break;
|
||||
case SettingKeys.Battle_Style:
|
||||
scene.battleStyle = value;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user