diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 68fac9d..bebb4fb 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -358,6 +358,24 @@ export class MothershipActorSheet extends ActorSheet { this.actor.updateEmbeddedDocuments('Item', [item]); }); + //increase shots + html.on('mousedown', '.weapon-shots', ev => { + const li = ev.currentTarget.closest(".item"); + const item = duplicate(this.actor.getEmbeddedDocument("Item", li.dataset.itemId)) + if (event.button == 0) { + if (item.system.curShots >= 0 && item.system.curShots < item.system.shots && item.system.ammo > 0) { + item.system.curShots = Number(item.system.curShots) + 1; + item.system.ammo = Number(item.system.ammo) - 1; + } + } else if (event.button == 2) { + if (item.system.curShots > 0) { + item.system.curShots = Number(item.system.curShots) - 1; + item.system.ammo = Number(item.system.ammo) + 1; + } + } + this.actor.updateEmbeddedDocuments('Item', [item]); + }); + //Reload Shots html.on('mousedown', '.weapon-reload', ev => { const li = ev.currentTarget.closest(".item"); diff --git a/module/actor/actor.js b/module/actor/actor.js index 87b0cbb..4c20006 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -1734,6 +1734,8 @@ export class MothershipActor extends Actor { } //log what was done console.log(`Rolled on table ID: ${tableId}, with: rollString:${rollString}, aimFor:${aimFor}, zeroBased:${zeroBased}, checkCrit:${checkCrit}, rollAgainst:${rollAgainst}, comparison:${comparison}`); + //return messageData + return [messageData]; } //central adding addribute function | TAKES '1d10','low' | RETURNS player selected attribute. If parameters are null, it asks the player. @@ -2236,8 +2238,8 @@ export class MothershipActor extends Actor { }); //log what was done console.log(`Rolled damage on:${weapon.name}`); - //exit - return; + //return messageData + return [messageData]; } //rest save if (attribute === 'restSave') { @@ -2734,13 +2736,15 @@ export class MothershipActor extends Actor { speaker: {actor: this.id, token: this.token, alias: this.name}, content: messageContent },{keepId:true}); - + //is DSN active? if(game.modules.get("dice-so-nice").active){ //wait for dice await game.dice3d.waitFor3DAnimationByMessageID(chatId); } //log what was done console.log(`Rolled a check on: ${attribute}, with: rollString:${rollString}, aimFor:${aimFor}, skill:${skill}, skillValue:${skillValue}, weapon:${weapon.name}`); + //return messageData + return [messageData]; } //central function to modify actors | TAKES 'system.other.stress.value',-1,'-1d5',true | RETURNS change details, and optional chat message diff --git a/system.json b/system.json index a605834..c069b5a 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "mosh", "title": "MoSh - Unofficial Mothership", "description": "The unofficial Mothership system for FoundryVTT.", - "version": "0.5.15", + "version": "0.5.17", "esmodules": [ "module/mosh.js" ], @@ -132,8 +132,8 @@ "primaryTokenAttribute": "health", "secondaryTokenAttribute": "other.stress", "url": "https://github.com/Futil/foundry-mothership", - "manifest": "https://raw.githubusercontent.com/Futil/foundry-mothership/0.5.15/system.json", - "download": "https://github.com/Futil/foundry-mothership/releases/download/0.5.15/foundry-mothership.zip", + "manifest": "https://raw.githubusercontent.com/Futil/foundry-mothership/0.5.17/system.json", + "download": "https://github.com/Futil/foundry-mothership/releases/download/0.5.17/foundry-mothership.zip", "license": "LICENSE.txt", "authors": [ { diff --git a/templates/actor/actor-sheet.html b/templates/actor/actor-sheet.html index 495de7c..7e58474 100644 --- a/templates/actor/actor-sheet.html +++ b/templates/actor/actor-sheet.html @@ -610,10 +610,14 @@ {{/if}} {{#if weapon.system.useAmmo}} {{#if (compare 'int' weapon.system.curShots '===' weapon.system.shots)}} -