progress
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user