This commit is contained in:
Kim Ravn Hansen
2025-11-04 15:34:49 +01:00
parent 87f8add864
commit de96d45ade
3 changed files with 486 additions and 461 deletions

View File

@@ -58,7 +58,7 @@ export class Character {
itemSlots;
/** @type {Set<string>} Things the character is particularly proficient at. */
skills = new Set();
proficiencies = new Set();
/** @type {Map<Item,number} Things the character is particularly proficient at. */
items = new Map();
@@ -93,5 +93,23 @@ export class Character {
this.items.set(item, count + existingItemCount);
}
clamp(skill, min, max) {
const val = this[skill];
if (val === undefined) {
throw new Error(`Invalid skill >>>${skill}<<<`)
}
if (val < min) {
this[skill] = min
return
}
if (val > max) {
this.skill = max;
return
}
}
// todo removeItem(item, count)
}