Fix success/failure computation
All checks were successful
Release Creation / build (release) Successful in 1m0s
All checks were successful
Release Creation / build (release) Successful in 1m0s
This commit is contained in:
@@ -199,7 +199,17 @@ export default class HellbornRoll extends Roll {
|
||||
|
||||
options.nbAdvantages = Number(options.nbAdvantages)
|
||||
options.nbDisadvantages = Number(options.nbDisadvantages)
|
||||
let diceFormula = `3D6 + ${options.nbAdvantages}D6kh - ${options.nbDisadvantages}D6kh + ${options.rollItem.value}`
|
||||
let dice = 3;
|
||||
let keep = ""
|
||||
if ( options.nbAdvantages > 0 || options.nbDisadvantages > 0) {
|
||||
dice = 4;
|
||||
if ( options.nbAdvantages > options.nbDisadvantages) {
|
||||
keep = "kh3"
|
||||
} else {
|
||||
keep = "kl3"
|
||||
}
|
||||
}
|
||||
let diceFormula = `${dice}D6${keep} + ${options.rollItem.value}`
|
||||
const roll = new this(diceFormula, options.data, rollData)
|
||||
await roll.evaluate()
|
||||
console.log("Roll", rollData, roll)
|
||||
@@ -235,16 +245,14 @@ export default class HellbornRoll extends Roll {
|
||||
commonResult = Object.entries(commonResult).reduce((a, b) => (a[1] > b[1]) ? a : b)[0]
|
||||
let nbEqual = workResults.filter(r => Number(r.result) === Number(commonResult)).length
|
||||
|
||||
if (commonResult >= 4 && nbEqual >= 2) {
|
||||
nbEqual += (options.nbAdvantages > 0 && roll.terms[2].total === commonResult) ? 1 : 0
|
||||
this.options.satanicSuccess = nbEqual >= 3
|
||||
if (commonResult >= 4 && nbEqual >= 3) {
|
||||
this.options.satanicSuccess = true
|
||||
if (this.options.satanicSuccess) {
|
||||
resultType = "success"
|
||||
}
|
||||
}
|
||||
if (commonResult <= 3 && nbEqual >= 2) {
|
||||
nbEqual += (options.nbDisadvantages > 0 && roll.terms[4].total === commonResult) ? 1 : 0
|
||||
this.options.fiendishFailure = nbEqual >= 3
|
||||
if (commonResult <= 3 && nbEqual >= 3) {
|
||||
this.options.fiendishFailure = true
|
||||
if (this.options.fiendishFailure) {
|
||||
resultType = "failure"
|
||||
}
|
||||
@@ -253,8 +261,6 @@ export default class HellbornRoll extends Roll {
|
||||
this.options.isSuccess = resultType === "success"
|
||||
this.options.isFailure = resultType === "failure"
|
||||
this.options.results = roll.terms[0].results
|
||||
this.options.advantageResult = roll.terms[2].total
|
||||
this.options.disadvantageResult = roll.terms[4].total
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,20 +21,19 @@
|
||||
|
||||
<li>{{localize "HELLBORN.Label.difficulty"}} : {{difficulty}}</li>
|
||||
|
||||
{{#if (gt nbAdvantages 0)}}
|
||||
<li>With Advantage !</li>
|
||||
{{/if}}
|
||||
{{#if (gt nbDisadvantages 0)}}
|
||||
<li>With Disadvantages ! </li>
|
||||
{{/if}}
|
||||
|
||||
<li>Results :
|
||||
{{#each results as |result|}}
|
||||
{{result.result}}
|
||||
{{/each}}
|
||||
</li>
|
||||
|
||||
{{#if (gt nbAdvantages 0)}}
|
||||
<li>Advantages : {{nbAdvantages}}, result {{advantageResult}}</li>
|
||||
{{/if}}
|
||||
{{#if (gt nbDisadvantages 0)}}
|
||||
<li>Disadvantages : {{nbDisadvantages}}, result {{disadvantageResult}}</li>
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{#if isSuccess}}
|
||||
{{#if satanicSuccess}}
|
||||
<li class="result-satanic-success">
|
||||
|
||||
Reference in New Issue
Block a user