#6-lasten-und-belastung

Changes:
 + berechne belastung
 + füge effect für belastung hinzu was B halbiert
 + Container berechnen lasten von gegenständen in ihnen (#16)
This commit is contained in:
2024-01-21 15:12:12 +01:00
parent fa818e963a
commit 2afaba9827
4 changed files with 262 additions and 200 deletions
+39 -27
View File
@@ -14,22 +14,22 @@ export class M5Item extends Item {
const itemData = (this as any).system;
const calc = itemData.calc;
if (itemType === "item") {
calc.containers = null;
if (itemType === "item") {
calc.containers = null;
if (actor) {
const actorCalc = actor.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
if (actorCalc) {
calc.containers = actorCalc.gear.containers;
if (actor) {
const actorCalc = actor.derivedData({ containers: false, items: true, spells: true, effects: true, kampfkuenste: true, encumbrance: true });
if (actorCalc) {
calc.containers = actorCalc.gear.containers;
}
const container = character.getItem(itemData.containerId);
//console.log("M5Item.prepareDerivedData:containers", itemData, container?.system)
if (container) {
container.prepareDerivedData();
const containerData = container.system;
}
}
const container = character.getItem(itemData.containerId);
//console.log("M5Item.prepareDerivedData:containers", itemData, container?.system)
if (container) {
container.prepareDerivedData();
const containerData = container.system;
}
}
} else if (itemType === "skill") {
} else if (itemType === "skill") {
calc.fw = itemData.fw;
calc.bonus = 0;
@@ -46,7 +46,14 @@ export class M5Item extends Item {
];
if (character) {
const actorCalc = character.derivedData({ skills: true, weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
const actorCalc = character.derivedData({
skills: true,
items: true,
spells: true,
effects: true,
kampfkuenste: true,
encumbrance: true,
});
if (actorCalc?.skillMods && Object.keys(actorCalc.skillMods).indexOf(itemId) !== -1) {
pairs = pairs.concat(actorCalc.skillMods[itemId]);
}
@@ -81,9 +88,8 @@ export class M5Item extends Item {
calc.combatSkills = null;
calc.containers = null;
if (actor) {
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
const actorCalc = character.derivedData({ items: true, spells: true, effects: true, kampfkuenste: true, encumbrance: true });
if (actorCalc) {
calc.ew += actorCalc.stats.attackBonus.value;
calc.combatSkills = actorCalc.skills.combat;
@@ -94,8 +100,8 @@ export class M5Item extends Item {
if (container) {
container.prepareDerivedData();
const containerData = container.system;
}
}
const skill = character.getItem(itemData.skillId);
//console.log("M5Item.prepareDerivedData:weapon", itemData, skill?.system)
if (skill) {
@@ -115,7 +121,7 @@ export class M5Item extends Item {
calc.containers = null;
if (actor) {
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
const actorCalc = character.derivedData({ items: true, spells: true, effects: true, kampfkuenste: true, encumbrance: true });
if (actorCalc) {
calc.ew += actorCalc.stats.defense.value + actorCalc.stats.defenseBonus.value;
calc.combatSkills = actorCalc.skills.combat;
@@ -127,7 +133,7 @@ export class M5Item extends Item {
if (container) {
container.prepareDerivedData();
const containerData = container.system;
}
}
const skill = character.getItem(itemData.skillId);
//console.log("M5Item.prepareDerivedData:weapon", itemData, skill?.system)
@@ -148,7 +154,7 @@ export class M5Item extends Item {
itemData.mods[5] = { type: "stat", id: "apProtection", operation: "set", value: itemData.apProtection };
calc.containers = null;
if (actor) {
const actorCalc = actor.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
const actorCalc = actor.derivedData({ items: true, spells: true, effects: true, kampfkuenste: true, encumbrance: true });
if (actorCalc) {
calc.containers = actorCalc.gear.containers;
}
@@ -157,12 +163,12 @@ export class M5Item extends Item {
if (container) {
container.prepareDerivedData();
const containerData = container.system;
}
}
}
}
} else if (itemType === "spell") {
calc.fw = 0;
if (actor) {
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
const actorCalc = character.derivedData({ items: true, spells: true, effects: true, kampfkuenste: true, encumbrance: true });
if (actorCalc) {
calc.ew = actorCalc.stats.spellCasting.value;
}
@@ -174,7 +180,7 @@ export class M5Item extends Item {
calc.generalSkills = null;
if (actor) {
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
const actorCalc = character.derivedData({ items: true, spells: true, effects: true, kampfkuenste: true, encumbrance: true });
if (actorCalc) {
calc.generalSkills = actorCalc.skills.general;
}
@@ -217,7 +223,13 @@ export class M5Item extends Item {
}
case M5ModType.SKILL: {
if (character) {
const actorCalc = character.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
const actorCalc = character.derivedData({
items: true,
spells: true,
effects: true,
kampfkuenste: true,
encumbrance: true,
});
if (actorCalc) {
let category = (game as Game).i18n.localize("midgard5.skill");
Object.keys(actorCalc.skills.general).forEach((skillId) => {