Combat tab

This commit is contained in:
2023-03-22 22:43:30 +01:00
parent e0adf04753
commit 4ca23257cb
6 changed files with 26 additions and 19 deletions

View File

@@ -152,6 +152,12 @@ export class Hero6ActorSheet extends ActorSheet {
const characKey = $(event.currentTarget).data("charac-key");
this.actor.rollCharac(characKey);
});
html.find('.roll-direct').click((event) => {
const rollFormula = $(event.currentTarget).data("roll-formula");
let roll = new Roll(rollFormula).roll({async: false})
roll.toMessage()
});
html.find('.roll-item').click((event) => {
const li = $(event.currentTarget).parents(".item");
let itemId = li.data("item-id")

View File

@@ -66,6 +66,10 @@ export class Hero6Actor extends Actor {
if (this.type == "character") {
}
}
computeDicesValue() {
this.system.biodata.presenceattack = Hero6Utility.getDerivatedDiceValue(this.system.characteristics.pre.value )
this.system.characteristics.str.strdice = Hero6Utility.getDerivatedDiceValue(this.system.characteristics.str.value )
}
/* -------------------------------------------- */
prepareDerivedData() {
@@ -73,6 +77,7 @@ export class Hero6Actor extends Actor {
this.system.encCapacity = this.getEncumbranceCapacity()
this.buildContainerTree()
this.computeHitPoints()
this.computeDicesValue()
}
super.prepareDerivedData();

View File

@@ -76,6 +76,15 @@ export class Hero6Utility {
}) */
}
/*-------------------------------------------- */
static getDerivatedDiceValue(value) {
let dices = Math.floor(value/5) +"d6"
if ( value % 5 > 2) {
dices += "+1d3"
}
return dices
}
/*-------------------------------------------- */
static upperFirst(text) {
if (typeof text !== 'string') return text