Fix as per CSV sheet tracking + creature explanation
This commit is contained in:
@@ -45,6 +45,34 @@ export default class MGNECharacter extends foundry.abstract.TypeDataModel {
|
||||
this.syncLimit = Math.max(0, this.abilities.toughness?.value ?? 0)
|
||||
this.syncRemaining = Math.max(0, this.syncLimit - (this.artifactSync.used ?? 0))
|
||||
this.armorFormula = this.parent?.getArmorRollFormula?.() ?? "0"
|
||||
|
||||
// Compute current load per RAW:
|
||||
// trivial = 0, light = 10 per slot, normal = 1, heavy = fills remaining capacity (max 1)
|
||||
let normalLoad = 0
|
||||
let lightCount = 0
|
||||
let heavyCount = 0
|
||||
for (const item of (this.parent?.items ?? [])) {
|
||||
if (item.system?.carried === false) continue // not being carried
|
||||
const w = item.system?.weight ?? "normal"
|
||||
if (w === "trivial") continue
|
||||
else if (w === "light") lightCount++
|
||||
else if (w === "normal") normalLoad++
|
||||
else if (w === "heavy") heavyCount++
|
||||
}
|
||||
normalLoad += Math.floor(lightCount / 10)
|
||||
this.lightItemCount = lightCount
|
||||
this.heavyItemCount = heavyCount
|
||||
|
||||
if (heavyCount >= 2) {
|
||||
// Can't carry two heavy items — automatically overloaded
|
||||
this.currentLoad = this.carryCapacity + (heavyCount - 1)
|
||||
} else if (heavyCount === 1) {
|
||||
// Heavy fills remaining capacity; other items fit alongside it
|
||||
this.currentLoad = Math.max(normalLoad, this.carryCapacity)
|
||||
} else {
|
||||
this.currentLoad = normalLoad
|
||||
}
|
||||
this.overloaded = this.currentLoad > this.carryCapacity
|
||||
}
|
||||
|
||||
/** @override */
|
||||
|
||||
Reference in New Issue
Block a user