final changes

This commit is contained in:
Ricky Martinez
2023-04-29 19:21:19 -05:00
parent 6d2eca8fad
commit 2f105d2975
3 changed files with 307 additions and 142 deletions
-4
View File
@@ -89,7 +89,6 @@ h3 {
.sheet-rolltemplate-rolllow table,
.sheet-rolltemplate-roll table,
.sheet-rolltemplate-spell table,
.sheet-rolltemplate-weapondmg table,
.sheet-rolltemplate-weapon table{
background-color:antiquewhite;
border:1px solid #c1875d;
@@ -103,7 +102,6 @@ h3 {
.sheet-rolltemplate-rolllow table th,
.sheet-rolltemplate-roll table th,
.sheet-rolltemplate-spell table th,
.sheet-rolltemplate-weapondmg table th,
.sheet-rolltemplate-weapon table th{
background-color:antiquewhite;
text-align:center;
@@ -115,7 +113,6 @@ h3 {
.sheet-rolltemplate-rolllow table td,
.sheet-rolltemplate-roll table td,
.sheet-rolltemplate-spell table td,
.sheet-rolltemplate-weapondmg table td,
.sheet-rolltemplate-weapon table td{
padding: 2px;
}
@@ -124,7 +121,6 @@ h3 {
.sheet-rolltemplate-rolllow table .inlinerollresult,
.sheet-rolltemplate-roll table .inlinerollresult,
.sheet-rolltemplate-spell table .inlinerollresult,
.sheet-rolltemplate-weapondmg table .inlinerollresult,
.sheet-rolltemplate-weapon table .inlinerollresult{
border:none !important;
background-color:inherit;
+307 -138
View File
@@ -56,7 +56,7 @@
<div class="twocolumns">
<div class="labels">
<label title="Tuf 5 CP. Rolled for life saving throws (poison, drowning, etc.), strength throws, defense against Persuade, and Inventory slots (if used). +1 HP">Toughness </label>
<label title="Dex 5 CP. Rolled for physical feats (attack, climbing/falling, picking locks, etc.)">Dexterity </label>
<label title="Ath 5 CP. Rolled for physical feats (attack, climbing/falling, picking locks, etc.)">Athleticism </label>
<label title="IQ 5 CP. Rolled for magic and mental feats (perception, puzzles, knowledge, etc.)">Intelligence </label>
</div>
<div class="valuecolumn">
@@ -66,14 +66,22 @@
</div>
<div class="valuecolumn">
<button style="height: 18px;" type="roll" title="Roll stat." value="&{template:roll}{{name=@{character_name}}}{{total=[[ [[1d20]] + @{tuf}[Tuf] ]]}}{{roll=$[[0]]}}{{target=[[@{targetr}]]}}{{stat='Toughness'}}"></button>
<button style="height: 18px;" type="roll" title="Roll stat." value="&{template:roll}{{name=@{character_name}}}{{total=[[ [[1d20]] + @{dx}[Dex] ]]}}{{roll=$[[0]]}}{{target=[[@{targetr}]]}}{{stat='Dexterity'}}"></button>
<button style="height: 18px;" type="roll" title="Roll stat." value="&{template:roll}{{name=@{character_name}}}{{total=[[ [[1d20]] + @{dx}[Ath] ]]}}{{roll=$[[0]]}}{{target=[[@{targetr}]]}}{{stat='Athleticism'}}"></button>
<button style="height: 18px;" type="roll" title="Roll stat." value="&{template:roll}{{name=@{character_name}}}{{total=[[ [[1d20]] + @{iq}[IQ] ]]}}{{roll=$[[0]]}}{{target=[[@{targetr}]]}}{{stat='Intelligence'}}"></button>
</div>
<div class="valuecolumn">
<button style="height: 18px; color: orange;" type="roll" title="Roll stat with mods." value="&{template:roll}{{name=@{character_name}}}{{total=[[ [[1d20]] + ?{Modifier?|0}[Mod] + @{tuf}[Tuf] ]]}}{{roll=$[[0]]}}{{target=[[@{targetr}]]}}{{stat='Toughness'}}"></button>
<button style="height: 18px; color: orange;" type="roll" title="Roll stat with mods." value="&{template:roll}{{name=@{character_name}}}{{total=[[ [[1d20]] + ?{Modifier?|0}[Mod] + @{dx}[Dex] ]]}}{{roll=$[[0]]}}{{target=[[@{targetr}]]}}{{stat='Dexterity'}}"></button>
<button style="height: 18px; color: orange;" type="roll" title="Roll stat with mods." value="&{template:roll}{{name=@{character_name}}}{{total=[[ [[1d20]] + ?{Modifier?|0}[Mod] + @{dx}[Ath] ]]}}{{roll=$[[0]]}}{{target=[[@{targetr}]]}}{{stat='Athleticism'}}"></button>
<button style="height: 18px; color: orange;" type="roll" title="Roll stat with mods." value="&{template:roll}{{name=@{character_name}}}{{total=[[ [[1d20]] + ?{Modifier?|0}[Mod] + @{iq}[IQ] ]]}}{{roll=$[[0]]}}{{target=[[@{targetr}]]}}{{stat='Intelligence'}}"></button>
</div>
<div class="valuecolumn">
<input type="hidden" name="attr_foo_tufperc" value="80%">
<input type="hidden" name="attr_foo_dxperc" value="80%">
<input type="hidden" name="attr_foo_iqperc" value="80%">
<input style="width: 46px;" type="text" disabled name="attr_tufperc" value="@{foo_tufperc}">
<input style="width: 46px;" type="text" disabled name="attr_dxperc" value="@{foo_dxperc}">
<input style="width: 46px;" type="text" disabled name="attr_iqperc" value="@{foo_iqperc}">
</div>
</div>
<div class="twocolumns">
<div class="valuecolumn">
@@ -88,32 +96,22 @@
<h2>Utility</h2>
<div class="twocolumns">
<div class="labels">
<label title="HP. The hit points you have left.">Hit Points </label>
<label title="Tuf gives +1 HP, and you can buy Bonus HP">HP Max </label>
<label title="2 CP. Adds to Max HP">HP Bonus </label>
<label title="E. The Energy you have left.">Energy </label>
<label title="Used for Attacks. IQ & Dex give +1 E. You can buy Bonus E">E Max </label>
<label title="HP / Max. Your avaialble & Max HP. Tuf gives +1 HP.">Hit Points </label>
<label title="1 CP. Adds to Max HP.">HP Bonus </label>
<label title="E / Max. Your avaialble & Max E. Ath & IQ give +1 E. E is used for Abilities & Overdrive.">Energy </label>
<label title="1 CP. Adds to Max E">E Bonus </label>
<br>
<label>Silver </label>
</div>
<div class="valuecolumn">
<input type="number" name="attr_hp" value="5">
<input type="number" disabled name="attr_hp_max" title="Tuf gives +1 HP, and you can buy Bonus HP" value="((@{tuf}) + (@{hpmax}))">
<div><input type="number" min="0" name="attr_hp" value="5">/</div>
<input type="number" min="0" name="attr_hpmax" value="0">
<input type="number" min="0" name="attr_e" value="0">
<input type="number" disabled name="attr_e_max" title="Used for Attacks. IQ & Dex give +1 E. You can buy Bonus E" value="((@{emax}) + (@{dx}) + (@{iq}))">
<div><input type="number" min="0" name="attr_e" value="10">/</div>
<input type="number" min="0" name="attr_emax" value="0">
<br>
<input type="number" style="width: 80px;" step=".01" name="attr_gold" value="100">
</div>
<div>
<button title="Restore HP to Max HP" type="action" name="act_restore_hp">Restore HP</button>
<br>
<br>
<br>
<br>
<button title="Restore E to Max E" type="action" name="act_restore_e">Restore E</button>
<div class="valuecolumn">
<input type="number" disabled name="attr_hp_max" title="HP Max" value="((@{tuf}) + (@{hpmax}))">
<button title="Restore HP to Max HP" type="action" name="act_restore_hp" style="height: 20px;">Rest HP</button>
<input type="number" disabled name="attr_e_max" title="E Max" value="((@{emax}) + (@{dx}) + (@{iq}))">
<button title="Restore E to Max E" type="action" name="act_restore_e" style="height: 20px;">Rest E</button>
</div>
</div>
</div>
@@ -121,25 +119,28 @@
<h2>Points</h2>
<div class="twocolumns">
<div class="labels">
<label title="The points awarded to you by the gm">Total Worth </label>
<label title="The total points you have spent">Spent </label>
<label title="The points awarded to you by the GM">Total Worth </label>
<label title="Total points you have spent">Spent </label>
<label title="The remaining points" style="color: chartreuse;">Available </label>
<label title="The points you have spent on Stats & Utility">Stats </label>
<label title="Total number of Powers. All Powers cost 1 CP">Powers </label>
<label title="Stats (5 CP each) & Utility (1 CP each)">Stats </label>
<label title="Cost of all Dmg (5 CP each)">Dmg </label>
<label title="Cost of all Attacks. Attacks Cost the same as their Max DC">Abilities </label>
<label title="Total points spent on Armor. 2 CP each">Armor </label>
<label title="The points you have spent on Passives">Passives </label>
</div>
<div class="valuecolumn">
<input type="number" name="attr_tw" value="200" style="width: 100px;">
<input type="number" disabled name="attr_totalspent" value="((@{stats}) + (@{armor}) + (@{passives}) + (@{powers}))" class="x">
<input type="number" disabled name="attr_avail" value="((@{tw})-(@{totalspent}))" class="x">
<input type="number" disabled name="attr_stats" title="5 CP for each stat. 1 CP for each utility" value="(((@{tuf})-5)*5 + ((@{dx})-5)*5 + ((@{iq})-5)*5 + (@{emax}) + (@{hpmax})*2)" >
<input type="hidden" name="attr_foo_armor" value="0">
<input type="hidden" name="attr_foo_passives" value="0">
<input type="hidden" name="attr_foo_powers" value="0">
<input type="number" disabled name="attr_powers" value="@{foo_powers}">
<input type="number" disabled name="attr_armor" value="@{foo_armor}">
<input type="number" disabled name="attr_passives" value="@{foo_passives}">
<input type="number" name="attr_tw" value="100" style="width: 100px;">
<input type="number" disabled name="attr_totalspent" title="Spent" value="((@{stats}) + (@{armor}) + (@{passives}) + (@{atks}) + (@{dmgc}))" class="x">
<input type="number" disabled name="attr_avail" title="Available" value="((@{tw})-(@{totalspent}))" class="x">
<input type="number" disabled name="attr_stats" title="Stats" value="(((@{tuf})-5)*5 + ((@{dx})-5)*5 + ((@{iq})-5)*5 + (@{emax}) + (@{hpmax}))" class="x">
<input type="hidden" name="attr_foo_dmgc" value="0" class="x">
<input type="hidden" name="attr_foo_atks" value="0" class="x">
<input type="hidden" name="attr_foo_armor" value="0" class="x">
<input type="hidden" name="attr_foo_passives" value="0" class="x">
<input type="number" disabled name="attr_dmgc" title="Dmg" value="@{foo_dmgc}" class="x">
<input type="number" disabled name="attr_atks" title="Attacks" value="@{foo_atks}" class="x">
<input type="number" disabled name="attr_armor" title="Armor" value="@{foo_armor}" class="x">
<input type="number" disabled name="attr_passives" title="Passives" value="@{foo_passives}" class="x">
</div>
</div>
</div>
@@ -149,27 +150,68 @@
<h3>Attacks</h3>
<div class="weapon">
<label style="width: 170px">Name</label>
<label style="width: 190px" title="The 1 power for this Attack. Leave blank if the Attack only does Damage. Include Duration unit.">Power</label>
<label style="width: 50px" title="Additional DC for the Power. If this is > 0, the Attack costs 1 CP.">Power DC</label>
<label style="width: 20px" title="E cost to cast the Power, derived from Power DC (0-4 = 1, 5-9 = 2, 10-14 = 3, etc.)">E</label>
<label style="width: 45px" title="The Dmg this Power deals. Each Dmg increases Total DC by 2">Dmg</label>
<label style="width: 36px" title="Use Attack with or without Mods. If Dmg is > Power DC, This rolls Dex, otherwise rolls IQ.">Roll</label>
<label style="width: 63px" title="Power DC + Dmgx2">Total DC</label>
<label style="width: 200px">Name</label>
<label style="width: 40px" title="The Dmg this Attack deals. 5 CP">Base Dmg</label>
<label style="width: 36px; color: rgb(102, 0, 0);" title="Base Dmg + Dmg Effort.">Total Dmg</label>
&emsp;
<label style="width: 40px" title="Additional Dmg through Effort. Each Dmg Effort increases Total DC by 2">Dmg Effort</label>
<label style="width: 36px; color: rgb(102, 0, 0);" title="Dmg Effort x2.">DC</label>
<label style="width: 80px">Stat</label>
<label style="width: 36px" title="Use Attack with or without Mods.">Roll</label>
<label style="width: 60px; color: rgb(102, 0, 0);" title="The percent chance you have of landing this Attack.">Success %</label>
</div>
<div>
<fieldset class="repeating_attacks">
<div class="weapon">
<input type="hidden" name="attr_foo_success" value="100">
<input type="text" name="attr_atkname">
<textarea type="text" name="attr_power"></textarea>
<input type="number" min="0" max="60" name="attr_pdc" value="0">
<input type="hidden" name="attr_foo_e" value="0">
<input type="number" disabled name="attr_e" title="Energy Cost" value="@{foo_e}">
<input type="number" name="attr_bdmg" value="0">
<input style="color:rgb(102, 0, 0);" type="number" disabled name="attr_totdmg" title="Total Dmg" value="((@{bdmg})+(@{dmg}))">
&emsp;
<input type="number" min="0" max="30" name="attr_dmg" value="0">
<input style="color:rgb(102, 0, 0);" type="number" disabled name="attr_dc" title="Total DC" value="2*(@{dmg})">
<select name="attr_type" style="width: 80px;">
<option value="@{tuf}">Tuf (m)</option>
<option value="@{dx}" selected="selected">Ath</option>
<option value="@{iq}" selected="selected">IQ</option>
</select>
<button style="height: 24px;" type="roll" title="Use the Attack" value="&{template:weapon}{{name=@{character_name}}}{{atkname=@{atkname}}}{{total=[[ [[1d20]]+ @{type}[stat] ]]}}{{roll=$[[0]]}}{{diff=[[@{dc}]]}}{{dmg=[[@{bdmg}[base] + @{dmg}[eff]]]}}"></button>
<button style="height: 24px; color: orange;" type="roll" title="Use the Attack with Mods" value="&{template:weapon}{{name=@{character_name}}}{{atkname=@{atkname}}}{{total=[[ [[1d20]] + ?{Hit Mod?|0}[Mod] + @{type}[stat] ]]}}{{roll=$[[0]]}}{{diff=[[@{dc}]]}}{{dmg=[[@{dmg}[Dmg] + ?{Dmg Mod?|0}[Mod] ]]}}"></button>
<input style="color:rgb(102, 0, 0);" type="number" style="width: 70px;" disabled name="attr_success" title="% Success" value="@{foo_success}" class="x">
</div>
</fieldset>
</div>
<br>
<div class="sheet-rolltemplate-spacer"></div>
<h3>Abilities</h3>
<div class="weapon">
<label style="width: 170px;">Name</label>
<label style="width: 210px" title="The 1 Ability for this Attack. Leave blank if the Attack only does Damage. Include Duration unit.">Ability</label>
<label style="width: 30px;color:rgb(0, 209, 0);" title="E cost to cast the Ability, derived from Ability DC (0-4 = 1, 5-9 = 2, 10-14 = 3, etc.)">E</label>
<label style="width: 36px" title="The DC of the Ability. If this is >= Dmg the Ability is IQ based">ADC</label>
<label style="width: 39px" title="The physical Dmg this Ability deals. Each Dmg increases Total DC by 2. If this is > ADC the Ability is Ath based">Dmg</label>
<label style="width: 45px; color:rgb(102, 0, 0)ed;" title="Ability DC + Dmgx2.">Total DC</label>
<label style="width: 36px" title="Use Attack with or without Mods. If Dmg is > Ability DC, This rolls Ath, otherwise IQ.">Roll</label>
<label style="width: 60px;color:rgb(102, 0, 0);" title="The percent you have of landing this Attack.">Success %</label>
</div>
<div>
<fieldset class="repeating_spells">
<div class="weapon">
<input type="hidden" name="attr_type" value="@{dx}">
<button style="height: 24px;" type="roll" title="Use the Attack" value="&{template:weapon}{{name=@{character_name}}}{{atkname=@{atkname}}}{{cost=@{e}}}{{total=[[ [[1d20]]+ @{type}[stat] ]]}}{{roll=$[[0]]}}{{diff=[[@{dc}]]}}{{power=@{power}}}{{dmg=[[@{dmg}]]}}{{pdc=[[@{pdc}]]}}"></button>
<button style="height: 24px; color: orange;" type="roll" title="Use the Attack with Mods" value="&{template:weapon}{{name=@{character_name}}}{{atkname=@{atkname}}}{{cost=@{e}}}{{total=[[ [[1d20]] + ?{Hit Mod?|0}[Mod] + @{type}[stat] ]]}}{{roll=$[[0]]}}{{diff=[[@{dc}]]}}{{power=@{power}}}{{dmg=[[@{dmg}[Dmg] + ?{Dmg Mod?|0}[Mod] ]]}}{{pdc=[[@{pdc}]]}}"></button>
<input type="number" max="60" disabled name="attr_dc" title="Total DC" value="((@{pdc}) + 2*(@{dmg}))">
<input type="hidden" name="attr_foo_success" value="Ath: 100%">
<input type="text" name="attr_atkname">
<textarea type="text" name="attr_ability"></textarea>
<input style="color:rgb(0, 209, 0);" min="1" type="number" name="attr_e" title="Energy Cost" value="1">
<input type="number" min="0" max="60" name="attr_adc" value="0">
<input type="number" min="0" max="30" name="attr_dmg" value="0">
<input style="color:rgb(102, 0, 0);" type="number" disabled name="attr_dc" title="Total DC" value="((@{adc}) + 2*(@{dmg}))">
<button style="height: 24px;" type="roll" title="Use the Attack" value="&{template:spell}{{name=@{character_name}}}{{atkname=@{atkname}}}{{cost=@{e}}}{{total=[[ [[1d20]]+ @{type}[stat] ]]}}{{roll=$[[0]]}}{{diff=[[@{dc}]]}}{{ability=@{ability}}}{{dmg=[[@{dmg}]]}}{{adc=[[@{adc}]]}}"></button>
<button style="height: 24px; color: orange;" type="roll" title="Use the Attack with Mods" value="&{template:spell}{{name=@{character_name}}}{{atkname=@{atkname}}}{{cost=@{e}}}{{total=[[ [[1d20]] + ?{Hit Mod?|0}[Mod] + @{type}[stat] ]]}}{{roll=$[[0]]}}{{diff=[[@{dc}]]}}{{ability=@{ability}}}{{dmg=[[@{dmg}[Dmg] + ?{Dmg Mod?|0}[Mod] ]]}}{{adc=[[@{adc}]]}}"></button>
<input style="color:rgb(102, 0, 0);" type="text" style="width: 70px;" disabled name="attr_success" title="% Success" value="@{foo_success}" class="x">
</div>
</fieldset>
</div>
@@ -180,7 +222,7 @@
<h3>Armor</h3>
<div class="weapon">
<label>Name</label>
<label title="The place on the body the armor resides. The most important spot is the body, since that's the default hit location.">Location</label>
<label title="The place on the body the armor resides. The most important spot is the Torso, since that's the default hit location.">Location</label>
<label title="Armor (2 points)" style="width: 38px;">Armor</label>
<label>Cost</label>
</div>
@@ -189,8 +231,8 @@
<div class="weapon">
<input type="text" name="attr_armorname" title="Name of the Armor">
<input type="text" name="attr_armorloc" title="location of the Armor">
<input type="number" min="0" name="attr_armor" value="0">
<input type="number" disabled name="attr_armorcp" title="cost of this Armor" value="((@{armor})*2)" >
<input type="number" min="0" name="attr_armorp" value="0">
<input type="number" disabled name="attr_armorcp" title="cost of this Armor" value="(@{armorp})*2" >
</div>
</fieldset>
</div>
@@ -200,18 +242,18 @@
<h3>Passives</h3>
<div class="weapon">
<label style="width: 170px;">Name</label>
<label style="width: 190px;" title="Makes sure to put all details in this box (length, bonus, rolls, all of it)">power</label>
<label style="width: 190px;" title="Makes sure to put all details in this box (length, bonus, rolls, all of it)">Passive</label>
<label>CP</label>
</div>
<fieldset class="repeating_passives">
<div class="weapon">
<input type="text" name="attr_abilname" title="Name of the ability"><textarea name="attr_ability"></textarea> <input type="number" name="attr_pass_cp" title="+ for advantage, - for disadvantage">
<input type="text" name="attr_abilname" title="Name of the ability"><textarea name="attr_ability"></textarea> <input type="number" name="attr_passcp" title="+ for advantage, - for disadvantage">
</div>
</fieldset>
</div>
<div class="inv">
<h2>Gear</h2>
<h2>Gear</h2> Silver<input type="number" style="width: 80px;" step=".01" name="attr_gold" value="100">
<div class="weapon">
<label>Name</label>
<label>Description</label>
@@ -223,8 +265,8 @@
<fieldset class="repeating_items">
<div class="weapon">
<input type="text" name="attr_itemname" title="Name of the Item">
<input type="text" name="attr_itempower" title="power of the item">
<input type="number" name="attr_quantity" title="Number of this item you have. Most items can't have more than 10, and some can have fewer">
<input type="text" name="attr_itemdescr" title="Description">
<input type="number" name="attr_quantity" title="Number of this item you have. Most items can't have more than 10.">
<input type="number" name="attr_slots" title="items don't have a weight, just a slot count. Most items take 1 slot">
<input type="number" name="attr_itemcost" title="The amount in silver the item costs">
</div>
@@ -264,9 +306,49 @@
);
});
});
on("change:repeating_attacks:bdmg remove:repeating_attacks", function(eventInfo) {
getRepeatingFields("repeating_attacks", ["bdmg"], function(fieldValues){
setAttrs({
"foo_dmgc": sumFieldValues(fieldValues)*5
});
});
});
on("remove:repeating_spells", function(eventinfo) {
getRepeatingFields("repeating_spells", ["adc"], function(fieldValues){
setAttrs({
"foo_atks": sumFieldValues(fieldValues)
});
});
});
on("change:repeating_armors:armorp remove:repeating_armors", function(eventinfo) {
getRepeatingFields("repeating_armors", ["armorp"], function(fieldValues){
setAttrs({
"foo_armor": sumFieldValues(fieldValues)*2
});
});
});
on("change:repeating_items:slots remove:repeating_items", function(eventInfo) {
getRepeatingFields("repeating_items", ["slots"], function(fieldValues){
setAttrs({
"foo_slotsused": sumFieldValues(fieldValues)
});
});
});
on("change:repeating_passives:passcp remove:repeating_passives", function(eventInfo) {
getRepeatingFields("repeating_passives", ["passcp"], function(fieldValues){
setAttrs({
"foo_passives": sumFieldValues(fieldValues)
});
});
});
function sumFieldValues(fieldValues){
let sum = 0;
var sum = 0;
Object.values(fieldValues).forEach(element => sum += parseInt(element)||0);
return sum;
}
@@ -277,9 +359,9 @@
callback(0);
return;
}
let fieldArray = [];
for (let j = 0; j < fieldNames.length; j++) {
for (let i = 0; i < ids.length; i++) {
var fieldArray = [];
for (var j = 0; j < fieldNames.length; j++) {
for (var i = 0; i < ids.length; i++) {
fieldArray.push(sectionName + '_' + ids[i] + '_' + fieldNames[j]);
}
}
@@ -289,10 +371,6 @@
});
}
function getCostOfPower(dc){
return Math.max(0,Math.ceil((parseInt(dc))/5));
}
on('change:iq change:dx change:emax' , function(eventInfo) {
getAttrs( ["e"]
, function(values) {
@@ -312,77 +390,128 @@
);
});
});
on("change:repeating_attacks:pdc", function(eventInfo) {
getRepeatingFields("repeating_attacks", ["pdc"], function(fieldValues){
let sendValues = {"foo_powers":0};
let idName;
let propName;
let last_Ind;
for (const property in fieldValues) {
last_Ind = property.lastIndexOf("_");
idName = property.substring(0, last_Ind);
propName = property.substring(last_Ind+1, property.length);
sendValues[idName + "_foo_e"] = getCostOfPower(fieldValues[property]);
if(parseInt(fieldValues[property])> 0){
sendValues["foo_powers"] += 1;
}
}
setAttrs( sendValues , {silent:true} );
});
function calculateChance(dc, subtractStat){
if(dc == subtractStat + 1)
return 95;
return 100*Math.max(0, (20 - Math.max(0, dc - subtractStat-1)))/20;
}
on("change:targetr", function(eventInfo){
getAttrs(
["iq", "dx", "tuf", "targetr"]
, function(values) {
var sendValues = {};
sendValues["foo_tufperc"] = String(calculateChance(parseInt(values.targetr), parseInt(values.tuf))) + "%";
sendValues["foo_dxperc"] = String(calculateChance(parseInt(values.targetr), parseInt(values.dx)))+ "%";
sendValues["foo_iqperc"] = String(calculateChance(parseInt(values.targetr), parseInt(values.iq)))+ "%";
setAttrs(sendValues,{silent:true});
});
});
on("change:dx change:iq change:tuf", function(eventInfo) {
getAttrs(
["iq", "dx", "tuf", "targetr"]
, function(values) {
var sendValuesFirst = {};
sendValuesFirst["foo_tufperc"] = String(calculateChance(parseInt(values.targetr), parseInt(values.tuf))) + "%";
sendValuesFirst["foo_dxperc"] = String(calculateChance(parseInt(values.targetr), parseInt(values.dx)))+ "%";
sendValuesFirst["foo_iqperc"] = String(calculateChance(parseInt(values.targetr), parseInt(values.iq)))+ "%";
setAttrs( sendValuesFirst , {silent:true} );
getRepeatingFields("repeating_spells", ["adc", "dmg"], function(fieldValues){
var sendValues = {};
fieldValues.iq = values.iq;
fieldValues.dx = values.dx;
var incomingAtk;
for(const property in fieldValues){
if(property[0] == 'r'){
incomingAtk = property.substring(0, property.lastIndexOf("_"));
if(sendValues[incomingAtk + "_type"] == undefined){
setTypeAndSuccess(sendValues, incomingAtk, fieldValues);
}
}
}
setAttrs(sendValues,{silent:true});
});
getRepeatingFields("repeating_attacks", ["type", "dmg"], function(fieldValues){
var sendValues = {};
var incomingAtk;
for(const property in fieldValues){
if(property[property.length - 1] == 'e'){
incomingAtk = property.substring(0, property.lastIndexOf("_"));
var subtractStat = getSubtractStat(fieldValues[incomingAtk + "_type"], values);
sendValues[incomingAtk + "_foo_success"] = calculateChance(parseInt(fieldValues[incomingAtk + "_dmg"])*2, subtractStat);
}
}
setAttrs(sendValues,{silent:true});
});
});
});
function getSubtractStat(type, values){
if(type == "@{tuf}"){
return parseInt(values.tuf);
}
if(type == "@{dx}"){
return parseInt(values.dx);
}
if(type == "@{iq}"){
return parseInt(values.iq);
}
}
on("change:repeating_attacks:pdc change:repeating_attacks:dmg", function(eventInfo) {
let sendValues = {};
on("change:repeating_attacks:dmg change:repeating_attacks:type", function(eventInfo) {
const last_Ind = eventInfo.sourceAttribute.lastIndexOf("_");
const incomingAtk = eventInfo.sourceAttribute.substring(0, last_Ind);
getAttrs([
incomingAtk + "_pdc", incomingAtk + "_dmg"
]
getAttrs(
[incomingAtk + "_type", incomingAtk + "_dmg", "iq", "dx", "tuf"]
, function(values) {
// making sure we didnt go over 60
if(parseInt(values[incomingAtk + "_pdc"]) + parseInt(values[incomingAtk + "_dmg"])*2 > 60){
sendValues[eventInfo.sourceAttribute] = eventInfo.previousValue;
values[incomingAtk + eventInfo.sourceAttribute.substring(last_Ind, eventInfo.sourceAttribute.length)] = eventInfo.previousValue;
}
// set buttons
if(parseInt(values[incomingAtk + "_pdc"]) >= parseInt(values[incomingAtk + "_dmg"])){
sendValues[incomingAtk + "_type"] = "@{iq}"
}else{
sendValues[incomingAtk + "_type"] = "@{dx}"
}
var sendValues = {};
var subtractStat = getSubtractStat(values[incomingAtk + "_type"], values);
sendValues[incomingAtk + "_foo_success"] = calculateChance(parseInt(values[incomingAtk + "_dmg"])*2, subtractStat);
setAttrs( sendValues , {silent:true} );
});
});
on("change:repeating_items:slots", function(eventInfo) {
getRepeatingFields("repeating_items", ["slots"], function(fieldValues){
setAttrs({
"foo_slotsused": sumFieldValues(fieldValues)
});
});
});
on("change:repeating_armors:armor", function(eventInfo) {
getRepeatingFields("repeating_armors", ["armor"], function(fieldValues){
let arSum = 0;
for (const property in fieldValues) {
arSum += parseInt(fieldValues[property])*2;
}
setAttrs({
"foo_armor": arSum
});
});
});
on("change:repeating_passives:pass_cp", function(eventInfo) {
getRepeatingFields("repeating_passives", ["pass_cp"], function(fieldValues){
setAttrs({
"foo_passives": sumFieldValues(fieldValues)
on("change:repeating_spells:adc change:repeating_spells:dmg", function(eventInfo) {
var sendValues = {};
const last_Ind = eventInfo.sourceAttribute.lastIndexOf("_");
const incomingAtk = eventInfo.sourceAttribute.substring(0, last_Ind);
getAttrs(
[incomingAtk + "_adc", incomingAtk + "_dmg", "iq", "dx"]
, function(values) {
var totalDC = parseInt(values[incomingAtk + "_adc"]) + parseInt(values[incomingAtk + "_dmg"])*2;
// making sure we didnt go over 60
if(totalDC > 60){
sendValues[eventInfo.sourceAttribute] = eventInfo.previousValue;
eventInfo.newValue = eventInfo.previousValue;
values[incomingAtk + eventInfo.sourceAttribute.substring(last_Ind, eventInfo.sourceAttribute.length)] = eventInfo.previousValue;
}
setTypeAndSuccess(sendValues, incomingAtk, values);
setAttrs( sendValues , {silent:true} );
getRepeatingFields("repeating_spells", ["adc"], function(fieldValues){
setAttrs({
"foo_atks": sumFieldValues(fieldValues)
});
});
});
});
function setTypeAndSuccess(sendValues, incomingAtk, values){
if(parseInt(values[incomingAtk + "_adc"]) >= parseInt(values[incomingAtk + "_dmg"])){
sendValues[incomingAtk + "_type"] = "@{iq}"
sendValues[incomingAtk + "_foo_success"] ="IQ: " + String(calculateChance(parseInt(values[incomingAtk + "_adc"]) + parseInt(values[incomingAtk + "_dmg"])*2, parseInt(values.iq))) + "%";
}else{
sendValues[incomingAtk + "_type"] = "@{dx}"
sendValues[incomingAtk + "_foo_success"] ="DX: " + String(calculateChance(parseInt(values[incomingAtk + "_adc"]) + parseInt(values[incomingAtk + "_dmg"])*2, parseInt(values.dx))) + "%";
}
}
on("sheet:opened", function(eventInfo){
getAttrs([
"first"
@@ -400,9 +529,8 @@
,"emax":0
,"gold":100
,"foo_armor":0
,"foo_dmg":0
,"foo_passives":0
,"foo_powers":0
,"foo_atks":0
}
, {silent:true}
);
@@ -427,7 +555,7 @@
<td>
{{#rollTotal() roll 20}}
<strong style="color: green;">CRIT SUCCESS!</strong> ({{roll}}) <br>
You succeed, and get really lucky! Optionally you can gamble with a high or low. Success means you double the power. Fail means you just succeed.
You succeed, and get really lucky! Optionally you can gamble with a high or low. Success means you Double Crit. Fail means you just succeed.
{{/rollTotal() roll 20}}
{{#rollBetween() roll 2 19}}
@@ -467,19 +595,60 @@
<td>
{{#rollWasCrit() roll}}
<strong style="color: green;">CRIT SUCCESS!</strong> ({{roll}}) <br>
Your attack auto hits. Double Power or Dmg. No E cost.
Your attack auto hits. Double Dmg {{dmg}} + {{dmg}}.
{{/rollWasCrit() roll}}
{{#rollWasFumble() roll}}
<strong style="color: red;">CRIT FAIL!</strong> ({{roll}}) <br>
Your attack auto fails. Succeed a "high or low" or drop your weapon or fall prone.
{{/rollWasFumble() roll}}
{{#rollBetween() roll 2 19}}
{{#rollLess() total diff}}
{{total}} <strong style="color: red;">Fails...</strong>. Action wasted.
{{/rollLess() total diff}}
{{#^rollLess() total diff}}
{{total}} <strong style="color: green;">Success</strong>. <br>
Dmg: {{dmg}}
{{/^rollLess() total diff}}
{{/rollBetween() roll 2 19}}
</td>
</tr>
</table>
</rolltemplate>
<rolltemplate class="sheet-rolltemplate-spell">
<table>
<tr>
<th>
{{name}} attacks with {{atkname}} Difficulty: {{diff}}
</th>
</tr>
<tr>
<td>
<div class="sheet-rolltemplate-spacer"></div>
</td>
</tr>
<tr>
<td>
{{#rollWasCrit() roll}}
<strong style="color: green;">CRIT SUCCESS!</strong> ({{roll}}) <br>
Your attack auto hits. Double Ability or Dmg. No E cost.
{{#^rollTotal() dmg 0}}
<br>
Dmg: {{dmg}}
{{/^rollTotal() dmg 0}}
{{#^rollTotal() pdc 0}}
{{#^rollTotal() adc 0}}
<br>
Power: Subtract <strong >{{cost}}</strong> E.
Ability: Subtract <strong >{{cost}}</strong> E.
<div class="sheet-rolltemplate-spacer"></div>
{{power}}
{{/^rollTotal() pdc 0}}
{{ability}}
{{/^rollTotal() adc 0}}
<div class="sheet-rolltemplate-spacer"></div>
Optionally, gamble with a High-or-Low for even more Powers. A Fail loses all Crits.
Optionally, gamble with a High-or-Low for even more Benefits. A Fail loses all Crits.
{{/rollWasCrit() roll}}
{{#rollWasFumble() roll}}
@@ -499,12 +668,12 @@
<br>
Dmg: {{dmg}}
{{/^rollTotal() dmg 0}}
{{#^rollTotal() pdc 0}}
{{#^rollTotal() adc 0}}
<br>
Power: Subtract <strong >{{cost}}</strong> E.
Ability: Subtract <strong >{{cost}}</strong> E.
<div class="sheet-rolltemplate-spacer"></div>
{{power}}
{{/^rollTotal() pdc 0}}
{{ability}}
{{/^rollTotal() adc 0}}
{{/^rollLess() total diff}}
{{/rollBetween() roll 2 19}}
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 96 KiB