Bookkeeping and tweaking

This commit is contained in:
Kim Ravn Hansen
2025-10-13 15:54:15 +02:00
parent 934160280c
commit f14ec9e09f
3 changed files with 21 additions and 22 deletions

View File

@@ -9,10 +9,13 @@
import { isIdSane, miniUid } from "../utils/id.js";
import { Xorshift32 } from "../utils/random.js";
import { Character } from "./character.js";
import { ItemAttributes, ItemBlueprint } from "./item.js";
import { ItemBlueprint } from "./item.js";
import { Player } from "./player.js";
/** @typedef {import("./character.js").Character} Character */
/** @typedef {import("./item.js").ItemAttributes} ItemAttributes */
/** @typedef {import("./item.js").ItemBlueprint} ItemBlueprint */
export class Game {
_counter = 1_000_000;
@@ -117,10 +120,8 @@ export class Game {
*/
getItemBlueprint(blueprintId) {
if (!isIdSane(blueprintId)) {
throw new Error(`blueprintId >>${blueprintId}<< is insane!`);
throw new Error(`blueprintId >>${blueprintId}<< is not a valid id`);
}
const tpl = this._itemBlueprints.get(blueprintId);
return tpl || undefined;
return this._itemBlueprints.get(blueprintId);
}
}