Item merkmale
This commit is contained in:
1 parent
e4eecb7b8e
commit
9964948e31
17 files changed
+148
-41
No files matched your search
@@ -1,9 +1,7 @@
|
||||
export async function prepArmor(actor) {
|
||||
const actorData = actor.system;
|
||||
|
||||
// 1. Basis-Wert festlegen
|
||||
let baseRüstwert = actorData.rüstwert || 0;
|
||||
|
||||
let baseRüstwert = actorData.rüstwert.base || 0;
|
||||
// 2. Ausgerüstete Rüstung finden und addieren
|
||||
const equippedMainArmor = actor.items.filter(
|
||||
(i) => i.type === "armor" && i.system.equipped && !i.system.zusätzlich
|
||||
@@ -12,13 +10,27 @@ export async function prepArmor(actor) {
|
||||
(i) => i.type === "armor" && i.system.equipped && i.system.zusätzlich
|
||||
);
|
||||
let armorBonus = Math.max(...equippedMainArmor.map((x) => x.system.rüstwert), 0);
|
||||
|
||||
for (let armor of equippedAddArmor) {
|
||||
armorBonus += armor.system.rüstwert;
|
||||
}
|
||||
|
||||
// 3. Finalen Standard-Wert berechnen
|
||||
actorData.rüstwert = baseRüstwert + armorBonus;
|
||||
actorData.rüstwert.mod = baseRüstwert + armorBonus;
|
||||
|
||||
const armors = [];
|
||||
const einschränkungen = [];
|
||||
[...equippedMainArmor, ...equippedAddArmor]?.forEach((armor) => {
|
||||
einschränkungen.push(...armor.system.merkmale);
|
||||
|
||||
const w = {
|
||||
name: armor.name,
|
||||
rüstwert: armor.system.rüstwert,
|
||||
img: armor.img,
|
||||
id: armor.id
|
||||
};
|
||||
armors.push(w);
|
||||
});
|
||||
|
||||
return { armors: armors, einschränkungen: [...new Set(einschränkungen)] };
|
||||
}
|
||||
|
||||
export async function prepWeapons(actor) {
|
||||
@@ -45,7 +57,6 @@ export async function prepSpells(actor) {
|
||||
const spellItems = actor.items.filter((x) => x.type === "zauber" && x.system.equipped);
|
||||
const spells = [];
|
||||
const skill = foundry.utils.getProperty(actor, "system.skills.magie.zaubern");
|
||||
console.warn(skill, spellItems);
|
||||
spellItems.forEach((spell) => {
|
||||
const w = {
|
||||
name: spell.name,
|
||||
@@ -63,7 +74,7 @@ export async function prepSpells(actor) {
|
||||
}
|
||||
|
||||
export async function prepWeight(actor) {
|
||||
const items = actor.items.filter((x) => x.system.gewicht);
|
||||
const items = actor.items.filter((x) => x.system.gewicht && !x.system.equipped);
|
||||
let gewicht = items.reduce((accumulator, item) => accumulator + item.system.gewicht, 0);
|
||||
|
||||
let traglast = Math.max(actor.system.skills.körper.athletik.value, 10);
|
||||
|
||||
Reference in new issue
Block a user