feat: add hide unimplemented moves setting

pull/884/head
Justin Heflin 2024-05-14 20:58:18 -04:00
parent aeeebcbf38
commit f275701a5e
5 changed files with 23 additions and 2 deletions

View File

@ -93,6 +93,7 @@ export default class BattleScene extends SceneBase {
public seVolume: number = 1; public seVolume: number = 1;
public gameSpeed: integer = 1; public gameSpeed: integer = 1;
public damageNumbersMode: integer = 0; public damageNumbersMode: integer = 0;
public hideUnimplementedMoves: boolean = true;
public showLevelUpStats: boolean = true; public showLevelUpStats: boolean = true;
public enableTutorials: boolean = import.meta.env.VITE_BYPASS_TUTORIAL === "1"; public enableTutorials: boolean = import.meta.env.VITE_BYPASS_TUTORIAL === "1";
public enableRetries: boolean = false; public enableRetries: boolean = false;

View File

@ -99,6 +99,7 @@ export default class Move implements Localizable {
private conditions: MoveCondition[]; private conditions: MoveCondition[];
private flags: integer; private flags: integer;
private nameAppend: string; private nameAppend: string;
private implemented: boolean = true;
constructor(id: Moves, type: Type, category: MoveCategory, defaultMoveTarget: MoveTarget, power: integer, accuracy: integer, pp: integer, chance: integer, priority: integer, generation: integer) { constructor(id: Moves, type: Type, category: MoveCategory, defaultMoveTarget: MoveTarget, power: integer, accuracy: integer, pp: integer, chance: integer, priority: integer, generation: integer) {
this.id = id; this.id = id;
@ -191,6 +192,10 @@ export default class Move implements Localizable {
return false; return false;
} }
isImplemented(): boolean {
return this.implemented;
}
isTypeImmune(type: Type): boolean { isTypeImmune(type: Type): boolean {
switch (type) { switch (type) {
case Type.GRASS: case Type.GRASS:
@ -216,6 +221,7 @@ export default class Move implements Localizable {
unimplemented(): this { unimplemented(): this {
this.nameAppend += ' (N)'; this.nameAppend += ' (N)';
this.implemented = false;
return this; return this;
} }

View File

@ -1017,7 +1017,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
getLevelMoves(startingLevel?: integer, includeEvolutionMoves: boolean = false, simulateEvolutionChain: boolean = false): LevelMoves { getLevelMoves(startingLevel?: integer, includeEvolutionMoves: boolean = false, simulateEvolutionChain: boolean = false): LevelMoves {
const ret: LevelMoves = []; let ret: LevelMoves = [];
let levelMoves: LevelMoves = []; let levelMoves: LevelMoves = [];
if (!startingLevel) if (!startingLevel)
startingLevel = this.level; startingLevel = this.level;
@ -1077,6 +1077,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
} }
if (this.scene.hideUnimplementedMoves) {
ret = ret.filter(([, move]) => allMoves[move].isImplemented())
}
return ret; return ret;
} }

View File

@ -20,6 +20,7 @@ export enum Setting {
Sprite_Set = "SPRITE_SET", Sprite_Set = "SPRITE_SET",
Move_Animations = "MOVE_ANIMATIONS", Move_Animations = "MOVE_ANIMATIONS",
Show_Stats_on_Level_Up = "SHOW_LEVEL_UP_STATS", Show_Stats_on_Level_Up = "SHOW_LEVEL_UP_STATS",
Hide_Unimplemented_Moves = "IGNORE_UNIMPLEMENTED_MOVES",
EXP_Gains_Speed = "EXP_GAINS_SPEED", EXP_Gains_Speed = "EXP_GAINS_SPEED",
EXP_Party_Display = "EXP_PARTY_DISPLAY", EXP_Party_Display = "EXP_PARTY_DISPLAY",
HP_Bar_Speed = "HP_BAR_SPEED", HP_Bar_Speed = "HP_BAR_SPEED",
@ -53,6 +54,7 @@ export const settingOptions: SettingOptions = {
[Setting.Sprite_Set]: ['Consistent', 'Mixed Animated'], [Setting.Sprite_Set]: ['Consistent', 'Mixed Animated'],
[Setting.Move_Animations]: ['Off', 'On'], [Setting.Move_Animations]: ['Off', 'On'],
[Setting.Show_Stats_on_Level_Up]: ['Off', 'On'], [Setting.Show_Stats_on_Level_Up]: ['Off', 'On'],
[Setting.Hide_Unimplemented_Moves]: ['Off', 'On'],
[Setting.EXP_Gains_Speed]: ['Normal', 'Fast', 'Faster', 'Skip'], [Setting.EXP_Gains_Speed]: ['Normal', 'Fast', 'Faster', 'Skip'],
[Setting.EXP_Party_Display]: ['Normal', 'Level Up Notification', 'Skip'], [Setting.EXP_Party_Display]: ['Normal', 'Level Up Notification', 'Skip'],
[Setting.HP_Bar_Speed]: ['Normal', 'Fast', 'Faster', 'Instant'], [Setting.HP_Bar_Speed]: ['Normal', 'Fast', 'Faster', 'Instant'],
@ -78,6 +80,7 @@ export const settingDefaults: SettingDefaults = {
[Setting.Sprite_Set]: 0, [Setting.Sprite_Set]: 0,
[Setting.Move_Animations]: 1, [Setting.Move_Animations]: 1,
[Setting.Show_Stats_on_Level_Up]: 1, [Setting.Show_Stats_on_Level_Up]: 1,
[Setting.Hide_Unimplemented_Moves]: 0,
[Setting.EXP_Gains_Speed]: 0, [Setting.EXP_Gains_Speed]: 0,
[Setting.EXP_Party_Display]: 0, [Setting.EXP_Party_Display]: 0,
[Setting.HP_Bar_Speed]: 0, [Setting.HP_Bar_Speed]: 0,
@ -89,7 +92,7 @@ export const settingDefaults: SettingDefaults = {
[Setting.Vibration]: 0 [Setting.Vibration]: 0
}; };
export const reloadSettings: Setting[] = [Setting.UI_Theme, Setting.Language, Setting.Sprite_Set]; export const reloadSettings: Setting[] = [Setting.UI_Theme, Setting.Hide_Unimplemented_Moves, Setting.Language, Setting.Sprite_Set];
export function setSetting(scene: BattleScene, setting: Setting, value: integer): boolean { export function setSetting(scene: BattleScene, setting: Setting, value: integer): boolean {
switch (setting) { switch (setting) {
@ -134,6 +137,9 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
case Setting.Show_Stats_on_Level_Up: case Setting.Show_Stats_on_Level_Up:
scene.showLevelUpStats = settingOptions[setting][value] === 'On'; scene.showLevelUpStats = settingOptions[setting][value] === 'On';
break; break;
case Setting.Hide_Unimplemented_Moves:
scene.hideUnimplementedMoves = settingOptions[setting][value] === 'On'
break;
case Setting.EXP_Gains_Speed: case Setting.EXP_Gains_Speed:
scene.expGainsSpeed = value; scene.expGainsSpeed = value;
break; break;

View File

@ -1597,6 +1597,10 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
} }
} }
if (this.scene.hideUnimplementedMoves) {
this.speciesStarterMoves = this.speciesStarterMoves.filter(move => allMoves[move].isImplemented())
}
const speciesMoveData = this.scene.gameData.starterData[species.speciesId].moveset; const speciesMoveData = this.scene.gameData.starterData[species.speciesId].moveset;
let moveData: StarterMoveset = speciesMoveData let moveData: StarterMoveset = speciesMoveData
? Array.isArray(speciesMoveData) ? Array.isArray(speciesMoveData)