diff --git a/src/module/data/character.mjs b/src/module/data/character.mjs index 1c257cab..761659ef 100644 --- a/src/module/data/character.mjs +++ b/src/module/data/character.mjs @@ -125,7 +125,11 @@ export class PlayerCharacterDataModel extends foundry.abstract.TypeDataModel { key: new StringField(), notiz: new StringField(), })), - + wunden: new SchemaField({ + aktuell: new NumberField({required: true, integer: true}), + max: new NumberField({required: true, integer: true}), + mod: new NumberField({required: true, integer: true}), + }), heldenausruestung: new ArrayField( new SchemaField({ links: new DocumentIdField(), diff --git a/src/module/documents/character.mjs b/src/module/documents/character.mjs index 4393b264..7ce64505 100644 --- a/src/module/documents/character.mjs +++ b/src/module/documents/character.mjs @@ -54,6 +54,9 @@ export class Character extends Actor { systemData.rs = 0; systemData.be = 0; + // half KO is the maximum a character can sustain wounds before collapsing + systemData.wunden.max = ko / 2; + // map current set to RS and BE const ausruestung = systemData.heldenausruestung[systemData.setEquipped]; diff --git a/src/module/sheets/characterSheet.mjs b/src/module/sheets/characterSheet.mjs index 6c546520..9e34fab0 100644 --- a/src/module/sheets/characterSheet.mjs +++ b/src/module/sheets/characterSheet.mjs @@ -125,6 +125,13 @@ export class CharacterSheet extends ActorSheet { context.name = context.derived.name ?? actorData.name; context.effects = actorData.effects ?? []; + context.maxWounds = actorData.system.wunden.max ?? 3; + context.wounds = actorData.system.wunden.aktuell ?? 0; + context.woundsFilled = []; + for (let i = 1; i <= context.maxWounds; i++) { + context.woundsFilled[i] = i <= context.wounds + } + this.#addSkillsToContext(context) this.#addAdvantagesToContext(context) this.#addSpecialAbilitiesToContext(context) @@ -912,6 +919,16 @@ export class CharacterSheet extends ActorSheet { } ]); + html.on('click', '[data-operation="addWounds"]', async (evt) => { + const {value} = evt.currentTarget.dataset + this.object.update({"system.wunden.aktuell": value}) + }) + + html.on('click', '[data-operation="reduceWounds"]', async (evt) => { + const {value} = evt.currentTarget.dataset + this.object.update({"system.wunden.aktuell": value}) + }) + html.on('click', '.liturgy.rollable', async (evt) => { evt.stopPropagation(); @@ -964,7 +981,6 @@ export class CharacterSheet extends ActorSheet { }) - } #handleDroppedEquipment(actor, equipment) { diff --git a/src/style/_character-sheet.scss b/src/style/_character-sheet.scss index 6a671515..df56d535 100644 --- a/src/style/_character-sheet.scss +++ b/src/style/_character-sheet.scss @@ -287,6 +287,62 @@ .tab.combat { + .wounds { + position: relative; + height: 24px; + display: flex; + margin-bottom: 8px; + padding-left: 130px; + + label { + position: absolute; + left: 0; + top: 0; + line-height: 24px; + width: 120px; + bottom: 0; + vertical-align: middle; + text-align: right; + height: 24px; + display: inline-block; + z-index: 2; + } + + .filled-segment { + border: 1px solid black; + background-image: url('../assets/gradient.png'); + background-size: 24px 100%; + position: relative; + flex: 1; + text-align: center; + vertical-align: middle; + line-height: 24px; + color: gold; + text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3); + background-color: rgba(255, 0, 0, 0.8); + background-blend-mode: multiply; + + } + + .empty-segment { + border: 1px solid black; + background-image: url('../assets/gradient.png'); + background-size: 32px 100%; + position: relative; + flex: 1; + text-align: center; + vertical-align: middle; + line-height: 24px; + color: gold; + text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3); + background-color: rgba(0, 0, 0, 0.8); + background-blend-mode: multiply; + + } + + } + + } diff --git a/src/templates/actor/actor-character-sheet.hbs b/src/templates/actor/actor-character-sheet.hbs index 108caddf..ec4b8e00 100644 --- a/src/templates/actor/actor-character-sheet.hbs +++ b/src/templates/actor/actor-character-sheet.hbs @@ -285,6 +285,17 @@ +