restores wounds logic
parent
d62bbe9886
commit
eb6f13f78e
|
|
@ -125,14 +125,16 @@ export class Character extends Actor {
|
||||||
// half KO is the maximum a character can sustain wounds before collapsing
|
// half KO is the maximum a character can sustain wounds before collapsing
|
||||||
systemData.wunden.max = ko / 2;
|
systemData.wunden.max = ko / 2;
|
||||||
if (game.settings.get("DSA_4-1", "optional_trefferzonen")) {
|
if (game.settings.get("DSA_4-1", "optional_trefferzonen")) {
|
||||||
systemData.wunden.kopf = 0;
|
systemData.wunden.kopf = 0
|
||||||
systemData.wunden.brust = 0;
|
systemData.wunden.brust = 0
|
||||||
systemData.wunden.bauch = 0;
|
systemData.wunden.bauch = 0
|
||||||
systemData.wunden.ruecken = 0;
|
systemData.wunden.ruecken = 0
|
||||||
systemData.wunden.armlinks = 0;
|
systemData.wunden.armlinks = 0
|
||||||
systemData.wunden.armrechts = 0;
|
systemData.wunden.armrechts = 0
|
||||||
systemData.wunden.beinlinks = 0;
|
systemData.wunden.beinlinks = 0
|
||||||
systemData.wunden.beinrechts = 0;
|
systemData.wunden.beinrechts = 0
|
||||||
|
} else {
|
||||||
|
systemData.wunden.gesamt = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
systemData.ws = ko / 2;
|
systemData.ws = ko / 2;
|
||||||
|
|
|
||||||
|
|
@ -12,36 +12,34 @@ export default {
|
||||||
|
|
||||||
context.isGM = game.user.isGM
|
context.isGM = game.user.isGM
|
||||||
context.effects = []
|
context.effects = []
|
||||||
Object.values(actorData.items).forEach((item, index) => {
|
|
||||||
if (item.type === "ActiveEffect") {
|
|
||||||
const effect = item.effects[0];
|
|
||||||
const conditions = []
|
|
||||||
|
|
||||||
if (effect) {
|
for (let i = 0; i < actorData.appliedEffects.length; i++) {
|
||||||
effect.changes.forEach(change => {
|
const item = actorData.appliedEffects[i]
|
||||||
if (change.key.indexOf("wunden") === -1) {
|
const conditions = []
|
||||||
const key = change.key
|
|
||||||
.replace(/system\./g, "")
|
item.changes.forEach(change => {
|
||||||
.replace(/\.mod/g, "")
|
if (change.key.indexOf("wunden") === -1) {
|
||||||
.replace(/attribute./g, "")
|
const key = change.key
|
||||||
.replace(/.links/g, "(Links)")
|
.replace(/system\./g, "")
|
||||||
.replace(/.rechts/g, "(Rechts)")
|
.replace(/\.mod/g, "")
|
||||||
const value = Number(change.value) > 0 ? "+" + change.value : change.value
|
.replace(/attribute./g, "")
|
||||||
conditions.push(
|
.replace(/.links/g, "(Links)")
|
||||||
`${key}${value}`
|
.replace(/.rechts/g, "(Rechts)")
|
||||||
)
|
const value = Number(change.value) > 0 ? "+" + change.value : change.value
|
||||||
}
|
conditions.push(
|
||||||
})
|
`${key}${value}`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
context.effects.push({
|
context.effects.push({
|
||||||
name: item.name,
|
name: item.parent.name,
|
||||||
conditions: conditions.join(" "),
|
conditions: conditions.join(" "),
|
||||||
id: item._id,
|
id: item.parent._id,
|
||||||
actor: actorData._id
|
actor: actorData._id
|
||||||
});
|
});
|
||||||
}
|
|
||||||
})
|
}
|
||||||
|
|
||||||
return context
|
return context
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
||||||
cancelCooldown: CharacterSheet.#cancelCooldown,
|
cancelCooldown: CharacterSheet.#cancelCooldown,
|
||||||
activateCooldown: CharacterSheet.#activateCooldown,
|
activateCooldown: CharacterSheet.#activateCooldown,
|
||||||
rest: CharacterSheet.#startResting,
|
rest: CharacterSheet.#startResting,
|
||||||
|
removeEffect: CharacterSheet.#removeEffect,
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -235,6 +236,22 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
||||||
dialog.render(true)
|
dialog.render(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async #removeEffect(event, target) {
|
||||||
|
const {actorId, effectId} = target.dataset
|
||||||
|
|
||||||
|
if (actorId === this.document._id) {
|
||||||
|
|
||||||
|
const item = this.document.items.get(effectId)
|
||||||
|
|
||||||
|
if (item.type === "ActiveEffect") {
|
||||||
|
this.document.deleteEmbeddedDocuments("Item", [effectId])
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle form submission
|
* Handle form submission
|
||||||
* @this {AdvantageSheet}
|
* @this {AdvantageSheet}
|
||||||
|
|
@ -317,7 +334,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
||||||
context.effects = actorData.effects ?? []
|
context.effects = actorData.effects ?? []
|
||||||
|
|
||||||
context.maxWounds = actorData.system.wunden.max ?? 3
|
context.maxWounds = actorData.system.wunden.max ?? 3
|
||||||
context.wounds = actorData.system.wunden.aktuell ?? 0
|
context.wounds = actorData.system.wunden.gesamt ?? 0
|
||||||
context.woundsFilled = []
|
context.woundsFilled = []
|
||||||
for (let i = 1; i <= context.maxWounds; i++) {
|
for (let i = 1; i <= context.maxWounds; i++) {
|
||||||
context.woundsFilled[i] = i <= context.wounds
|
context.woundsFilled[i] = i <= context.wounds
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
"image": "icons/skills/wounds/bone-broken-knee-beam.webp",
|
"image": "icons/skills/wounds/bone-broken-knee-beam.webp",
|
||||||
"effects": [
|
"effects": [
|
||||||
{
|
{
|
||||||
"key": "system.wunden",
|
"key": "system.wunden.gesamt",
|
||||||
"mode": 2,
|
"mode": 2,
|
||||||
"value": "1",
|
"value": "1",
|
||||||
"priority": 10
|
"priority": 10
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,10 @@
|
||||||
<label>BE:</label>
|
<label>BE:</label>
|
||||||
{{derived.be}}
|
{{derived.be}}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="speed">
|
||||||
|
<label>GS:</label>
|
||||||
|
{{derived.gs.aktuell}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>{{this.conditions}}</td>
|
<td>{{this.conditions}}</td>
|
||||||
<td>{{#if ../isGM}}
|
<td>{{#if ../isGM}}
|
||||||
<button data-operation="removeEffect" data-actor-id="{{actor}}" data-effect-id="{{id}}"><i
|
<button data-action="removeEffect" data-actor-id="{{actor}}" data-effect-id="{{id}}"><i
|
||||||
class="fa-solid fa-trash"></i></button>{{/if}}</td>
|
class="fa-solid fa-trash"></i></button>{{/if}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue