Constructor
new EquipmentSystem(configopt)
| Name | Type | Attributes | Description |
|---|---|---|---|
config | Object | <optional> |
- Source
Classes
Methods
bindTarget(target) → {EquipmentSystem}
Bind a Combatant, Stats, or composite target to receive equipment stat modifiers.
| Name | Type | Description |
|---|---|---|
target | Object |
- Source
- Type:
- EquipmentSystem
canEquip(slot, item) → {boolean}
Check if an item can be equipped into a designated slot. Rejects incompatible items, consumables, or unknown slots.
| Name | Type | Description |
|---|---|---|
slot | string | |
item | Object |
- Source
- Type:
- boolean
createSnapshot() → {Object}
Create persistence snapshot of equipped items.
- Source
- Type:
- Object
equip(slotOrItem, maybeItemopt, optionsopt) → {Object|boolean}
Equip an item into a designated slot. Modifies bound Combatant/Stats and reverts previous item stats if replacing. Rejects incompatible slots.
| Name | Type | Attributes | Description |
|---|---|---|---|
slotOrItem | string | | ||
maybeItem | Object | <optional> | |
options | Object | <optional> |
- Source
Returns previous item or equipped item on success, false on rejection.
- Type:
- Object |
boolean
getAllStatModifiers() → {Object}
Compute aggregate stat modifiers across all equipped items.
- Source
- Type:
- Object
getEquippedItem(slot) → {Object|null}
Alias for getSlot.
| Name | Type | Description |
|---|---|---|
slot | string |
- Source
- Type:
- Object |
null
getSlot(slot) → {Object|null}
Get item in a designated slot.
| Name | Type | Description |
|---|---|---|
slot | string |
- Source
- Type:
- Object |
null
getStatModifier(statName) → {number}
Compute total stat modifier for a specific stat across all equipped items.
| Name | Type | Description |
|---|---|---|
statName | string |
- Source
- Type:
- number
loadJSON(data)
Load from JSON representation.
| Name | Type | Description |
|---|---|---|
data | Object |
- Source
normalizeSlot(slot) → {string|null}
Normalize slot name, mapping aliases like 'hand' or 'weapon' to 'mainHand'.
| Name | Type | Description |
|---|---|---|
slot | string |
- Source
- Type:
- string |
null
restoreSnapshot(snapshot, optionsopt) → {boolean}
Restore equipped items from snapshot, maintaining stat modifier binding.
| Name | Type | Attributes | Description |
|---|---|---|---|
snapshot | Object | ||
options | Object | <optional> |
- Source
- Type:
- boolean
toJSON() → {Object}
Export to plain JSON representation.
- Source
- Type:
- Object
unbindTarget() → {boolean}
Unbind current target, reverting any applied stat modifiers.
- Source
- Type:
- boolean
unequip(slot, optionsopt) → {Object|null}
Unequip item from a designated slot, reverting stats on bound Combatant/Stats.
| Name | Type | Attributes | Description |
|---|---|---|---|
slot | string | ||
options | Object | <optional> |
- Source
Unequipped item or null if slot was empty.
- Type:
- Object |
null