Files
roll20-character-sheets/Forge/Forge.html
T
2024-06-03 13:15:14 -04:00

744 lines
35 KiB
HTML

<div class="wrapper">
<input type="hidden" class="tabstoggle" name="attr_sheetTab" value="pilot"/>
<div>
<button type="action" name="act_pilot" class="tabs">Character</button>
<button type="action" name="act_info" class="tabs">Info</button>
<button type="action" name="act_inv" class="tabs">Gear</button>
</div>
<div class="info">
<h2>Information</h2>
<div class="grid">
<div class="col">
<label>Name </label>
<input class="colInput" type="text" name="attr_character_name">
</div>
<div class="col">
<label>Race </label>
<input class="colInput" type="text" name="attr_race">
</div>
<div class="col">
<label>Class </label>
<input class="colInput" type="text" name="attr_class">
</div>
<div class="col">
<label>City of Origin </label>
<input class="colInput" type="text" name="attr_coo">
</div>
<div class="col">
<label>Age </label>
<input class="colInput" type="text" name="attr_age">
</div>
<div class="col">
<label>Height </label>
<input class="colInput" type="text" name="attr_height">
</div>
<div class="col">
<label>Weight </label>
<input class="colInput" type="text" name="attr_weight">
</div>
<div class="col">
<label>Language </label>
<input class="colInput" type="text" name="attr_lang">
</div>
<div class="col">
<label>Notes </label>
<textarea class="colInput" name="attr_notes">
</div>
</div>
</div>
<div class="pilot">
<div class="tabstoggle">
<h2></button> D20 <button type="roll" value="[[1d20]]"></button>High <button type="roll" value="&{template:rollhigh}{{name=@{character_name}}}{{roll=[[1d20]]}}"></button> or Low <button type="roll" value="&{template:rolllow}{{name=@{character_name}}}{{roll=[[1d20]]}}"></h2>
</div>
<div class="twocolumns">
<div>
<h2 title="All stats cost 5 points. No need to roll if the difficulty is lower than the stat.">Stats</h2>
<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="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">
<input type="number" min="0" max="40" name="attr_tuf" value="5">
<input type="number" min="0" max="40" name="attr_dx" value="5">
<input type="number" min="0" max="40" name="attr_iq" value="5">
</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}[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}[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">
<input type="number" min="-60" max="60" name="attr_targetr" value="10">
</div>
<div class="labels">
<label style="float: left;" title="Target is used against stat checks">Target </label>
</div>
</div>
</div>
<div style="margin-left: 50px;">
<h2>Utility</h2>
<div class="twocolumns">
<div class="labels">
<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>
</div>
<div class="valuecolumn">
<div><input type="number" min="0" name="attr_hp" value="5">/</div>
<input type="number" min="0" name="attr_hpmax" value="0">
<div><input type="number" min="0" name="attr_e" value="10">/</div>
<input type="number" min="0" name="attr_emax" value="0">
</div>
<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>
<div style="margin-left: 50px;">
<h2>Points</h2>
<div class="twocolumns">
<div class="labels">
<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="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="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>
</div>
<div class="sheet-rolltemplate-spacer"></div>
<h3>Attacks</h3>
<div class="weapon">
<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">
<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}">
<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>
<br>
<div class="sheet-rolltemplate-spacer"></div>
<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 Torso, since that's the default hit location.">Location</label>
<label title="Armor (2 points)" style="width: 38px;">Armor</label>
<label>Cost</label>
</div>
<div>
<fieldset class="repeating_armors">
<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_armorp" value="0">
<input type="number" disabled name="attr_armorcp" title="cost of this Armor" value="(@{armorp})*2" >
</div>
</fieldset>
</div>
<br>
<div class="sheet-rolltemplate-spacer"></div>
<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)">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_passcp" title="+ for advantage, - for disadvantage">
</div>
</fieldset>
</div>
<div class="inv">
<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>
<label style="width: 35px;">#</label>
<label style="width: 35px;">Slots</label>
<label>Cost</label>
</div>
<div>
<fieldset class="repeating_items">
<div class="weapon">
<input type="text" name="attr_itemname" title="Name of the Item">
<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>
</fieldset>
</div>
<div>
<input type="hidden" name="attr_foo_slotsused" value="0">
Slots used: <input name="attr_slotsused" type="number" disabled value="@{foo_slotsused}"> Slots available: <input type="number" name="attr_slotsavail" disabled value="((@{tuf})*2-(@{foo_slotsused})+10)">
</div>
</div>
</div>
<script type="text/worker">
["pilot","info","grim","inv"].forEach(button => {
on(`clicked:${button}`, function() {
setAttrs({
"sheetTab": button
});
});
});
on('clicked:restore_e', function() {
getAttrs( ["emax", "dx", "iq"]
, function(values) {
setAttrs({"e": (parseInt(values.emax) + parseInt(values.dx) + parseInt(values.iq))}
, {silent:true}
);
});
});
on('clicked:restore_hp', function() {
getAttrs( ["hpmax", "tuf"]
, function(values) {
setAttrs({"hp":(parseInt(values.hpmax) + parseInt(values.tuf))}
, {silent:true}
);
});
});
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){
var sum = 0;
Object.values(fieldValues).forEach(element => sum += parseInt(element)||0);
return sum;
}
function getRepeatingFields(sectionName, fieldNames, callback) {
getSectionIDs(sectionName, function (ids) {
if (ids.length === 0) {
callback(0);
return;
}
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]);
}
}
getAttrs(fieldArray, function (fieldValues) {
callback(fieldValues);
});
});
}
on('change:iq change:dx change:emax' , function(eventInfo) {
getAttrs( ["e"]
, function(values) {
setAttrs({"e": (parseInt(values.e) + (parseInt(eventInfo.newValue) - (parseInt(eventInfo.previousValue)||0)))}, {silent:true});
});
});
on("change:tuf change:hpmax", function(eventInfo) {
getAttrs([
"hp",
]
, function(values) {
setAttrs({
"hp": (parseInt(values.hp) + parseInt(eventInfo.newValue) - (parseInt(eventInfo.previousValue)||0))
}
, {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:dmg change:repeating_attacks:type", function(eventInfo) {
const last_Ind = eventInfo.sourceAttribute.lastIndexOf("_");
const incomingAtk = eventInfo.sourceAttribute.substring(0, last_Ind);
getAttrs(
[incomingAtk + "_type", incomingAtk + "_dmg", "iq", "dx", "tuf"]
, function(values) {
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_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"
]
, function(values) {
if(values.first == undefined){
setAttrs({
"tuf": 5
,"iq":5
,"dx":5
,"hpmax":0
,"hp":5
,"first":1
,"e":10
,"emax":0
,"gold":100
,"foo_armor":0
,"foo_passives":0
,"foo_atks":0
}
, {silent:true}
);
}
});
});
</script>
<rolltemplate class="sheet-rolltemplate-roll">
<table>
<tr>
<th>
{{name}} rolls {{stat}}:
</th>
</tr>
<tr>
<td>
<div class="sheet-rolltemplate-spacer"></div>
</td>
</tr>
<tr>
<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 Crit. Fail means you just succeed.
{{/rollTotal() roll 20}}
{{#rollBetween() roll 2 19}}
{{#rollGreater() total target}}
{{total}} is a <strong style="color: green;">Success</strong> against {{target}}
{{/rollGreater() total target}}
{{#rollTotal() total target}}
{{total}} is a <strong style="color: green;">Success</strong> against {{target}}
{{/rollTotal() total target}}
{{#rollLess() total target}}
{{total}} is a <strong style="color: red;">Fail</strong> against {{target}}
{{/rollLess() total target}}
{{/rollBetween() roll 2 19}}
{{#rollTotal() roll 1}}
<strong style="color: red;">CRIT FAIL!</strong> ({{roll}}) <br>
You auto fail. Succeed a "high or low" or something bad might happen to you
{{/rollTotal() roll 1}}
</td>
</tr>
</table>
</rolltemplate>
<rolltemplate class="sheet-rolltemplate-weapon">
<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 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() adc 0}}
<br>
Ability: Subtract <strong >{{cost}}</strong> E.
<div class="sheet-rolltemplate-spacer"></div>
{{ability}}
{{/^rollTotal() adc 0}}
<div class="sheet-rolltemplate-spacer"></div>
Optionally, gamble with a High-or-Low for even more Benefits. A Fail loses all Crits.
{{/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.<br>Subtract {{cost}} E.
{{/rollWasFumble() roll}}
{{#rollBetween() roll 2 19}}
{{#rollLess() total diff}}
{{total}} <strong style="color: red;">Fails...</strong>. Action wasted. Do NOT subtract E.
{{/rollLess() total diff}}
{{#^rollLess() total diff}}
{{total}} <strong style="color: green;">Success</strong>.
{{#^rollTotal() dmg 0}}
<br>
Dmg: {{dmg}}
{{/^rollTotal() dmg 0}}
{{#^rollTotal() adc 0}}
<br>
Ability: Subtract <strong >{{cost}}</strong> E.
<div class="sheet-rolltemplate-spacer"></div>
{{ability}}
{{/^rollTotal() adc 0}}
{{/^rollLess() total diff}}
{{/rollBetween() roll 2 19}}
</td>
</tr>
</table>
</rolltemplate>
<rolltemplate class="sheet-rolltemplate-rollhigh">
<table>
<tr>
<th>
{{name}} rolls for high!
</th>
</tr>
<tr>
<td>
<div class="sheet-rolltemplate-spacer"></div>
</td>
</tr>
<tr>
<td>
{{#rollBetween() roll 11 20}}
<strong style="color: green;">Nailed It!</strong> ({{roll}})
{{/rollBetween() roll 11 20}}
{{#rollBetween() roll 1 10}}
<strong style="color: red;">fail...</strong> ({{roll}})
{{/rollBetween() roll 1 10}}
<br>
p.s. high/lows cannot crit
</td>
</tr>
</table>
</rolltemplate>
<rolltemplate class="sheet-rolltemplate-rolllow">
<table>
<tr>
<th>
{{name}} rolls for low!
</th>
</tr>
<tr>
<td>
<div class="sheet-rolltemplate-spacer"></div>
</td>
</tr>
<tr>
<td>
{{#rollBetween() roll 11 20}}
<strong style="color: red;">fail...</strong> ({{roll}})
{{/rollBetween() roll 11 20}}
{{#rollBetween() roll 1 10}}
<strong style="color: green;">Nailed It!</strong> ({{roll}})
{{/rollBetween() roll 1 10}}
<br>
p.s. high/lows cannot crit
</td>
</tr>
</table>
</rolltemplate>