Update release

This commit is contained in:
LeRatierBretonnien 2023-03-28 15:41:15 +02:00
parent 0368be050b
commit b9b8fa7c0d
5 changed files with 56 additions and 42 deletions

View File

@ -308,6 +308,33 @@ export class Hero6Utility {
} }
} }
/* -------------- ----------------------------- */
static computeBodyValue(roll) {
let bodyValue = 0
for (let term of roll.terms) {
if (term.constructor.name == "Die") {
for (let value of term.values) {
if (value > 1) {
bodyValue += 1
}
if (value == 6) {
bodyValue += 1
}
}
}
if (term.constructor.name == "NumericTerm") {
if (term.total > 1) {
bodyValue += 1
}
if (term.total == 6) {
bodyValue += 1
}
}
}
return bodyValue
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static async rollHero6(rollData) { static async rollHero6(rollData) {
@ -331,6 +358,7 @@ export class Hero6Utility {
myRoll = new Roll(diceFormula).roll({ async: false }) myRoll = new Roll(diceFormula).roll({ async: false })
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode")) await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
} }
rollData.roll = myRoll rollData.roll = myRoll
rollData.target = target rollData.target = target
rollData.diceFormula = diceFormula rollData.diceFormula = diceFormula
@ -347,6 +375,10 @@ export class Hero6Utility {
} }
rollData.margin = target - rollData.result rollData.margin = target - rollData.result
if (rollData.item && rollData.item.system.computebody) {
rollData.bodyValue = this.computeBody(myRoll)
}
this.outputRollMessage(rollData) this.outputRollMessage(rollData)
} }
@ -355,31 +387,8 @@ export class Hero6Utility {
let roll = new Roll(rollData.rollFormula).roll({ async: false }) let roll = new Roll(rollData.rollFormula).roll({ async: false })
rollData.roll = roll rollData.roll = roll
// Compute BODY
let bodyValue = 0
for (let term of roll.terms) {
if ( term.constructor.name == "Die") {
for (let value of term.values) {
if (value > 1) {
bodyValue +=1
}
if (value == 6) {
bodyValue +=1
}
}
}
if ( term.constructor.name == "NumericTerm") {
if (term.total > 1) {
bodyValue +=1
}
if (term.total == 6) {
bodyValue +=1
}
}
}
rollData.result = roll.total rollData.result = roll.total
rollData.bodyValue = bodyValue rollData.bodyValue = this.computeBody(rollData.roll)
this.outputRollMessage(rollData) this.outputRollMessage(rollData)
} }

View File

@ -91,7 +91,7 @@
"styles": [ "styles": [
"styles/simple.css" "styles/simple.css"
], ],
"version": "10.0.32", "version": "10.0.33",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",
"verified": "10", "verified": "10",
@ -99,7 +99,7 @@
}, },
"title": "Hero System v6 for FoundrtVTT (Official)", "title": "Hero System v6 for FoundrtVTT (Official)",
"manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/raw/branch/main/system.json", "manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/raw/branch/main/system.json",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/archive/fvtt-hero-system-6-v10.0.32.zip", "download": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/archive/fvtt-hero-system-6-v10.0.33.zip",
"url": "https://www.uberwald.me/gitea/uberwald/", "url": "https://www.uberwald.me/gitea/uberwald/",
"background": "images/ui/hro6_welcome_page.webp", "background": "images/ui/hro6_welcome_page.webp",
"id": "fvtt-hero-system-6" "id": "fvtt-hero-system-6"

View File

@ -345,6 +345,7 @@
"endurance": 0, "endurance": 0,
"hasroll": false, "hasroll": false,
"roll": 0, "roll": 0,
"computebody": false,
"items": {} "items": {}
} }
}, },

View File

@ -135,7 +135,7 @@
<ul class="stat-list alternate-list"> <ul class="stat-list alternate-list">
<li class="item flexrow list-item items-title-bg"> <li class="item flexrow list-item items-title-bg">
<span class="item-field-label-long-img"> <span class="item-field-label-long-img">
<label class="">{{upperFirst key}} Maneuvers</label> <label class="">{{upperFirst key}} Standard Maneuver</label>
</span> </span>
<span class="item-field-label-short"> <span class="item-field-label-short">
<label class="short-label">PHA</label> <label class="short-label">PHA</label>

View File

@ -6,4 +6,8 @@
<li class="flexrow"><label class="item-field-label-long">Roll</label> <li class="flexrow"><label class="item-field-label-long">Roll</label>
<input type="text" class="item-field-label-medium" name="system.roll" value="{{system.roll}}" data-dtype="Number"/> <input type="text" class="item-field-label-medium" name="system.roll" value="{{system.roll}}" data-dtype="Number"/>
</li> </li>
<li class="flexrow"><label class="item-field-label-long">Computes BODY ?</label>
<label class="item-field-label-medium"><input type="checkbox" name="system.computebody" {{checked system.computebody}}/></label>
</li>
{{/if}} {{/if}}