From 91457080b72225998c40a7a01f5cc1c3f526ed90 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 27 Aug 2022 08:10:00 -0400 Subject: [PATCH 1/4] Fix DM about BetterRolls5e Incompatibility --- scripts/die-hard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/die-hard.js b/scripts/die-hard.js index b3be09d..4dbf8d6 100644 --- a/scripts/die-hard.js +++ b/scripts/die-hard.js @@ -23,7 +23,7 @@ Hooks.once('ready', () => { if (game.modules.get("betterrolls5e") !== undefined && game.modules.get("betterrolls5e")?.active === true) { dieHardLog(true, 'WARNING - DieHard is incompatible with Better Rolls 5e.') - game.dieHardSystem.dmToGm('WARNING - DieHard is incompatible with Better Rolls 5e.'); + DieHard.dmToGm('WARNING - DieHard is incompatible with Better Rolls 5e.'); } }); From fcb9a0c1d05e47362033371cfdbb1ab50eb3e73b Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 27 Aug 2022 08:59:19 -0400 Subject: [PATCH 2/4] Change wording of DM about BetterRolls5e Incompatibility --- scripts/die-hard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/die-hard.js b/scripts/die-hard.js index 4dbf8d6..7c17930 100644 --- a/scripts/die-hard.js +++ b/scripts/die-hard.js @@ -23,7 +23,7 @@ Hooks.once('ready', () => { if (game.modules.get("betterrolls5e") !== undefined && game.modules.get("betterrolls5e")?.active === true) { dieHardLog(true, 'WARNING - DieHard is incompatible with Better Rolls 5e.') - DieHard.dmToGm('WARNING - DieHard is incompatible with Better Rolls 5e.'); + DieHard.dmToGm('WARNING - DieHard is incompatible with Better Rolls 5e. To learn more and be alerted when a fix is released, watch this GitHub Issue'); } }); From bddeffec0be4f6b71dd3a2f6632946d051a36d1d Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 27 Aug 2022 08:59:42 -0400 Subject: [PATCH 3/4] Change around some wording and DMs --- scripts/classes/DieHardSystem.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/scripts/classes/DieHardSystem.js b/scripts/classes/DieHardSystem.js index fabb82a..6eeed85 100644 --- a/scripts/classes/DieHardSystem.js +++ b/scripts/classes/DieHardSystem.js @@ -188,18 +188,22 @@ export default class DieHardSystem { let evalResult = game.dieHardSystem.evalFudge(newResult, userFudge.operator, userFudge.operatorValue) if (evalResult) { - dieHardLog(false, functionLogName + ' - New result: ' + newResult) + dieHardLog(false, functionLogName + ' - New result: ' + this.total) gen_new_result = false; roll.result = newResult this.results.push(roll); - DieHard.dmToGm("Raw Fudge (" + userFudge.howFormula + ") values: " + failedRolls.join(', ') + " Final: " + newResult); + if (failedRolls.length === 0) { + DieHard.dmToGm('DieHard-Fudge: Total Fudge not needed (' + newResult + ' ' + userFudge.howFormula + ')'); + } else { + DieHard.dmToGm('DieHard-Fudge: Raw Fudge (' + userFudge.howFormula + ') values: ' + failedRolls.join(', ') + ' Final: ' + newResult); + } } else { // New roll is insufficient, but lets at least check if it is "closer" if (game.dieHardSystem.isBetterFudge(roll.result, newResult, userFudge.operator, userFudge.operatorValue)) { - dieHardLog(false, functionLogName + ' - New result insufficient, but at least better (' + newResult + "). Try again (tries left: " + SafetyLoopIndex + ")...") + dieHardLog(false, functionLogName + ' - New result (' + newResult + ') insufficient (' + userFudge.fudgeOperator + ' ' + userFudge.fudgeOperatorValue + '), but at least better. Try again (tries left: ' + SafetyLoopIndex + ')...') roll.result = newResult } else { - dieHardLog(false, functionLogName + ' - New result insufficient (' + newResult + "). Try again (tries left: " + SafetyLoopIndex + ")...") + dieHardLog(false, functionLogName + ' - New result (' + newResult + ') insufficient (' + userFudge.fudgeOperator + ' ' + userFudge.fudgeOperatorValue + '). Try again (tries left: ' + SafetyLoopIndex + ')...') } failedRolls.push(newResult); } @@ -353,7 +357,7 @@ export default class DieHardSystem { wrapRollEvaluate(wrapped, eval_options) { let uuid = makeId(6) let functionLogName = 'DieHardSystem.wrapRollEvaluate-' + uuid - dieHardLog(false, functionLogName); + dieHardLog(false, functionLogName, this, eval_options); if (! DieHardSetting('fudgeEnabled') ) { dieHardLog(true, functionLogName + ' - Fudge disabled'); @@ -400,14 +404,13 @@ export default class DieHardSystem { if (this instanceof CONFIG.Dice.DieHardFudgeRoll) { dieHardLog(false, functionLogName + 'e - recursive roll', this); } else { - dieHardLog(false, functionLogName + ' - base roll', this); - dieHardLog(false, functionLogName + ' - result', result); + dieHardLog(false, functionLogName + ' - base roll', this, result); let gen_new_result = false; let evalResult = game.dieHardSystem.evalFudge(this.total, this.data.fudgeOperator, this.data.fudgeOperatorValue) if (evalResult) { - dieHardLog(false, functionLogName + ' - Fudge not needed, but still disabled'); - DieHard.dmToGm('DieHard-Fudge: Total Fudge not needed, but still disabled...'); + dieHardLog(false, functionLogName + ' - Fudge not needed (' + this.total + ' ' + this.data.fudgeOperator + ' ' + this.data.fudgeOperatorValue + ')'); + DieHard.dmToGm('DieHard-Fudge: Total Fudge not needed (' + this.total + ' ' + this.data.fudgeOperator + ' ' + this.data.fudgeOperatorValue + ')'); dieHardLog(false, functionLogName + ' - dmToGm'); } else { @@ -424,14 +427,14 @@ export default class DieHardSystem { dieHardLog(false, functionLogName + ' - New result: ' + new_roll.total) gen_new_result = false; foundry.utils.mergeObject(this, new_roll); - DieHard.dmToGm("Total Fudge (" + result.data.fudgeHow + ") values: " + failedRolls.join(', ') + " Final: " + new_roll.total); + DieHard.dmToGm('DieHard-Fudge: Total Fudge (' + result.data.fudgeHow + ') values: ' + failedRolls.join(', ') + ' Final: ' + new_roll.total); } else { // New roll is insufficient, but lets at least check if it is "closer" if (game.dieHardSystem.isBetterFudge(this.total, new_roll.total, this.data.fudgeOperator, this.data.fudgeOperatorValue)) { - dieHardLog(false, functionLogName + ' - New result insufficient, but at least better (' + new_roll.total + "). Try again (tries left: " + SafetyLoopIndex + ")...") + dieHardLog(false, functionLogName + ' - New result (' + new_roll.total + ') insufficient (' + this.data.fudgeOperator + ' ' + this.data.fudgeOperatorValue + '), but at least better. Try again (tries left: ' + SafetyLoopIndex + ')...') foundry.utils.mergeObject(this, new_roll); } else { - dieHardLog(false, functionLogName + ' - New result insufficient (' + new_roll.total + "). Try again (tries left: " + SafetyLoopIndex + ")...") + dieHardLog(false, functionLogName + ' - New result (' + new_roll.total + ') insufficient (' + this.data.fudgeOperator + ' ' + this.data.fudgeOperatorValue + '). Try again (tries left: ' + SafetyLoopIndex + ')...') } failedRolls.push(new_roll.total); } From 93fe698a5c51966813d494ff5f32293c40b70210 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 27 Aug 2022 09:00:42 -0400 Subject: [PATCH 4/4] Clean up inconsistent use of quotes --- scripts/classes/DieHardSystem.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/classes/DieHardSystem.js b/scripts/classes/DieHardSystem.js index 6eeed85..c12e390 100644 --- a/scripts/classes/DieHardSystem.js +++ b/scripts/classes/DieHardSystem.js @@ -1,6 +1,6 @@ -import {dieHardLog, makeId} from "../lib/helpers.js"; -import DieHardFudgeRoll from "./DieHardFudgeRoll.js"; -import DieHard, {DieHardSetting} from "./DieHard.js"; +import {dieHardLog, makeId} from '../lib/helpers.js'; +import DieHardFudgeRoll from './DieHardFudgeRoll.js'; +import DieHard, {DieHardSetting} from './DieHard.js'; export default class DieHardSystem { constructor() { @@ -540,9 +540,9 @@ export default class DieHardSystem { // ToDo: clean this up try{ if (this.hasActiveFudges()) { - document.getElementById('die-hard-fudge-icon').classList.add("die-hard-fudge-icon-active"); + document.getElementById('die-hard-fudge-icon').classList.add('die-hard-fudge-icon-active'); } else { - document.getElementById('die-hard-fudge-icon').classList.remove("die-hard-fudge-icon-active"); + document.getElementById('die-hard-fudge-icon').classList.remove('die-hard-fudge-icon-active'); } } catch (e) { }