From 2b8f2da7d84f3e8a79bc5c45e3f410105b755109 Mon Sep 17 00:00:00 2001 From: LeFrique Date: Thu, 14 Mar 2024 12:08:20 +0100 Subject: [PATCH] Skill & Sheets Update + Added FW-Increase/Decrease on Weapon and Language Skills + Added ItemIcons for Skills, Gear, Spells, Combat and Effects + Re-Added Belastungseffect with all mods working nearly smoothless (only bugging on new actors once created) --- lang/de.json | 1 + source/module/actors/M5Character.ts | 93 ++++++++++++-------------- templates/sheets/character/combat.hbs | 12 ++++ templates/sheets/character/effects.hbs | 4 ++ templates/sheets/character/gear.hbs | 15 +++++ templates/sheets/character/skills.hbs | 38 ++++++++--- templates/sheets/character/spells.hbs | 8 ++- 7 files changed, 106 insertions(+), 65 deletions(-) diff --git a/lang/de.json b/lang/de.json index 327c633..efd3e95 100644 --- a/lang/de.json +++ b/lang/de.json @@ -248,6 +248,7 @@ "midgard5.learned-skills": "Gelernte Fertigkeiten", "midgard5.language": "Sprache", "midgard5.languages": "Sprachen", + "midgard5.writings": "Schriften", "midgard5.weapon-skill": "Waffenfertigkeit", "midgard5.weapon-skills": "Waffenfertigkeiten", "midgard5.unlearned-skill": "Ungelernte Fertigkeit", diff --git a/source/module/actors/M5Character.ts b/source/module/actors/M5Character.ts index 290bae8..716e3c1 100644 --- a/source/module/actors/M5Character.ts +++ b/source/module/actors/M5Character.ts @@ -363,6 +363,7 @@ export class M5Character extends Actor { ret.gear.weapons[item.id] = { label: label, + icon: item.img, skillId: item.system.skillId, magic: item.system.magic, valuable: item.system?.valuable, @@ -405,6 +406,7 @@ export class M5Character extends Actor { ret.gear.defensiveWeapons[item.id] = { label: label, + icon: item.img, skillId: item.system.skillId, magic: item.system.magic, valuable: item.system?.valuable, @@ -448,6 +450,7 @@ export class M5Character extends Actor { ret.gear.armor[item.id] = { label: label, + icon: item.img, magic: item.system.magic, valuable: item.system?.valuable, hoarded: item.system?.hoarded, @@ -460,57 +463,41 @@ export class M5Character extends Actor { containerId: item.system.containerId || "", }; }); - - // if (!skip?.encumbrance) { - // const item = context.items.filter((x) => x.name === "Belastung"); - // if (ret.stats.encumbrance > ret.stats.heavyLoad) { - // if (item.length === 0) { - // this.createEffect("Belastung", [{ id: "movement", operation: M5ModOperation.DIVISION, type: M5ModType.STAT, value: 2 }]); - // } 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.length === 1) { - // item[0]?.update({ - // data: { - // equipped: false, - // }, - // }); - // } - // } - // } - - // if (!skip?.encumbrance) { - // const item = context.items.filter((x) => x.name === "Höchstlast"); - // if (ret.stats.encumbrance > ret.stats.loadMax) { - // if (item.length === 0) { - // this.createEffect("Höchstlast", [{ id: "ap", operation: M5ModOperation.SUBTRACT, type: M5ModType.STAT, value: 1 }]); - // } 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.loadMax) { - // if (item.length === 1) { - // item[0]?.update({ - // data: { - // equipped: false, - // }, - // }); - // } - // } - // } - } + + const item = context.items.filter((x) => x.name === "Belastung"); + if (item.length === 0) { + this.createEffect("Belastung", [ + { id: "movement", operation: M5ModOperation.DIVISION, type: M5ModType.STAT, value: 2 }, + { id: "attackBonus", operation: M5ModOperation.SUBTRACT, type: M5ModType.STAT, value: 4 }, + { id: "defenseBonus", operation: M5ModOperation.SUBTRACT, type: M5ModType.STAT, value: 4 } + ]); + } else if (item.length === 2) { + item[1]?.delete(); + } + + if (item.length === 1) { + item[0]?.update({ + img: "icons/containers/bags/sack-simple-leather-orange.webp" }); + } + + if (ret.stats.encumbrance <= ret.stats.heavyLoad) { + item[0]?.update({ + data: { + equipped: false, + } + }); + } + + if (!skip?.encumbrance) { + if (ret.stats.encumbrance > ret.stats.heavyLoad) { + item[0].update({ + data: { + equipped: true, + }, + }); + } + } + } if (!skip?.effects) { context.items @@ -526,6 +513,7 @@ export class M5Character extends Actor { ret.gear.effects[item.id] = { label: label, + icon: item.img, magic: item.system.magic, calc: item.system.calc, equipped: item.system?.equipped || false, @@ -543,6 +531,7 @@ export class M5Character extends Actor { const skillMap = ret.skills[item.system.type]; skillMap[item.id] = { label: item.name, + icon: item.img, fw: item.system.fw, attribute: item.system.attribute, pp: item.system.pp, @@ -570,6 +559,7 @@ export class M5Character extends Actor { ret.spells[item.id] = { label: item.name, + icon: item.img, process: "midgard5.spell-process-" + item.system.process, calc: item.system.calc, type: item.system.type, @@ -593,6 +583,7 @@ export class M5Character extends Actor { ret.kampfkuenste[item.id] = { label: item.name, + icon: item.img, isKido: item.system.isKido, type: item.system.type, variante: item.system.variante, diff --git a/templates/sheets/character/combat.hbs b/templates/sheets/character/combat.hbs index d2a38f2..bd11d3c 100644 --- a/templates/sheets/character/combat.hbs +++ b/templates/sheets/character/combat.hbs @@ -54,6 +54,7 @@ + @@ -65,6 +66,7 @@ {{#each data.calc.gear.weapons as |item itemId|}} {{#if item.equipped}} + @@ -81,6 +83,7 @@ {{/each}} + @@ -93,6 +96,7 @@
{{localize "TYPES.Item.weapon"}} {{localize "midgard5.ew"}} {{localize "midgard5.damage"}}
{{item.label}}{{#if item.special}}(*){{/if}} {{item.calc.ew}} {{item.damageBase}}
{{localize "midgard5.brawl"}} {{data.calc.stats.brawlFw}} 1d6 -4
+ @@ -103,6 +107,7 @@ {{#each data.calc.kampfkuenste as |item itemId|}} +
{{localize "TYPES.Item.kampfkunst"}} {{localize "midgard5.kampfkunst-variante-short"}} {{localize "midgard5.ew"}}
{{item.label}} {{#if item.isKido}} @@ -131,17 +136,20 @@ + + + @@ -151,6 +159,7 @@
{{localize "midgard5.defense"}} {{add data.calc.stats.defense.value data.calc.stats.defenseBonus.value}}
{{localize "midgard5.resistanceMind"}} {{data.calc.stats.resistanceMind.value}}
{{localize "midgard5.resistanceBody"}} {{data.calc.stats.resistanceBody.value}}
+ @@ -162,6 +171,7 @@ {{#each data.calc.gear.defensiveWeapons as |item itemId|}} {{#if item.equipped}} + @@ -182,6 +192,7 @@
{{localize "TYPES.Item.defensiveWeapon"}} {{localize "midgard5.ew"}} {{localize "midgard5.defenseBonus-short"}}
{{item.label}} {{item.calc.ew}} {{item.defenseBonus}}
+ @@ -191,6 +202,7 @@ {{#each data.calc.gear.armor as |item itemId|}} {{#if item.equipped}} +
{{localize "TYPES.Item.armor"}} {{localize "midgard5.actor-lp-short"}}
{{item.label}} {{lpProtection}} diff --git a/templates/sheets/character/effects.hbs b/templates/sheets/character/effects.hbs index 59808f5..931816c 100644 --- a/templates/sheets/character/effects.hbs +++ b/templates/sheets/character/effects.hbs @@ -1,6 +1,7 @@ + {{#each data.calc.gear.effects as |item itemId|}} + + {{#unless (eq item.label "Belastung")}} + {{/unless}} {{/each}} diff --git a/templates/sheets/character/gear.hbs b/templates/sheets/character/gear.hbs index d56105a..78f5384 100644 --- a/templates/sheets/character/gear.hbs +++ b/templates/sheets/character/gear.hbs @@ -69,6 +69,7 @@
{{localize "TYPES.Item.effect"}} @@ -9,6 +10,7 @@
{{item.label}} {{#if item.equipped}} @@ -18,7 +20,9 @@ {{/unless}} {{/if}}
+ @@ -83,6 +84,7 @@ {{#each ../data.calc.gear.items as |item itemId|}} {{#if (eq item.containerId containerId)}} + @@ -116,6 +118,7 @@ {{#each ../data.calc.gear.weapons as |item itemId|}} {{#if (eq item.containerId containerId)}} + @@ -145,6 +148,7 @@ {{#each ../data.calc.gear.defensiveWeapons as |item itemId|}} {{#if (eq item.containerId containerId)}} + @@ -174,6 +178,7 @@ {{#each ../data.calc.gear.armor as |item itemId|}} {{#if (eq item.containerId containerId)}} + @@ -222,6 +227,7 @@
{{localize "TYPES.Item.item"}} {{localize "midgard5.item-quantity"}} {{localize "midgard5.item-value"}}
{{item.label}}
{{item.label}}
{{item.label}}
{{item.label}}
+ @@ -234,6 +240,7 @@ {{#each data.calc.gear.containers as |item itemId|}} + @@ -269,6 +276,7 @@
{{localize "TYPES.Item.container"}} {{localize "midgard5.item-value"}} {{localize "midgard5.item-weight"}}
{{item.label}}
+ @@ -283,6 +291,7 @@ {{#each data.calc.gear.items as |item itemId|}} {{#if (or ../data.info.showAllItems (eq item.containerId ""))}} + @@ -325,6 +334,7 @@
{{localize "TYPES.Item.item"}} {{localize "midgard5.item-quantity"}} {{localize "midgard5.item-value"}}
{{item.label}}
+ @@ -337,6 +347,7 @@ {{#each data.calc.gear.weapons as |item itemId|}} {{#if (or ../data.info.showAllItems (eq item.containerId ""))}} +
{{localize "TYPES.Item.weapon"}} {{localize "midgard5.item-value"}} {{localize "midgard5.item-weight"}}
{{item.label}} {{#unless (or (eq item.value 0) (eq item.currency ""))}} @@ -370,6 +381,7 @@ + @@ -381,6 +393,7 @@ {{#each data.calc.gear.defensiveWeapons as |item itemId|}} {{#if (or ../data.info.showAllItems (eq item.containerId ""))}} +
{{localize "TYPES.Item.defensiveWeapon"}} {{localize "midgard5.item-value"}} {{localize "midgard5.item-weight"}}
{{item.label}} {{#unless (or (eq item.value 0) (eq item.currency ""))}} @@ -414,6 +427,7 @@ + @@ -425,6 +439,7 @@ {{#each data.calc.gear.armor as |item itemId|}} {{#if (or ../data.info.showAllItems (eq item.containerId ""))}} +
{{localize "TYPES.Item.armor"}} {{localize "midgard5.item-value"}} {{localize "midgard5.item-weight"}}
{{item.label}} {{#unless (or (eq item.value 0) (eq item.currency ""))}} diff --git a/templates/sheets/character/skills.hbs b/templates/sheets/character/skills.hbs index bea88e2..23c8c18 100644 --- a/templates/sheets/character/skills.hbs +++ b/templates/sheets/character/skills.hbs @@ -6,6 +6,7 @@ + @@ -17,6 +18,7 @@ {{#each data.calc.skills.innate as |skill skillId|}} + @@ -26,14 +28,7 @@ {{/each}} - - - - - - - - + @@ -41,6 +36,15 @@ + + + + + + + + +
{{localize "midgard5.innate-ability"}} {{localize "midgard5.fw"}} {{localize "midgard5.bonus"}}
{{skill.label}} {{skill.fw}} {{skill.calc.bonus}}
{{localize "midgard5.perception"}}{{data.calc.stats.perceptionFW}}{{data.calc.stats.perception.value}}{{add data.calc.stats.perception.value data.calc.stats.perceptionFW}}
{{localize "midgard5.drinking"}} {{data.calc.stats.drinkingFW}} {{data.calc.stats.drinking.value}}
{{localize "midgard5.perception"}}{{data.calc.stats.perceptionFW}}{{data.calc.stats.perception.value}}{{add data.calc.stats.perception.value data.calc.stats.perceptionFW}}
@@ -84,6 +88,7 @@ + @@ -96,8 +101,13 @@ {{#each data.calc.skills.combat as |skill skillId|}} + - + @@ -110,10 +120,11 @@
-
{{localize "midgard5.languages"}}
+
{{localize "midgard5.languages"}} & {{localize "midgard5.writings"}}
{{localize "midgard5.weapon-skill"}} {{localize "midgard5.fw"}} {{localize "midgard5.bonus"}}
{{skill.label}}{{skill.fw}} + + {{skill.fw}} + + {{skill.calc.bonus}} {{skill.calc.ew}} {{skill.pp}}
+ @@ -126,8 +137,13 @@ {{#each data.calc.skills.language as |skill skillId|}} + - + diff --git a/templates/sheets/character/spells.hbs b/templates/sheets/character/spells.hbs index d54a85d..df236c5 100644 --- a/templates/sheets/character/spells.hbs +++ b/templates/sheets/character/spells.hbs @@ -30,6 +30,7 @@
{{localize "midgard5.language"}} {{localize "midgard5.fw"}} {{localize "midgard5.bonus"}}
{{skill.label}}{{skill.fw}} + + {{skill.fw}} + + {{skill.calc.bonus}} {{skill.calc.ew}} {{skill.pp}}
+ @@ -40,13 +41,14 @@ - + {{#each data.calc.spells as |item itemId|}} + {{/each}} - -
{{localize "TYPES.Item.spell"}} {{localize "midgard5.spell-type"}} {{localize "midgard5.spell-castDuration-short"}}{{localize "midgard5.spell-effectDuration-short"}} {{localize "midgard5.ew"}}
{{item.label}} {{localize item.process}} @@ -70,8 +72,8 @@
+
+