Add retry option (easy mode)
parent
23a8fb1fc9
commit
326918a5f1
|
@ -116,6 +116,7 @@ export default class BattleScene extends SceneBase {
|
|||
public damageNumbersMode: integer = 0;
|
||||
public showLevelUpStats: boolean = true;
|
||||
public enableTutorials: boolean = import.meta.env.VITE_BYPASS_TUTORIAL === "1";
|
||||
public enableRetries: boolean = false;
|
||||
public uiTheme: UiTheme = UiTheme.DEFAULT;
|
||||
public windowType: integer = 0;
|
||||
public experimentalSprites: boolean = false;
|
||||
|
|
|
@ -3175,6 +3175,38 @@ export class GameOverPhase extends BattlePhase {
|
|||
start() {
|
||||
super.start();
|
||||
|
||||
if (this.victory || !this.scene.enableRetries)
|
||||
this.handleClearSession();
|
||||
else {
|
||||
this.scene.ui.showText(`Would you like to retry from the start of the battle?`, null, () => {
|
||||
this.scene.ui.setMode(Mode.CONFIRM, () => {
|
||||
this.scene.ui.fadeOut(1250).then(() => {
|
||||
this.scene.reset();
|
||||
this.scene.clearPhaseQueue();
|
||||
this.scene.gameData.loadSession(this.scene, this.scene.sessionSlotId).then(() => {
|
||||
this.scene.pushPhase(new EncounterPhase(this.scene, true));
|
||||
|
||||
const availablePartyMembers = this.scene.getParty().filter(p => !p.isFainted()).length;
|
||||
|
||||
this.scene.pushPhase(new SummonPhase(this.scene, 0));
|
||||
if (this.scene.currentBattle.double && availablePartyMembers > 1)
|
||||
this.scene.pushPhase(new SummonPhase(this.scene, 1));
|
||||
if (this.scene.currentBattle.waveIndex > 1 && this.scene.currentBattle.battleType !== BattleType.TRAINER) {
|
||||
this.scene.pushPhase(new CheckSwitchPhase(this.scene, 0, this.scene.currentBattle.double));
|
||||
if (this.scene.currentBattle.double && availablePartyMembers > 1)
|
||||
this.scene.pushPhase(new CheckSwitchPhase(this.scene, 1, this.scene.currentBattle.double));
|
||||
}
|
||||
|
||||
this.scene.ui.fadeIn(1250);
|
||||
this.end();
|
||||
});
|
||||
});
|
||||
}, () => this.handleClearSession(), false, 0, 0, 1000);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
handleClearSession(): void {
|
||||
this.scene.gameData.tryClearSession(this.scene, this.scene.sessionSlotId).then((success: boolean | [boolean, boolean]) => {
|
||||
this.scene.time.delayedCall(1000, () => {
|
||||
let firstClear = false;
|
||||
|
|
|
@ -9,11 +9,12 @@ export enum Setting {
|
|||
BGM_Volume = "BGM_VOLUME",
|
||||
SE_Volume = "SE_VOLUME",
|
||||
Damage_Numbers = "DAMAGE_NUMBERS",
|
||||
Show_Stats_on_Level_Up = "SHOW_LEVEL_UP_STATS",
|
||||
UI_Theme = "UI_THEME",
|
||||
Window_Type = "WINDOW_TYPE",
|
||||
Tutorials = "TUTORIALS",
|
||||
Enable_Retries = "ENABLE_RETRIES",
|
||||
Sprite_Set = "SPRITE_SET",
|
||||
Show_Stats_on_Level_Up = "SHOW_LEVEL_UP_STATS",
|
||||
Fusion_Palette_Swaps = "FUSION_PALETTE_SWAPS",
|
||||
Player_Gender = "PLAYER_GENDER",
|
||||
Touch_Controls = "TOUCH_CONTROLS",
|
||||
|
@ -34,11 +35,12 @@ export const settingOptions: SettingOptions = {
|
|||
[Setting.BGM_Volume]: new Array(11).fill(null).map((_, i) => i ? (i * 10).toString() : 'Mute'),
|
||||
[Setting.SE_Volume]: new Array(11).fill(null).map((_, i) => i ? (i * 10).toString() : 'Mute'),
|
||||
[Setting.Damage_Numbers]: [ 'Off', 'Simple', 'Fancy' ],
|
||||
[Setting.Show_Stats_on_Level_Up]: [ 'Off', 'On' ],
|
||||
[Setting.UI_Theme]: [ 'Default', 'Legacy' ],
|
||||
[Setting.Window_Type]: new Array(5).fill(null).map((_, i) => (i + 1).toString()),
|
||||
[Setting.Tutorials]: [ 'Off', 'On' ],
|
||||
[Setting.Enable_Retries]: [ 'Off', 'On' ],
|
||||
[Setting.Sprite_Set]: [ 'Consistent', 'Prioritize Animation' ],
|
||||
[Setting.Show_Stats_on_Level_Up]: [ 'Off', 'On' ],
|
||||
[Setting.Fusion_Palette_Swaps]: [ 'Off', 'On' ],
|
||||
[Setting.Player_Gender]: [ 'Boy', 'Girl' ],
|
||||
[Setting.Touch_Controls]: [ 'Auto', 'Disabled' ],
|
||||
|
@ -51,11 +53,12 @@ export const settingDefaults: SettingDefaults = {
|
|||
[Setting.BGM_Volume]: 10,
|
||||
[Setting.SE_Volume]: 10,
|
||||
[Setting.Damage_Numbers]: 0,
|
||||
[Setting.Show_Stats_on_Level_Up]: 1,
|
||||
[Setting.UI_Theme]: 0,
|
||||
[Setting.Window_Type]: 0,
|
||||
[Setting.Tutorials]: 1,
|
||||
[Setting.Enable_Retries]: 0,
|
||||
[Setting.Sprite_Set]: 0,
|
||||
[Setting.Show_Stats_on_Level_Up]: 1,
|
||||
[Setting.Fusion_Palette_Swaps]: 1,
|
||||
[Setting.Player_Gender]: 0,
|
||||
[Setting.Touch_Controls]: 0,
|
||||
|
@ -84,9 +87,6 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
|
|||
case Setting.Damage_Numbers:
|
||||
scene.damageNumbersMode = value;
|
||||
break;
|
||||
case Setting.Show_Stats_on_Level_Up:
|
||||
scene.showLevelUpStats = settingOptions[setting][value] === 'On';
|
||||
break;
|
||||
case Setting.UI_Theme:
|
||||
scene.uiTheme = value;
|
||||
break;
|
||||
|
@ -96,11 +96,17 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
|
|||
case Setting.Tutorials:
|
||||
scene.enableTutorials = settingOptions[setting][value] === 'On';
|
||||
break;
|
||||
case Setting.Enable_Retries:
|
||||
scene.enableRetries = settingOptions[setting][value] === 'On';
|
||||
break;
|
||||
case Setting.Sprite_Set:
|
||||
scene.experimentalSprites = !!value;
|
||||
if (value)
|
||||
scene.initExpSprites();
|
||||
break;
|
||||
case Setting.Show_Stats_on_Level_Up:
|
||||
scene.showLevelUpStats = settingOptions[setting][value] === 'On';
|
||||
break;
|
||||
case Setting.Fusion_Palette_Swaps:
|
||||
scene.fusionPaletteSwaps = !!value;
|
||||
break;
|
||||
|
|
|
@ -3,12 +3,14 @@ import { TextStyle, addTextObject } from "./text";
|
|||
import { Mode } from "./ui";
|
||||
import UiHandler from "./ui-handler";
|
||||
import { addWindow } from "./ui-theme";
|
||||
import * as Utils from "../utils";
|
||||
|
||||
export interface OptionSelectConfig {
|
||||
xOffset?: number;
|
||||
yOffset?: number;
|
||||
options: OptionSelectItem[];
|
||||
maxOptions?: integer;
|
||||
delay?: integer;
|
||||
noCancel?: boolean;
|
||||
}
|
||||
|
||||
|
@ -29,6 +31,8 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
|
|||
|
||||
protected config: OptionSelectConfig;
|
||||
|
||||
protected blockInput: boolean;
|
||||
|
||||
protected scrollCursor: integer = 0;
|
||||
|
||||
private cursorObj: Phaser.GameObjects.Image;
|
||||
|
@ -93,10 +97,22 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
|
|||
this.scrollCursor = 0;
|
||||
this.setCursor(0);
|
||||
|
||||
if (this.config.delay) {
|
||||
this.blockInput = true;
|
||||
this.optionSelectText.setAlpha(0.5);
|
||||
this.scene.time.delayedCall(Utils.fixedInt(this.config.delay), () => {
|
||||
this.blockInput = false;
|
||||
this.optionSelectText.setAlpha(1);
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
processInput(button: Button): boolean {
|
||||
if (this.blockInput)
|
||||
return false;
|
||||
|
||||
const ui = this.getUi();
|
||||
|
||||
let success = false;
|
||||
|
|
|
@ -15,6 +15,8 @@ export default class BiomeSelectUiHandler extends UiHandler {
|
|||
|
||||
private cursorObj: Phaser.GameObjects.Image;
|
||||
|
||||
private blockInput: boolean;
|
||||
|
||||
private biomeSelectHandler: Function;
|
||||
|
||||
constructor(scene: BattleScene) {
|
||||
|
@ -59,12 +61,22 @@ export default class BiomeSelectUiHandler extends UiHandler {
|
|||
|
||||
this.biomeSelectContainer.setVisible(true);
|
||||
this.setCursor(0);
|
||||
|
||||
this.blockInput = true;
|
||||
this.biomesText.setAlpha(0.5);
|
||||
this.scene.time.delayedCall(Utils.fixedInt(1000), () => {
|
||||
this.blockInput = false;
|
||||
this.biomesText.setAlpha(1);
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
processInput(button: Button): boolean {
|
||||
if (this.blockInput)
|
||||
return false;
|
||||
|
||||
const ui = this.getUi();
|
||||
|
||||
let success = false;
|
||||
|
|
|
@ -26,7 +26,8 @@ export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
|
|||
label: 'No',
|
||||
handler: args[1]
|
||||
}
|
||||
]
|
||||
],
|
||||
delay: args.length >= 6 && args[5] !== null ? args[5] as integer : 0
|
||||
};
|
||||
|
||||
super.show([ config ]);
|
||||
|
|
Loading…
Reference in New Issue