Increase endless mode limit to 15

This commit is contained in:
Flashfyre 2024-04-06 23:50:26 -04:00
parent 9449de4854
commit e747fa2ecd
2 changed files with 63 additions and 37 deletions

View File

@ -129,6 +129,7 @@ export class LoginPhase extends Phase {
export class TitlePhase extends Phase { export class TitlePhase extends Phase {
private loaded: boolean; private loaded: boolean;
private lastSessionData: SessionSaveData; private lastSessionData: SessionSaveData;
private gameMode: GameModes;
constructor(scene: BattleScene) { constructor(scene: BattleScene) {
super(scene); super(scene);
@ -169,9 +170,40 @@ export class TitlePhase extends Phase {
options.push({ options.push({
label: 'New Game', label: 'New Game',
handler: () => { handler: () => {
this.scene.ui.setMode(Mode.MESSAGE); const setModeAndEnd = (gameMode: GameModes) => {
this.scene.ui.clearText(); this.gameMode = gameMode;
this.end(); this.scene.ui.setMode(Mode.MESSAGE);
this.scene.ui.clearText();
this.end();
};
if (this.scene.gameData.unlocks[Unlockables.ENDLESS_MODE]) {
const options = [
{
label: gameModes[GameModes.CLASSIC].getName(),
handler: () => setModeAndEnd(GameModes.CLASSIC)
},
{
label: gameModes[GameModes.ENDLESS].getName(),
handler: () => setModeAndEnd(GameModes.ENDLESS)
}
];
if (this.scene.gameData.unlocks[Unlockables.SPLICED_ENDLESS_MODE]) {
options.push({
label: gameModes[GameModes.SPLICED_ENDLESS].getName(),
handler: () => setModeAndEnd(GameModes.SPLICED_ENDLESS)
});
}
options.push({
label: 'Cancel',
handler: () => {
this.scene.clearPhaseQueue();
this.scene.pushPhase(new TitlePhase(this.scene));
super.end();
}
});
this.scene.ui.showText('Select a game mode.', null, () => this.scene.ui.setOverlayMode(Mode.OPTION_SELECT, { options: options }));
} else
this.end();
} }
}, },
{ {
@ -271,7 +303,7 @@ export class TitlePhase extends Phase {
end(): void { end(): void {
if (!this.loaded && !this.scene.gameMode.isDaily) { if (!this.loaded && !this.scene.gameMode.isDaily) {
this.scene.arena.preloadBgm(); this.scene.arena.preloadBgm();
this.scene.pushPhase(new SelectStarterPhase(this.scene)); this.scene.pushPhase(new SelectStarterPhase(this.scene, this.gameMode));
this.scene.newArena(this.scene.gameMode.getStartingBiome(this.scene)); this.scene.newArena(this.scene.gameMode.getStartingBiome(this.scene));
} else } else
this.scene.playBgm(); this.scene.playBgm();
@ -339,8 +371,12 @@ export class SelectGenderPhase extends Phase {
} }
export class SelectStarterPhase extends Phase { export class SelectStarterPhase extends Phase {
constructor(scene: BattleScene) { private gameMode: GameModes;
constructor(scene: BattleScene, gameMode: GameModes) {
super(scene); super(scene);
this.gameMode = gameMode;
} }
start() { start() {
@ -394,7 +430,7 @@ export class SelectStarterPhase extends Phase {
this.end(); this.end();
}); });
}); });
}); }, this.gameMode);
} }
} }
@ -2322,7 +2358,7 @@ export class MoveEffectPhase extends PokemonPhase {
return true; return true;
if (this.scene.arena.weather?.weatherType === WeatherType.FOG) if (this.scene.arena.weather?.weatherType === WeatherType.FOG)
moveAccuracy.value = Math.floor(moveAccuracy.value * 0.6); moveAccuracy.value = Math.floor(moveAccuracy.value * 0.8);
if (!this.move.getMove().getAttrs(OneHitKOAttr).length && this.scene.arena.getTag(ArenaTagType.GRAVITY)) if (!this.move.getMove().getAttrs(OneHitKOAttr).length && this.scene.arena.getTag(ArenaTagType.GRAVITY))
moveAccuracy.value = Math.floor(moveAccuracy.value * 1.67); moveAccuracy.value = Math.floor(moveAccuracy.value * 1.67);

View File

@ -6,7 +6,7 @@ import { Mode } from "./ui";
import MessageUiHandler from "./message-ui-handler"; import MessageUiHandler from "./message-ui-handler";
import { Gender, getGenderColor, getGenderSymbol } from "../data/gender"; import { Gender, getGenderColor, getGenderSymbol } from "../data/gender";
import { allAbilities } from "../data/ability"; import { allAbilities } from "../data/ability";
import { GameModes, gameModes } from "../game-mode"; import { GameMode, GameModes, gameModes } from "../game-mode";
import { Unlockables } from "../system/unlockables"; import { Unlockables } from "../system/unlockables";
import { GrowthRate, getGrowthRateColor } from "../data/exp"; import { GrowthRate, getGrowthRateColor } from "../data/exp";
import { DexAttr, DexEntry, StarterFormMoveData, StarterMoveset } from "../system/game-data"; import { DexAttr, DexEntry, StarterFormMoveData, StarterMoveset } from "../system/game-data";
@ -111,6 +111,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
private iconAnimHandler: PokemonIconAnimHandler; private iconAnimHandler: PokemonIconAnimHandler;
private starterSelectCallback: StarterSelectCallback; private starterSelectCallback: StarterSelectCallback;
private gameMode: GameModes;
constructor(scene: BattleScene) { constructor(scene: BattleScene) {
super(scene, Mode.STARTER_SELECT); super(scene, Mode.STARTER_SELECT);
@ -450,7 +451,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
} }
show(args: any[]): boolean { show(args: any[]): boolean {
if (args.length >= 1 && args[0] instanceof Function) { if (args.length >= 2 && args[0] instanceof Function && typeof args[1] === 'number') {
super.show(args); super.show(args);
for (let g = 0; g < this.genSpecies.length; g++) { for (let g = 0; g < this.genSpecies.length; g++) {
@ -468,10 +469,13 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.starterSelectContainer.setVisible(true); this.starterSelectContainer.setVisible(true);
this.gameMode = args[1];
this.setGenMode(false); this.setGenMode(false);
this.setCursor(0); this.setCursor(0);
this.setGenMode(true); this.setGenMode(true);
this.setCursor(0); this.setCursor(0);
this.tryUpdateValue(0);
handleTutorial(this.scene, Tutorial.Starter_Select); handleTutorial(this.scene, Tutorial.Starter_Select);
@ -600,7 +604,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.starterMovesets.push(this.starterMoveset.slice(0) as StarterMoveset); this.starterMovesets.push(this.starterMoveset.slice(0) as StarterMoveset);
if (this.speciesLoaded.get(species.speciesId)) if (this.speciesLoaded.get(species.speciesId))
getPokemonSpeciesForm(species.speciesId, props.formIndex).cry(this.scene); getPokemonSpeciesForm(species.speciesId, props.formIndex).cry(this.scene);
if (this.starterCursors.length === 6 || this.value === 10) if (this.starterCursors.length === 6 || this.value === this.getValueLimit())
this.tryStart(); this.tryStart();
this.updateInstructions(); this.updateInstructions();
ui.playSelect(); ui.playSelect();
@ -826,6 +830,16 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.instructionsText.setText(instructionLines.join('\n')); this.instructionsText.setText(instructionLines.join('\n'));
} }
getValueLimit(): integer {
switch (this.gameMode) {
case GameModes.ENDLESS:
case GameModes.SPLICED_ENDLESS:
return 15;
default:
return 10;
}
}
setCursor(cursor: integer): boolean { setCursor(cursor: integer): boolean {
let changed = false; let changed = false;
@ -1216,11 +1230,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
tryUpdateValue(add?: integer): boolean { tryUpdateValue(add?: integer): boolean {
const value = this.starterGens.reduce((total: integer, gen: integer, i: integer) => total += this.scene.gameData.getSpeciesStarterValue(this.genSpecies[gen][this.starterCursors[i]].speciesId), 0); const value = this.starterGens.reduce((total: integer, gen: integer, i: integer) => total += this.scene.gameData.getSpeciesStarterValue(this.genSpecies[gen][this.starterCursors[i]].speciesId), 0);
const newValue = value + (add || 0); const newValue = value + (add || 0);
const overLimit = newValue > 10; const overLimit = newValue > this.getValueLimit();
let newValueStr = newValue.toString(); let newValueStr = newValue.toString();
if (newValueStr.startsWith('0.')) if (newValueStr.startsWith('0.'))
newValueStr = newValueStr.slice(1); newValueStr = newValueStr.slice(1);
this.valueLimitLabel.setText(`${newValueStr}/10`); this.valueLimitLabel.setText(`${newValueStr}/${this.getValueLimit()}`);
this.valueLimitLabel.setColor(this.getTextColor(!overLimit ? TextStyle.TOOLTIP_CONTENT : TextStyle.SUMMARY_PINK)); this.valueLimitLabel.setColor(this.getTextColor(!overLimit ? TextStyle.TOOLTIP_CONTENT : TextStyle.SUMMARY_PINK));
this.valueLimitLabel.setShadowColor(this.getTextColor(!overLimit ? TextStyle.TOOLTIP_CONTENT : TextStyle.SUMMARY_PINK, true)); this.valueLimitLabel.setShadowColor(this.getTextColor(!overLimit ? TextStyle.TOOLTIP_CONTENT : TextStyle.SUMMARY_PINK, true));
if (overLimit) { if (overLimit) {
@ -1264,31 +1278,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
}; };
})); }));
}; };
if (this.scene.gameData.unlocks[Unlockables.ENDLESS_MODE]) { startRun(this.gameMode);
ui.setMode(Mode.STARTER_SELECT);
const options = [
{
label: gameModes[GameModes.CLASSIC].getName(),
handler: () => startRun(GameModes.CLASSIC)
},
{
label: gameModes[GameModes.ENDLESS].getName(),
handler: () => startRun(GameModes.ENDLESS)
}
];
if (this.scene.gameData.unlocks[Unlockables.SPLICED_ENDLESS_MODE]) {
options.push({
label: gameModes[GameModes.SPLICED_ENDLESS].getName(),
handler: () => startRun(GameModes.SPLICED_ENDLESS)
});
}
options.push({
label: 'Cancel',
handler: () => cancel()
});
ui.showText('Select a game mode.', null, () => ui.setModeWithoutClear(Mode.OPTION_SELECT, { options: options, yOffset: 19 }));
} else
startRun(GameModes.CLASSIC);
}, cancel, null, null, 19); }, cancel, null, null, 19);
}); });