account for negative rolls + cryo dmg fixes
This commit is contained in:
+16
-5
@@ -1071,27 +1071,38 @@ export class MothershipActor extends Actor {
|
||||
//change data point: change each 100 or 10 result to zero
|
||||
if (zeroBased) {
|
||||
//1d10 changes
|
||||
if (rollString.substr(0,rollString.indexOf("[")).trim() === '1d10' || rollString === '1d10') {
|
||||
if (rollString.substr(0,rollString.indexOf("[")).trim() === '1d10' || rollString === '1d10' || rollString.substr(0,rollString.indexOf("[")).trim() === '-1d10' || rollString === '-1d10') {
|
||||
//loop through dice
|
||||
enrichedRollResult.dice.forEach(function(roll){
|
||||
//loop through each result
|
||||
roll.results.forEach(function(die) {
|
||||
//change any 10s to 0s
|
||||
if (die.result === 10) {die.result = 0;}
|
||||
if (die.result === 10 || die.result === -10) {die.result = 0;}
|
||||
});
|
||||
});
|
||||
//1d100 changes
|
||||
} else if (rollString.substr(0,rollString.indexOf("[")).trim() === '1d100' || rollString === '1d100') {
|
||||
} else if (rollString.substr(0,rollString.indexOf("[")).trim() === '1d100' || rollString === '1d100' || rollString.substr(0,rollString.indexOf("[")).trim() === '-1d100' || rollString === '-1d100') {
|
||||
//loop through dice
|
||||
enrichedRollResult.dice.forEach(function(roll){
|
||||
//loop through each result
|
||||
roll.results.forEach(function(die) {
|
||||
//change any 100s to 0s
|
||||
if (die.result === 100) {die.result = 0;}
|
||||
if (die.result === 100 || die.result === -100) {die.result = 0;}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
//update dice totals to negative for negative rolls
|
||||
if (rollString.substr(0,1) === '-') {
|
||||
//loop through dice
|
||||
enrichedRollResult.dice.forEach(function(roll){
|
||||
//loop through each result
|
||||
roll.results.forEach(function(die) {
|
||||
//change any non-zero
|
||||
die.result = die.result*-1;
|
||||
});
|
||||
});
|
||||
}
|
||||
//pick a new winner if [-] or [+]
|
||||
if (rollString.includes("[")) {
|
||||
//if [-] pick a new worst number
|
||||
@@ -3379,7 +3390,7 @@ export class MothershipActor extends Actor {
|
||||
this.modifyActor('system.stats.body.value',parsedRollResult.total,null,false);
|
||||
//get flavor text
|
||||
let msgFlavor = this.getFlavorText('item','condition','cryo');
|
||||
let msgOutcome = `All stats and saves decreased by <strong>1</strong>.`;
|
||||
let msgOutcome = `All stats and saves decreased by <strong>` + Math.abs(parsedRollResult.total).toString() + `</strong>.`;
|
||||
//create chat message text
|
||||
let messageContent = `
|
||||
<div class="mosh">
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
{"_id":"XlfEeDblsp7fTzUx","name":"Strength Check -","type":"script","scope":"global","img":"icons/svg/d10-grey.svg","command":"game.mosh.initRollCheck('1d100 [-]','low','strength',null,null,null);","folder":null,"flags":{},"_stats":{"systemId":"mosh","systemVersion":"0.4.0","coreVersion":"11.308","createdTime":1685936572185,"modifiedTime":1693515520278,"lastModifiedBy":"6EeM38DJkcBWNAmw"}}
|
||||
{"_id":"9X5WPlXiZn9EqF9f","name":"Strength Check +","type":"script","scope":"global","img":"icons/svg/d10-grey.svg","command":"game.mosh.initRollCheck('1d100 [+]','low','strength',null,null,null);","folder":null,"flags":{},"_stats":{"systemId":"mosh","systemVersion":"0.4.0","coreVersion":"11.308","createdTime":1685936572185,"modifiedTime":1693515520278,"lastModifiedBy":"6EeM38DJkcBWNAmw"}}
|
||||
{"_id":"aur5HWqZJNspwdCd","name":"Take Bleeding Damage","type":"script","scope":"global","img":"icons/svg/d10-grey.svg","command":"prepBleedingDamage();\n\n//tell the actor to run the function\nasync function prepBleedingDamage() {\n //determine who to run the macro for\n if (game.settings.get('mosh','macroTarget') === 'character') {\n //is there a selected character? warn if no\n if (!game.user.character) {\n //warn player\n game.mosh.noCharSelected();\n } else {\n //run the function for the player's 'Selected Character'\n game.user.character.takeBleedingDamage();\n }\n } else if (game.settings.get('mosh','macroTarget') === 'token') {\n //is there a selected character? warn if no\n if (!canvas.tokens.controlled.length) {\n //warn player\n game.mosh.noCharSelected();\n } else {\n //run the function for all selected tokens\n canvas.tokens.controlled.forEach(function(token){\n token.actor.takeBleedingDamage();\n });\n }\n }\n}","folder":null,"flags":{},"_stats":{"systemId":"mosh","systemVersion":"0.4.0","coreVersion":"11.308","createdTime":1685936572185,"modifiedTime":1693515520278,"lastModifiedBy":"6EeM38DJkcBWNAmw"}}
|
||||
{"_id":"SeMStXQGIaeiLwvw","name":"-1d5 All Stats/Saves","type":"script","scope":"global","img":"icons/svg/d10-grey.svg","command":"prepCryoDamage();\n\n//tell the actor to run the function\nasync function prepCryoDamage(); {\n //determine who to run the macro for\n if (game.settings.get('mosh','macroTarget') === 'character') {\n //is there a selected character? warn if no\n if (!game.user.character) {\n //warn player\n game.mosh.noCharSelected();\n } else {\n //run the function for the player's 'Selected Character'\n game.user.character.takeCryoDamage('-1d5');\n }\n } else if (game.settings.get('mosh','macroTarget') === 'token') {\n //is there a selected character? warn if no\n if (!canvas.tokens.controlled.length) {\n //warn player\n game.mosh.noCharSelected();\n } else {\n //run the function for all selected tokens\n canvas.tokens.controlled.forEach(function(token){\n token.actor.takeCryoDamage('-1d5');\n });\n }\n }\n}","folder":null,"flags":{},"_stats":{"systemId":"mosh","systemVersion":"0.4.0","coreVersion":"11.308","createdTime":1685936572185,"modifiedTime":1693515520278,"lastModifiedBy":"6EeM38DJkcBWNAmw"}}
|
||||
{"_id":"2MuANcdgp2g8SDlF","name":"-1d10 All Stats/Saves","type":"script","scope":"global","img":"icons/svg/d10-grey.svg","command":"prepCryoDamage();\n\n//tell the actor to run the function\nasync function prepCryoDamage(); {\n //determine who to run the macro for\n if (game.settings.get('mosh','macroTarget') === 'character') {\n //is there a selected character? warn if no\n if (!game.user.character) {\n //warn player\n game.mosh.noCharSelected();\n } else {\n //run the function for the player's 'Selected Character'\n game.user.character.takeCryoDamage('-1d10');\n }\n } else if (game.settings.get('mosh','macroTarget') === 'token') {\n //is there a selected character? warn if no\n if (!canvas.tokens.controlled.length) {\n //warn player\n game.mosh.noCharSelected();\n } else {\n //run the function for all selected tokens\n canvas.tokens.controlled.forEach(function(token){\n token.actor.takeCryoDamage('-1d10');\n });\n }\n }\n}","folder":null,"flags":{},"_stats":{"systemId":"mosh","systemVersion":"0.4.0","coreVersion":"11.308","createdTime":1685936572185,"modifiedTime":1693515520278,"lastModifiedBy":"6EeM38DJkcBWNAmw"}}
|
||||
{"_id":"SeMStXQGIaeiLwvw","name":"-1d5 All Stats/Saves","type":"script","scope":"global","img":"icons/svg/d10-grey.svg","command":"prepCryoDamage();\n\n//tell the actor to run the function\nasync function prepCryoDamage() {\n //determine who to run the macro for\n if (game.settings.get('mosh','macroTarget') === 'character') {\n //is there a selected character? warn if no\n if (!game.user.character) {\n //warn player\n game.mosh.noCharSelected();\n } else {\n //run the function for the player's 'Selected Character'\n game.user.character.takeCryoDamage('-1d5');\n }\n } else if (game.settings.get('mosh','macroTarget') === 'token') {\n //is there a selected character? warn if no\n if (!canvas.tokens.controlled.length) {\n //warn player\n game.mosh.noCharSelected();\n } else {\n //run the function for all selected tokens\n canvas.tokens.controlled.forEach(function(token){\n token.actor.takeCryoDamage('-1d5');\n });\n }\n }\n}","folder":null,"flags":{},"_stats":{"systemId":"mosh","systemVersion":"0.4.0","coreVersion":"11.308","createdTime":1685936572185,"modifiedTime":1693515520278,"lastModifiedBy":"6EeM38DJkcBWNAmw"}}
|
||||
{"_id":"2MuANcdgp2g8SDlF","name":"-1d10 All Stats/Saves","type":"script","scope":"global","img":"icons/svg/d10-grey.svg","command":"prepCryoDamage();\n\n//tell the actor to run the function\nasync function prepCryoDamage() {\n //determine who to run the macro for\n if (game.settings.get('mosh','macroTarget') === 'character') {\n //is there a selected character? warn if no\n if (!game.user.character) {\n //warn player\n game.mosh.noCharSelected();\n } else {\n //run the function for the player's 'Selected Character'\n game.user.character.takeCryoDamage('-1d10');\n }\n } else if (game.settings.get('mosh','macroTarget') === 'token') {\n //is there a selected character? warn if no\n if (!canvas.tokens.controlled.length) {\n //warn player\n game.mosh.noCharSelected();\n } else {\n //run the function for all selected tokens\n canvas.tokens.controlled.forEach(function(token){\n token.actor.takeCryoDamage('-1d10');\n });\n }\n }\n}","folder":null,"flags":{},"_stats":{"systemId":"mosh","systemVersion":"0.4.0","coreVersion":"11.308","createdTime":1685936572185,"modifiedTime":1693515520278,"lastModifiedBy":"6EeM38DJkcBWNAmw"}}
|
||||
{"_id":"8euTBbjY9uDQR13K","name":"Maintenance Check","type":"script","scope":"global","img":"icons/svg/d10-grey.svg","command":"prepMaintenanceCheck();\n\n//tell the actor to run the function\nasync function prepMaintenanceCheck() {\n //determine who to run the macro for\n if (game.settings.get('mosh','macroTarget') === 'character') {\n //is there a selected character? warn if no\n if (!game.user.character || !game.user.character.type === 'ship') {\n //warn player\n game.mosh.noShipSelected();\n } else {\n //run the function for the player's 'Selected Character'\n game.user.character.maintenanceCheck();\n }\n } else if (game.settings.get('mosh','macroTarget') === 'token') {\n //is there a selected character? warn if no\n if (!canvas.tokens.controlled.length) {\n //warn player\n game.mosh.noShipSelected();\n } else {\n //run the function for all selected tokens\n canvas.tokens.controlled.forEach(function(token){\n token.actor.maintenanceCheck();\n });\n }\n }\n}","folder":null,"flags":{},"_stats":{"systemId":"mosh","systemVersion":"0.4.0","coreVersion":"11.308","createdTime":1685936572185,"modifiedTime":1693515520278,"lastModifiedBy":"6EeM38DJkcBWNAmw"}}
|
||||
{"_id":"C04VbNoj8LgfY8QK","name":"Maintenance Check [-]","type":"script","scope":"global","img":"icons/svg/d10-grey.svg","command":"prepMaintenanceCheck();\n\n//tell the actor to run the function\nasync function prepMaintenanceCheck() {\n //determine who to run the macro for\n if (game.settings.get('mosh','macroTarget') === 'character') {\n //is there a selected character? warn if no\n if (!game.user.character || !game.user.character.type === 'ship') {\n //warn player\n game.mosh.noShipSelected();\n } else {\n //run the function for the player's 'Selected Character'\n game.user.character.rollTable(`maintenanceCheck`,`1d100 [-]`,`low`,null,null,null,null);\n }\n } else if (game.settings.get('mosh','macroTarget') === 'token') {\n //is there a selected character? warn if no\n if (!canvas.tokens.controlled.length) {\n //warn player\n game.mosh.noShipSelected();\n } else {\n //run the function for all selected tokens\n canvas.tokens.controlled.forEach(function(token){\n token.actor.rollTable(`maintenanceCheck`,`1d100 [-]`,`low`,null,null,null,null);\n });\n }\n }\n}","folder":null,"flags":{},"_stats":{"systemId":"mosh","systemVersion":"0.4.0","coreVersion":"11.308","createdTime":1685936572185,"modifiedTime":1693515520278,"lastModifiedBy":"6EeM38DJkcBWNAmw"}}
|
||||
{"_id":"g5hyNqBioTNe5TGx","name":"Maintenance Check [+]","type":"script","scope":"global","img":"icons/svg/d10-grey.svg","command":"prepMaintenanceCheck();\n\n//tell the actor to run the function\nasync function prepMaintenanceCheck() {\n //determine who to run the macro for\n if (game.settings.get('mosh','macroTarget') === 'character') {\n //is there a selected character? warn if no\n if (!game.user.character || !game.user.character.type === 'ship') {\n //warn player\n game.mosh.noShipSelected();\n } else {\n //run the function for the player's 'Selected Character'\n game.user.character.rollTable(`maintenanceCheck`,`1d100 [+]`,`low`,null,null,null,null);\n }\n } else if (game.settings.get('mosh','macroTarget') === 'token') {\n //is there a selected character? warn if no\n if (!canvas.tokens.controlled.length) {\n //warn player\n game.mosh.noShipSelected();\n } else {\n //run the function for all selected tokens\n canvas.tokens.controlled.forEach(function(token){\n token.actor.rollTable(`maintenanceCheck`,`1d100 [+]`,`low`,null,null,null,null);\n });\n }\n }\n}","folder":null,"flags":{},"_stats":{"systemId":"mosh","systemVersion":"0.4.0","coreVersion":"11.308","createdTime":1685936572185,"modifiedTime":1693515520278,"lastModifiedBy":"6EeM38DJkcBWNAmw"}}
|
||||
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
MANIFEST-000006
|
||||
@@ -1,8 +0,0 @@
|
||||
2024/05/31-17:17:38.526 5714 Recovering log #4
|
||||
2024/05/31-17:17:38.530 5714 Delete type=0 #4
|
||||
2024/05/31-17:17:38.531 5714 Delete type=3 #2
|
||||
2024/05/31-17:20:09.428 2734 Level-0 table #9: started
|
||||
2024/05/31-17:20:09.428 2734 Level-0 table #9: 0 bytes OK
|
||||
2024/05/31-17:20:09.432 2734 Delete type=0 #7
|
||||
2024/05/31-17:20:09.434 2734 Manual compaction at level-0 from '!macros!06NSvDYTtmkeUtLq' @ 72057594037927935 : 1 .. '!macros!zLRsweb35Lw0NMev' @ 0 : 0; will stop at (end)
|
||||
2024/05/31-17:20:09.434 2734 Manual compaction at level-1 from '!macros!06NSvDYTtmkeUtLq' @ 72057594037927935 : 1 .. '!macros!zLRsweb35Lw0NMev' @ 0 : 0; will stop at (end)
|
||||
@@ -1,5 +0,0 @@
|
||||
2024/05/31-17:00:59.070 3e44 Delete type=3 #1
|
||||
2024/05/31-17:17:20.780 2734 Level-0 table #5: started
|
||||
2024/05/31-17:17:20.793 2734 Level-0 table #5: 27786 bytes OK
|
||||
2024/05/31-17:17:20.794 2734 Delete type=0 #3
|
||||
2024/05/31-17:17:20.826 2734 Manual compaction at level-0 from '!macros!06NSvDYTtmkeUtLq' @ 72057594037927935 : 1 .. '!macros!zLRsweb35Lw0NMev' @ 0 : 0; will stop at (end)
|
||||
Binary file not shown.
Reference in New Issue
Block a user