From ebde071332d69b8f59447b94e57d5cd5baaa36d9 Mon Sep 17 00:00:00 2001 From: Alex Rinehart Date: Wed, 8 Mar 2023 17:04:48 -0800 Subject: [PATCH] Fix 5 bugs --- Cyberrats/Cyberrats.css | 5 +++++ Cyberrats/Cyberrats.html | 33 ++++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/Cyberrats/Cyberrats.css b/Cyberrats/Cyberrats.css index 9c96574311..120495d421 100644 --- a/Cyberrats/Cyberrats.css +++ b/Cyberrats/Cyberrats.css @@ -802,6 +802,11 @@ input.sheer-disabler:checked ~ button.enab { display: none !important; } +.pull-right { + font-size: 1.3em; + margin-top: 5px; +} + hr.separaotr { border-top: 3px solid #c9c9c9; } diff --git a/Cyberrats/Cyberrats.html b/Cyberrats/Cyberrats.html index 6fcb7f7a5e..53ad94e3d1 100644 --- a/Cyberrats/Cyberrats.html +++ b/Cyberrats/Cyberrats.html @@ -164,6 +164,8 @@

All Known Powers

+ + You've equipped /5 powers.
@@ -382,7 +384,7 @@ - + @@ -1151,7 +1153,7 @@
- +
@@ -2218,7 +2220,8 @@ function getAssistantInfo(assistant) { function buildDicePool(numDice) { - if(numDice == 0) { +console.log("Building dice pool for " + numDice); + if(numDice <= 0) { numDice = 2; const rolls = [...Array(numDice)].map(() => "[[d6]]").join(", "); return `[[{${rolls}}kl1]]`; // Keep LOWEST not highest @@ -2229,7 +2232,7 @@ function buildDicePool(numDice) { } function getResults(numDice) { - if(numDice === 0) { + if(numDice <= 0) { numDice = 2; } return numDice <= 1 @@ -2364,7 +2367,7 @@ on("change:dicemod", function(eventInfo) { "sly", "cyber" ], function(values) { - + console.log("Dicemod changed"); const diceMod = parseInt(eventInfo.newValue); updateSmashFormulas(parseInt(values.smash) + diceMod); updateSlyFormulas(parseInt(values.sly) + diceMod); @@ -2393,6 +2396,7 @@ on("change:smash", function(eventInfo) { }); function updateSlyFormulas(totalSlyDice) { +console.log("Total sly dice: " + totalSlyDice); const roll_formula_sly = buildDicePool(totalSlyDice); const roll_results_sly = getResults(totalSlyDice); setAttrs({ @@ -2574,7 +2578,7 @@ on("change:repeating_powers:equipped", function(eventInfo) { getAttrs(["powersEquipped"], (values) => { setAttrs( { - powersEquipped: values.powersEquipped + changeval + powersEquipped: parseInt(values.powersEquipped) + changeval } ); }); @@ -2645,6 +2649,7 @@ on("change:hivedecayroom1 change:hivedecayroom2 change:hivedecayroom3 change:hiv }); on("sheet:opened", () => { +console.log("Load"); // Initialize our default values. Not necessary if we used translation. getAttrs(["smash_fail", "cyber_fail", "sly_fail", "smash", "sly", "cyber", "dicemod", "sublockedroom6"], (values) => { const sm = values.smash_fail; @@ -2826,7 +2831,21 @@ on("clicked:reset", function() { } if(rows) setAttrs(rows); }); - + console.log("Antwer"); + // Reload all weapons + getSectionIDs("repeating_weapon", idarray => { + let rows = {}; + for (let i = 0; i < idarray.length; i++) { + getAttrs(['repeating_weapon_' + idarray[i] + '_max_ammo'], function(values){ + let maxVal = parseInt(values['repeating_weapon_' + idarray[i] + '_max_ammo']); + console.log(maxVal); + rows['repeating_weapon_' + idarray[i] + '_ammo'] = maxVal; + if(rows) setAttrs(rows); + }) + } + + }); + console.log("Bruges"); const shouldResetPowers = values.resetpowers == 'true'; if(shouldResetPowers) {