diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 29d4295..68fac9d 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -326,6 +326,13 @@ export class MothershipActorSheet extends ActorSheet { this.actor.rollCheck(null,'low','combat',null,null,item); }); + // Rollable Damage + html.find('.dmg-roll').click(ev => { + const li = ev.currentTarget.closest(".item"); + const item = duplicate(this.actor.getEmbeddedDocument("Item", li.dataset.itemId)); + this.actor.rollCheck(null,null,'damage',null,null,item); + }); + // Rollable Item/Anything with a description that we want to click on. html.find('.description-roll').click(ev => { const li = ev.currentTarget.closest(".item"); diff --git a/module/actor/actor.js b/module/actor/actor.js index f35e908..a411e53 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -2064,6 +2064,84 @@ export class MothershipActor extends Actor { let firstEdition = game.settings.get('mosh','firstEdition'); let useCalm = game.settings.get('mosh','useCalm'); //customize this roll if its a unique use-case + //damage roll + if (attribute === 'damage') { + //set special roll value for use later + specialRoll = attribute; + //parse the roll string + parsedDamageString = this.parseRollString(weapon.system.damage,'high'); + //override message header + msgHeader = weapon.name; + //override header image + msgImgPath = weapon.img; + let dsnTheme = 0; + if(game.settings.get('mosh', 'damageDiceTheme') != ""){ //We're going to check if the theme field is blank. Otherwise, don't use this. + //set damage dice color + dsnTheme = game.settings.get('mosh','damageDiceTheme'); + } + //prepare flavortext + if (weapon.system.damage === "Str/10" && this.type === 'character') { + //determine the damage string + flavorText = 'You strike your target for [[floor(' + this.system.stats.strength.value + '/10)]] damage.'; + } else { + flavorText = 'You inflict [[' + parsedDamageString + '[' + dsnTheme + ']' + critMod + ']] points of damage.'; + } + //determine if this roll needs a description area + if (weapon.system.description || weapon.system.woundEffect) { + needsDesc = true; + } + //create wound effect string + if (weapon.system.woundEffect) { + //start with string as is + woundEffect = weapon.system.woundEffect; + //prepare array for looping + //replace ' [-]' and ' [+]' + woundEffect = woundEffect.replaceAll(' [-]','_dis').replaceAll(' [+]','_adv'); + //simplify wounds + woundEffect = woundEffect.replace('Bleeding','bleeding'); + woundEffect = woundEffect.replace('Blunt Force','blunt_force'); + woundEffect = woundEffect.replace('Fire & Explosives','fire_explosives'); + woundEffect = woundEffect.replace('Gore & Massive','gore_massive'); + woundEffect = woundEffect.replace('Gunshot','gunshot'); + //split string + let woundArray = woundEffect.split(' '); + //loop through this string and replace each wound effect with macro UUID + woundArray.forEach((element, index, array) => { + array[index] = this.getFlavorText('macro', 'wound', element); + }); + //combine back into string + woundEffect = woundArray.join(' '); + } + //generate chat message + //prepare data + let messageData = { + actor: this, + weapon: weapon, + msgHeader: msgHeader, + msgImgPath: msgImgPath, + flavorText: flavorText, + needsDesc: needsDesc, + woundEffect: woundEffect, + specialRoll: specialRoll + }; + let chatData = { + user: game.user.id, + speaker: { + actor: this.id, + token: this.token, + alias: this.name + } + }; + let template = 'systems/mosh/templates/chat/rollCheck.html'; + renderTemplate(template, messageData).then(content => { + chatData.content = content; + ChatMessage.create(chatData); + }); + //log what was done + console.log(`Rolled damage on:${weapon.name}`); + //exit + return; + } //rest save if (attribute === 'restSave') { //1e rest save diff --git a/module/actor/creature-sheet.js b/module/actor/creature-sheet.js index 4fb35d0..1f38979 100644 --- a/module/actor/creature-sheet.js +++ b/module/actor/creature-sheet.js @@ -162,6 +162,13 @@ export class MothershipCreatureSheet extends ActorSheet { this.actor.rollCheck(null,'low','combat',null,null,item); }); + // Rollable Damage + html.find('.dmg-roll').click(ev => { + const li = ev.currentTarget.closest(".item"); + const item = duplicate(this.actor.getEmbeddedDocument("Item", li.dataset.itemId)); + this.actor.rollCheck(null,null,'damage',null,null,item); + }); + //increase ammo html.on('mousedown', '.weapon-ammo', ev => { //dupe item to work on diff --git a/templates/actor/actor-sheet.html b/templates/actor/actor-sheet.html index 8d12599..495de7c 100644 --- a/templates/actor/actor-sheet.html +++ b/templates/actor/actor-sheet.html @@ -599,9 +599,9 @@
{{weapon.name}}
{{#if weapon.system.antiArmor}} -
{{weapon.system.damage}} (AA)
+
{{weapon.system.damage}} (AA)
{{else}} -
{{weapon.system.damage}}
+
{{weapon.system.damage}}
{{/if}} {{#if weapon.system.useAmmo}}
{{weapon.system.ammo}}
diff --git a/templates/actor/creature-sheet.html b/templates/actor/creature-sheet.html index 12ef992..cc33fec 100644 --- a/templates/actor/creature-sheet.html +++ b/templates/actor/creature-sheet.html @@ -183,7 +183,7 @@
{{weapon.name}}
-
{{weapon.system.damage}}
+
{{weapon.system.damage}}
{{#if weapon.system.useAmmo}}
{{weapon.system.ammo}}
{{else}} diff --git a/templates/chat/rollCheck.html b/templates/chat/rollCheck.html index e3b4d30..25ec969 100644 --- a/templates/chat/rollCheck.html +++ b/templates/chat/rollCheck.html @@ -9,22 +9,47 @@ {{/if}}
- {{{parsedRollResult.outcomeHtml}}} -
-
- {{#if (compare 'int' parsedRollResult.total '>=' 90)}} - You rolled 90 or higher, which is always considered a failure. - {{else}} - {{#if (compare 'int' skillValue '>' 0)}} - You {{{outcomeVerb}}} less than your {{{attribute}}} plus {{{skill}}} skill bonus. + {{#if (compare 'str' specialRoll '!==' 'damage')}} + {{{parsedRollResult.outcomeHtml}}} +
+
+ {{#if (compare 'int' parsedRollResult.total '>=' 90)}} + You rolled 90 or higher, which is always considered a failure. {{else}} - You {{{outcomeVerb}}} less than your {{{attribute}}}. + {{#if (compare 'int' skillValue '>' 0)}} + You {{{outcomeVerb}}} less than your {{{attribute}}} plus {{{skill}}} skill bonus. + {{else}} + You {{{outcomeVerb}}} less than your {{{attribute}}}. + {{/if}} {{/if}} - {{/if}} +
-
- {{{parsedRollResult.rollHtml}}} + {{{parsedRollResult.rollHtml}}} + {{/if}}
+ {{#if (compare 'str' specialRoll '===' 'damage')}} +
{{{flavorText}}}
+ {{#if needsDesc}} +
+
+
+
DESCRIPTION
+
+
+
+
+
{{{weapon.system.description}}}
+ {{#if woundEffect}} +
+
Wound Effect +
+ {{{woundEffect}}} +
+ {{/if}} + {{/if}} +
+
+ {{else}} {{#if parsedRollResult.success}} {{#if weapon}}
{{{flavorText}}}
@@ -57,6 +82,7 @@

@UUID[Compendium.mosh.macros_hotbar_1e.IgWvaabVqzKDzLL4]{Make a Panic Check} {{/if}} {{/if}} + {{/if}}