fix: fixes brokeness of resting dialog
parent
20d3a04577
commit
6231da455f
|
|
@ -33,7 +33,7 @@ export class RestingDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @type {Actor}
|
||||
* @type {Character}
|
||||
* @private
|
||||
*/
|
||||
_actor = null
|
||||
|
|
@ -159,7 +159,7 @@ export class RestingDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
this.badWeather = -1
|
||||
this.woundTreated = false
|
||||
this.woundRegenerationModifier = 0
|
||||
this.wounds = 1
|
||||
this.wounds = this._actor.getWoundModel().current
|
||||
this.badCamp = false
|
||||
this.watch = false
|
||||
this.interrupted = false
|
||||
|
|
@ -176,13 +176,14 @@ export class RestingDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
|
||||
static async #regenerate() {
|
||||
const context = this.#updateData()
|
||||
const rollData = this._actor.getRollData()
|
||||
const rollData = this._actor.system
|
||||
|
||||
// regenerate LeP
|
||||
|
||||
const targetBonusLep = rollData.attribute.ko.aktuell + context.koRoll
|
||||
const targetBonusAsp = rollData.attribute.in.aktuell + context.inRoll
|
||||
|
||||
// TODO: needs to be situational (not every character has AsP for example) and not a compound roll statement
|
||||
const regenerationRoll = await new Roll("1d20[Konstitution]+1d20[Intuition]+1d20[Konstitution] + 2d6").evaluate()
|
||||
|
||||
const [koRoll, _, inRoll, __, woundRoll, ___, lepAndAsp] = regenerationRoll.terms // the 3d20s
|
||||
|
|
@ -191,6 +192,7 @@ export class RestingDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
const woundHealed = woundRoll.results[0].result <= rollData.attribute.ko.aktuell + (context.woundMod * -1)
|
||||
const [regLep, regAsp] = lepAndAsp.results // the 2d6s
|
||||
|
||||
// TODO: message needs to be better structured, and also include Buttons to heal LeP and restore AsP
|
||||
await regenerationRoll.toMessage({
|
||||
speaker: ChatMessage.getSpeaker({actor: this.actor}),
|
||||
flavor:
|
||||
|
|
@ -245,8 +247,6 @@ export class RestingDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
context.hasAsP = true
|
||||
context.wounds = this.wounds
|
||||
|
||||
// TODO count wounds
|
||||
|
||||
let lepRestModifier = 0
|
||||
let aspRestModifier = 0
|
||||
|
||||
|
|
|
|||
|
|
@ -621,4 +621,38 @@ export class Character extends Actor {
|
|||
}
|
||||
await this.update({system: {lep: {aktuell: previousLeP - damage}}})
|
||||
}
|
||||
|
||||
getWoundModel() {
|
||||
if (this.type === "Character") {
|
||||
const actorData = this;
|
||||
const systemData = actorData.system;
|
||||
let returnValue = {
|
||||
max: 0,
|
||||
current: 0,
|
||||
ws: 0
|
||||
}
|
||||
|
||||
returnValue.max = systemData.wunden.max;
|
||||
console.log("spiel mit trefferzonen: ", game.settings.get("DSA_4-1", "optional_trefferzonen"));
|
||||
if (game.settings.get("DSA_4-1", "optional_trefferzonen")) {
|
||||
returnValue.current =
|
||||
systemData.wunden.kopf +
|
||||
systemData.wunden.brust +
|
||||
systemData.wunden.bauch +
|
||||
systemData.wunden.ruecken +
|
||||
systemData.wunden.armlinks +
|
||||
systemData.wunden.armrechts +
|
||||
systemData.wunden.beinlinks +
|
||||
systemData.wunden.beinrechts +
|
||||
systemData.wunden.gesamt;
|
||||
} else {
|
||||
returnValue.current = systemData.wunden.aktuell;
|
||||
}
|
||||
|
||||
returnValue.ws = systemData.ws;
|
||||
return returnValue;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
.application.dsa41.dialog.resting {
|
||||
.application.dsa41.dialog.resting,
|
||||
.application.dsa41.dialog.meditating {
|
||||
|
||||
section {
|
||||
|
||||
|
|
@ -13,6 +14,7 @@
|
|||
div.setting {
|
||||
margin-left: 32px;
|
||||
padding-bottom: 16px;
|
||||
position: relative;
|
||||
|
||||
&.setting-nest-1 {
|
||||
margin-left: 64px;
|
||||
|
|
@ -23,6 +25,14 @@
|
|||
margin-left: 34px;
|
||||
}
|
||||
|
||||
input[type="checkbox"] {
|
||||
margin-left: -32px;
|
||||
|
||||
&+span {
|
||||
margin-left: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
&.combined {
|
||||
input[type="checkbox"], input[type="radio"] {
|
||||
margin-left: -32px;
|
||||
|
|
@ -43,6 +53,8 @@
|
|||
input[type="checkbox"], input[type="radio"] {
|
||||
margin-left: -32px;
|
||||
padding-right: 8px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
span {
|
||||
|
|
|
|||
|
|
@ -1,24 +1,25 @@
|
|||
<section>
|
||||
|
||||
{{!-- TODO: Refactor dialog and explain more what each and every knob and input does --}}
|
||||
<div class="options">
|
||||
|
||||
<div class="setting">
|
||||
<label>
|
||||
<span>Dauer der Rast</span>
|
||||
<input type="number" name="length" placeholder="6" value="{{length}}"/>
|
||||
<input type="number" name="length" placeholder="6" value="{{length}}"/><span>Stunden</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="setting">
|
||||
<label>
|
||||
<span>Wunden</span>
|
||||
<span>Anzahl Wunden</span>
|
||||
<input type="number" name="wounds" placeholder="0" value="{{wounds}}"/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="setting combined">
|
||||
<div class="setting">
|
||||
<label>
|
||||
<input type="checkbox" name="wound_treated"/><span>Wunde behandelt</span>
|
||||
<input type="checkbox" name="wound_treated"/>
|
||||
<span>Wunde behandelt (Modifikator)</span>
|
||||
<input type="number" name="wound_treat_modifier" placeholder="0" value="{{wound_treat_modifier}}"/>
|
||||
</label>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue