BHR Implementation

Implemented BHR calculation on Character Sheet, and added ability to click on it to roll.
master
The Happy Anarchist 2020-09-21 22:07:42 -10:00
parent 60705b3d9c
commit 393c40a030
4 changed files with 75 additions and 1 deletions

View File

@ -42,6 +42,7 @@
"ACKS.roll.reaction": "Reaction roll",
"ACKS.roll.initiative": "Group {group} rolls for Initiative!",
"ACKS.roll.individualInit": "{name} rolls for Initiative!",
"ACKS.roll.bhr": "Healing roll",
"ACKS.table.treasure.roll": "Roll Treasure",
@ -136,6 +137,8 @@
"ACKS.AttacksShort": "ATT",
"ACKS.Damage": "Damage",
"ACKS.Spellcaster": "Spellcaster",
"ACKS.BHR": "Base Healing Rate",
"ACKS.BHRShort": "BHR",
"ACKS.Language": "Language",
"ACKS.SpokenLanguages": "Spoken Languages",

View File

@ -185,6 +185,11 @@ export class AcksActorSheet extends ActorSheet {
actorObject.rollHitDice({ event: event });
});
html.find(".bhr .attribute-name a").click((ev) => {
let actorObject = this.actor;
actorObject.rollBHR({ event: event });
});
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;

View File

@ -15,6 +15,7 @@ export class AcksActor extends Actor {
this.computeAC();
this.computeEncumbrance();
this.computeTreasure();
this.computeBHR();
// Determine Initiative
if (game.settings.get("acks", "initiative") != "group") {
@ -291,6 +292,32 @@ export class AcksActor extends Actor {
},
};
// Roll and return
return AcksDice.Roll({
event: options.event,
parts: rollParts,
data: data,
skipDialog: true,
speaker: ChatMessage.getSpeaker({ actor: this }),
flavor: label,
title: label,
});
}
rollBHR(options = {}) {
const label = game.i18n.localize(`ACKS.roll.bhr`);
const rollParts = [this.data.data.hp.bhr];
if (this.data.type == "character") {
rollParts.push();
}
const data = {
actor: this.data,
roll: {
type: "Healing",
},
};
// Roll and return
return AcksDice.Roll({
event: options.event,
@ -759,5 +786,35 @@ export class AcksActor extends Actor {
spoken,
data.scores.int.value
);
}
computeBHR() {
if (this.data.type != "character") {
return;
}
const data = this.data.data;
const bhrcalc = {
0: "1d2",
4: "1d3",
10: "1d4",
17: "1d6",
24: "1d8",
30: "1d10",
37: "2d6",
50: "2d8",
64: "2d10",
77: "2d12",
90: "3d10",
111: "4d10",
141: "5d10",
171: "6d10",
200: "7d10",
};
data.hp.bhr = AcksActor._valueFromTable(
bhrcalc,
data.hp.max
);
};
}

View File

@ -108,6 +108,15 @@
data-dtype="String" />
</div>
</li>
<li class="attribute bhr">
<h4 class="attribute-name box-title" title="{{ localize 'ACKS.BHR' }}">
<a>{{ localize "ACKS.BHRShort" }}</a>
</h4>
<div class="attribute-value"
title="Calculated from {{data.hp.max}} HP">
{{data.hp.bhr}}
</div>
</li>
{{#if config.initiative}}
<li class="attribute">
<h4 class="attribute-name box-title" title="{{ localize 'ACKS.Initiative' }}">