implements visuals for BRW wound system

feature/wounds
macniel 2025-10-10 14:30:05 +02:00
parent 169e41d2c8
commit bbe3bc2718
5 changed files with 92 additions and 2 deletions

View File

@ -125,7 +125,11 @@ export class PlayerCharacterDataModel extends foundry.abstract.TypeDataModel {
key: new StringField(), key: new StringField(),
notiz: 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( heldenausruestung: new ArrayField(
new SchemaField({ new SchemaField({
links: new DocumentIdField(), links: new DocumentIdField(),

View File

@ -54,6 +54,9 @@ export class Character extends Actor {
systemData.rs = 0; systemData.rs = 0;
systemData.be = 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 // map current set to RS and BE
const ausruestung = systemData.heldenausruestung[systemData.setEquipped]; const ausruestung = systemData.heldenausruestung[systemData.setEquipped];

View File

@ -125,6 +125,13 @@ export class CharacterSheet extends ActorSheet {
context.name = context.derived.name ?? actorData.name; context.name = context.derived.name ?? actorData.name;
context.effects = actorData.effects ?? []; 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.#addSkillsToContext(context)
this.#addAdvantagesToContext(context) this.#addAdvantagesToContext(context)
this.#addSpecialAbilitiesToContext(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) => { html.on('click', '.liturgy.rollable', async (evt) => {
evt.stopPropagation(); evt.stopPropagation();
@ -964,7 +981,6 @@ export class CharacterSheet extends ActorSheet {
}) })
} }
#handleDroppedEquipment(actor, equipment) { #handleDroppedEquipment(actor, equipment) {

View File

@ -287,6 +287,62 @@
.tab.combat { .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;
}
}
} }

View File

@ -285,6 +285,17 @@
</div> </div>
<div class="wounds">
<label data-operation="reduceWounds" data-value="0">Wunden: {{this.wounds}} / {{this.maxWounds}}</label>
{{#each this.woundsFilled}}
{{#if this}}
<div class="filled-segment" data-operation="reduceWounds"
data-value="{{@index}}">{{@index}}</div>
{{else}}
<div class="empty-segment" data-operation="addWounds" data-value="{{@index}}">{{@index}}</div>
{{/if}}
{{/each}}
</div>
<div class="actions"> <div class="actions">
{{#each this.actions}} {{#each this.actions}}