diff --git a/lang/de.json b/lang/de.json index 9d42861..1014c7f 100644 --- a/lang/de.json +++ b/lang/de.json @@ -197,6 +197,8 @@ "midgard5.defensive-weapon": "Verteidigungswaffe", "midgard5.no-skill": "Keine Fertigkeit", "midgard5.magic": "magisch", + "midgard5.equipped": "Ausgerüstet", + "midgard5.active": "Aktiv", "midgard5.rangedWeapon": "Schusswaffe", "midgard5.assignItemToCharacter": "Füge Gegenstand einem Charakter hinzu, um Fähigkeit auwählen zu können", diff --git a/packs/items/blaupause-gegenstaende/rüstung.json b/packs/items/blaupause-gegenstaende/rüstung.json index bedad89..c76a252 100644 --- a/packs/items/blaupause-gegenstaende/rüstung.json +++ b/packs/items/blaupause-gegenstaende/rüstung.json @@ -13,8 +13,7 @@ "resistanceBody": 0, "spellBonus": 0 }, - "equippable": false, - "equipped": true, + "equipped": false, "attributeMod": { "st": 0, "gs": 0, @@ -43,4 +42,4 @@ "XD0IpWT6bN4AJiYQ": 3 }, "_id": "pV1hNavlQGJ9UaEf" -} \ No newline at end of file +} diff --git a/source/PreloadTemplates.ts b/source/PreloadTemplates.ts index 4dc8b1b..7f5fa17 100644 --- a/source/PreloadTemplates.ts +++ b/source/PreloadTemplates.ts @@ -13,6 +13,7 @@ const preloadTemplates = async (): Promise[]> = "sheets/character/spells.hbs", "sheets/character/kampfkuenste.hbs", "sheets/character/effects.hbs", + "sheets/partial/mod.hbs", "sheets/item/rolls.hbs", "chat/roll-m5.hbs", ]; diff --git a/source/module/actors/M5Character.ts b/source/module/actors/M5Character.ts index 700b0b5..cfbc6cc 100644 --- a/source/module/actors/M5Character.ts +++ b/source/module/actors/M5Character.ts @@ -138,7 +138,7 @@ export class M5Character extends Actor { const aggregate = new M5ModAggregate(data, ret); context.items - ?.filter((item) => item.type === "item" || item.type === "effect") + ?.filter((item) => (item.type === "item" || item.type === "effect" || item.type === "armor") && item.system.equipped) .forEach((item) => { const mods = item.system.mods; //console.log("Actor item mods", mods) @@ -166,6 +166,7 @@ export class M5Character extends Actor { label: label, magic: item.system.magic, calc: item.system.calc, + equipped: item.system?.equipped, }; }); } @@ -185,6 +186,7 @@ export class M5Character extends Actor { label: label, magic: item.system.magic, calc: item.system.calc, + equipped: item.system?.equipped, }; }); } @@ -267,6 +269,7 @@ export class M5Character extends Actor { label: label, magic: item.system.magic, calc: item.system.calc, + equipped: item.system?.equipped, }; }); } diff --git a/source/module/items/M5Item.ts b/source/module/items/M5Item.ts index 029f552..0c11969 100644 --- a/source/module/items/M5Item.ts +++ b/source/module/items/M5Item.ts @@ -105,6 +105,11 @@ export class M5Item extends Item { calc.fw += skillData.fw; } } + } else if (itemType === "armor") { + itemData.mods[0] = { type: "stat", id: "defenseBonus", operation: "add", value: itemData.stats.defenseBonus }; + itemData.mods[1] = { type: "stat", id: "attackBonus", operation: "add", value: itemData.stats.attackBonus }; + itemData.mods[2] = { type: "stat", id: "movement", operation: "add", value: itemData.stats.movementBonus }; + itemData.mods[3] = { type: "attribute", id: "gw", operation: "add100", value: itemData.attributeMod.gw }; } else if (itemType === "spell") { calc.fw = 0; if (actor) { @@ -134,8 +139,10 @@ export class M5Item extends Item { itemData.rolls.formulas[0].label = skill.name; } } - } else if (itemType === "item" || itemType === "effect") { + } + if (itemData?.mods) { calc.mods = {}; + Object.keys(itemData?.mods).forEach((key) => { const mod = itemData.mods[key]; const modCalc = {}; @@ -243,6 +250,7 @@ export class M5Item extends Item { } const roll = new M5Roll(rollData, this.actor, item.name); + console.log(roll); return roll.toMessage(); } else { ChatMessage.create({ diff --git a/source/template.json b/source/template.json index 7b06587..6741d15 100644 --- a/source/template.json +++ b/source/template.json @@ -350,7 +350,8 @@ "formulas": {}, "output": "" }, - "calc": {} + "calc": {}, + "mods": {} }, "spell": { "templates": ["itemDescription", "spellSelection"], diff --git a/templates/sheets/character/effects.hbs b/templates/sheets/character/effects.hbs index 00bc46f..cf85118 100644 --- a/templates/sheets/character/effects.hbs +++ b/templates/sheets/character/effects.hbs @@ -8,7 +8,12 @@ {{#each data.calc.gear.effects as |item itemId|}} - {{item.label}} + + {{item.label}} + {{#if item.equipped}} + {{localize "midgard5.active"}} + {{/if}} + {{/each}} diff --git a/templates/sheets/character/gear.hbs b/templates/sheets/character/gear.hbs index 3376ff7..25015f1 100644 --- a/templates/sheets/character/gear.hbs +++ b/templates/sheets/character/gear.hbs @@ -84,7 +84,12 @@ {{#each data.calc.gear.armor as |item itemId|}} - {{item.label}} + + {{item.label}} + {{#if item.equipped}} + {{localize "midgard5.equipped"}} + {{/if}} + {{actorItemValue ../actor._id itemId "lpProtection"}} {{actorItemValue ../actor._id itemId "apProtection"}} {{actorItemValue ../actor._id itemId "stats.attackBonus"}} @@ -107,7 +112,12 @@ {{#each data.calc.gear.items as |item itemId|}} - {{item.label}} + + {{item.label}} + {{#if item.equipped}} + {{localize "midgard5.equipped"}} + {{/if}} + {{/each}} diff --git a/templates/sheets/item/armor.hbs b/templates/sheets/item/armor.hbs index 9d66a82..5cfbde4 100644 --- a/templates/sheets/item/armor.hbs +++ b/templates/sheets/item/armor.hbs @@ -6,10 +6,25 @@
+ + + - + @@ -17,21 +32,24 @@ - + - + - +
+
+ + + + + + + + + +
+
{{localize "midgard5.actor-lp"}} {{localize "midgard5.actor-ap"}}
{{localize "midgard5.attackBonus"}} {{localize "midgard5.defenseBonus"}}
{{localize "midgard5.movementRange"}} {{localize "midgard5.actor-gw-long"}}
+ {{> "systems/midgard5/templates/sheets/partial/mod.hbs" mods=data.mods calc=data.calc}} + + {{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
\ No newline at end of file diff --git a/templates/sheets/item/effect.hbs b/templates/sheets/item/effect.hbs index cc43767..7a5cc1b 100644 --- a/templates/sheets/item/effect.hbs +++ b/templates/sheets/item/effect.hbs @@ -6,10 +6,20 @@
- + +
- - + +
+ + + + + + + + +
{{localize "midgard5.item-value"}} @@ -19,59 +29,8 @@
- - - - - - - - - - - {{#each data.mods as |mod modId|}} - - + {{> "systems/midgard5/templates/sheets/partial/mod.hbs" mods=data.mods calc=data.calc}} - - - - - - - {{/each}} - -
Mods
- - - - - - - -
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/sheets/item/item.hbs b/templates/sheets/item/item.hbs index cc43767..a3ebea0 100644 --- a/templates/sheets/item/item.hbs +++ b/templates/sheets/item/item.hbs @@ -6,10 +6,20 @@
- + +
- - + +
+ + + + + + + + +
{{localize "midgard5.item-value"}} @@ -19,59 +29,8 @@
- - - - - - - - - - - {{#each data.mods as |mod modId|}} - - + {{> "systems/midgard5/templates/sheets/partial/mod.hbs" mods=data.mods calc=data.calc}} - - - - - - - {{/each}} - -
Mods
- - - - - - - -
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/sheets/item/kampfkunst.hbs b/templates/sheets/item/kampfkunst.hbs index 6624265..0a8f566 100644 --- a/templates/sheets/item/kampfkunst.hbs +++ b/templates/sheets/item/kampfkunst.hbs @@ -85,9 +85,9 @@ {{/each}} {{/select}} - {{!-- {{else}} + {{else}} {{localize "midgard5.assignItemToCharacter"}} - {{/if}} --}} + {{/if}} diff --git a/templates/sheets/partial/mod.hbs b/templates/sheets/partial/mod.hbs new file mode 100644 index 0000000..f56d85a --- /dev/null +++ b/templates/sheets/partial/mod.hbs @@ -0,0 +1,53 @@ + + + + + + + + + + + {{#each mods as |mod modId|}} + + + + + + + + + + {{/each}} + +
Mods
+ + + + + + + +
\ No newline at end of file