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
|
||||
systemData.wunden.max = ko / 2;
|
||||
if (game.settings.get("DSA_4-1", "optional_trefferzonen")) {
|
||||
systemData.wunden.kopf = 0;
|
||||
systemData.wunden.brust = 0;
|
||||
systemData.wunden.bauch = 0;
|
||||
systemData.wunden.ruecken = 0;
|
||||
systemData.wunden.armlinks = 0;
|
||||
systemData.wunden.armrechts = 0;
|
||||
systemData.wunden.beinlinks = 0;
|
||||
systemData.wunden.beinrechts = 0;
|
||||
systemData.wunden.kopf = 0
|
||||
systemData.wunden.brust = 0
|
||||
systemData.wunden.bauch = 0
|
||||
systemData.wunden.ruecken = 0
|
||||
systemData.wunden.armlinks = 0
|
||||
systemData.wunden.armrechts = 0
|
||||
systemData.wunden.beinlinks = 0
|
||||
systemData.wunden.beinrechts = 0
|
||||
} else {
|
||||
systemData.wunden.gesamt = 0
|
||||
}
|
||||
|
||||
systemData.ws = ko / 2;
|
||||
|
|
|
|||
|
|
@ -12,36 +12,34 @@ export default {
|
|||
|
||||
context.isGM = game.user.isGM
|
||||
context.effects = []
|
||||
Object.values(actorData.items).forEach((item, index) => {
|
||||
if (item.type === "ActiveEffect") {
|
||||
const effect = item.effects[0];
|
||||
const conditions = []
|
||||
|
||||
if (effect) {
|
||||
effect.changes.forEach(change => {
|
||||
if (change.key.indexOf("wunden") === -1) {
|
||||
const key = change.key
|
||||
.replace(/system\./g, "")
|
||||
.replace(/\.mod/g, "")
|
||||
.replace(/attribute./g, "")
|
||||
.replace(/.links/g, "(Links)")
|
||||
.replace(/.rechts/g, "(Rechts)")
|
||||
const value = Number(change.value) > 0 ? "+" + change.value : change.value
|
||||
conditions.push(
|
||||
`${key}${value}`
|
||||
)
|
||||
}
|
||||
})
|
||||
for (let i = 0; i < actorData.appliedEffects.length; i++) {
|
||||
const item = actorData.appliedEffects[i]
|
||||
const conditions = []
|
||||
|
||||
item.changes.forEach(change => {
|
||||
if (change.key.indexOf("wunden") === -1) {
|
||||
const key = change.key
|
||||
.replace(/system\./g, "")
|
||||
.replace(/\.mod/g, "")
|
||||
.replace(/attribute./g, "")
|
||||
.replace(/.links/g, "(Links)")
|
||||
.replace(/.rechts/g, "(Rechts)")
|
||||
const value = Number(change.value) > 0 ? "+" + change.value : change.value
|
||||
conditions.push(
|
||||
`${key}${value}`
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
context.effects.push({
|
||||
name: item.name,
|
||||
conditions: conditions.join(" "),
|
||||
id: item._id,
|
||||
actor: actorData._id
|
||||
});
|
||||
}
|
||||
})
|
||||
context.effects.push({
|
||||
name: item.parent.name,
|
||||
conditions: conditions.join(" "),
|
||||
id: item.parent._id,
|
||||
actor: actorData._id
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return context
|
||||
},
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
|||
cancelCooldown: CharacterSheet.#cancelCooldown,
|
||||
activateCooldown: CharacterSheet.#activateCooldown,
|
||||
rest: CharacterSheet.#startResting,
|
||||
removeEffect: CharacterSheet.#removeEffect,
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -235,6 +236,22 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
|||
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
|
||||
* @this {AdvantageSheet}
|
||||
|
|
@ -317,7 +334,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
|||
context.effects = actorData.effects ?? []
|
||||
|
||||
context.maxWounds = actorData.system.wunden.max ?? 3
|
||||
context.wounds = actorData.system.wunden.aktuell ?? 0
|
||||
context.wounds = actorData.system.wunden.gesamt ?? 0
|
||||
context.woundsFilled = []
|
||||
for (let i = 1; i <= context.maxWounds; i++) {
|
||||
context.woundsFilled[i] = i <= context.wounds
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
"image": "icons/skills/wounds/bone-broken-knee-beam.webp",
|
||||
"effects": [
|
||||
{
|
||||
"key": "system.wunden",
|
||||
"key": "system.wunden.gesamt",
|
||||
"mode": 2,
|
||||
"value": "1",
|
||||
"priority": 10
|
||||
|
|
|
|||
|
|
@ -34,6 +34,10 @@
|
|||
<label>BE:</label>
|
||||
{{derived.be}}
|
||||
</div>
|
||||
<div class="speed">
|
||||
<label>GS:</label>
|
||||
{{derived.gs.aktuell}}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
</td>
|
||||
<td>{{this.conditions}}</td>
|
||||
<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>
|
||||
</tr>
|
||||
{{/each}}
|
||||
|
|
|
|||
Loading…
Reference in New Issue