From e338b79d3ad108e3f1a747ccab4e3f6a743fff0f Mon Sep 17 00:00:00 2001 From: Sven Balzer <4653051+Kyuusokuna@users.noreply.github.com> Date: Mon, 4 Aug 2025 10:05:42 +0200 Subject: [PATCH] add Wunden --- src/ActorSheet.hbs | 40 ++++++++++++++++ src/lang/de.json | 12 +++++ src/main.css | 32 +++++++++++++ src/main.mjs | 114 ++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 191 insertions(+), 7 deletions(-) diff --git a/src/ActorSheet.hbs b/src/ActorSheet.hbs index cfa1465..680c667 100644 --- a/src/ActorSheet.hbs +++ b/src/ActorSheet.hbs @@ -441,6 +441,46 @@
+
+
+
{{localize "DSA41.kampf.wunden.label"}}
+
+ + {{#*inline "wunden"}} +
+ + + +
+ {{/inline}} + +
+
{{localize "DSA41.kampf.wunden.kopf"}}
+ {{>wunden location="kopf"}} +
{{localize "DSA41.kampf.wunden.brust"}}
+ {{>wunden location="brust"}} +
+ +
+
{{localize "DSA41.kampf.wunden.bauch"}}
+ {{>wunden location="bauch"}} +
+ +
+
{{localize "DSA41.kampf.wunden.linker_arm"}}
+ {{>wunden location="linker_arm"}} +
{{localize "DSA41.kampf.wunden.rechter_arm"}}
+ {{>wunden location="rechter_arm"}} +
+ +
+
{{localize "DSA41.kampf.wunden.linkes_bein"}}
+ {{>wunden location="linkes_bein"}} +
{{localize "DSA41.kampf.wunden.rechtes_bein"}}
+ {{>wunden location="rechtes_bein"}} +
+
+
{{localize "DSA41.kampf.bewaffnung"}}
diff --git a/src/lang/de.json b/src/lang/de.json index 425b1d2..2611126 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -537,6 +537,18 @@ "still": "Still", "seitenwind": "Böiger Seitenwind", "starker_seitenwind": "Starker Seitenwind" + }, + + "wunden": { + "label": "Wunden", + + "kopf": "Kopf", + "brust": "Brust", + "bauch": "Bauch", + "linker_arm": "Linker Arm", + "rechter_arm": "Rechter Arm", + "linkes_bein": "Linkes Bein", + "rechtes_bein": "Rechtes Bein" } }, diff --git a/src/main.css b/src/main.css index 282f79f..ce676f0 100644 --- a/src/main.css +++ b/src/main.css @@ -592,6 +592,38 @@ html { } &[data-tab="kampf"] { + & .Wunden { + grid-template-columns: minmax(0, max-content) minmax(0, 1fr) minmax(0, max-content) minmax(0, 1fr); + + & .wunde { + display: inline; + + width: 2em; + height: 2em; + margin: 0 .25em 0 .25em; + + content: url("/icons/skills/wounds/injury-triple-slash-bleed.webp"); + + mix-blend-mode: difference; + + &.active { + filter: grayscale(0.0); + + &:hover, &:hover ~ .wunde.active { + filter: grayscale(0.75); + } + } + + &:not(.active) { + filter: grayscale(1.0); + + &:hover, &:has( ~ .wunde:hover) { + filter: grayscale(0.25); + } + } + } + } + & .Bewaffnung { grid-template-columns: minmax(0, max-content) repeat(3, minmax(0, auto)); diff --git a/src/main.mjs b/src/main.mjs index 47ea397..9072e0b 100644 --- a/src/main.mjs +++ b/src/main.mjs @@ -598,6 +598,16 @@ class DSA41_CharacterData extends TypeDataModel { modifikator_attacke: new NumberField({integer: true, initial: 0}), modifikator_parade: new NumberField({integer: true, initial: 0}), modifikator_fernkampf: new NumberField({integer: true, initial: 0}), + + wunden: new SchemaField({ + kopf: new NumberField({integer: true, initial: 0, min: 0, max: 3 }), + brust: new NumberField({integer: true, initial: 0, min: 0, max: 3 }), + bauch: new NumberField({integer: true, initial: 0, min: 0, max: 3 }), + linker_arm: new NumberField({integer: true, initial: 0, min: 0, max: 3 }), + rechter_arm: new NumberField({integer: true, initial: 0, min: 0, max: 3 }), + linkes_bein: new NumberField({integer: true, initial: 0, min: 0, max: 3 }), + rechtes_bein: new NumberField({integer: true, initial: 0, min: 0, max: 3 }), + }), } } @@ -634,14 +644,97 @@ class DSA41_CharacterData extends TypeDataModel { gesamt_behinderung: 0.0, }, }, + + wunden_modifiers: { + courage: 0, + cleverness: 0, + intuition: 0, + dexterity: 0, + agility: 0, + constitution: 0, + strength: 0, + initiative_basis: 0, + initiative: "", + attacke: 0, + parade: 0, + schaden: "", + }, }; + if (this.wunden.kopf >= 1) { + this.computed.wunden_modifiers.courage += -2 * this.wunden.kopf; + this.computed.wunden_modifiers.cleverness += -2 * this.wunden.kopf; + this.computed.wunden_modifiers.intuition += -2 * this.wunden.kopf; + this.computed.wunden_modifiers.initiative_basis += -2 * this.wunden.kopf; + this.computed.wunden_modifiers.initiative += (-2 * this.wunden.kopf) + "d6"; + + if (this.wunden.kopf >= 3) this.computed.wunden_modifiers.schaden += "+ 2d6"; + } + + if (this.wunden.brust >= 1) { + this.computed.wunden_modifiers.attacke += -this.wunden.brust; + this.computed.wunden_modifiers.parade += -this.wunden.brust; + this.computed.wunden_modifiers.constitution += -this.wunden.brust; + this.computed.wunden_modifiers.strength += -this.wunden.brust; + this.computed.wunden_modifiers.schaden += "+" + this.wunden.brust + "d6"; + } + + if (this.wunden.bauch >= 1) { + this.computed.wunden_modifiers.attacke += -this.wunden.bauch; + this.computed.wunden_modifiers.parade += -this.wunden.bauch; + this.computed.wunden_modifiers.constitution += -this.wunden.bauch; + this.computed.wunden_modifiers.strength += -this.wunden.bauch; + this.computed.wunden_modifiers.initiative_basis += -this.wunden.bauch; + this.computed.wunden_modifiers.schaden += "+" + this.wunden.bauch + "d6"; + } + + if (this.wunden.linker_arm >= 1) { + this.computed.wunden_modifiers.attacke += -2 * this.wunden.linker_arm; + this.computed.wunden_modifiers.parade += -2 * this.wunden.linker_arm; + this.computed.wunden_modifiers.strength += -2 * this.wunden.linker_arm; + this.computed.wunden_modifiers.dexterity += -2 * this.wunden.linker_arm; + } + + if (this.wunden.rechter_arm >= 1) { + this.computed.wunden_modifiers.attacke += -2 * this.wunden.rechter_arm; + this.computed.wunden_modifiers.parade += -2 * this.wunden.rechter_arm; + this.computed.wunden_modifiers.strength += -2 * this.wunden.rechter_arm; + this.computed.wunden_modifiers.dexterity += -2 * this.wunden.rechter_arm; + } + + if (this.wunden.linkes_bein >= 1) { + this.computed.wunden_modifiers.attacke += -2 * this.wunden.linkes_bein; + this.computed.wunden_modifiers.parade += -2 * this.wunden.linkes_bein; + this.computed.wunden_modifiers.agility += -2 * this.wunden.linkes_bein; + this.computed.wunden_modifiers.initiative_basis += -2 * this.wunden.linkes_bein; + } + + if (this.wunden.rechtes_bein >= 1) { + this.computed.wunden_modifiers.attacke += -2 * this.wunden.rechtes_bein; + this.computed.wunden_modifiers.parade += -2 * this.wunden.rechtes_bein; + this.computed.wunden_modifiers.agility += -2 * this.wunden.rechtes_bein; + this.computed.wunden_modifiers.initiative_basis += -2 * this.wunden.rechtes_bein; + } + this.computed.abenteuerpunkte.uebrig = this.abenteuerpunkte.gesamt - this.abenteuerpunkte.ausgegeben; - for (const [attribute, values] of Object.entries(this.attributes)) { - this.computed.attributes[attribute] = values.initial + values.advancement + values.modifier; - this.computed.attributes_without_modifiers[attribute] = values.initial + values.advancement; - } + this.computed.attributes_without_modifiers.courage = this.attributes.courage.initial + this.attributes.courage.advancement; + this.computed.attributes_without_modifiers.cleverness = this.attributes.cleverness.initial + this.attributes.cleverness.advancement; + this.computed.attributes_without_modifiers.intuition = this.attributes.intuition.initial + this.attributes.intuition.advancement; + this.computed.attributes_without_modifiers.charisma = this.attributes.charisma.initial + this.attributes.charisma.advancement; + this.computed.attributes_without_modifiers.dexterity = this.attributes.dexterity.initial + this.attributes.dexterity.advancement; + this.computed.attributes_without_modifiers.agility = this.attributes.agility.initial + this.attributes.agility.advancement; + this.computed.attributes_without_modifiers.constitution = this.attributes.constitution.initial + this.attributes.constitution.advancement; + this.computed.attributes_without_modifiers.strength = this.attributes.strength.initial + this.attributes.strength.advancement; + + this.computed.attributes.courage = this.computed.attributes_without_modifiers.courage + this.attributes.courage.modifier + this.computed.wunden_modifiers.courage; + this.computed.attributes.cleverness = this.computed.attributes_without_modifiers.cleverness + this.attributes.cleverness.modifier + this.computed.wunden_modifiers.cleverness; + this.computed.attributes.intuition = this.computed.attributes_without_modifiers.intuition + this.attributes.intuition.modifier + this.computed.wunden_modifiers.intuition; + this.computed.attributes.charisma = this.computed.attributes_without_modifiers.charisma + this.attributes.charisma.modifier; + this.computed.attributes.dexterity = this.computed.attributes_without_modifiers.dexterity + this.attributes.dexterity.modifier + this.computed.wunden_modifiers.dexterity; + this.computed.attributes.agility = this.computed.attributes_without_modifiers.agility + this.attributes.agility.modifier + this.computed.wunden_modifiers.agility; + this.computed.attributes.constitution = this.computed.attributes_without_modifiers.constitution + this.attributes.constitution.modifier + this.computed.wunden_modifiers.constitution; + this.computed.attributes.strength = this.computed.attributes_without_modifiers.strength + this.attributes.strength.modifier + this.computed.wunden_modifiers.strength; this.computed.lebenspunkte = {}; this.computed.ausdauer = {}; @@ -694,9 +787,9 @@ class DSA41_CharacterData extends TypeDataModel { this.computed.kampf.ruestungen_gesamt[key] = Math.round(value); } - this.computed.initiative.wert = this.computed.initiative.basiswert + this.modifikator_initiative - this.computed.kampf.ruestungen_gesamt.gesamt_behinderung; - this.computed.attacke.wert = this.computed.attacke.basiswert + this.modifikator_attacke; - this.computed.parade.wert = this.computed.parade.basiswert + this.modifikator_parade; + this.computed.initiative.wert = this.computed.initiative.basiswert + this.modifikator_initiative - this.computed.kampf.ruestungen_gesamt.gesamt_behinderung + this.computed.wunden_modifiers.initiative_basis; + this.computed.attacke.wert = this.computed.attacke.basiswert + this.modifikator_attacke + this.computed.wunden_modifiers.attacke; + this.computed.parade.wert = this.computed.parade.basiswert + this.modifikator_parade + this.computed.wunden_modifiers.parade; this.computed.fernkampf.wert = this.computed.fernkampf.basiswert + this.modifikator_fernkampf; this.kampftalente = this.parent.items.filter((x) => x.type === "Kampftalent").sort((a, b) => a.name > b.name); @@ -1560,6 +1653,13 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { content: item.system.beschreibung, }); }, + + "toggle-wound": async function(event, target) { + const location = event.target.closest("[data-location]").dataset.location; + const current_count = this.document.system.wunden[location]; + const toggled_count = Array.prototype.indexOf.call(event.target.parentNode.children, event.target) + 1; + this.document.update({ ["system.wunden." + location]: toggled_count > current_count ? toggled_count : toggled_count - 1 }); + } }, };