diff --git a/Forge/Forge.html b/Forge/Forge.html index 20f55841ba..fac6df0751 100644 --- a/Forge/Forge.html +++ b/Forge/Forge.html @@ -59,13 +59,14 @@ - +
+
@@ -96,9 +97,9 @@ - - - + + +
@@ -126,10 +127,10 @@ - +
- + @@ -139,7 +140,7 @@ - +
@@ -149,7 +150,7 @@

Attacks

- +
@@ -158,7 +159,7 @@
- + @@ -208,9 +209,9 @@
- - - + + +
@@ -222,11 +223,11 @@ - + - +
@@ -269,26 +270,10 @@ }); }); - const dmgTable = ["1d2","1d4","1d6","1d8","2d4","1d10","2d5","1d12","2d6","2d7","2d8","1d20","2d10","2d11","2d12","2d20"]; - - //const spellCostTable = [.1, .2, .2, .333333, .333333, .333333, .5, .5, .5, .5, 1, 1, 1, 1, 1, 2, 3,3,3,3,3, 4,4,4,4,4, 5,5,5,5,5 ,6,6,6,6,6 ,7,7,7,7,7 ,8,8,8,8,8,8 - //,9,9,9,9,9 ,10,10,10,10,10]; - - function getDamageRollStr(dmgAttr, callback){ - getAttrs([ - "dmg", dmgAttr - ] - , function(values) { - const dmgV = Math.min(15, Math.max(0, sumFieldValues(values)-1)); - callback(dmgTable[dmgV]); - }); - } + const dmgTable = ["1d2","1d4","2d2","1d6", "2d3","1d8","2d4","1d10","2d5","1d12","2d6","2d7","2d8","1d20","2d10","2d11","2d12","2d13", "2d14", "2d15", "2d16", "2d20"]; function getCostOfSpell(spellDiff){ return Math.floor(parseInt(spellDiff)/5) - 1; - //const mult = spellCostTable[parseInt(spellDiff)-5]; - //const fullCost = Math.ceil(mult*parseInt(maxUses)) - //return [fullCost, Math.max(1,Math.round(fullCost*(1/mult)))]; } @@ -296,10 +281,6 @@ getAttrs( ["mana", "iq", "manamax"] , function(values) { const minMana = Math.max(parseInt(values.iq), parseInt(eventInfo.newValue)); - console.log(minMana); - console.log(parseInt(values.iq)); - console.log(parseInt(values.manamax)); - console.log(parseInt(values.mana)); setAttrs({"mana": (parseInt(values.mana) + (minMana - (parseInt(eventInfo.previousValue)||0))), "manamax":minMana}, {silent:true}); }); }); @@ -320,19 +301,28 @@ }); }); + // Changing f + on("change:dmg", function(eventInfo) { + setAttrs({ + "dmgroll": dmgTable[Math.min(21, eventInfo.newValue)] + } + , {silent:true} + ); + }); + // Changing damage - on("change:repeating_weapons change:repeating_spells", function(eventInfo) { - const btndmgAttr = eventInfo.triggerName + "_dmgbtn"; - //document.getElementsByName(btndmgAttr)[0].disabled = false; - // set the attribute to a template with the updated die roll - let templateStr = "&{template:weapondmg}{{weaponname=@{weaponname}}}{{mindmg=[[@{dmg}+?{Mod? (Applies to min & dmg)|0}]]}}{{damage=[["; - getDamageRollStr(eventInfo.triggerName + "_damage", function(dmgroll){ - templateStr += dmgroll + "+?{Mod? (Applies to min & dmg)|0}]]}}"; - setAttrs({ - [btndmgAttr]: templateStr + on("change:repeating_weapons:damage change:repeating_spells:damage", function(eventInfo) { + getAttrs( ["dmgroll"] + , function(values) { + const splitVal = values.dmgroll.split("d"); + const maxMinDmg = parseInt(splitVal[0])*parseInt(splitVal[1]); + if(parseInt(eventInfo.newValue) > maxMinDmg){ + let attrsToSend = {}; + attrsToSend[eventInfo.sourceAttribute] = maxMinDmg; + setAttrs(attrsToSend + , {silent:true} + ); } - , {silent:true} - ); }); }); @@ -535,9 +525,10 @@ {{damage}} {{#rollLess() damage mindmg}} - Damage cannot be below Ferocity: {{mindmg}} + Damage cannot be below Ferocity: {{mindmg}} {{/rollLess() damage mindmg}} - - DR +
+ Subtract location DR @@ -579,7 +570,7 @@ @@ -599,7 +590,7 @@ {{#rollTotal() roll 1}} CRIT FAIL! ({{roll}})
- Your attack auto fails, succeed a "high or low" or your spell backfires. This also wastes mana. + Your attack auto fails, succeed a "high or low" or your Spell backfires. This also wastes mana. {{/rollTotal() roll 1}} {{#rollBetween() roll 2 19}}
- {{name}} attempts to cast spell {{weaponname}} Difficulty: {{diff}} + {{name}} attempts to cast Spell {{weaponname}} Difficulty: {{diff}}