Add workaround for double Belastun effekt

This commit is contained in:
Byroks 2024-02-18 15:31:15 +01:00
parent 9e17887167
commit 50e2e534a0
1 changed files with 10 additions and 8 deletions

View File

@ -288,12 +288,12 @@ export class M5Character extends Actor {
label += "*";
}
if (item.system.valuable) {
ret.stats.wealth += parseFloat((this.calculateValue(item.system.value * item.system.quantity, item.system.currency)).toPrecision(3));
ret.stats.wealth += parseFloat(this.calculateValue(item.system.value * item.system.quantity, item.system.currency).toPrecision(3));
}
if (item.system.hoarded) {
ret.stats.hoard += parseFloat((this.calculateValue(item.system.value * item.system.quantity, item.system.currency)).toPrecision(3));
ret.stats.hoard += parseFloat(this.calculateValue(item.system.value * item.system.quantity, item.system.currency).toPrecision(3));
}
if (!!item.system.containerId) {
ret.gear.containers[item.system.containerId].weight += parseFloat((item.system.weight * item.system.quantity).toPrecision(3));
if (ret.gear.containers[item.system.containerId].equipped) {
@ -461,20 +461,22 @@ export class M5Character extends Actor {
});
if (!skip?.encumbrance) {
const item = context.items.find((x) => x.name === "Belastung");
const item = context.items.filter((x) => x.name === "Belastung");
if (ret.stats.encumbrance > ret.stats.heavyLoad) {
if (!item) {
if (item.length === 0) {
this.createEffect("Belastung", [{ id: "movement", operation: M5ModOperation.DIVISION, type: M5ModType.STAT, value: 2 }]);
} else {
item.update({
} else if (item.length === 1) {
item[0].update({
data: {
equipped: true,
},
});
} else if (item.length === 2) {
item[1]?.delete();
}
} else if (ret.stats.encumbrance <= ret.stats.heavyLoad) {
if (!!item) {
item.update({
item[0].update({
data: {
equipped: false,
},