|
|
<input type="checkbox" class="sheet-block-switch" name="attr_npcsheet" value="1"><span> NPC? (DO NOT CLICK)</span><br/><br/> <div class="main"> <div class="header section"> <div class="header-grid"> <div class="header-field-grid"> <span>Name</span> <input class="line-input" name="attr_character_name"> </div> <div> <h2>Adventurer Conqueror King</h2> </div> <div class="header-field-grid"> <span>Title</span> <input class="line-input" type="text" name="attr_classtitle" value="the Unknown"> <span>Class</span> <select name="attr_class"> <option>Fighter</option> <option>Mage</option> <option>Cleric</option> <option>Thief</option> <option>Assassin</option> <option>Bard</option> <option>Bladedancer</option> <option>Explorer</option> </select> </div> <div class="header-field-grid"> <span>Alignment</span> <input class="line-input" type="text" name="attr_align" value=""> <span>Level</span> <input class="line-input" type="text" name="attr_level" value="0"> </div> </div> </div> <div class="attributes section"> <div class="grid-container-2col"> <div class="stat-grid"> <div class="sheet-stat-title"> <h3>Attributes</h3> </div> <span>Value</span><span></span><span>Modifier</span><span></span> <!-- Strength --> <input class="sheet-stat-input" type="text" name="attr_str" value="10"> <span class="sheet-stat-span">Str</span> <input class="sheet-stat-input" type="text" name="attr_str_mod" value="0"> <button class="sheet-roll-button" type='roll' value='&{template:acks} {{name=Strength Throw}} {{roll=[[1d20 + @{str_mod}]]}}' name='roll_StrengthCheck'></button>
<!-- Intelligence --> <input class="sheet-stat-input" type="text" name="attr_int" value="10"> <span class="sheet-stat-span">Int</span> <input class="sheet-stat-input" type="text" name="attr_int_mod" value="0"> <button class="sheet-roll-button" type='roll' value='&{template:acks} {{name=Intelligence Throw}} {{roll=[[1d20 + @{int_mod}]]}}' name='roll_IntelligenceCheck'></button> <!-- Wisdom --> <input class="sheet-stat-input" type="text" name="attr_wis" value="10"> <span class="sheet-stat-span">Wis</span> <input class="sheet-stat-input" type="text" name="attr_wis_mod" value="0"> <button class="sheet-roll-button" type='roll' value='&{template:acks} {{name=Wisdom Throw}} {{roll=[[1d20 + @{wis_mod}]]}}' name='roll_WisdomCheck'></button> <!-- Dexterity --> <input class="sheet-stat-input" type="text" name="attr_dex" value="10"> <span class="sheet-stat-span">Dex</span> <input class="sheet-stat-input" type="text" name="attr_dex_mod" value="0"> <button class="sheet-roll-button" type='roll' value='&{template:acks} {{name=Dexterity Throw}} {{roll=[[1d20 + @{dex_mod}]]}}' name='roll_DexterityCheck'></button> <!-- Constitution --> <input class="sheet-stat-input" type="text" name="attr_con" value="10"> <span class="sheet-stat-span">Con</span> <input class="sheet-stat-input" type="text" name="attr_con_mod" value="0"> <button class="sheet-roll-button" type='roll' value='&{template:acks} {{name=Constitution Throw}} {{roll=[[1d20 + @{con_mod}]]}}' name='roll_ConstitutionCheck'></button> <!-- Charisma --> <input class="sheet-stat-input" type="text" name="attr_chr" value="10"> <span class="sheet-stat-span">Chr</span> <input class="sheet-stat-input" type="text" name="attr_chr_mod" value="0"> <button class="sheet-roll-button" type='roll' value='&{template:acks} {{name=Charisma Throw}} {{roll=[[1d20 + @{chr_mod}]]}}' name='roll_CharismaCheck'></button> </div> <div class="stat2-grid"> <!-- Hit Points --> <span class="sheet-hp-span">HP</span> <span class="sheet-text-center">Current</span><span class="sheet-text-center">Maximum</span> <div><input class="sheet-stat-input sheet-hp-input" type="text" name="attr_hp"></div> <div><input class="sheet-stat-input sheet-hp-mod-input" type="text" name="attr_hp_max"></div>
<!-- Hit Points --> <span class="sheet-hp-span">AC</span> <div class="sheet-ac-wrapper"><input class="sheet-stat-input sheet-ac-input" type="text" name="attr_ac" value="0"></div> </div> </div> </div> <div class="saves section"> <div class="grid-container-2col"> <div class="movement-grid"> <div class="sheet-movement-title"> <h3>Movement</h3> </div> <span class="sheet-save-span">Base</span> <input class="sheet-stat-input sheet-input-big" type="text" name="attr_base_movement" value="120"> <span class="sheet-save-span">Combat</span> <input class="sheet-stat-input sheet-input-big" type="text" name="attr_combat_movement" value="floor(@{base_movement} / 3)" disabled="true"> <span class="sheet-save-span">Chrg/Run</span> <input class="sheet-stat-input sheet-input-big" type="text" name="attr_charge_movement" value="@{base_movement}" disabled="true"> <span class="sheet-save-span">Climb</span> <input class="sheet-stat-input sheet-input-big" type="text" name="attr_climb_movement"> <span class="sheet-save-span">Stealth</span> <input class="sheet-stat-input sheet-input-big" type="text" name="attr_stealth_movement" value="floor(@{base_movement} / 2)" disabled="true"> <span class="sheet-save-span">Daily</span> <input class="sheet-stat-input sheet-input-big" type="text" name="attr_daily_movement" value="floor(@{base_movement} * 2 / 10)" disabled="true"> </div> <div class="saves-grid"> <div class="sheet-saves-title"> <h3>Saving Throws</h3> </div> <span></span><span>Throw</span><span>Modifier</span><span></span> <span class="sheet-save-span">Petrif. & Paral.</span> <div><input class="sheet-stat-input" type="text" name="attr_save_pp"></div> <div><input class="sheet-stat-input" type="text" name="attr_save_pp_mod" value="0"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=Saving Throw}} {{subheader=Petrification & Paralysis}} {{roll=[[1d20 + @{save_pp_mod}]]}} {{target=[[@{save_pp}]]}}" name="roll_PPSave"></button></div> <span class="sheet-save-span">Poison & Death</span> <div><input class="sheet-stat-input" type="text" name="attr_save_pd"></div> <div><input class="sheet-stat-input" type="text" name="attr_save_pd_mod" value="0"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=Saving Throw}} {{subheader=Poison & Death}} {{roll=[[1d20 + @{save_pd_mod}]]}} {{target=[[@{save_pd}]]}}" name="roll_PDSave"></button></div> <span class="sheet-save-span">Blast & Breath</span> <div><input class="sheet-stat-input" type="text" name="attr_save_bb"></div> <div><input class="sheet-stat-input" type="text" name="attr_save_bb_mod" value="0"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=Saving Throw}} {{subheader=Blast & Breath}} {{roll=[[1d20 + @{save_bb_mod}]]}} {{target=[[@{save_bb}]]}}" name="roll_BBSave"></button></div> <span class="sheet-save-span">Staffs & Wands</span> <div><input class="sheet-stat-input" type="text" name="attr_save_sw"></div> <div><input class="sheet-stat-input" type="text" name="attr_save_sw_mod" value="0"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=Saving Throw}} {{subheader=Staffs & Wands}} {{roll=[[1d20 + @{save_sw_mod}]]}} {{target=[[@{save_sw}]]}}" name="roll_SWSave"></button></div> <span class="sheet-save-span">Spells</span> <div><input class="sheet-stat-input" type="text" name="attr_save_sp"></div> <div><input class="sheet-stat-input" type="text" name="attr_save_sp_mod" value="0"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=Saving Throw}} {{subheader=Spells}} {{roll=[[1d20 + @{save_sp_mod}]]}} {{target=[[@{save_sp}]]}}" name="roll_SPSave"></button></div> </div> </div> </div> <div class="lactions section"> <div class="attacks-grid"> <!-- Initiative --> <span class="sheet-initiative-span">Initiative</span> <div><input class="sheet-stat-input" type="text" name="attr_initiative_mod" value="0"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=Initiative Roll}} {{subheader=@{character_name}}} {{roll=[[1d6 + @{initiative_mod} &{tracker}]]}}" name="roll_Initiative"></button></div> <span class="sheet-initiative-span">Attack Throw</span> <div><input class="sheet-stat-input" type="text" name="attr_attack_throw_vis" value="@{attack_throw}" disabled="true"></div> <div><input class="sheet-stat-input sheet-hidden" type="text" name="attr_attack_throw"></div> </div> <div class="attacks-grid"> <div class="sheet-attack-title"> <h3>Weapons & Attacks</h3> </div> <span>Attack Name</span><span>Th. Mod</span><span>Damage</span><span></span> </div> <fieldset class="repeating_attacks"> <div class="attacks-grid"> <input class="sheet-name-input" type="text" name="attr_attack_name"> <div><input class="sheet-stat-input" type="text" name="attr_attack_throw_mod"></div> <div><input class="sheet-stat-input" type="text" name="attr_attack_dmg"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=@{attack_name} Attack}} {{roll=[[1d20 + @{attack_throw_mod}]]}} {{target=[[@{attack_throw}]]}} {{damage=[[@{attack_dmg}]]}}" name="roll_Attack"></button></div> </div> </fieldset>
<div class="proficiencies-grid"> <div class="sheet-proficiency-title"> <h3>Proficiencies</h3> </div> <span>Proficiency</span><span>Desc</span><span></span> </div> <fieldset class="repeating_proficiencies"> <div class="proficiencies-grid"> <input class="sheet-name-input" type="text" name="attr_proficiency_name"> <div><input class="sheet-stat-input" type="text" name="attr_proficiency_desc"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=@{proficiency_name} Proficency}} {{desc=@{proficiency_desc}}}" name="roll_Proficiency"></button></div> </div> </fieldset> </div> <div class="ractions section"> <div class="proficiencies-grid"> <div class="sheet-proficiency-title"> <h3>Class & Race Abilities</h3> </div> <span>Ability Name</span><span>Throw</span><span></span> </div> <fieldset class="repeating_abilities"> <div class="proficiencies-grid"> <input class="sheet-name-input" type="text" name="attr_ability_name"> <div><input class="sheet-stat-input" type="text" name="attr_ability_throw"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=@{ability_name}}} {{@subheader=Class/Race Ability}} {{roll=[[1d20]]}} {{target=@{ability_throw}}}" name="roll_Ability"></button></div> </div> </fieldset>
<div class="proficiencies-grid"> <div class="sheet-proficiency-title"> <h3>Actions</h3> </div> <span>Action Name</span><span>Throw</span><span></span> </div> <div class="proficiencies-grid"> <input class="sheet-name-input" type="text" name="attr_opendoor_name" value="Open Door" disabled> <div><input class="sheet-stat-input" type="text" name="attr_opendoor_throw"></div> <div><button class="sheet-roll-button" type="roll" value="/roll 1d20" name="roll_OpenDoor"></button></div> </div> <div class="proficiencies-grid"> <input class="sheet-name-input" type="text" name="attr_detectdoor_name" value="Detect Secret Door" disabled> <div><input class="sheet-stat-input" type="text" name="attr_detectdoor_throw"></div> <div><button class="sheet-roll-button" type="roll" value="/roll 1d20" name="roll_DetectDoor"></button></div> </div> <div class="proficiencies-grid"> <input class="sheet-name-input" type="text" name="attr_hearnoise_name" value="Hear Noise" disabled> <div><input class="sheet-stat-input" type="text" name="attr_hearnoise_throw"></div> <div><button class="sheet-roll-button" type="roll" value="/roll 1d20" name="roll_HearNoise"></button></div> </div> <div class="proficiencies-grid"> <input class="sheet-name-input" type="text" name="attr_findtraps_name" value="Find Traps" disabled> <div><input class="sheet-stat-input" type="text" name="attr_findtraps_throw"></div> <div><button class="sheet-roll-button" type="roll" value="?{Spell|Cure Light Wounds, **Cure Light Wounds** Target Regains [[1d8+5]] HP. | Cure Moderate Wounds, **Cure Moderate Wounds** Target Regains [[2d8+8]] HP. | Cure Serious Wounds, **Cure Serious Wounds** Target Regains [[3d8+8]] HP.}" name="roll_FindTraps"></button></div> </div> <fieldset class="repeating_actions"> <div class="proficiencies-grid"> <input class="sheet-name-input" type="text" name="attr_action_name"> <div><input class="sheet-stat-input" type="text" name="attr_action_throw"></div> <div><button class="sheet-roll-button" type="roll" value="/roll 1d20" name="roll_Action"></button></div> </div> </fieldset> </div> <div class="equipment section"> <div class="equipment-grid"> <div class="sheet-equipment-title"> <h3>Equipment & Magic Items</h3> </div> <span>Item Name</span><span>Encumb.</span> </div> <fieldset class="repeating_equipment"> <div class="equipment-grid"> <input class="sheet-name-input" type="text" name="attr_equipment_name"> <div><input class="sheet-stat-input" type="text" name="attr_equipment_encumb"></div> </div> </fieldset> </div> <div class="loot section"> <div class="currency-grid"> <div class="sheet-exp-title"> <h3>Experience</h3> </div> <span>Current</span><span></span><span>Needed</span><span></span><span>Bonus</span> <div class="sheet-exp-current"><input type="text" name="attr_exp_current"></div> <div class="sheet-exp-needed"><input type="text" name="attr_exp_needed"></div> <div><input class="sheet-currency-input" type="text" name="attr_exp_bonus"></div> <div class="sheet-currency-title"> <h3>Loot</h3> </div> <span>Copper</span><span>Silver</span><span>Electrum</span><span>Gold</span><span>Platinum</span> <input class="currency-input" type="text" name="attr_cp"> <input class="currency-input" type="text" name="attr_sp"> <input class="currency-input" type="text" name="attr_ep"> <input class="currency-input" type="text" name="attr_gp"> <input class="currency-input" type="text" name="attr_pp">
<div class="sheet-lootbox"><textarea class="sheet-textarea" wrap="off" name="attr_loot"></textarea></div> </div> </div> <div class="spells section"> <div class="spells-grid spells-grid-daily"> <div class="sheet-spells-title"> <h3>Spells Per Day</h3> </div> <span></span><span>One</span><span>Two</span><span>Three</span><span>Four</span><span>Five</span><span>Six</span> <span>Used</span> <input class="spells-input" type="text" name="attr_spells_l1"> <input class="spells-input" type="text" name="attr_spells_l2"> <input class="spells-input" type="text" name="attr_spells_l3"> <input class="spells-input" type="text" name="attr_spells_l4"> <input class="spells-input" type="text" name="attr_spells_l5"> <input class="spells-input" type="text" name="attr_spells_l6"> <span>Total</span> <input class="spells-input" type="text" name="attr_spells_l1_max"> <input class="spells-input" type="text" name="attr_spells_l2_max"> <input class="spells-input" type="text" name="attr_spells_l3_max"> <input class="spells-input" type="text" name="attr_spells_l4_max"> <input class="spells-input" type="text" name="attr_spells_l5_max"> <input class="spells-input" type="text" name="attr_spells_l6_max"> </div> <div class="spells-grid"> <div class="sheet-spells-title sheet-margin-top"> <h3>Spellbook</h3> </div> <span class="grid-span-1-2">Spell Name</span><span>Level</span><span class="grid-span-4-2">Effect</span><span>Damage</span><span></span><span></span><span></span> </div> <fieldset class="repeating_spells"> <div class="spells-grid"> <input class="sheet-name-input grid-span-1-2" type="text" name="attr_spell_name"> <div><input class="sheet-stat-input" type="text" name="attr_spell_level"></div> <div class="grid-span-4-2"><input class="sheet-stat-input" type="text" name="attr_spell_effect"></div> <div><input class="sheet-stat-input" type="text" name="attr_spell_damage"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=@{spell_name}}} {{subheader=Level @{spell_level} Arcane Spell}} {{desc=@{spell_effect}}} {{damage=[[@{spell_damage}]]}}" name="roll_Spell"></button></div> </div> </fieldset> </div>
</div> </div> <div class="npc"> <div class="npc-header sheet-grid-span-1-2 sheet-text-center"> <h2>Adventurer Conqueror King System</h2> <h4>NPC/Monster Stat Block</h4> <br><br><br> </div> <div class="npc-lsection"> <div class="attacks-grid"> <span class="sheet-initiative-span">Attack Throw</span> <div><input class="sheet-stat-input" type="text" name="attr_npc_attack_throw_vis" value="@{npc_attack_throw}" disabled="true"></div> <div><input class="sheet-stat-input sheet-hidden" type="text" name="attr_npc_attack_throw"></div> <span class="sheet-initiative-span">Armour Class</span> <div><input class="sheet-stat-input" type="text" name="attr_ac" value="0"></div> <div></div> <!-- Initiative --> <span class="sheet-initiative-span">Initiative</span> <div><input class="sheet-stat-input" type="text" name="attr_initiative_mod" value="0"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=Initiative Roll}} {{subheader=@{character_name}}} {{roll=[[1d6 + @{initiative_mod} &{tracker}]]}}" name="roll_Initiative"></button></div> </div> <div class="attacks-grid"> <div class="sheet-attack-title"> <h3>Weapons & Attacks</h3> </div> <span>Attack Name</span><span>Th. Mod</span><span>Damage</span><span></span> </div> <fieldset class="repeating_attacks"> <div class="attacks-grid"> <input class="sheet-name-input" type="text" name="attr_attack_name"> <div><input class="sheet-stat-input" type="text" name="attr_attack_throw_mod"></div> <div><input class="sheet-stat-input" type="text" name="attr_attack_dmg"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=@{attack_name} Attack}} {{roll=[[1d20 + @{attack_throw_mod}]]}} {{target=[[@{attack_throw}]]}} {{damage=[[@{attack_dmg}]]}}" name="roll_Attack"></button></div> </div> </fieldset>
<div class="proficiencies-grid"> <div class="sheet-proficiency-title"> <h3>Proficiencies</h3> </div> <span>Proficiency</span><span>Desc</span><span></span> </div> <fieldset class="repeating_proficiencies"> <div class="proficiencies-grid"> <input class="sheet-name-input" type="text" name="attr_proficiency_name"> <div><input class="sheet-stat-input" type="text" name="attr_proficiency_desc"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=@{proficiency_name} Proficency}} {{desc=@{proficiency_desc}}}" name="roll_Proficiency"></button></div> </div> </fieldset> </div> <div class="npc-rsection"> <div class="attacks-grid"> <span class="sheet-title-line">Hit Dice</span> <input class="sheet-stat-input" type="text" name="attr_npc_hitdice"> <input class="sheet-stat-input" type="text" name="attr_npc_hitdicemod" value="d8"> <div><button class="sheet-roll-button" type="roll" value="/w gm &{template:acks}{{name=@{character_name} Hit Dice}}{{roll=[[@{npc_hitdice}@{npc_hitdicemod}]]}}" name="roll_NPCHitDice"></button></div> <span class="sheet-title-line">Hit Points/Max</span><input class="sheet-stat-input" type="text" name="attr_hp"><input class="sheet-stat-input" type="text" name="attr_hp_max"><span></span> <span class="sheet-title-line">Class</span><span></span><span class="sheet-title-line">Level</span><span></span> <select name="attr_class"> <option>Fighter</option> <option>Mage</option> <option>Cleric</option> <option>Thief</option> <option>Assassin</option> <option>Bard</option> <option>Bladedancer</option> <option>Explorer</option> </select> <span></span> <input class="sheet-stat-input" type="text" name="attr_level"> <span></span> </div> <div class="saves-grid"> <div class="sheet-saves-title"> <h3>Saving Throws</h3> </div> <span></span><span>Throw</span><span>Modifier</span><span></span> <span class="sheet-save-span">Petrif. & Paral.</span> <div><input class="sheet-stat-input" type="text" name="attr_save_pp"></div> <div><input class="sheet-stat-input" type="text" name="attr_save_pp_mod" value="0"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=Saving Throw}} {{subheader=Petrification & Paralysis}} {{roll=[[1d20 + @{save_pp_mod}]]}} {{target=[[@{save_pp}]]}}" name="roll_PPSave"></button></div> <span class="sheet-save-span">Poison & Death</span> <div><input class="sheet-stat-input" type="text" name="attr_save_pd"></div> <div><input class="sheet-stat-input" type="text" name="attr_save_pd_mod" value="0"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=Saving Throw}} {{subheader=Poison & Death}} {{roll=[[1d20 + @{save_pd_mod}]]}} {{target=[[@{save_pd}]]}}" name="roll_PDSave"></button></div> <span class="sheet-save-span">Blast & Breath</span> <div><input class="sheet-stat-input" type="text" name="attr_save_bb"></div> <div><input class="sheet-stat-input" type="text" name="attr_save_bb_mod" value="0"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=Saving Throw}} {{subheader=Blast & Breath}} {{roll=[[1d20 + @{save_bb_mod}]]}} {{target=[[@{save_bb}]]}}" name="roll_BBSave"></button></div> <span class="sheet-save-span">Staffs & Wands</span> <div><input class="sheet-stat-input" type="text" name="attr_save_sw"></div> <div><input class="sheet-stat-input" type="text" name="attr_save_sw_mod" value="0"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=Saving Throw}} {{subheader=Staffs & Wands}} {{roll=[[1d20 + @{save_sw_mod}]]}} {{target=[[@{save_sw}]]}}" name="roll_SWSave"></button></div> <span class="sheet-save-span">Spells</span> <div><input class="sheet-stat-input" type="text" name="attr_save_sp"></div> <div><input class="sheet-stat-input" type="text" name="attr_save_sp_mod" value="0"></div> <div><button class="sheet-roll-button" type="roll" value="&{template:acks} {{name=Saving Throw}} {{subheader=Spells}} {{roll=[[1d20 + @{save_sp_mod}]]}} {{target=[[@{save_sp}]]}}" name="roll_SPSave"></button></div> </div> </div> </div>
<!-- Roll Templates --> <rolltemplate class="sheet-rolltemplate-acks"> <div class="sheet-acks-container"> <div class="sheet-acks-header">{{name}}</div> {{#subheader}} <div class="sheet-acks-subheader sheet-acks-row">{{subheader}}</div> {{/subheader}} {{#target}} <div class="sheet-acks-row">Target <span class="sheet-acks-target-value">{{target}}+</span></div> {{/target}} {{#roll}} <div class="sheet-acks-row">Roll {{roll}}</div> {{/roll}} {{#damage}} <div class="sheet-acks-row">Damage {{damage}}</div> {{/damage}} {{#desc}} <div class="sheet-acks-row sheet-acks-desc">{{desc}}</div> {{/desc}} </div> </rolltemplate>
<!-- Sheet Workers --> <script type="text/worker"> /*** ATTRIBUTE RELATED WORKERS ***/ const calculateAttrMod = function(attr) { // Calculate the modifier for a given attribute value let atr = parseInt(attr); let mod = 0; if(atr <= 3) mod = -3; if(atr >= 4 && atr <= 5) mod = -2; if(atr >= 6 && atr <= 8) mod = -1; if(atr >= 9 && atr <= 12) mod = 0; if(atr >= 13 && atr <= 15) mod = 1; if(atr >= 16 && atr <= 17) mod = 2; if(atr >= 18) mod = 3; return mod; }; /** Calculate Modifiers when an Attribute value changes **/ on("change:str", function(e) { console.log('calculate mod for str'); setAttrs({str_mod: calculateAttrMod(e.newValue)}); }); on("change:int", function(e) { console.log('calculate mod for int'); setAttrs({int_mod: calculateAttrMod(e.newValue)}); }); on("change:wis", function(e) { console.log('calculate mod for wis'); setAttrs({wis_mod: calculateAttrMod(e.newValue)}); }); on("change:dex", function(e) { console.log('calculate mod for dex'); setAttrs({dex_mod: calculateAttrMod(e.newValue)}); }); on("change:con", function(e) { console.log('calculate mod for con'); setAttrs({con_mod: calculateAttrMod(e.newValue)}); }); on("change:chr", function(e) { console.log('calculate mod for chr'); setAttrs({chr_mod: calculateAttrMod(e.newValue)}); }); </script> <script type="text/worker"> /*** SAVES/THROWS RELATED WORKERS ***/ const calculateSavesThrows = function(level, clas) { level = parseInt(level); var saves = [0, 0, 0, 0, 0, 0]; switch(clas) { case 'Fighter': case 'Assassin': case 'Explorer': switch(level) { case 0: saves = [16, 15, 17, 17, 18]; break; case 1: saves = [15, 14, 16, 16, 17, 10]; break; case 2: case 3: saves = [14, 13, 15, 15, 16, 9]; break; case 4: saves = [13, 12, 14, 14, 15, 8]; break; case 5: case 6: saves = [12, 11, 13, 13, 14, 7]; break; case 7: saves = [11, 10, 12, 12, 13, 6]; break; case 8: case 9: saves = [10, 9, 11, 11, 12, 5]; break; case 10: saves = [9, 8, 10, 10, 11, 4]; break; case 11: case 12: saves = [8, 7, 9, 9, 10, 3]; break; case 13: saves = [7, 6, 8, 8, 9, 2]; break; case 14: saves = [6, 5, 7, 7, 8, 1]; break; } break; case 'Mage': switch(level) { case 1: case 2: case 3: saves = [13, 13, 15, 11, 12, 10]; break; case 4: case 5: case 6: saves = [12, 12, 14, 10, 11, 9]; break; case 7: case 8: case 9: saves = [11, 11, 13, 9, 10, 8]; break; case 10: case 11: case 12: saves = [10, 10, 12, 8, 9, 7]; break; case 13: case 14: saves = [9, 9, 11, 7, 8, 6]; break; } break; case 'Cleric': case 'Bladedancer': switch(level) { case 1: case 2: saves = [13, 10, 16, 13, 15, 10]; break; case 3: case 4: saves = [12, 9, 15, 12, 14, 9]; break; case 5: case 6: saves = [11, 8, 14, 11, 13, 8]; break; case 7: case 8: saves = [10, 7, 13, 10, 12, 7]; break; case 9: case 10: saves = [9, 6, 12, 9, 11, 6]; break; case 11: case 12: saves = [8, 5, 11, 8, 10, 5]; break; case 13: case 14: saves = [7, 4, 10, 7, 9, 4]; break; } break; case 'Thief': case 'Bard': switch(level) { case 1: case 2: saves = [13, 13, 16, 14, 15, 10]; break; case 3: case 4: saves = [12, 12, 15, 13, 14, 9]; break; case 5: case 6: saves = [11, 11, 14, 12, 13, 8]; break; case 7: case 8: saves = [10, 10, 13, 11, 12, 7]; break; case 9: case 10: saves = [9, 9, 12, 10, 11, 6]; break; case 11: case 12: saves = [8, 8, 11, 9, 10, 5]; break; case 13: case 14: saves = [7, 7, 10, 8, 9, 4]; break; } break; } return saves; }; on("change:level change:class", function(e) { console.log('calculate saves and throws for class/level'); getAttrs(["level", "class"], function(v) { let saves = calculateSavesThrows(v.level, v.class); setAttrs({ save_pp: saves[0], save_pd: saves[1], save_bb: saves[2], save_sw: saves[3], save_sp: saves[4], attack_throw: saves[5] }); }); }); /* NPC Attack Throw */ const calculateNpcHit = function(hd) { switch(hd.toString()) { case '1': return 10; case '2': return 9; case '3': return 8; case '4': return 7; case '5': return 6; case '6': return 5; case '7': return 4; case '8': case '9': return 3; case '10': case '11': return 2; case '12': case '13': return 1; case '14': case '15': return 0; case '16': case '17': return -1; case '18': case '19': return -2; case '20': case '21': return -3; default: return -4; } }; on("change:npc_hitdice", function(e) { getAttrs(["npc_hitdice"], function(v) { let thrw = calculateNpcHit(v.npc_hitdice); setAttrs({npc_attack_throw: thrw}); }); }); </script>
|