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/package.json b/package.json index 85606b7..36e491b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "foundry-system-midgard5", - "version": "2.0.0", + "version": "2.1.0", "description": "", "main": "index.js", "scripts": { 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/M5Base.ts b/source/module/M5Base.ts index 27e40a2..72973f8 100644 --- a/source/module/M5Base.ts +++ b/source/module/M5Base.ts @@ -145,7 +145,7 @@ export interface M5CharacterCalculatedData { damageBonus: M5ModResult; attackBonus: M5ModResult; defenseBonus: M5ModResult; - movementBonus: M5ModResult; + movement: M5ModResult; resistanceMind: M5ModResult; resistanceBody: M5ModResult; spellCasting: M5ModResult; diff --git a/source/module/actors/M5Character.ts b/source/module/actors/M5Character.ts index 7bdd89f..cfbc6cc 100644 --- a/source/module/actors/M5Character.ts +++ b/source/module/actors/M5Character.ts @@ -58,7 +58,7 @@ export class M5Character extends Actor { damageBonus: { value: 0, mods: [] }, attackBonus: { value: 0, mods: [] }, defenseBonus: { value: 0, mods: [] }, - movementBonus: { value: 0, mods: [] }, + movement: { value: 0, mods: [] }, resistanceMind: { value: 0, mods: [] }, resistanceBody: { value: 0, mods: [] }, spellCasting: { value: 0, mods: [] }, @@ -121,7 +121,7 @@ export class M5Character extends Actor { ret.stats.damageBonus = this.modResult(Math.floor(ret.attributes.st.value / 20) + Math.floor(ret.attributes.gs.value / 30) - 3); ret.stats.attackBonus = this.modResult(ret.attributes.gs.bonus); ret.stats.defenseBonus = this.modResult(ret.attributes.gw.bonus); - ret.stats.movementBonus = this.modResult(0); + ret.stats.movement = this.modResult(data.movement); ret.stats.resistanceMind = this.modResult( (data.info.magicUsing ? 2 : 0) + ret.stats.defense.value + (data.info.race === "Mensch" ? ret.attributes.in.bonus : this.raceBonus(data.info.race)) ); @@ -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/actors/M5ModAggregate.ts b/source/module/actors/M5ModAggregate.ts index a07b142..f3ec131 100644 --- a/source/module/actors/M5ModAggregate.ts +++ b/source/module/actors/M5ModAggregate.ts @@ -31,7 +31,7 @@ export default class M5ModAggregate { this.push({ type: M5ModType.STAT, id: M5Stats.DEFENSE, operation: M5ModOperation.SET, value: calc.stats.defenseBonus.value }, characterString); this.push({ type: M5ModType.STAT, id: M5Stats.ATTACK, operation: M5ModOperation.SET, value: calc.stats.attackBonus.value }, characterString); this.push({ type: M5ModType.STAT, id: M5Stats.DAMAGE, operation: M5ModOperation.SET, value: calc.stats.damageBonus.value }, characterString); - this.push({ type: M5ModType.STAT, id: M5Stats.MOVEMENT, operation: M5ModOperation.SET, value: calc.stats.movementBonus.value }, characterString); + this.push({ type: M5ModType.STAT, id: M5Stats.MOVEMENT, operation: M5ModOperation.SET, value: calc.stats.movement.value }, characterString); this.push({ type: M5ModType.STAT, id: M5Stats.RESISTANCE_MIND, operation: M5ModOperation.SET, value: calc.stats.resistanceMind.value }, characterString); this.push({ type: M5ModType.STAT, id: M5Stats.RESISTANCE_BODY, operation: M5ModOperation.SET, value: calc.stats.resistanceBody.value }, characterString); this.push({ type: M5ModType.STAT, id: M5Stats.SPELL_CASTING, operation: M5ModOperation.SET, value: calc.stats.spellCasting.value }, characterString); 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/system.json b/source/system.json index f347969..56ef917 100644 --- a/source/system.json +++ b/source/system.json @@ -3,7 +3,7 @@ "name": "midgard5", "title": "Midgard 5. Edition", "description": "The German RPG Midgard 5. Edition", - "version": "2.0.0", + "version": "2.1.0", "compatibility": { "minimum": "10", "verified": "11", @@ -89,8 +89,8 @@ "primaryTokenAttribute": "lp", "secondaryTokenAttribute": "ap", "url": "https://github.com/Byroks/foundry-vtt-system-midgard5", - "manifest": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v2.0.0/system.json", - "download": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v2.0.0/midgard5-v2.0.0.zip", + "manifest": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v2.1.0/system.json", + "download": "https://github.com/Byroks/foundry-vtt-system-midgard5/releases/download/v2.1.0/midgard5-v2.1.0.zip", "initiative": "@c.calc.attributes.gw.value", "license": "LICENSE.txt" } \ No newline at end of file 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/base_values.hbs b/templates/sheets/character/base_values.hbs index 1a72a1d..43866ed 100644 --- a/templates/sheets/character/base_values.hbs +++ b/templates/sheets/character/base_values.hbs @@ -56,7 +56,7 @@ {{localize "midgard5.luckPoints"}} {{localize "Bewegungsweite"}} - + 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