add automation for exhaustion penalty to skill, stat, and san tests

This commit is contained in:
TheLastScrub
2024-06-28 21:51:52 -07:00
parent c3fa3c3601
commit 7cc777d7a3
12 changed files with 91 additions and 9 deletions
+16
View File
@@ -671,6 +671,22 @@ div .exhausted-section {
margin-bottom: 10px;
}
.exhausted-section input {
width: 75px;
text-align: center;
border: 1px solid rgb(122, 121, 113);
border-radius: 3px;
height: 100%;
margin-left: 10px;
min-height: 23px;
color: rgb(139, 0, 0);
background-color: rgba(0, 0, 0, 0.05);
}
.resource .exhaustion-label {
vertical-align: middle;
}
.bonds-section-header {
/* border-top: 1px solid #AAA; */
width: 100%;
+1
View File
@@ -97,6 +97,7 @@
"DG.Physical.Wounds": "Ferides",
"DG.Physical.FirstAidLabel": "Primers auxilis ja aplicats: ",
"DG.Physical.Exhausted": "Exhausted:",
"DG.Physical.ExhaustionPenalty": "Penalty:",
"DG.Generic.AddButtonLabel": "Afegir",
+1
View File
@@ -112,6 +112,7 @@
"DG.Physical.Wounds": "Verletzungen",
"DG.Physical.FirstAidLabel": "Erste Hilfe bereits geleistet: ",
"DG.Physical.Exhausted": "Exhausted:",
"DG.Physical.ExhaustionPenalty": "Penalty:",
"DG.Generic.AddButtonLabel": "Hinzufügen",
+1
View File
@@ -113,6 +113,7 @@
"DG.Physical.Wounds": "Wounds",
"DG.Physical.FirstAidLabel": "First Aid Has Already Been Attempted: ",
"DG.Physical.Exhausted": "Exhausted:",
"DG.Physical.ExhaustionPenalty": "Penalty:",
"DG.Generic.AddButtonLabel": "Add",
+1
View File
@@ -97,6 +97,7 @@
"DG.Physical.Wounds": "Heridas",
"DG.Physical.FirstAidLabel": "Los Primeros Auxilios ya han sido aplicados: ",
"DG.Physical.Exhausted": "Exhausted:",
"DG.Physical.ExhaustionPenalty": "Penalty:",
"DG.Generic.AddButtonLabel": "Añadir",
+1
View File
@@ -103,6 +103,7 @@
"DG.Physical.Wounds": "Blessures",
"DG.Physical.FirstAidLabel": "Les premiers secours ont déjà été tentés: ",
"DG.Physical.Exhausted": "Exhausted:",
"DG.Physical.ExhaustionPenalty": "Penalty:",
"DG.Generic.AddButtonLabel": "Ajout",
+1
View File
@@ -97,6 +97,7 @@
"DG.Physical.Wounds": "傷",
"DG.Physical.FirstAidLabel": "応急処置は既に施された",
"DG.Physical.Exhausted": "疲れ果てた:",
"DG.Physical.ExhaustionPenalty": "Penalty:",
"DG.Generic.AddButtonLabel": "加える",
+1
View File
@@ -88,6 +88,7 @@
"DG.Physical.Wounds": "Ferimentos",
"DG.Physical.FirstAidLabel": "Primeiros socorros já foi tentado: ",
"DG.Physical.Exhausted": "Exhausted:",
"DG.Physical.ExhaustionPenalty": "Penalty:",
"DG.Generic.AddButtonLabel": "Adicionar",
"DG.Mental.BreakingPoint": "Ponto de Ruptura: ",
"DG.Mental.Reset": "Resetar",
+5
View File
@@ -265,6 +265,11 @@ export default class DeltaGreenActor extends Actor {
system.statistics.str.meleeDamageBonus = bonus;
system.statistics.str.meleeDamageBonusFormula = sbonus;
if (system.physical.exhaustedPenalty > 0) {
system.physical.exhaustedPenalty =
-1 * Math.abs(system.physical.exhaustedPenalty);
}
console.log(agent);
}
+51 -4
View File
@@ -267,10 +267,36 @@ export class DGPercentileRoll extends DGRoll {
this.effectiveTarget
}`;
}
if (this.modifier) {
label += ` (${this.target}${DGUtils.formatStringWithLeadingPlus(
this.modifier,
)}%)`;
let isExhausted = false;
let exhaustedCheckPenalty = -20;
try {
// I suspect (but am not entirely certain) that being tired doesn't make you less lucky)
if (this.type !== "luck") {
isExhausted = this.actor.system.physical.exhausted;
exhaustedCheckPenalty = this.actor.system.physical.exhaustedPenalty;
exhaustedCheckPenalty = -1 * Math.abs(exhaustedCheckPenalty);
}
} catch {
isExhausted = false;
exhaustedCheckPenalty = -20;
}
if (this.modifier || isExhausted) {
label += ` (${this.target}`;
if (this.modifier) {
label += ` ${DGUtils.formatStringWithLeadingPlus(this.modifier)}%`;
}
if (isExhausted) {
label += ` ${DGUtils.formatStringWithLeadingPlus(
exhaustedCheckPenalty,
)}%`;
}
label += `)`;
}
let resultString = "";
@@ -425,18 +451,39 @@ export class DGPercentileRoll extends DGRoll {
* Actual target for the roll accounting for modifier if present.
* Floored to 1 if a negative modifier would bring it below 1.
* Capped at 99 unless it is an inhuman stat test.
* Also worth noting, per page 47 of the Agent's Handbook, Exhaustion penalties
* affect not only skill and stat tests, but SAN tests as well...
*
* @returns {null|integer}
*/
get effectiveTarget() {
let target = 1;
let isExhausted = false;
let exhaustedCheckPenalty = -20;
try {
// I suspect (but am not entirely certain) that being tired doesn't make you less lucky)
if (this.type !== "luck") {
isExhausted = this.actor.system.physical.exhausted;
exhaustedCheckPenalty = this.actor.system.physical.exhaustedPenalty;
exhaustedCheckPenalty = -1 * Math.abs(exhaustedCheckPenalty);
}
} catch {
isExhausted = false;
exhaustedCheckPenalty = -20;
}
if (!this.target || Number.isNaN(this.target)) {
return null;
}
target = parseInt(this.target);
if (isExhausted) {
target += exhaustedCheckPenalty;
}
if (this.modifier && !Number.isNaN(this.modifier)) {
const modifier = parseInt(this.modifier);
+2 -1
View File
@@ -487,7 +487,8 @@
"description": "(Physical description of agent)",
"wounds": "",
"firstAidAttempted": false,
"exhausted": false
"exhausted": false,
"exhaustedPenalty": -20
},
"biography": {
"profession": "",
+10 -4
View File
@@ -172,10 +172,16 @@
<input class="labeled-resource-checkbox" type="checkbox" name="system.physical.firstAidAttempted" {{checked actor.system.physical.firstAidAttempted}} data-dtype="Boolean" title="{{localize 'DG.Tooltip.FirstAidAttempted'}}" />
</div>
<div class="exhausted-section resource">
<label class="bolded-label first-aid-label"
title="{{localize 'DG.Tooltip.Exhaustion'}}"
>{{localize 'DG.Physical.Exhausted'}}</label>
<input class="labeled-resource-checkbox" type="checkbox" name="system.physical.exhausted" {{checked actor.system.physical.exhausted}} data-dtype="Boolean" title="{{localize 'DG.Tooltip.Exhaustion'}}" />
<label class="bolded-label exhaustion-label" title="{{localize 'DG.Tooltip.Exhaustion'}}">{{localize 'DG.Physical.Exhausted'}}</label>
<input class="labeled-resource-checkbox" type="checkbox" name="system.physical.exhausted" {{checked actor.system.physical.exhausted}} data-dtype="Boolean" title="{{localize 'DG.Tooltip.Exhaustion'}}" />
{{#if actor.system.physical.exhausted }}
<label class="bolded-label exhaustion-label" title="{{localize 'DG.Tooltip.Exhaustion'}}">{{localize 'DG.Physical.ExhaustionPenalty'}}</label>
<input type="number" name="system.physical.exhaustedPenalty" value="{{actor.system.physical.exhaustedPenalty}}" data-dtype="Number" title="{{localize 'DG.Tooltip.Exhaustion'}}" min="-99" max="0" />
{{/if}}
</div>
<div>
<label class="bolded-label">{{localize 'DG.Physical.Wounds'}}</label>