diff --git a/css/lmrtfy.css b/css/lmrtfy.css index 8ca08bb..4ee2062 100644 --- a/css/lmrtfy.css +++ b/css/lmrtfy.css @@ -75,7 +75,7 @@ form .form-group .lmrtfy-skill-checks { .lmrtfy-skill-checks > div , .lmrtfy-extras > div { flex: 3; - padding: 4px; + padding: 2px; display: flex; } diff --git a/lang/en.json b/lang/en.json index ef8a8d8..1de56ef 100644 --- a/lang/en.json +++ b/lang/en.json @@ -70,10 +70,11 @@ "LMRTFY.DemonLordRollWithBanes": "Roll with Banes", "LMRTFY.DemonLordRollWithBoons": "Roll with Boons", "LMRTFY.DemonLordCustomFormulaPlaceholder": "1d20 + @attributes.strength.modifier + 1", - "LMRTFY.DemonLordNrOfBBDice": "Boons/Banes:", - "LMRTFY.DemonLordBoonsNote": "These rolls will be made with boons.", - "LMRTFY.DemonLordBanesNote": "These rolls will be made with banes.", - "LMRTFY.DemonLordAddMod": "Additional modifier:", + "LMRTFY.DemonLordNrOfboonsBanes": "Boons/Banes:", + "LMRTFY.DemonLordBoonsNote": "These rolls will be made with {boonsBanes} boon(s).", + "LMRTFY.DemonLordBanesNote": "These rolls will be made with {boonsBanes} bane(s).", + "LMRTFY.DemonLordAdditionalModifier": "Additional modifier:", + "LMRTFY.DemonLordFateRoll": "Fate Roll", "LMRTFY.DemonLordNoCombat": "You are not in combat!", "LMRTFY.DemonLordNoBoonsBanes": "No Boons/Banes" } diff --git a/src/lmrtfy.js b/src/lmrtfy.js index 178ff76..504bd83 100644 --- a/src/lmrtfy.js +++ b/src/lmrtfy.js @@ -187,7 +187,7 @@ class LMRTFY { LMRTFY.normalRollEvent = {}; LMRTFY.advantageRollEvent = {}; LMRTFY.disadvantageRollEvent = {}; - LMRTFY.specialRolls = { 'initiative': true }; + LMRTFY.specialRolls = { 'initiative': true, 'deathsave': true, 'perception': true }; LMRTFY.abilityAbbreviations = abilities; LMRTFY.modIdentifier = 'modifier'; LMRTFY.abilityModifiers = {}; diff --git a/src/requestor.js b/src/requestor.js index c2180ae..8172253 100644 --- a/src/requestor.js +++ b/src/requestor.js @@ -299,13 +299,13 @@ class LMRTFYRequestor extends FormApplication { clearDemonLordSettings() { if (($("#advantage").val() === "-1") || ($("#advantage").val() === "1")) { - $("#BBDice").prop('disabled', false); - $("#AddMod").prop('disabled', false); + $("#boonsBanes").prop('disabled', false); + $("#additionalModifier").prop('disabled', false); } else { - $("#AddMod").val("0"); - $("#BBDice").val("0"); - $("#BBDice").prop('disabled', true); - $("#AddMod").prop('disabled', true); + $("#additionalModifier").val("0"); + $("#boonsBanes").val("0"); + $("#boonsBanes").prop('disabled', true); + $("#additionalModifier").prop('disabled', true); } } @@ -366,11 +366,11 @@ class LMRTFYRequestor extends FormApplication { } } - let BBDice = undefined; - let AddMod = undefined; + let boonsBanes = undefined; + let additionalModifier = undefined; if (game.system.id === 'demonlord') { - BBDice = formData.BBDice; - AddMod = formData.AddMod; + boonsBanes = formData.boonsBanes; + additionalModifier = formData.additionalModifier; } const socketData = { @@ -395,8 +395,8 @@ class LMRTFYRequestor extends FormApplication { socketData['dc'] = dc; } if (game.system.id === 'demonlord') { - socketData['BBDice'] = BBDice; - socketData['AddMod'] = AddMod; + socketData['boonsBanes'] = boonsBanes; + socketData['additionalModifier'] = additionalModifier; } if (saveAsMacro) { diff --git a/src/roller.js b/src/roller.js index 375955e..0f0fed3 100644 --- a/src/roller.js +++ b/src/roller.js @@ -19,8 +19,8 @@ class LMRTFYRoller extends Application { } if (game.system.id === 'demonlord') { - this.BBDice = data.BBDice; - this.AddMod = data.AddMod; + this.boonsBanes = data.boonsBanes; + this.additionalModifier = data.additionalModifier; } if (data.title) { @@ -128,9 +128,9 @@ class LMRTFYRoller extends Application { async getData() { let note = "" if (this.advantage == 1) - note = (game.system.id === 'demonlord') ? game.i18n.localize("LMRTFY.DemonLordBoonsNote") : game.i18n.localize("LMRTFY.AdvantageNote"); + note = (game.system.id === 'demonlord') ? game.i18n.format("LMRTFY.DemonLordBoonsNote", { boonsBanes :this.boonsBanes}) : game.i18n.localize("LMRTFY.AdvantageNote"); else if (this.advantage == -1) - note = (game.system.id === 'demonlord') ? game.i18n.localize("LMRTFY.DemonLordBanesNote") : game.i18n.localize("LMRTFY.DisadvantageNote"); + note = (game.system.id === 'demonlord') ? game.i18n.format("LMRTFY.DemonLordBanesNote", { boonsBanes :this.boonsBanes}) : game.i18n.localize("LMRTFY.DisadvantageNote"); let abilities = {} let saves = {} @@ -336,10 +336,10 @@ class LMRTFYRoller extends Application { await actor.rollAttribute(actor.getAttribute(key), 0, 0) break; case 1: - await actor.rollAttribute(actor.getAttribute(key), this.BBDice, this.AddMod) + await actor.rollAttribute(actor.getAttribute(key), this.boonsBanes, this.additionalModifier) break; case -1: - await actor.rollAttribute(actor.getAttribute(key), (this.BBDice)*-1, this.AddMod) + await actor.rollAttribute(actor.getAttribute(key), (this.boonsBanes)*-1, this.additionalModifier) break; case 2: await actor[rollMethod].call(actor, ...args, options); @@ -420,6 +420,21 @@ class LMRTFYRoller extends Application { this._checkClose(); } + _makeDemonLordCorruptionRoll() { + const rollMode = game.settings.get("core", "rollMode"); + game.settings.set("core", "rollMode", this.mode || CONST.DICE_ROLL_MODES); + + for (let actor of this.actors) { + Hooks.once("preCreateChatMessage", this._tagMessage.bind(this)); + actor.rollCorruption(); + } + + game.settings.set("core", "rollMode", rollMode); + + this._disableButtons(event); + this._checkClose(); + } + async _makeDiceRoll(event, formula, defaultMessage = null) { if (formula.startsWith("1d20")) { if (this.advantage === 1) @@ -643,26 +658,35 @@ class LMRTFYRoller extends Application { _onDeathSave(event) { event.preventDefault(); - if (game.system.id == "dnd5e") { - for (let actor of this.actors) { - actor.rollDeathSave(event); - } - event.currentTarget.disabled = true; - this._checkClose(); - } else if (game.system.id == "pf2e") { - for (let actor of this.actors) { - actor.rollRecovery(); - } - event.currentTarget.disabled = true; - this._checkClose(); - } else { - this._makeDiceRoll(event, "1d20", game.i18n.localize("LMRTFY.DeathSaveRollMessage")); + switch (game.system.id) { + case "dnd5e": + for (let actor of this.actors) { + actor.rollDeathSave(event); + } + break + case "pf2e": + for (let actor of this.actors) { + actor.rollRecovery(); + } + break; + case "demonlord": + for (let actor of this.actors) { + this._makeDiceRoll(event, "1d6", game.i18n.localize("LMRTFY.DemonLordFateRoll")); + } + break; + default: + this._makeDiceRoll(event, "1d20", game.i18n.localize("LMRTFY.DeathSaveRollMessage")); } + event.currentTarget.disabled = true; + this._checkClose(); } _onPerception(event) { event.preventDefault(); - this._makeDiceRoll(event, `1d20 + @attributes.perception.totalModifier`, game.i18n.localize("LMRTFY.PerceptionRollMessage")); + if (game.system.id === 'demonlord') + this._makeDemonLordCorruptionRoll() + else + this._makeDiceRoll(event, `1d20 + @attributes.perception.totalModifier`, game.i18n.localize("LMRTFY.PerceptionRollMessage")); } _onRollTable(event) { diff --git a/templates/demonlord-request-rolls.html b/templates/demonlord-request-rolls.html index f5274c9..72bcd23 100644 --- a/templates/demonlord-request-rolls.html +++ b/templates/demonlord-request-rolls.html @@ -61,8 +61,8 @@
- - @@ -73,8 +73,8 @@
- - @@ -113,13 +113,13 @@ {{#if specialRolls.deathsave}}
- +
{{/if}} {{#if specialRolls.perception}}
- +
{{/if}}
diff --git a/templates/roller.html b/templates/roller.html index 9e10df8..fa65581 100644 --- a/templates/roller.html +++ b/templates/roller.html @@ -26,7 +26,7 @@ {{#each abilities as |name ability|}}
- {{#if (lmrtfy-isdemonlord this)}} />{{else}} />{{/if}} + {{#if (lmrtfy-isdemonlord this)}}{{else}} {{/if}}
{{#canFailAbilityChecks name ability}} {{/canFailAbilityChecks}} @@ -57,12 +57,12 @@ {{/if}} {{#if deathsave}}
- + {{#if (lmrtfy-isdemonlord this)}}{{else}}{{/if}}
{{/if}} {{#if perception}}
- + {{#if (lmrtfy-isdemonlord this)}}{{/if}}
{{/if}} {{#if tables}}