Files
roll20-character-sheets/When The Wolf Comes/wtwc.html
T
William Barker 8da2fffd72 [When The Wolf Comes] New Sheet
New Sheet based in Ian Stuart Sharpe's TTRPG of the same name. This has his permission (and involvement!)
2025-07-27 13:26:26 -04:00

1565 lines
96 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- BEGIN SHEET -->
<!-- Tab radio buttons -->
<input type="radio" class="sheet-page1" name="attr_page" value="1" checked="checked" id="sheet-page1">
<label for="sheet-page1" data-i18n="main">Main</label>
<input type="radio" class="sheet-page2" name="attr_page" value="2" id="sheet-page2">
<label for="sheet-page2" data-i18n="auxilliary">Auxilliary</label>
<div class="sheet-page1" style='width: 840px; height: 1100px; margin: -10px 0 0 -10px; padding: 0px; border: 1px solid #a8a8a8;'><!--- Tab 1 start -->
<div style='margin: 114px 0px 0px 18px; width: 785px; height: 980px; border: 0px solid pink;' >
<!-- Name, Origin, Gender -->
<!-- <div style='margin: 114px 0px 0px 0px; width: 785px; border: 0px solid pink;'></div> -->
<div style='display: inline-block; vertical-align: top; width: 404px; border: 0px solid orange;'>
<!-- Character Name -->
<input type='text' spellcheck="false" style='width: 334px; text-align: center; height: 30px; font-weight: bold; font-size: 1.6em; border: 0px solid red; background-color: rgba(255,255,255,0.1); margin:2px 0px 0px 58px' name='attr_character_name' /><br>
<!-- Character Name (if long) and Titles, Professions, or Station -->
<input type='text' spellcheck="false" style='width: 368px; text-align: left; height: 18px; border: 0px solid green; background-color: rgba(255,255,255,0.1); margin:0px 0px 0px 24px' name='attr_character_name2'/><br>
<!-- Origin (race: Mann, Alfar, Dvergar, Jotnar, Dokkalfar, Sons of Ivaldi, Jarnvidjur, Jofurr, Orcneas, Wanes) -->
<select name='attr_origin' data-i18n-title="origin" title="Origin" spellcheck="false" style='width: 188px; text-align: center; height: 24px; padding: 0px 0px -4px 0px; border: 0px solid blue; background-color: rgba(255,255,255,0.1); margin:-2px 0px 0px 60px'>
<option type="text" style="color:SaddleBrown" data-i18n-title="mann-attribute-option" data-i18n="mann" title="Choose one attribute to increase by 1" selected> Mann</option>
<option type="text" style="color:Crimson" data-i18n-title="alfar-attribute-option" data-i18n="alfar" title="Choose two attributes and increase each by 1"> Alfar</option>
<option type="text" style="color:SkyBlue" data-i18n="dvergar"> Dvergar</option>
<option type="text" style="color:Navy" data-i18n="jotnar"> Jotnar</option>
<option type="text" style="color:Navy" data-i18n="dokkalfar"> Dokkalfar</option>
<option type="text" style="color:Navy" data-i18n="ivaldi"> Ivaldi</option>
<option type="text" style="color:Navy" data-i18n="jarnvidjur"> Jarnvidjur</option>
<option type="text" style="color:Navy" data-i18n="jofurr"> Jofurr</option>
<option type="text" style="color:Navy" data-i18n="orcneas"> Orcneas</option>
<option type="text" style="color:Navy" data-i18n="wanes"> Wanes</option>
</select>
<!-- Gender -->
<input type='text' style='width: 88px; text-align: center; height: 20px; border: 0px solid pink; background-color: rgba(255,255,255,0.1); margin:0px 0px 0px 48px' name='attr_gender' />
</div>
<!-- Background -->
<div style='display: inline-block; vertical-align: top; width: 370px; border: 0px solid red;'>
<textarea name='attr_background' spellcheck="false" style='background-color: rgba(255,255,255,0.1); border: 0 solid purple; width: 380px; max-width: 360px; height:32px; max-height:32px; margin: 32px 0px 0px 10px; padding-top: 2px;'></textarea>
</div>
<!-- Apearance, Age, Size, Speed -->
<div style='display: inline-block; vertical-align: top; width: 404px; border: 0px dashed red; margin:32px 0px 0px 0px;'>
<!-- Apperance and Build -->
<textarea name='attr_appearance' style='background-color: rgba(255,255,255,0.1); border: 0 solid purple; width: 380px; max-width: 360px; height:71px; max-height:71px; margin: 0px 0px 0px 22px; padding-top: 2px;'></textarea>
<!-- Age -->
<input type='text' class="bioSmall" name='attr_age' style='margin:-4px 0px 0px 154px' />
<!-- Size -->
<input type='text' class="bioSmall" name='attr_size' style='margin:-4px 0px 0px 30px' />
<!-- Speed -->
<input type='hidden' name='attr_speed_prior_affliction' title='Speed prior to affliction impairment' />
<input type='text' class="bioSmall" name='attr_speed' style='margin:-4px 0px 0px 44px' data-i18n-title="speed-components" title='Base Speed - Armour penalty' />
</div>
<!-- Personality & Religion -->
<div style='display: inline-block; vertical-align: top; width: 370px; border: 0px solid black;'>
<textarea name='attr_personality' spellcheck="false" style='background-color: rgba(255,255,255,0.1); border: 0px solid red; width: 380px; max-width: 360px; height:32px; max-height:32px; margin: 34px 0px 0px 10px; padding-top: 2px;'></textarea>
<textarea name='attr_religion' spellcheck="false" style='background-color: rgba(255,255,255,0.1); border: 0px solid green; width: 380px; max-width: 360px; height:32px; max-height:32px; margin: 33px 0px 0px 10px; padding-top: 2px;'></textarea>
</div>
<div style='display: inline-block; vertical-align: top; width: 200px; border: 0px solid orange; padding: none;'>
<!-- This string may become useful or irrelevant based on whether manual input is desired or global variables are prefered. Currenly in use for Might Attribute -->
<input type="hidden" name="attr_weals_woes_query" value="?{#(Weals - Woes)|0}">
<!-- Might -->
<!-- NOTE: Attribute range 1-20 allowable -->
<!-- Might Attribute value -->
<input class="attribute" type='text' name='attr_might' style='margin:-5px 0px 0px 24px' data-i18n-title="might-definition" title='Might: brawn, constitution, physical strength and durability' value='10' />
<!-- Might Attribute Modifier (Might - 10) - used as bonus in Might Challenge and Melee attacks -->
<input type='text' style='width: 90px; text-align: center; height: 44px; font-weight: bold; font-size: 2em; border: 0px solid red; background-color: rgba(255,255,255,0.1); margin:-10px 0px 0px -8px' data-i18n-title="might-modifier" title='Might Modifier: Might - 10' name='attr_might_mod' value='0' />
<!-- Might Challenge roll button -->
<button class="sheet-textButton" style='margin:-34px 0px 0px 98px; background-color: rgba(249,249,249,1.0); border: 0px solid red;' type="roll" name="roll_mightChallenge" data-i18n-title="might-challenge" title="Might Challenge: 1d20 + Might Modifier + Weals - Woes - Armour Woe" value="&{template:challenge} {{Name=Challenge}} {{Actor=@{character_name}}} {{SkillName=Might}} {{Roll=[[1d20+@{might_mod}+@{weals}-@{woes}-@{armour_woe} -@{affliction_woes} ]]}}" name="roll_mightChallenge" data-i18n="might">Might</button>
<!-- Sleight -->
<input class="attribute" type='text' name='attr_sleight' style='margin:-5px 0px 0px 24px' data-i18n-title="sleight-definition" title='Sleight: nimbleness, cunning, and reflexes' value='10' />
<input type='text' style='width: 90px; text-align: center; height: 44px; font-weight: bold; font-size: 2em; border: 0px solid green; background-color: rgba(255,255,255,0.1); margin:-8px 0px 0px -6px' data-i18n-title="sleight-modifier" title='Sleight Modifier: Sleight - 10' name='attr_sleight_mod' value='0' />
<button class="sheet-textButton" style='margin:-33px 0px 0px 98px; background-color: rgba(249,249,249,1.0); border: 0px solid red;' type="roll" name="roll_sleightChallenge" data-i18n-title="sleight-challenge" title="Sleight Challenge: 1d20 + Sleight Modifier - Armour Woe" value="&{template:challenge} {{Name=Challenge}} {{Actor=@{character_name}}} {{SkillName=Sleight}} {{Roll=[[1d20+@{sleight_mod}+@{weals}-@{woes}-@{armour_woe} -@{affliction_woes}]]}}" name="roll_sleightChallenge" data-i18n="sleight">Sleight</button>
</div>
<!-- Paths -->
<div style='display: inline-block; vertical-align: top; width: 390px; border: 0px dashed orange; padding: none;'>
<input type='text' style='width: 274px; text-align: left; height: 30px; border: 0px solid blue; background-color: rgba(255,255,255,0.1); margin:12px 0px 0px 107px' name='attr_novice' />
<input type='text' style='width: 274px; text-align: left; height: 30px; border: 0px solid blue; background-color: rgba(255,255,255,0.1); margin:3px 0px 0px 107px' name='attr_expert' />
<input type='text' style='width: 274px; text-align: left; height: 30px; border: 0px solid blue; background-color: rgba(255,255,255,0.1); margin:3px 0px 0px 107px' name='attr_mythic' />
</div>
<!-- Inspiration - Luck/Plot Points pg 86-->
<div style='display: inline-block; vertical-align: top; width: 136px; border: 0px dashed purple; padding: none;'>
<input class="attribute" type='text' style='margin:12px 0px 0px 59px' data-i18n-title="inspiration-definition" title='Profound clarity of thought and action' name='attr_inspiration' value=' ' />
</div>
<div style='display: inline-block; vertical-align: top; width: 200px; border: 0px solid orange; padding: none;'>
<!-- Wits -->
<input class="attribute" type='text' name='attr_wits' style='margin:-4px 0px 0px 22px' data-i18n-title="wits-definition" title='Wits: judgement, recall and education' value='10' />
<input type='text' style='width: 90px; text-align: center; height: 44px; font-weight: bold; font-size: 2em; border: 0px solid blue; background-color: rgba(255,255,255,0.1); margin:-8px 0px 0px -6px' data-i18n-title="wits-modifier" title='Wits Modifier: Wits - 10' name='attr_wits_mod' value='0'/>
<button class="sheet-textButton" style='margin:-36px 0px 0px 98px; background-color: rgba(249,249,249,1.0); border: 0px solid red;' type="roll" name="roll_witsChallenge" data-i18n-title="wits-challenge" title="Wits Challenge: 1d20 + Wits Modifier + Weals - Woes" value="&{template:challenge} {{Name=Challenge}} {{Actor=@{character_name}}} {{SkillName=Wits}} {{Roll=[[1d20+@{wits_mod}+@{weals}-@{woes}-@{affliction_woes}]]}}" name="roll_witsChallenge" data-i18n="wits">Wits</button>
<!-- Will -->
<input class="attribute" type='text' name='attr_will' style='margin:-4px 0px 0px 22px' data-i18n-title="will-definition" title='Will: courage, discipline and sense of self' value='10' />
<input type='text' style='width: 90px; text-align: center; height: 44px; font-weight: bold; font-size: 2em; border: 0px solid pink; background-color: rgba(255,255,255,0.1); margin:-12px 0px 0px -6px' data-i18n-title="will-modifier" title='Will Modifier: Will - 10' name='attr_will_mod' value='0'/>
<button class="sheet-textButton" style='margin:-35px 0px 0px 98px; background-color: rgba(249,249,249,1.0); border: 0px solid red;' type="roll" name="roll_willChallenge" data-i18n-title="will-challenge" title="Will Challenge: 1d20 + Will Modifier + Weals - Woes" value="&{template:challenge} {{Name=Challenge}} {{Actor=@{character_name}}} {{SkillName=Will}} {{Roll=[[1d20+@{will_mod}+@{weals}-@{woes}-@{affliction_woes}]]}}" name="roll_willChallenge" data-i18n="will">Will</button>
<!-- Awareness -->
<input class="attribute" type='text' name='attr_awareness' style='margin:-5px 0px 0px 22px' data-i18n-title="awareness-definition" title='Awareness: sharp senses' value='10' />
<input type='text' style='width: 90px; text-align: center; height: 44px; font-weight: bold; font-size: 2em; border: 0px solid black; background-color: rgba(255,255,255,0.1); margin:-10px 0px 0px -6px' data-i18n-title="awareness-modifier" title='Awareness Modifier: Awareness - 10' name='attr_awareness_mod' value='0' />
<button class="sheet-textButton" style='margin:-39px 0px 0px 96px; background-color: rgba(249,249,249,1.0); border: 0px solid red;' type="roll" name="roll_awarenessChallenge" data-i18n-title="awareness-challenge" title="Awareness Challenge: 1d20 + Awareness Modifier + Weals - Woes" value="&{template:challenge} {{Name=Challenge}} {{Actor=@{character_name}}} {{SkillName=Awareness}} {{Roll=[[1d20+@{awareness_mod}+@{weals}-@{woes}-@{affliction_woes}]]}}" name="roll_awarenessChallenge" data-i18n="awareness">Awareness</button>
<!-- Vision -->
<input type='text' style='width: 134px; text-align: center; height: 20px; border: 0px solid red; background-color: rgba(255,255,255,0.1); margin:-24px 0px 0px 60px' data-i18n-title="vision-origin" title='Exceptional vision granted by Origin, Gift or Spell' name='attr_vision' />
</div >
<!-- Abilities Talents -->
<div style='display: inline-block; vertical-align: top; margin-top: 36px; width: 565px; height: 320px; margin:-9px 0px 0px 14px; border: 0px solid pink;'>
<fieldset class='repeating_talents' style='vertical-align: top;'>
<input type="text" style='width: 140px; text-align: center; height: 19px; border: 0px solid; color: black; background-color: rgba(255,255,255,0.1);' name='attr_talent' />
<input type='text' style='width: 410px; text-align: center; height: 19px; border: 0px solid; color: black; background-color: rgba(255,255,255,0.1); margin:0px 0px 0px 4px;' name='attr_description'/>
</fieldset>
</div>
<!-- NOTES: Weals and Woes? -->
<input type="text" style='width: 36px; text-align: center; height:18px; margin:8px 0px 0px 80px; color: Blue; font-size: 1em; font-weight: bold; border: 1px solid blue' data-i18n-title="weal" title="Current Weal" name="attr_weals" value="0">
<input type="text" style='width: 36px; text-align: center; height:18px; margin:8px 0px 0px 180px; color: DarkRed; font-size: 1em; font-weight: bold; border: 1px solid red' data-i18n-title="woe-afflictions" title="Total Woe from Afflictions" name="attr_affliction_woes" readonly value="0">
<input type="text" style='width: 36px; text-align: center; height:18px; margin:8px 0px 0px 0px; color: Purple; font-size: 1em; font-weight: bold; border: 1px solid purple' data-i18n-title="woe" title="Current Woe" name="attr_woes" value="0">
<!-- Disorders | Affliction nb:opacity:0; -->
<div style='width: 788px; height:96px; border: 0px solid green; margin:4px 0px 0px 0px;'>
<div style='display: inline-block; vertical-align: top; width: 374px; height:88px; background-color: rgba(233,233,233,1.0); margin: 0px 0px 0px 16px; border: 0px solid blue;'>
<div style='margin: auto;'>
<input id="affliction_asleep" type="checkbox" name="attr_affliction_asleep"><label style='margin: 0px 0px -4px 30px;' data-i18n-title="asleep-description" data-i18n="asleep" title='Becomes prone and unconscious. Action to wake up. Removed upon taking damage unless noted otherwise' for="affliction_asleep">Asleep</label>
<input id="affliction_blinded" type="checkbox" name="attr_affliction_blinded"><label style='margin: 0px 0px -4px 0px;' data-i18n-title="blinded-description" title='Cannot see: surroundings obscured. Attack rolls against Defence or Sleight get 1 weal. Speed becomes 2 unless lower' for="affliction_blinded" data-i18n="blinded">Blinded</label>
<input id="affliction_charmed" type="checkbox" name="attr_affliction_charmed"><label style=' margin: 0px 0px -4px 0px;' data-i18n-title="charmed-description" title='Treats source as trusted friend and ally. Cannot attack source' for="affliction_charmed" data-i18n="charmed">Charmed</label>
<input id="affliction_compelled" type="checkbox" name="attr_affliction_compelled"><label style='margin: 0px 0px -4px 0px;' data-i18n-title="compelled-description" title='Cannot use actions or move. Instead, source can force creature to move or use an action during fast turn. All decisions are made by source' for="affliction_compelled" data-i18n="compelled">Compelled</label>
</div>
<div style='margin: auto;'>
<input id="affliction_dazed" type="checkbox" name="attr_affliction_dazed"><label style='margin: 0px 0px -4px 20px;' data-i18n-title="dazed-description" title='Cannot use actions' for="affliction_dazed" data-i18n="dazed">Dazed</label>
<input id="affliction_deafened" type="checkbox" name="attr_affliction_deafened"><label style='margin: 0px 0px -4px 0px;' data-i18n-title="deafened-description" title='Cannot hear: hearing-based Awareness fails' for="affliction_deafened" data-i18n="deafened">Deafened</label>
<input id="affliction_defenceless" type="checkbox" name="attr_affliction_defenceless"><label style='margin: 0px 0px -4px 0px;' data-i18n-title="defenceless-description" title='Defence becomes 5. Cannot use actions. Speed becomes 2 unless lower' for="affliction_defenceless" data-i18n="defenceless">Defenceless</label>
<input id="affliction_diseased" type="checkbox" name="attr_affliction_diseased"><label style='margin: 0px 0px -4px 0px;' data-i18n-title="diseased-description" title='All attack rolls and challenge rolls are made with 1 woe' for="affliction_diseased" data-i18n="diseased">Diseased</label>
</div>
<div style='margin: auto;'>
<input id="affliction_fatigued" type="checkbox" name="attr_affliction_fatigued"><label style='margin: 0px 0px -4px 20px;' data-i18n-title="fatigued-description" title='All attack rolls and challenge rolls are made with 1 woe' for="affliction_fatigued" data-i18n="fatigued">Fatigued</label>
<input id="affliction_frightenedUnseen" type="checkbox" name="attr_affliction_frightened_unseen"><label style='margin: 0px 0px -4px 0px;' data-i18n-title="frightened-unseen-description" title='All attack rolls and challenge rolls are made with 1 woe if unseen' for="affliction_frightenedUnseen" data-i18n="fright-unseen">Fright: Unseen</label>
<input id="affliction_frightenedSeen" type="checkbox" name="attr_affliction_frightened_seen"><label style='margin: 0px 0px -4px -4px;' data-i18n-title="frightened-seen-description" title='All attack rolls and challenge rolls are made with 3 woe if seen' for="affliction_frightenedSeen" data-i18n="fright-seen"> Seen</label>
<input id="affliction_grabbed" type="checkbox" name="attr_affliction_grabbed"><label style='margin: 0px 0px -4px 0px;' data-i18n-title="grabbed-description" title='Depending on size, either cannot move away (if grabber larger or equal), or move grabbing creature automatically' for="affliction_grabbed" data-i18n="grabbed">Grabbed</label>
</div>
<div style='margin: auto;'>
<input id="affliction_immobilized" type="checkbox" name="attr_affliction_immobilized"><label style='margin: 0px 0px -4px 20px;' data-i18n-title="immobilized-description" title='Speed becomes 0, cannot benefit from bonuses to speed. Attack rolls against get 1 weal' for="affliction_immobilized" data-i18n="immobilized">Immobilized</label>
<input id="affliction_impaired" type="checkbox" name="attr_affliction_impaired"><label style='margin: 0px 0px -4px 0px;' data-i18n-title="impaired-description" title='All attack rolls and challenge rolls are made with 1 woe' for="affliction_impaired" data-i18n="impaired">Impaired</label>
<input id="affliction_poisoned" type="checkbox" name="attr_affliction_poisoned"><label style='margin: 0px 0px -4px 0px;' data-i18n-title="poisoned-description" title='All attack rolls and challenge rolls are made with 1 woe' for="affliction_poisoned" data-i18n="poisoned">Poisoned</label>
<input id="affliction_prone" type="checkbox" name="attr_affliction_prone"><label style='margin: 0px 0px -4px 0px;' data-i18n-title="prone-description" title='Lies on the ground. Other creatures can move through its space. Might and Sleight rolls are made with 1 woe. Attack rolls against get 1 weal. If not in reach, Defence 1 woe. Can use full movement to stand up' for="affliction_prone" data-i18n="prone">Prone</label>
</div>
<div style='margin: auto;'>
<input id="affliction_slowed" type="checkbox" name="attr_affliction_slowed"><label style='margin: 0px 0px -4px 10px;' data-i18n-title="slowed-description" title='Can only take a slow turn. Speed is halved, cannot benefit from increases to Speed' for="affliction_slowed" data-i18n="slowed">Slowed</label>
<input id="affliction_stunned" type="checkbox" name="attr_affliction_stunned"><label style='margin: 0px 0px -4px 0px;' data-i18n-title="stunned-description" title='Cannot use actions or move. Challenge rolls fail. Attack rolls against are made with 1 weal' for="affliction_stunned" data-i18n="stunned">Stunned</label>
<input id="affliction_surprised" type="checkbox" name="attr_affliction_surprised"><label style='margin: 0px 0px -4px 0px;' data-i18n-title="surprised-description" title='Cannot use actions or move. Challenge rolls fail' for="affliction_surprised" data-i18n="surprised">Surprised</label>
<input id="affliction_unconscious" type="checkbox" name="attr_affliction_unconscious" value="1"><label style='margin: 0px 0px -4px 0px;' data-i18n-title="unconscious-description" title='Cannot use actions or move. Challenge rolls fail. Defence becomes 5' for="affliction_unconscious" data-i18n="unconscious">Unconscious</label>
</div>
</div>
<!-- Professions | Languages -->
<div style='display: inline-block; vertical-align: top; width: 366px; margin: 0px 0px 0px 22px; border: 0px solid pink;'>
<input type="text" class="profession" name='attr_languages'/>
<input type="text" class="profession" name='attr_profession1'/>
<input type="text" class="profession" name='attr_profession2'/>
<input type="text" class="profession" name='attr_profession3'/>
</div>
</div>
<!-- Trauma, Honour, Shame -->
<div style='display: inline-block; vertical-align: top; width: 770px; margin:18px 0px 0px 12px; border: 0px solid blue;'>
<!-- Trauma -->
<input class="oval" type="text" name='attr_trauma' style='margin:4px 8px 0px 163px;' data-i18n-title="trauma" title='Scars left by terrifying or unnatual experiences'/>
<!-- Honour -->
<input class="oval" type="text" name='attr_honour' style='margin:4px 0px 0px 268px;' data-i18n-title="honour" title='Fame earned'/>
<!-- Shame -->
<input class="oval" type="text" name='attr_shame' style='margin:4px 0px 0px 74px;' data-i18n-title="shame" title='Infamy acquired'/>
<!-- List of currenntly known Crafts that accumulated Shame, as only new Crafts increase Shame - this mechanism is not currenlty implemented -->
<input type="hidden" name="attr_craftsOfShame" title="The list of known Crafts as only new Crafts contribute to Shame" value="">
<input type="text" style='width: 1px; text-align: center; height: 0px; margin:200px 0px 0px 120px; border: 0px solid; color: black; background-color: rgba(255,255,255,0.1);' name='attr_placeholder2'/>
</div>
</div>
</div><!-- end Tab 1 -->
<div class="sheet-page2" style='width: 840px; height: 1100px; margin: -10px 0 0 -10px; padding: 0px; border: 1px solid #a8a8a8;'><!--- Tab 2 start -->
<div style='margin-top: 136px; width: 800px; height: 100px; border: 0px solid pink;'>
<!-- Health, Damage, Injured, Healing Rate, Rest -->
<!-- Health -->
<input class="attribute" type='text' name='attr_health' style='margin:0px 0px 0px 39px;' data-i18n-title="health-description" title="Health: the ability to resist damage" />
<!-- Damage -->
<input type='text' name='attr_damage' style='background-color: rgba(255,255,255,0.1); width: 595px; height:44px; font-weight: bold; font-size: 2em; margin: -2px 0px 0px 0px; border: 0px solid purple; padding-left: 4px;' data-i18n-title="damage-description" title="Damage: accepts a number (e.g. 7) or a string of additions (e.g. 1+3+2)" />
<input type='text' name='attr_totaldamage' style='background-color: rgba(255,255,255,0.1); width: 80px; height:44px; font-weight: bold; font-size: 2em; text-align: center; margin: -2px 0px 0px -4px; border: 0px solid red;' data-i18n-title="damage-total" title="Total of damage inflicted" />
<!-- Injured -->
<input type='text' style='width: 52px; text-align: center; height: 20px; margin: -36px 0px 0px 185px; font-weight: bold; font-size: 1.5em; color: crimson; border: 0px solid red; background-color: rgba(255,255,255,0.1)' name='attr_injured' data-i18n-title="injured-flag" title="Set when damage equals or exceeds half health"/>
<!-- Healing Rate -->
<input type='text' style='width: 52px; text-align: center; height: 22px; margin: -36px 0px 0px 84px; font-weight: bold; font-size: 1.6em; border: 0px solid red; background-color: rgba(255,255,255,0.1)' name='attr_healingrate' data-i18n-title="healing-rate" title="Amount of damage reduced upon a rest" />
<!-- Rest Buttons: Rest and Long Rest -->
<span><button type="action" name="act_rest" style='display: inline-block; vertical-align: top; width: 30px; height: 20px; margin: -20px 0px 0px 4px; border: 1px solid black; background-color: rgba(255,217,222);' data-i18n-title="rest-description" title='Click to Rest for 8 hours: Healing and Spell recovery' data-i18n="rest">Rest</button></span>
<span><button type="action" name="act_longrest" style='display: inline-block; vertical-align: top; width: 84px; height: 20px; margin: -20px 0px 0px -4px; border: 1px solid black; background-color: rgba(255,217,222);' data-i18n-title="long-rest-description" title='Click to Long Rest for 24 hours: Double Healing and Spell recovery' data-i18n="long-rest">Long Rest</button></span>
<!-- Unconsious (Affliction/Woe) and Incapacitated -->
<input id="affliction_unconscious" type="checkbox" name="attr_affliction_unconscious" value="1"><label style='margin:-16px 0px 0px 22px; width:110px; border: 0px solid blue; background-color: rgba(233,233,233,1.0);' data-i18n-title="unconscious-description" title='Cannot use actions or move. Challenge rolls fail. Defence becomes 5' for="affliction_unconscious" data-i18n="unconscious">Unconscious</label>
<input id="affliction_incapacitated" type="checkbox" name="attr_affliction_incapacitated" value="1"><label style='margin:-16px 0px 0px -10px; width:110px; border: 0px solid blue; background-color: rgba(233,233,233,1.0);' data-i18n-title="incapacitated-description" title='Cannot use actions or move. Challenge rolls fail. Defence becomes 5' for="affliction_incapacitated" data-i18n="incapacitated">Incapacitated</label>
<button class="sheet-textButton" style='margin:-30px 0px 0px -8px; width: 10px; background-color: rgba(249,249,249,1.0); border: 1px solid black;' type="roll" name="roll_fate" data-i18n-title="fate-roll" title="Fate Roll: 1d6" value="&{template:fate} {{Name=@{character_name}}} {{Roll=[[1d6]]}} {{Minutes=[[1d6]]}} {{Rounds=[[1d3]]}}" name="roll_fate">?</button>
</div>
<div style='height: 140px; margin: 24px 0px 0px 8px; width: 796px; border: 0px solid blue;'>
<!-- Defence -->
<div style='display: inline-block; vertical-align: top; margin: 0px 0px 0px 30px; width: 81px; height: 140px; border: 0px dashed green;'>
<input type='hidden' name='attr_defence_base' /><input type='hidden' title='Defence Bonus for Armour' name='attr_defence_armour' value='0' /><input type='hidden' title='Defence Bonus for Shield' name='attr_defence_shield' value='0' /><input type='hidden' name='attr_defence_prior_affliction' title='Defence prior to affliction impairment' />
<input class="attribute" type='text' name='attr_defence' style='margin: -2px 0px 0px 2px;' data-i18n-title="sleight-defence" title='Sleight based defence + Armour + Shield' value='' />
<!-- <button class="sheet-textButton" style='margin: 0px 0px 0px 12px; background-color: rgba(249,249,249,1.0); border: 0px solid red;' type="roll" name="roll_defenceChallenge" data-i18n-title="Defence Challenge: 1d20 + (Defence-10)" title="Defence Challenge: 1d20 + (Defence-10)" value="&{template:challenge} {{Name=Challenge}} {{Actor=@{character_name}}} {{SkillName=Defence}} {{Roll=[[1d20 + @{defence} - 10]]}}" name="roll_defenceChallenge" data-i18n="Defence">Defence</button>-->
</div>
<!-- Weapons -->
<div style='display: inline-block; vertical-align: top; margin: 0px 0px 0px 0px; width: 676px; height: 140px; border: 0px dashed blue;'>
<div style='display: inline-block; vertical-align: top; width: 663px; margin:18px 0px 0px 14px; border: 0px solid green;'>
<fieldset class='repeating_weapons' style='width: 600px; margin:9px 0px 0px 0px;'>
<input type="text" style='width: 180px; text-align: center; height: 19px; padding: 0px 0px 0px 5px; border: 0px solid; color: black; background-color: rgba(255,255,255,0.1);' name='attr_weapon_type' value='' />
<button class='sheet-attack-button' style='width: 12px; height: 16px; margin:0px 0px 0px -4px;' data-i18n-title="melee-attack" title='Melee Attack' type="roll" value="&{template:combat} {{Actor=@{character_name}}} {{Name=@{weapon_type}}} {{Damage=[[@{damage}]]}} {{Roll=[[1d20+@{might_mod}+@{weals}-@{woes}-@{affliction_woes}-@{armour_woe}]]}} {{Type=Melee}}" name="roll_melee"></button>
<button class='sheet-parry-button' style='width: 12px; height: 16px; margin:0px 0px 0px -6px;' data-i18n-title="range-attack" title='Range Attack' type="roll" value="&{template:combat} {{Actor=@{character_name}}} {{Name=@{weapon_type}}} {{Damage=[[@{damage}]]}} {{Roll=[[1d20+@{sleight_mod}+@{weals}-@{woes}-@{affliction_woes}-@{armour_woe}]]}} {{Type=Range}}" name="roll_range"></button>
<input type='text' style='width: 80px; text-align: center; height: 20px; border: 0px solid; color: black; background-color: rgba(255,255,255,0.1); margin:0px 0px 0px 0px;' name='attr_damage' value=''/>
<input type='text' style='width: 78px; text-align: center; height: 20px; border: 0px solid; color: black; background-color: rgba(255,255,255,0.1); margin:0px 0px 0px 4px;' name='attr_hands' value=''/>
<input type='text' style='width: 270px; text-align: center; height: 20px; border: 0px solid; color: black; background-color: rgba(255,255,255,0.1); margin:0px 0px 0px 4px;' name='attr_properties' value=''/>
</fieldset>
</div>
</div>
</div>
<!-- Notes:
Spellcraft: Galdar, Spacraft are Will Spells, Gand, Lyf, Runar, Seidt are Wits Spells
Gifts: Hamr(Shape), Hugr(Thought), Fylgja(Follower), Hamingja(Luck), Minni(Memory)
Spell uses have a set of tables
Gift uses between rest are Spirit + 1
-->
<!-- SPELLS | GIFTS -->
<div style='display: inline-block; vertical-align: top; margin: 31px 0px 0px 38px; width: 498px; height: 540px; border: 0px dashed red;'>
<fieldset class='repeating_spells' style='width: 600px; margin:8px 0px 0px 20px;border: 0px solid red;'>
<input type="text" style='width: 134px; text-align: center; height: 19px; border: 0px solid; color: black; background-color: rgba(255,255,255,0.1); margin:0px 0px 0px 0px;' name='attr_spellName' value='' />
<!--<button class='sheet-skill-button' style='width: 12px; height: 12px; margin:0px 0px 0px -4px;' data-i18n-title="spell-cast" title='Cast Spell' type="roll" value="&{template:combat} {{Actor=@{character_name}}} {{Name=@{spellName}}} {{Damage=[[0+@{spellDescription}]]}} {{Roll=[[1d20+@{wits_mod}+@{weals}-@{woes}-@{affliction_woes}-@{armour_woe}]]}} {{Type=Spell}}" name="cast_spell"></button>-->
<input type='text' style='width: 20px; text-align: center; height: 19px; border: 0px solid; color: black; background-color: rgba(255,255,255,0.1); margin:0px 0px 0px 0px;' data-i18n-title="spell-rank" title='Spell Rank' name='attr_spellRank' value=''/>
<input type='text' style='width: 80px; text-align: center; height: 19px; border: 0px solid; color: black; background-color: rgba(255,255,255,0.1); margin:0px 0px 0px 2px;' data-i18n-title="crafts-gifts" spellcheck="false" title='Spellcraft: Galdar, Spacraft are Will Spells, Gand, Lyf, Runar, Seidt are Wits Spells; &#013;Gifts: Hamr(Shape), Hugr(Thought), Fylgja(Follower), Hamingja(Luck), Minni(Memory)' name='attr_spellCraft' value=''/>
<!-- Spellcraft: Spells and/or Gifts -->
<!-- NOTE: CAN NOT put a selection element in a repeating section -->
<!--
<select name='attr_spellCraft' title="Spells or Gifts" style='width: 80px; text-align: center; height: 19px; margin:-2px 0px 0px 2px; padding:0px 0px 3px 0px; border: 0px solid blue; background-color: rgba(255,255,255,0.1)'>
<option type="text" style="color:Crimson" title="Will"> Galdar</option>
<option type="text" style="color:Crimson" title="Wits"> Gand</option>
<option type="text" style="color:Crimson" title="Wits"> Lyf</option>
<option type="text" style="color:Crimson" title="Wits"> Runar</option>
<option type="text" style="color:Crimson" title="Wits"> Seiðr</option>
<option type="text" style="color:Crimson" title="Will"> Spácraft</option>
<option type="text" style="color:Navy" title="Shape"> Hamr</option>
<option type="text" style="color:Navy" title="Thought"> Hugr</option>
<option type="text" style="color:Navy" title="Follower"> Fylgja</option>
<option type="text" style="color:Navy" title="Luck"> Hamingja</option>
<option type="text" style="color:Navy" title="Memory"> Minni</option>
</select>
-->
<input type='text' style='width: 80px; text-align: center; height: 19px; border: 0px solid; color: black; background-color: rgba(255,255,255,0.1); margin:0px 0px 0px 2px;' name='attr_spellTarget' value=''/>
<input type='text' style='width: 120px; text-align: center; height: 19px; border: 0px solid; color: black; background-color: rgba(255,255,255,0.1); margin:0px 0px 0px 2px;' name='attr_spellDescription' value=''/>
<input type='text' style='width: 16px; text-align: center; height: 19px; border: 0px solid; color: black; background-color: rgba(255,255,255,0.1); margin:0px 0px 0px 0px;' data-i18n-title="max-castings" title='Number of times spell can be cast before a rest' name='attr_spellCastings' value=''/>
<input type='text' style='width: 16px; text-align: center; height: 19px; border: 0px solid; color: black; background-color: rgba(255,255,255,0.1); margin:0px 0px 0px 0px;' data-i18n-title="castings" title='Number of times spell has been cast' name='attr_spellExpended' value=''/>
<input type='hidden' title="Ability used to cast a spell" name='attr_ability_name' value="wits" />
</fieldset>
</div>
<div style='display: inline-block; vertical-align: top; width: 242px; margin:13px 0px 0px 18px; border: 0px solid green;'>
<!-- Equipment -->
<div style='height: 320px;'>
<fieldset class='repeating_equipment' style='width: 240px; margin:0px 0px 0px 0px;border: 1px solid red;'>
<input type="text" style='width: 240px; text-align: center; height: 19px; border: 0px solid; color: black; background-color: rgba(255,255,255,0.1); margin:0px 0px 0px 0px;' name='attr_item' />
</fieldset>
</div>
<div style='height: 56px; background-color: rgba(233,233,233); border: 0px solid blue;'>
<!-- Armour and Shield -->
<label style='width: 230px; text-align: center; height: 18px; font-weight: bold; font-size: 1.2em; border: 0px solid red;' data-i18n="armour"> Armour </label>
<!-- Armour -->
<select name='attr_armour' data-i18n-title="armour" title="Armour" style='width: 136px; text-align: center; height: 26px; margin:-11px 0px 0px 0px'>
<option type="text" style="color:SkyBlue" data-i18n-title="cloth-protection" title="Protected by Pure Intentions" selected data-i18n="cloth-armour"> Clothing</option>
<option type="text" style="color:CornflowerBlue" data-i18n-title="leather-prerequisites" title="Requires Might 10, Sleight +2" data-i18n="leather-armour"> Leather</option>
<option type="text" style="color:CornflowerBlue" data-i18n-title="covert-prerequisites" title="Requires Might 10, Can Halve Bullet Damage" data-i18n="covert-vest-armour"> Covert Vest</option>
<option type="text" style="color:Blue" data-i18n-title="ballistic-prerequisites" title="Requires Might 12, Sleight +1" data-i18n="ballistic-armour"> Ballistic Vest</option>
<option type="text" style="color:Blue" data-i18n-title="mail-prerequisites" title="Requires Might 12, Defence 14" data-i18n="mail-armour"> Mail</option>
<option type="text" style="color:Navy" data-i18n-title="plate-prerequisites" title="Requires Might 14, Defence 16" data-i18n="plate-armour"> Plate</option>
<option type="text" style="color:Navy" data-i18n-title="combat-prerequisites" title="Requires Might 14, Defence 16" data-i18n="combat-armour"> Combat</option>
</select>
<!-- Shield -->
<select name='attr_shield' data-i18n-title="shield" title="Shield" style='width: 100px; text-align: center; height: 26px; margin:-11px 0px 0px 0px'>
<option type="text" style="color:SkyBlue" data-i18n-title="no-shield-protection" title="Protected by Pure Intentions" selected data-i18n="no-shield"> No Shield</option>
<option type="text" style="color:Blue" data-i18n-title="shield-protection" title="+2 Defence" data-i18n="shield"> Shield</option>
</select>
<input type='hidden' title='Honour Bonus for Armour & Clothing above 10Kr' name='attr_honour_armour' value='0' />
<input type='hidden' title='Armour Speed Penalty if insufficient Might' name='attr_speed_armour' value='0' />
<input type='hidden' title='Armour Might & Sleight Woe if insufficient Might' name='attr_armour_woe' value='0' />
</div>
<!-- Valuables & Wealth -->
<input type="text" style='width: 178px; text-align: center; height: 19px; border: 0px solid; color: brown; background-color: rgba(255,255,255,0.1); margin:25px 0px 0px 0px; font-size: 0.8em;' name='attr_valuables1' />
<input type="text" style='width: 36px; text-align: center; height: 19px; border: 0px solid; color: red; background-color: rgba(255,255,255,0.1); margin:25px 0px 0px 0px;' name='attr_crowns' />
<input type="text" style='width: 178px; text-align: center; height: 19px; border: 0px solid; color: brown; background-color: rgba(255,255,255,0.1); margin: 0px 0px 0px 0px; font-size: 0.8em;' name='attr_valuables2' />
<input type="text" style='width: 36px; text-align: center; height: 19px; border: 0px solid; color: red; background-color: rgba(255,255,255,0.1); margin: 0px 0px 0px 0px;' name='attr_dollars' />
<input type="text" style='width: 178px; text-align: center; height: 19px; border: 0px solid; color: brown; background-color: rgba(255,255,255,0.1); margin: 0px 0px 0px 0px; font-size: 0.8em;' name='attr_valuables3' />
<input type="text" style='width: 36px; text-align: center; height: 19px; border: 0px solid; color: red; background-color: rgba(255,255,255,0.1); margin: 0px 0px 0px 0px;' name='attr_pennies' />
<!-- Lifestyle -->
<span><button type="action" name="act_lifestyle" style='width: 38px; height: 13px; border: 0px solid green; background-color: rgba(255,255,255,0.1); margin: 22px 0px 0px 2px;' data-i18n-title="lifestyle" title='Click to populate Lifestyle' ></button>
<input type="text" spellcheck="false" style='width: 184px; text-align: center; height: 21px; border: 0px solid brown; color: black; background-color: rgba(255,255,255,0.1); margin: -11px 0px 0px 0px; font-size: 1.4em;' name='attr_lifestyle' /></span>
<input type="text" spellcheck="false" style='width: 154px; text-align: center; height: 19px; border: 0px solid; color: red; background-color: rgba(255,255,255,0.1); margin: -6px 0px 0px 58px;' data-i18n-title="lifestyle-details" title='Lifestyle Expenses (per adventure): Thrall 1p; Freedman 1$; Karl 5$; Thegn 1Kr; Hersir 5 Kr; Jarl 10Kr' name='attr_expenses' />
<input type="text" style='width: 24px; text-align: center; height: 19px; border: 0px solid; color: red; background-color: rgba(255,255,255,0.1); margin: -6px 0px 0px 1px;' name='attr_expenses_end' />
</div>
<!-- Advancement -->
<div style='display: inline-block; vertical-align: top; width: 310px; margin: 24px 0px 0px 64px; background-color: rgba(233,233,233,1.0); border: 0px dashed green'>
<div style='width: 326px; height: 22px; margin: 0px 0px 0px 0px; border: 0px solid purple'>
<label data-i18n="1">1</label><input id="level1" type="checkbox" name="attr_advance1"><label style='margin: 0px 0px 0px -4px;' data-i18n-title="first-level" title='First Level' for="level1" data-i18n="novice">Novice</label>
<label data-i18n="2">2</label><input id="level2" type="checkbox" name="attr_advance2"><label style='margin: 0px 0px 0px -4px;' data-i18n-title="second-level" title='Second Level' for="level2" data-i18n="novice">Novice</label>
<label data-i18n="3">3</label><input id="level3" type="checkbox" name="attr_advance3"><label style='margin: 0px 0px 0px -4px;' data-i18n-title="third-level" title='Third Level' for="level3" data-i18n="expert">Expert</label>
<label data-i18n="4">4</label><input id="level4" type="checkbox" name="attr_advance4"><label style='margin: 0px 0px 0px -4px;' data-i18n-title="fourth-level" title='Fourth Level' for="level4" data-i18n="origin">Origin</label>
</div>
<div style='width: 306px; height: 22px; margin: 0px 0px 0px 0px; border: 0px solid red'>
<label data-i18n="5">5</label><input id="level5" type="checkbox" name="attr_advance5"><label style='margin: 0px 0px 0px -4px;' data-i18n-title="fifth-level" title='Fifth Level' for="level5" data-i18n="novice">Novice</label>
<label data-i18n="6">6</label><input id="level6" type="checkbox" name="attr_advance6"><label style='margin: 0px 0px 0px -4px;' data-i18n-title="sixth-level" title='Sixth Level' for="level6" data-i18n="expert">Expert</label>
<label data-i18n="7">7</label><input id="level7" type="checkbox" name="attr_advance7"><label style='margin: 0px 0px 0px -4px;' data-i18n-title="seventh-level" title='Seventh Level' for="level7" data-i18n="mythic">Mythic</label>
</div>
<div style='width: 306px; height: 22px; margin: 0px 0px 0px 0px; border: 0px solid orange'>
<label data-i18n="8">8</label> <input id="level8" type="checkbox" name="attr_advance8"> <label style='margin: 0px 0px 0px -4px;' data-i18n-title="eighth-level" title='Eighth Level' for="level8" data-i18n="novice">Novice</label>
<label data-i18n="9">9</label> <input id="level9" type="checkbox" name="attr_advance9"> <label style='margin: 0px 0px 0px -4px;' data-i18n-title="ninth-level" title='Ninth Level' for="level9" data-i18n="expert">Expert</label>
<label data-i18n="10">10</label><input id="level10" type="checkbox" name="attr_advance10"><label style='margin: 0px 0px 0px -4px;' data-i18n-title="tenth-level" title='Tenth Level' for="level10" data-i18n="mythic">Mythic</label>
</div>
<div style='width: 306px; height: 6px; margin: 0px 0px 0px 0px; border: 0px dashed orange'></div> <!-- this is to cover up background writing -->
</div>
<!-- Spirit & Power -->
<div style='display: inline-block; vertical-align: top; width: 200px; margin: 15px 0px 0px 210px; border: 0px dashed purple; padding: none;'>
<input class="small-circle" type='text' name='attr_power' style='margin: 0px 0px 0px 9px' data-i18n-title="power" title='Power enables Spellcraft' />
<input class="small-circle" type='text' name='attr_spirit' style='margin: 0px 0px 0px 36px' data-i18n-title="spirit" title='Spirit empowers Gifts' />
</div>
</div> <!-- end Tab 2 -->
<!-- Roll Templates -->
<rolltemplate class="sheet-rolltemplate-combat">
<div class="container">
{{#Actor}}
<div><span class="tcat">*{{Actor}}*</span></div>
{{/Actor}}
<div><h1>{{Name}}</h1></div>
<div class="arrow-container"><div class="arrow-right"></div></div>
<div class="rowcolor"><span>{{Type}}: </span>{{Roll}}</div>
<div class="rowcolor"><span>Damage: </span>{{Damage}}</div>
{{#Range}}
<div class="rowcolor"><span class="tcat">Range: </span>{{Range}}</div>
{{/Range}}
{{#ROF}}
<div class="rowcolor"><span class="tcat">RoF: </span>{{ROF}}<span class="tcat"> Mag: </span>{{Mag}}</div>
{{/ROF}}
</div>
</rolltemplate>
<rolltemplate class="sheet-rolltemplate-melee">
<div class="container">
<div><h1>{{name}}</h1></div>
<div class="arrow-container"><div class="arrow-right"></div></div>
{{#Check}}
<div class="rowcolor"><span class="tcat">Check: </span>{{computed::Roll}}</div>
{{/Check}}
{{#DL}}
<div class="rowcolor"><span class="tcat">DL: </span>{{DL}}</div>
{{#rollLess() computed::Roll DL }}
<div class="rowcolor"><span class="tcat">Result: </span>Failure</div>
{{/rollLess() computed::Roll DL }}
{{#^rollLess() computed::Roll DL }}
<div class="rowcolor"><span class="tcat">Result: </span>Success!</div>
{{/^rollLess() computed::Roll DL }}
{{/DL}}
{{#Destiny}}
<div class="rowcolor"><span class="tcat">Destiny: </span>{{Destiny}}</div>
{{/Destiny}}
{{#Luck}}
<div class="rowcolor"><span class="tcat">Luck: </span>{{Luck}}</div>
{{/Luck}}
{{#Damage}}
<div class="rowcolor"><span class="tcat">Damage: </span>{{Damage}}</div>
{{/Damage}}
</div>
</rolltemplate>
<!-- Challenge Target is always 10 -->
<rolltemplate class="sheet-rolltemplate-challenge">
<div class="container">
{{#Actor}}
<div><span class="tcat"></span>*{{Actor}}*</td></tr>
{{/Actor}}
<div><h1>{{Name}}
{{#SkillName}}
*for* {{SkillName}}
{{/SkillName}}
</h1></div>
<div class="arrow-container"><div class="arrow-right"></div></div>
<div class="rowcolor"><span>Check: </span>{{Roll}}
{{#rollGreater() Roll 9}}
<span data-i18n="challenge-success">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Success&nbsp;&nbsp;</span></div>
{{/rollGreater() Roll 9}}
{{#^rollGreater() Roll 9}}
<span data-i18n="challenge-failure">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Failure&nbsp;&nbsp;</span></div>
{{/^rollGreater() Roll 9}}
</div>
</rolltemplate>
<rolltemplate class="sheet-rolltemplate-fate">
<div class="container">
<div><h1>The FATE of *{{Name}}*</h1></div>
<div class="arrow-container"><div class="arrow-right"></div></div>
<div class="rowcolor"><span class="tcat">Outcome: </span>{{Roll}}</div>
{{#rollTotal() Roll 1}}
<div><span nodata-i18n="Outcome">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Immediate death</span></div>
{{/rollTotal() Roll 1}}
{{#rollTotal() Roll 2}}
<div><span nodata-i18n="Outcome">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Falls prone and unconscious. Death within {{Rounds}} round(s) unless healed</span></div>
{{/rollTotal() Roll 2}}
{{#rollTotal() Roll 3}}
<div><span nodata-i18n="Outcome">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Becomes unconscious. Death within {{Minutes}} minute(s) unless healed</span></div>
{{/rollTotal() Roll 3}}
{{#rollTotal() Roll 4}}
<div><span nodata-i18n="Outcome">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Becomes unconscious for {{Minutes}} minute(s) then heals 1 damage</span></div>
{{/rollTotal() Roll 4}}
{{#rollTotal() Roll 5}}
<div><span nodata-i18n="Outcome">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Becomes unconscious for {{Rounds}} round(s) then heals 1 damage</span></div>
{{/rollTotal() Roll 5}}
{{#rollTotal() Roll 6}}
<div><span nodata-i18n="Outcome">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Becomes unconscious for 1 round then heals 1 damage</span></div>
{{/rollTotal() Roll 6}}
</div>
</rolltemplate>
<!-- SHEET WORKERS -->
<script type="text/worker">
/* Functions to add entries to Repeating Sections */
function addWeapon(section,wpnType,hands,damage,properties){
var id=getId();
var setObj = {};
setObj[section+"_"+id+'_weapon_type']=wpnType;
setObj[section+"_"+id+'_hands']=hands;
setObj[section+"_"+id+'_damage']=damage;
setObj[section+"_"+id+'_properties']=properties;
setAttrs(setObj);
}
function addTalents(section, talent, description){
var id=getId();
var setObj = {};
setObj[section+"_"+id+'_talent'] = talent;
setObj[section+"_"+id+'_description'] = description;
setAttrs(setObj);
}
function addEquipment(section, items){
var id=getId();
var setObj = {};
setObj[section+"_"+id+'_item'] = items;
setAttrs(setObj);
}
function addSpellOrGift(section, spell, rank, craft, target, description, castings, ability){
var id=getId();
var setObj = {};
setObj[section+"_"+id+'_spellName'] = spell;
setObj[section+"_"+id+'_spellRank'] = rank;
setObj[section+"_"+id+'_spellCraft'] = craft;
setObj[section+"_"+id+'_spellTarget'] = target;
setObj[section+"_"+id+'_spellDescription'] = description;
setObj[section+"_"+id+'_spellCastings'] = castings;
setObj[section+"_"+id+'_spellExpended'] = '0';
setObj[section+"_"+id+'_ability_name'] = ability;
console.log(" addSpellOrGift: spell " + spell + " castings " + castings);
setAttrs(setObj);
}
function getId(){
const sattrs = {};
const createdIDs = [];
var retId = 0;
if (createdIDs.length==0){
retId = generateRowID();
createdIDs.push(retId);
}
var checkit = true;
while (checkit==true) {
let newID = generateRowID();
console.log("Newid "+newID);
if (!createdIDs.includes(newID)) {
newrowid = newID;
console.log("newrowid "+newID);
createdIDs.push(newrowid);
checkit=false;
}
}
retId = newrowid;
return retId;
}
function clearSection(section){
getSectionIDs(section, function(idarray) {
for(var i=0; i < idarray.length; i++) {
removeRepeatingRow(section + "_" + idarray[i]);
}
});
}
function calculate(damage) {
// Adapted from https://www.geeksforgeeks.org/calculate-sum-of-all-numbers-present-in-a-string/
// A temporary string
let temp = "0";
console.log(" damage " + damage + " len " + damage.length);
// holds sum of all numbers present in the string
let sum = 0;
// read each character in input string
for (let i = 0; i < damage.length; i++) {
let ch = damage.charAt(i);
//console.log(" ch " + ch);
// if current character is a digit
if (ch >= '0' && ch <= '9' )
temp += ch;
// if current character is an alphabet
else {
// increment sum by number found earlier
// (if any)
sum += parseInt(temp);
// reset temporary string to empty
temp = "0";
}
}
return sum + parseInt(temp);
}
function lessen(damage, healed) {
// A temporary string
let temp = "0";
console.log(" lessen passed " + damage + " healed " + healed);
// holds sum of processed numbers present in the string
let sum = 0;
// read each character in input string
for (let i = 0; i < damage.length; i++) {
let ch = damage.charAt(i);
//console.log(" ch " + ch);
// if current character is a digit
if (ch >= '0' && ch <= '9' )
temp += ch;
// if current character is an alphabet
else {
// increment sum by number found earlier
// (if any)
console.log(" lessen: before sum " + sum + " temp " + temp);
sum += parseInt(temp);
console.log(" lessen: after sum " + sum + " temp " + temp);
if (sum > healed) {
let remainder = sum - healed;
console.log(" lessen: sum = " + sum + " healed " + healed + " should return " + String(remainder) + damage.substring(i) )
return String(remainder) + damage.substring(i);
} else if (sum == healed) {
console.log(" lessen: sum = " + sum + " healed " + healed + " match so should return " + damage.substring(i+1) )
return damage.substring(i+1);
}
// reset temporary string to empty
temp = "0";
}
}
return sum + parseInt(temp) - healed;
}
on("change:damage", function() {
console.log("****** Damage Change *****");
getAttrs(["damage", "totaldamage", "health", "injured", "incapacitated"], function(values) {
let Damage = values.damage;
let TotalDamage = values.totaldamage;
let Health = parseInt(values.health) || 0;
console.log(" Damage " + Damage + " Total (current) " + TotalDamage );
let Sum = calculate(Damage);
console.log("Sum = " + Sum);
let InjuredThreshold = Math.floor(Health/2);
let injuredStatus = "";
if (Sum >= InjuredThreshold) {
console.log(" Damage " + Damage + " Sum " + Sum + " exceeds or matches InjuredThreshold " + InjuredThreshold );
injuredStatus = "X";
}
let incapacitatedStatus = 0;
if (Sum >= Health) {
console.log(" Damage " + Damage + " exceeds or matches Health " + Health + " triggering Incapacitated ");
incapacitatedStatus = 1;
}
setAttrs({
totaldamage: String(Sum), injured: injuredStatus, affliction_incapacitated: incapacitatedStatus
});
});
});
// Rest - Heal injuries and reset expended castings
on("clicked:rest", function() {
console.log(" Clicked Rest");
getAttrs(["totaldamage", "damage", "injured", "healingrate", "health"], function(values) {
let TotalDamage = parseInt(values.totaldamage) || 0;
let Damage = values.damage; // This is a string of arithemtic operands and addition operations. e.g. "1+4+2" or "8"
let Health = parseInt(values.health) || 0;
let Injured = values.injured;
let HealingRate = Number(values.healingrate);
let InjuredThreshold = Math.floor(Health/2);
let Sum = calculate(Damage);
if (TotalDamage <= HealingRate) {
TotalDamage = 0;
Damage = "";
Injured = "";
} else {
TotalDamage -= HealingRate;
if (TotalDamage >= InjuredThreshold) {
Injured = "";
} else {
Injured = "X";
}
Damage = lessen(Damage, values.healingrate);
console.log(" lessen returns " + Damage);
}
console.log(" Injured: " + Injured + " HealingRate " + HealingRate + " Damage " + Damage);
setAttrs({ injured: Injured, damage: String(Damage), totaldamage: TotalDamage }); // Note: totaldamage does NOT need to be set, as altering damage triggers totaldamage recalculation, but race conditions apply
});
// Reset Expended Castings in repeating spells and gifts
getSectionIDs(`repeating_spells`, function(idArray) {
for(let i = 0; i < idArray.length; i++) {
setAttrs({ ["repeating_spells_" + idArray[i] + "_spellExpended"] : "0" });
};
});
});
// Long Rest - Heal injuries and reset expended castings - should merge with REST above
on("clicked:longrest", function() {
console.log(" Clicked Long Rest");
getAttrs(["totaldamage", "damage", "injured", "healingrate", "health"], function(values) {
let TotalDamage = parseInt(values.totaldamage) || 0;
let Damage = values.damage; // This is a string of arithemtic operands and addition operations. e.g. "1+4+2" or "8"
let Health = parseInt(values.health) || 0;
let Injured = values.injured;
let HealingRate = Number(values.healingrate) * 2 ;
let InjuredThreshold = Math.floor(Health/2);
let Sum = calculate(Damage);
if (TotalDamage <= HealingRate) {
TotalDamage = 0;
Damage = "";
Injured = "";
} else {
TotalDamage -= HealingRate;
if (TotalDamage >= InjuredThreshold) {
Injured = "";
} else {
Injured = "X";
}
Damage = lessen(Damage, String(HealingRate));
console.log(" lessen returns " + Damage);
}
console.log(" Injured: " + Injured + " HealingRate " + HealingRate + " Damage " + Damage);
setAttrs({ injured: Injured, damage: String(Damage), totaldamage: TotalDamage }); // Note: totaldamage does NOT need to be set, as altering damage triggers totaldamage recalculation, but race conditions apply
});
// Reset Expended Castings in repeating spells and gifts
getSectionIDs(`repeating_spells`, function(idArray) {
for(let i = 0; i < idArray.length; i++) {
setAttrs({ ["repeating_spells_" + idArray[i] + "_spellExpended"] : "0" });
};
});
});
// Cast - Cast a Spell
on("clicked:cast", function() {
console.log(" Clicked Cast");
getAttrs(["spellName", "spellRank", "spellCraft", "spellTarget", "spellDescription", "spellCastings", "spellExpended","ability_name", "might_mod", "weals", "woes", "armour_woe", "affliction_woes"], function(values) {
let Name = values.spellName.toLowercase();
let Rank = values.spellRank.toLowercase();
let Craft = values.spellCraft.toLowercase();
let Target = values.spellTarget.toLowercase();
let Description = values.spellDescription.toLowercase();
let Castings = parseInt(values.spellCastings) || 0;
let Expended = parseInt(values.spellExpended) || 0;
let Ability = values.ability_name.toLowercase();
let MightMod = parseInt(values.might_mod) || 0;
let Weal = parseInt(values.weals) || 0;
let Woe = parseInt(values.woes) || 0;
let ArmourWoe = parseInt(values.armour_woe) || 0;
let AfflictWoe = parseInt(values.affliction_woes) || 0;
let Result = "";
console.log(" Name: " + Name + " Rank: " + Rank + " Craft: " + Craft + " Target: " + Target + " Castings: " + Castings + " Expended: " + Expended);
console.log(" MightMod: " + MightMod + " Weal: " + Weal + " Woe: " + Woe + " ArmourWoe: " + ArmourWoe + " Castings: " + Castings + " AfflictWoe: " + AfflictWoe);
console.log(" Desc: " + Description);
if (Castings < Expended) { // Can cast this spell - have not reached number of castings allowed
Expended += 1;
}
else {
console.log(" No castings left:" + Castings + " Expended " + Expended);
Result = "No castings left, all expended";
}
let RollBase = '&{template:challenge} {{Name=Cast}} {{Actor=@{character_name}}} {{SkillName=Might}} {{Roll=[[1d20+@{might_mod}+@{weals}-@{woes}-@{armour_woe} -@{affliction_woes} ]]}}';
setAttrs({ spellExpended: Expended, });
});
// Reset Expended Castings in repeating spells and gifts
getSectionIDs(`repeating_spells`, function(idArray) {
for(let i = 0; i < idArray.length; i++) {
setAttrs({ ["repeating_spells_" + idArray[i] + "_spellExpended"] : "0" });
};
});
});
on("change:might change:sleight change:will change:wits change:awareness", function() {
console.log("****** Attributes Change *****");
getAttrs(["might", "sleight", "will", "wits", "awareness", "origin", "defence_armour", "defence_shield"], function(values) {
// Note: HERE is where the restriction of Attribute range (1,20) should be enforced
let Origin = values.origin;
let Might = parseInt(values.might) || 0;
if (Might < 0) { Might = 0 };
if (Might > 20) { Might = 20 };
let MightMod = Might - 10;
let Sleight = parseInt(values.sleight) || 0;
if (Sleight < 0) { Sleight = 0 };
if (Sleight > 20) { Sleight = 20 };
let SleightMod = Sleight - 10;
let Will = parseInt(values.will) || 0;
if (Will < 0) { Will = 0 };
if (Will > 20) { Will = 20 };
let WillMod = Will - 10;
let Wits = parseInt(values.wits) || 0;
if (Wits < 0) { Wits = 0 };
if (Wits > 20) { Wits = 20 };
let WitsMod = Wits - 10;
let Awareness = Wits;
let DefenceArmour = parseInt(values.defence_armour) || 0;
let DefenceShield = parseInt(values.defence_shield) || 0;
if (Origin == "Ivaldi" || Origin == "Jarnvidjur" || Origin == "Wanes") {
Awareness += 1;
}
let AwarenessMod = Awareness - 10;
let Defence = Sleight;
let DefenceBase;
if (Origin == "Dvergar" && Defence < 13) {
Defence = 13;
}
DefenceBase = Defence;
Defence = DefenceBase + DefenceArmour + DefenceShield;
let Health = Might;
if (Origin == "Jotnar") {
Health = Might + 3;
}
let HealingRate = Math.floor(Might/4);
if (Origin == "Alfar") {
HealingRate = Math.floor(Might/3);
}
console.log(" Might: " + Might + " Sleight: " + Sleight + " Will: " + Will + " Wits: " + Wits + " Awareness: " + Awareness);
console.log(" Mods - Might: " + MightMod + " Sleight: " + SleightMod + " Will: " + WillMod + " Wits: " + WitsMod + " Awareness: " + AwarenessMod);
console.log(" Defence: " + Defence + " from: DefenceBase: " + DefenceBase + " + DefenceArmour: " + DefenceArmour + " + DefenceShield: " + DefenceShield);
<!-- if origin selection is not allowed -->
<!--setAttrs({ might_mod: MightMod, sleight_mod: SleightMod, will_mod: WillMod, wits_mod: WitsMod, awareness_mod: AwarenessMod,-->
<!-- awareness: Awareness, defence: Sleight, health: Might, healingrate: HealingRate, -->
<!-- size: 1, speed: 10, power: 0, spirit: 0, damage: 0, trauma: 0, shame: 0, honour: 0}); -->
setAttrs({ might: Might, sleight: Sleight, will: Will, wits: Wits,
might_mod: MightMod, sleight_mod: SleightMod, will_mod: WillMod, wits_mod: WitsMod, awareness_mod: AwarenessMod,
awareness: Awareness, health: Health, healingrate: HealingRate,
defence: Defence, defence_base: DefenceBase
});
});
});
<!-- Mann: Might:10, Sleight:10 Wits:10 Will:10 +1pts Health = Might , Awareness = Wits, Defence = Sleight Healing = Health/4 round down Speed=10 Size = 1 Power=0 Spirit=0 Damage=0 Trauma=0 Honour=0 -->
<!-- Gift: Udal Right, 'Choose one Attribute to increase by one' Languages: Noor, one other regional language Professions: one profession - select from any category. -->
<!-- Alfar: Might: 9, Sleight:10 Wits:10 Will: 9 2+1pts Health = Might , Awareness = Wits, Defence = Sleight Healing = Health/3 round down Speed=10 Size = 1 Power=0 Spirit=0 Damage=0 Trauma=0 Honour=0 -->
<!-- Vision: Treesight Gift: Dream Sight, 'Choose two Attributes to increase by one' Yggdrasils Gift, Guardian Tree,Vulnerable to Fire Languages:Noor and Álfsöngr You may select three professions rather than the usual two, but all of them must be rolled randomly -->
<!-- Dvergar: Might: 8, Sleight: 8 Wits:11 Will: 9 Health = Might , Awareness = Wits, Defence = 13 Healing = Health/4 round down Speed=8 Size = 1 Power=0 Spirit=0 Damage=0 Trauma=0 Honour=0 -->
<!-- Vision: Thermal Sensors Gift: Faultless Recall, Immune, Artificial Body Languages: Noor and Doppel-Dverg Professions: no criminal professions -->
<!-- Jotnar: Might:12, Sleight:10 Wits: 9 Will: 9 Health = Might+3, Awareness = Wits, Defence = Sleight Healing = Health/4 round down Speed=10 Size = 1 Power=0 Spirit=0 Damage=0 Trauma=0 Honour=0 -->
<!-- Vision: Night Vision Gift: Giant's Mood Languages: Jötnar Brogue Professions: None from the scientific or trade list -->
<!-- Dokkalfar: Might: 8, Sleight: 8 Wits:11 Will:11 Health = Might , Awareness = Wits, Defence = Sleight Healing = Health/4 round down Speed=10 Size = 1 Power=0 Spirit=0 Damage=0 Trauma=1d3 Shame=1d3 -->
<!-- Vision: Thermal Sensors Gift: Black Sight, Immune, Artificial Body, Quirk of Fate, Self Fortification Languages: True Norse and Noor Professions: One of your two chosen professions must be a trade -->
<!-- Ivaldi: Might: 9, Sleight: 9 Wits:12 Will:10 Health = Might , Awareness = Wits+1, Defence = Sleight Healing = Health/4 round down Speed=10 Size = 1 Power=0 Spirit=0 Damage=0 Trauma=1d3 Shame=1d3 -->
<!-- Gift: Soul Sight, Neural Interface, Augmented Reality Languages: Noor and Grikk Professions: You may only choose scientific professions -->
<!-- Jarnvidjur: Might: 9, Sleight:11 Wits: 8 Will: 8 Health = Might , Awareness = Wits+1, Defence = Sleight Healing = Health/4 round down Speed=12 Size = 1 Power=0 Spirit=0 Damage=0 Trauma=1d3 Shame=1d3 -->
<!-- Vision: Night Vision Gift: Quicksilver, Pack Attack, Vicious Bite Languages: Jötnar Brogue Professions: You are precluded from choosing trade professions -->
<!-- Jofurr: Might:11, Sleight:10 Wits: 9 Will:10 Health = Might , Awareness = Wits, Defence = Sleight Healing = Health/4 round down Speed=10 Size = 1 Power=0 Spirit=0 Damage=0 Trauma=1d3 Honour=1d3 -->
<!-- Gift: Steadfast Languages: Noor Professions: No profession other than that suggested by your background -->
<!-- Orcneas: Might:12, Sleight: 9 Wits: 9 Will:10 Health = Might , Awareness = Wits, Defence = Sleight Healing = Health/4 round down Speed=10 Size = 1 Power=0 Spirit=0 Damage=0 Trauma=0 Shame=1d3 -->
<!-- Vision: Night Vision Gift: Shape Strong, Immune, Devourers Languages: Jötnar Brogue Professions: You may only choose criminal professions. -->
<!-- Wanes: Might:10, Sleight:11 Wits: 9 Will:10 Health = Might , Awareness = Wits+1, Defence = Sleight Healing = Health/4 round down Speed=10 Size = 1 Power=0 Spirit=0 Damage=0 Trauma=1d3 Shame=1d3 -->
<!-- Gift: Bird Charms, Inured to Cold, Dream Weaving Languages: Noor Professions: You may only choose wilderness professions -->
// Finderski and GiGs tabs example - https://app.roll20.net/forum/post/7879593/tabs-on-your-custom-character-sheet/?pageforid=7885202#post-7885202
const buttonlist = ["first","fifth"];
buttonlist.forEach(button => {
on(`clicked:${button}`, function() {
setAttrs({
sheetTab: button
});
});
});
// Lifestyle
on("clicked:lifestyle", function() {
console.log(" Clicked Lifestyle\n");
getAttrs(["lifestyle", "origin"], function(values) {
if (undefined == values.lifestyle) {
console.log(" No lifestyle\n");
}
else {
let Origin = values.origin ;
let die1 = Math.floor((Math.random() * 6) + 1);
let die2 = Math.floor((Math.random() * 6) + 1);
let die3 = Math.floor((Math.random() * 6) + 1);
let total = die1 + die2 + die3;
let Expenses = "1p";
console.log(" Three die are: " + die1 + " " + die2 + " " + die3 + " total: " + total);
if ( Origin == "Dvergar" ) {
total -= 2;
} else if ( Origin == "Jofurr" ) {
total += 2;
}
let Job = "None";
let coin1 = Math.floor((Math.random() * 6) + 1);
let coin2 = Math.floor((Math.random() * 6) + 1);
let Pennies = "";
let Dollars = "";
let Crowns = "";
let Weapons1 = "";
let Weapons2 = "";
let Valuables1 = "";
let Valuables2 = "";
let Valuables3 = "";
let Armour = "Clothing";
let Shield = "No Shield";
clearSection("repeating_weapons");
clearSection("repeating_equipment");
switch (total) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
Job = "Thrall";
Weapons1 = "Club";
addWeapon("repeating_weapons", Weapons1, "One", "1d2", "Swift"); // These are placeholders as Club is not defined in corebook
addEquipment("repeating_equipment", "Rags, and Slave collar");
break;
case 7:
case 8:
case 9:
case 10:
Job = "Freedman";
Pennies = String(coin1+coin2);
Weapons1 = "Light Weapon";
addWeapon("repeating_weapons", Weapons1, "Off", "1d3","Swift, thrown (short)");
addEquipment("repeating_equipment", "Patched Clothing, Backpack");
addEquipment("repeating_equipment", "Bread, Waterskin, Flashlight");
Expenses = "1$";
break;
case 11:
case 12:
case 13:
case 14:
Job = "Karl";
Dollars = String(coin1);
Weapons1 = "Light Weapon";
addWeapon("repeating_weapons", Weapons1, "Off", "1d3","Swift, thrown (short)");
Weapons2 = "Bow + 20 Arrows";
addWeapon("repeating_weapons", Weapons2, "Two", "1d6","Cap 1, range (intermediate)");
addEquipment("repeating_equipment", "Fashionable Clothing");
addEquipment("repeating_equipment", "Bail-out Bag");
Shield = "Shield"; /* NOTE: Shield is a WEAPON in the corebook*/
Expenses = "5$";
break;
case 15:
case 16:
Job = "Thegn";
Dollars = String(coin1+coin2);
Weapons1 = "Light Weapon";
addWeapon("repeating_weapons", Weapons1, "Off", "1d3","Swift, thrown (short)");
Weapons2 = "Revolver + 6 Rounds";
addWeapon("repeating_weapons", Weapons2, "Off", "1d6+3","Cap 6, range (medium)");
addEquipment("repeating_equipment", "Fine Clothing");
addEquipment("repeating_equipment", "Bail-out Bag, Toolkit or Med Kit");
Expenses = "1Kr";
break;
case 17:
Job = "Hersir";
Crowns = String(coin1);
Weapons1 = "Hand Weapon";
addWeapon("repeating_weapons", Weapons1, "One", "1d6","");
Weapons2 = "Pistol + 13 Rounds";
addWeapon("repeating_weapons", Weapons2, "Off", "1d6+3","Cap 13, range (intermediate)");
Valuables1 = "Expensive Clothing";
addEquipment("repeating_equipment", "Expensive Clothing");
addEquipment("repeating_equipment", "Bail-out Bag, Med Kit");
Armour = "Covert Vest";
Valuables2 = Armour;
Expenses = "5Kr";
break;
case 18:
case 19:
case 20:
Job = "Jarl";
Crowns = String(coin1+coin2);
Weapons1 = "Light Weapon";
addWeapon("repeating_weapons", Weapons1, "Off", "1d3","Swift, thrown (short)");
Weapons2 = "Shotgun + 10 Rounds";
addWeapon("repeating_weapons", Weapons2, "Two", "2d6","Cap 2, range (intermediate)");
Valuables1 = "Custom Clothing";
addEquipment("repeating_equipment", "Custom Clothing");
addEquipment("repeating_equipment", "Bail-out Bag, Med Kit");
Armour = "Covert Vest";
Valuables2 = Armour;
Expenses = "10Kr";
break;
};
console.log(" Total: " + total + " Job: " + Job);
console.log(" Pennies: " + Pennies + " Dollars: " + Dollars + " Crowns: " + Crowns);
console.log(" Armour: " + Armour + " Shield: " + Shield);
setAttrs({ lifestyle: Job, crowns: Crowns, dollars: Dollars, pennies: Pennies, valuables1: Valuables1, valuables2: Valuables2, valuables3: Valuables3, armour: Armour, shield: Shield, expenses: Expenses });
}
});
});
on("change:origin", function() {
console.log(" Clicked Origin\n");
getAttrs(["origin"], function(values) {
let Origin = values.origin;
let Might = 10;
let Sleight = 10;
let Wits = 10;
let Will = 10;
let Excess = 1;
let Health = Might;
let Awareness = Wits;
let Defence = Sleight;
let Healing = Math.floor(Health/4);
let Speed = 10;
let Size = 1;
let Power = 0;
let Spirit = 0;
let Trauma = 0;
let Honour = 0;
let Shame = 0;
let Vision = "";
let Gift = "";
let Languages = "Noor & one other regional language";
let Professions = "Choose two professions";
let Advice = "";
let listOfShame = "";
// Before adding Talents, remove existing as Origin is done at character creation
clearSection("repeating_talents");
clearSection("repeating_spells");
switch (Origin) {
case "Mann":
//addTalents("repeating_talents", "Udal Right", "Ancestral spirit offers guidance [Wits challenge]");
addSpellOrGift("repeating_spells", "Udal Right", "0", " Fylgja", "Self", "Ancestral spirit offers guidance [Wits challenge]", "1", "wits");
Advice = "Choose one attribute to increase by 1";
listOfShame="Fylgja";
break;
case "Alfar":
Might = 9; Will = 9; Excess = 2; Health = Might;
Healing = Math.floor(Health/3);
Vision = "Treesight";
Languages = "Noor and Álfsöngr";
Professions = "You may select three randomly rolled professions";
//Spellcraft: Galdar, Spacraft are Will Spells, Gand, Lyf, Runar, Seidt are Wits Spells
//Gifts: Hamr(Shape), Hugr(Thought), Fylgja(Follower), Hamingja(Luck), Minni(Memory)
addSpellOrGift("repeating_spells", "Dream Sight", "0", " Fylgja", "Self", "Glimpses of possibilities [Nulls surprise, weal/woe re-roll]", "1", "none");
addTalents("repeating_talents", "Yggdrasils Gift", "If stabilizing rolls 20+, +healing rate added");
addTalents("repeating_talents", "Guardian Tree", "Acton or triggered action to protect creatue within reach");
addTalents("repeating_talents", "Vulnerable to Fire", "Double damage from fire, also Impaired for 1 round");
Advice = "Choose two attributes and increase each by 1";
listOfShame="Fylgja";
break;
case "Dvergar":
Might = 8; Sleight = 8; Wits = 11; Will = 9; Health = Might; Awareness = Wits; Defence = 13; Speed = 8; Excess = 0;
Healing = Math.floor(Health/4);
Vision = "Thermal Sensors";
Languages = "Noor and Doppel-Dverg";
Professions = "Choose two professions but no criminal professions";
addSpellOrGift("repeating_spells", "Faultless Recall", "0", " Minni", "Self", "Wits recall challenge becomes triggered action +1 weal", "1", "wits");
addTalents("repeating_talents", "Immune", "Immune damage from disease and poison; diseased, fatigued, poisoned");
addTalents("repeating_talents", "Artificial Body","You do not eat, drink, or breathe; ignore hunger, thirst, sleep deprivation");
listOfShame="Minni";
break;
case "Jotnar":
Might = 12; Wits = 9; Will = 9; Health = Might; Awareness = Wits; Excess = 0;
Healing = Math.floor(Health/4);
Vision = "Night Vision";
Languages = "Jötnar Brogue";
Professions = "Choose two professions but not scientific or trade";
addSpellOrGift("repeating_spells", "Giant's Mood", "0", " Hamr", "Self", "Triggered action doubles Speed to visible creature", "1", "none");
listOfShame="Hamr";
break;
case "Dokkalfar":
Might = 8; Sleight = 8; Wits = 11; Will = 11; Health = Might; Awareness = Wits; Defence = Sleight; Excess = 0;
Healing = Math.floor(Health/4);
Trauma = Math.floor((Math.random() * 3) + 1);
Shame = Math.floor((Math.random() * 3) + 1);
Vision = "Thermal Sensors";
Languages = "True Norse and Noor";
Professions = "One of your two chosen professions must be a trade";
addSpellOrGift("repeating_spells", "Black Sight", "0", " Minni", "Self", "Allows you to see through solid objects for 1 round", "1", "none");
addTalents("repeating_talents", "Immune", "Immune damage from disease and poison; diseased, fatigued, poisoned");
addTalents("repeating_talents", "Artificial Body", "You do not eat, drink, or breathe; ignore hunger, thirst, sleep deprivation");
addTalents("repeating_talents", "Quirk of Fate", "Unconsciousness exceeding 5 minutes means eath an spirit posseses nearby object");
addTalents("repeating_talents", "Self Fortification", "You can use an action to fortify your body for 1 minute. Halves damage");
listOfShame="Minni";
break;
case "Ivaldi":
Might = 9; Sleight = 9; Wits = 12; Health = Might; Awareness = Wits + 1; Defence = Sleight; Excess = 0;
Healing = Math.floor(Health/4);
Trauma = Math.floor((Math.random() * 3) + 1);
Shame = Math.floor((Math.random() * 3) + 1);
Languages = "Noor and Grikk";
Professions = "Choose two scientific professions";
addSpellOrGift("repeating_spells", "Soul Sight", "0", " Hugr", "Self", "Awareness attack roll against the targets Wits", "1", "aware");
addTalents("repeating_talents", "Neural Interface", "Will challenge rolls to maintain concentration with 1 weal");
addTalents("repeating_talents", "Augmented Reality", "When Path presents 'gift of nature', choose Thought or Memory bound object");
listOfShame="Hugr";
break;
case "Jarnvidjur":
Might = 9; Sleight = 11; Wits = 8; Will = 8; Health = Might; Awareness = Wits + 1; Defence = Sleight; Speed = 12; Excess = 0;
Healing = Math.floor(Health/4);
Trauma = Math.floor((Math.random() * 3) + 1);
Shame = Math.floor((Math.random() * 3) + 1);
Vision = "Night Vision";
Languages = "Jötnar Brogue";
Professions = "Choose two professions but none from the trade list";
addSpellOrGift("repeating_spells", "Quicksilver", "0", " Hugr", "Self", "Removes slowed, immobilized, or grabbed - with conditions", "1", "none");
addTalents("repeating_talents", "Pack Attack", "Attack with an ally close gains 1 weal");
addTalents("repeating_talents", "Vicious Bite", "Retailiate triggers Might attack +1 weal against Defence, 1d6 damage");
listOfShame="Hugr";
break;
case "Jofurr":
Might = 11; Wits = 9; Health = Might; Excess = 0;
Healing = Math.floor(Health/4);
Trauma = Math.floor((Math.random() * 3) + 1);
Honour = Math.floor((Math.random() * 3) + 1);
Languages = "Noor";
Professions = "No profession other than those of your background";
addSpellOrGift("repeating_spells", "Steadfast", "0", " Hamingja", "Self", "Frightened condition triggers Will challenge roll", "&infin;", "will");
listOfShame="Hamingja";
break;
case "Orcneas":
Might = 12; Sleight = 9; Wits = 9; Health = Might; Awareness = Wits; Defence = Sleight; Excess = 0;
Healing = Math.floor(Health/4);
Shame = Math.floor((Math.random() * 3) + 1);
Vision = "Night Vision";
Languages = "Jötnar Brogue";
Professions = "You may only choose criminal professions";
addSpellOrGift("repeating_spells", "Shape Strong", "0", " Hugr", "Self", "Extra action per turn until Might challange failure results in 1 minute exhaustion", "1", "might");
addTalents("repeating_talents", "Immune", "Immune damage from disease and poison; diseased, poisoned + genotype immunities");
addTalents("repeating_talents", "Devourers", "Consume one body for 1 minute to heal damage equal to healing rate");
listOfShame="Hugr";
break;
case "Wanes":
Sleight = 11; Wits = 9; Awareness = Wits; Defence = Sleight; Excess = 0;
Healing = Math.floor(Health/4);
Trauma = Math.floor((Math.random() * 3) + 1);
Shame = Math.floor((Math.random() * 3) + 1);
Languages = "Noor";
Professions = "You may only choose wilderness professions";
addSpellOrGift("repeating_spells", "Bird Charms", "0", " Fylgja", "Creature", "Call one nearby animal and commune for one minute", "1", "none");
addTalents("repeating_talents", "Inured to Cold", "Half cold damage, immune to cold environs");
addTalents("repeating_talents", "Dream Weaving", "When hidden or slient and mind send emotes to other wanes");
listOfShame="Fylgja";
break;
default:
console.log(" Origin: " + Origin + " better be Mann, or problems");
break;
};
console.log(" Stats go here: ");
setAttrs({ might: Might, sleight: Sleight, wits: Wits, will: Will, excess: Excess, health: Health, awareness: Awareness, defence: Defence, defence_base: Defence, healing: Healing,
size: Size, speed: Speed, power: Power, spirit: Spirit, trauma: Trauma, shame: Shame, honour: Honour, vision: Vision,
languages: "Languages: " + Languages, profession1: Professions, profession2: Advice, craftsOfShame: listOfShame });
});
});
// GiGs bumper guard for repeating talents - only 16 entries
on("change:repeating_talents", function() {
console.log(" Change repeating talents\n");
section = "repeating_talents";
getSectionIDs(section, function(idarray) {
for(var i=16; i < idarray.length; i++) {
console.log(" Deleting repeating talents row: " + i + "\n");
removeRepeatingRow(section + "_" + idarray[i]);
}
});
});
on("change:repeating_weapons", function() {
console.log(" Change repeating weapons\n");
section = "repeating_weapons";
getSectionIDs(section, function(idarray) {
for(var i=5; i < idarray.length; i++) {
console.log(" Deleting repeating weapons row: " + i + "\n");
removeRepeatingRow(section + "_" + idarray[i]);
}
});
});
on("change:repeating_equipment", function() {
console.log(" Change repeating equipment\n");
section = "repeating_equipment";
getSectionIDs(section, function(idarray) {
for(var i=16; i < idarray.length; i++) {
console.log(" Deleting repeating equipment row: " + i + "\n");
removeRepeatingRow(section + "_" + idarray[i]);
}
});
});
on("change:repeating_spells", function() {
console.log(" Change repeating spells\n");
section = "repeating_spells";
getSectionIDs(section, function(idarray) {
for(var i=16; i < idarray.length; i++) {
console.log(" Deleting repeating spells row: " + i + "\n");
removeRepeatingRow(section + "_" + idarray[i]);
}
});
});
// Ajust Defence, Honour, Speed, and Woe for Armour change
on("change:armour change:shield", function() {
console.log(" On Change: Armour or Shield");
getAttrs(["armour", "shield", "might", "defence_base", "honour", "honour_armour", "speed", "speed_armour"], function(values) {
let Armour = values.armour;
let Shield = values.shield;
let Might = values.might;
let DefenceBase = parseInt(values.defence_base);
let Defence = DefenceBase;
let Honour = values.honour;
let curHonourBonus = values.honour_armour;
let Speed = values.speed;
let curSpeedArmour = values.speed_armour;
let ShieldBonus = 0;
if (Shield == "Shield") {
ShieldBonus = 2;
}
let ArmourBonus = 0;
let neededMight = 1;
let HonourBonus = 0;
console.log(" Armour:" + Armour);
switch (Armour) {
case "Clothing":
neededMight = 1;
break;
case "Leather":
ArmourBonus = 2;
case "Covert Vest":
neededMight = 10;
break;
case "Ballistic Vest":
ArmourBonus = 1;
neededMight = 12;
break;
case "Mail":
ArmourBonus = 14 - DefenceBase; //Note: this could go negative, but wearing it is their choice (hopefully)
neededMight = 12;
break;
case "Plate":
case "Combat":
ArmourBonus = 16 - DefenceBase; //Note: this could go negative, but wearing it is their choice (hopefully)
neededMight = 14;
HonourBonus = 1;
break;
};
// Calculate Defence
Defence = DefenceBase + ArmourBonus + ShieldBonus;
// Calculate Woe and Speed penalty
ArmourWoe = 0;
SpeedArmour = 0;
if (Might < neededMight) {
ArmourWoe = 1;
SpeedArmour = -2;
}
if (curHonourBonus > HonourBonus) {
Honour = String(parseInt(Honour) - 1);
} else if (curHonourBonus < HonourBonus) {
Honour = String(parseInt(Honour) + 1);
}
if (curSpeedArmour > SpeedArmour) {
Speed = String(parseInt(Speed) - 2);
} else if (curSpeedArmour < SpeedArmour) {
Speed = String(parseInt(Speed) + 2);
}
console.log(" Armour Bonus: " + ArmourBonus + " for " + Armour + " needed Might: " + neededMight + " vs Might " + Might + " Woe: " + ArmourWoe + " Speed Penalty for Armour " + SpeedArmour);
console.log(" Defence: " + Defence + " for " + Armour + " ArmourBonus: " + ArmourBonus + " + ShieldBonus " + ShieldBonus + " + DefenceBase: " + DefenceBase);
setAttrs({ armour_woe: ArmourWoe, speed: Speed, speed_armour: SpeedArmour, honour: Honour, honour_armour: HonourBonus, defence: Defence, defence_armour: ArmourBonus, defence_shield: ShieldBonus
});
});
});
/* On an emotional level I know this should be done as arrays, but don't know how - sigh */
on("change:affliction_asleep change:affliction_blinded change:affliction_charmed change:affliction_compelled change:affliction_dazed change:affliction_deafened change:affliction_defenceless change:affliction_diseased change:affliction_fatigued change:affliction_frightened_unseen change:affliction_frightened_seen change:affliction_grabbed change:affliction_immobilized change:affliction_impaired change:affliction_poisoned change:affliction_prone change:affliction_slowed change:affliction_stunned change:affliction_surprised change:affliction_unconscious", function(eventInfo) {
let Value = eventInfo.newValue;
let Source = eventInfo.sourceAttribute;
console.log("****** Affliction Change: source " + Source + " Value " + Value);
getAttrs(["affliction_asleep", "affliction_blinded", "affliction_charmed", "affliction_compelled", "affliction_dazed", "affliction_deafened", "affliction_defenceless", "affliction_diseased", "affliction_fatigued", "affliction_frightened_unseen", "affliction_frightened_seen", "affliction_grabbed", "affliction_immobilized", "affliction_impaired", "affliction_poisoned", "affliction_prone", "affliction_slowed", "affliction_stunned", "affliction_surprised", "affliction_unconscious", "defence", "defence_prior_affliction", "speed", "speed_prior_affliction"], function(values) {
let Defence = parseInt(values.defence) || 0 ; // may be needed for defence_prior_affliction
let priorDefence = parseInt(values.defence_prior_affliction) || 0 ;
let Speed = parseInt(values.speed) || 0 ; // may be needed for speed_prior_affliction
let priorSpeed = parseInt(values.speed_prior_affliction) || 0 ;
let asleep = values.affliction_asleep == 'on' ? 1 : 0;
let blinded = values.affliction_blinded == 'on' ? 1 : 0;
let charmed = values.affliction_charmed == 'on' ? 1 : 0;
let compelled = values.affliction_compelled == 'on' ? 1 : 0;
let dazed = values.affliction_dazed == 'on' ? 1 : 0;
let deafened = values.affliction_deafened == 'on' ? 1 : 0;
let defenceless = values.affliction_defenceless == 'on' ? 1 : 0;
let diseased = values.affliction_diseased == 'on' ? 1 : 0;
let fatigued = values.affliction_fatigued == 'on' ? 1 : 0;
let frightUnseen = values.affliction_frightened_unseen == 'on' ? 1 : 0;
let frightSeen = values.affliction_frightened_seen == 'on' ? 3 : 0;
let grabbed = values.affliction_grabbed == 'on' ? 1 : 0;
let immobilized = values.affliction_immobilized == 'on' ? 1 : 0;
let impaired = values.affliction_impaired == 'on' ? 1 : 0;
let poisoned = values.affliction_poisoned == 'on' ? 1 : 0;
let prone = values.affliction_prone == 'on' ? 1 : 0;
let slowed = values.affliction_slowed == 'on' ? 1 : 0;
let stunned = values.affliction_stunned == 'on' ? 1 : 0;
let surprised = values.affliction_surprised == 'on' ? 1 : 0;
let unconscious = values.affliction_unconscious == 'on' ? 1 : 0;
if (Source == "affliction_asleep") {
if (Value == 'on') {
console.log(" Asleep set ON: " + values.affliction_asleep + " is asleep: " + asleep + " prior defence " + Defence);
if (Defence > 5) {
setAttrs({ affliction_prone: 'on', affliction_unconscious: '1', defence_prior_affliction: String(Defence), defence: 5 });
} else {
setAttrs({ affliction_prone: 'on', affliction_unconscious: '1' });
}
} else {
console.log(" Asleep set OFF: " + values.affliction_asleep + " is asleep: " + asleep + " prior defence " + Defence);
if (priorDefence > Defence) { setAttrs({ affliction_prone: '0', affliction_unconscious: '0', defence: priorDefence }); }
else {
setAttrs({ affliction_prone: '0', affliction_unconscious: '0' });
}
}
}
if (Source == "affliction_blinded") {
if (Value == 'on') {
console.log(" Blinded set ON: " + values.affliction_blinded + " is blind: " + blinded + " prior speed " + Speed);
if (Speed > 2) {
setAttrs({ speed_prior_affliction: String(Speed), speed: 2 });
}
} else {
console.log(" Blinded set OFF: " + values.affliction_blinded + " is blind: " + blinded + " prior speed " + Speed);
if (priorSpeed > Speed) { setAttrs({ speed: priorSpeed }); }
}
}
if (Source == "affliction_immobilized") {
if (Value == 'on') {
console.log(" Immobilized set ON: " + values.affliction_immobilized + " is immobilized: " + immobilized + " prior speed " + Speed);
if (Speed > 0) {
setAttrs({ speed_prior_affliction: String(Speed), speed: 0 });
}
} else {
console.log(" Immobilized set OFF: " + values.affliction_immobilized + " is immobilized: " + immobilized + " prior speed " + Speed);
if (priorSpeed > Speed) { setAttrs({ speed: priorSpeed }); }
}
}
if (Source == "affliction_slowed") { // Cannot stack
if (Value == 'on') {
console.log(" Slowed set ON: " + values.affliction_slowed + " is slowed: " + slowed + " prior speed " + Speed);
let halfSpeed = Math.floor(Speed/2);
setAttrs({ speed_prior_affliction: String(Speed), speed: halfSpeed });
} else {
console.log(" Spped set OFF: " + values.affliction_slowed + " is slowed: " + slowed + " prior speed " + Speed);
setAttrs({ speed: priorSpeed });
}
}
if (Source == "affliction_unconscious") {
if (Value == '1') {
console.log(" Unconscious set ON: " + values.affliction_unconscious + " is unconscious: " + unconscious + " prior defence " + Defence);
if (Defence > 5) {
setAttrs({ defence_prior_affliction: String(Defence), defence: 5 });
}
} else {
console.log(" Unconscious set OFF: " + values.affliction_unconscious + " is unconscious: " + unconscious + " prior defence " + Defence);
if (priorDefence > Defence)
{ setAttrs({ defence: priorDefence }); }
}
}
if (Source == "affliction_defenceless") {
if (Value == 'on') {
console.log(" Defenceless set ON: " + values.affliction_defenceless + " is defenceless: " + defenceless + " prior speed " + Speed + " prior defence " + Defence);
if (Speed > 2) {
setAttrs({ speed_prior_affliction: String(Speed), speed: 2 });
}
if (Defence > 5) {
setAttrs({ defence_prior_affliction: String(Defence), defence: 5 });
}
} else {
console.log(" Defenceless set OFF: " + values.affliction_defenceless + " is defenceless: " + defenceless + " prior speed " + Speed + " prior defence " + Defence);
setAttrs({ speed: priorSpeed, defence: priorDefence });
}
}
console.log( " Fright Seen " + frightSeen + " Unseen " + frightUnseen );
//let total_woe = asleep + blinded + charmed + compelled + dazed + deafened + defenceless + diseased + fatigued + frightened + grabbed + immobilized + impaired + poisoned + prone + slowed + stunned + surprised + unconscious;
let total_woe = diseased + fatigued + frightUnseen + frightSeen + grabbed + impaired + poisoned + prone;
//console.log(" Total Woe: " + total_woe);
setAttrs({ affliction_woes: total_woe });
});
});
on("change:repeating_spells:spellRank", function(eventInfo) {
let Rank = eventInfo.newValue;
let Source = eventInfo.sourceAttribute;
console.log("****** Spell Rank Change *****");
console.log(" newValue: " + Rank);
console.log(" for:" + Source);
getAttrs(["power", "repeating_spells_spellCastings","repeating_spells_spellCraft"], function(values) {
let Craft = values.repeating_spells_spellCraft;
// Ensure that the entry is a Spell not a Gift
// Spellcraft: Galdar, Spacraft are Will Spells, Gand, Lyf, Runar, Seidt are Wits Spells
if ((Craft == "Galdar") || (Craft == "Gand") || (Craft == "Lyf") || (Craft == "Runar") || (Craft == "Seidt") || (Craft == "Spacraft")) {
let Power = values.power;
let curCastings = values.repeating_spells_spellCastings;
console.log(" curCastings: " + curCastings);
if (curCastings == "&infin;" || curCastings == "&#8734;") {
console.log(" skip over infinite: " + curCastings);
return;
}
let Castings = 0;
if (Rank == 0) {
Castings = parseInt(Power) + 1;
} else if (Rank == 1) {
if (Power == 1) { Castings = 1; }
else if ((Power > 1) && (Power < 5)) { Castings = 2; }
else if ((Power == 5) || (Power == 6)) { Castings = 3; }
} else if (Rank == 2) {
if ((Power == 2) || (Power == 3)) { Castings = 1; }
else if ((Power == 4) || (Power == 5)) { Castings = 2; }
else if (Power == 6) { Castings = 3; }
} else if (Rank == 3) {
if ((Power == 3) || (Power == 4)) { Castings = 1; }
else if ((Power == 5) || (Power == 6)) { Castings = 2; }
} else if (Rank == 4) {
if ((Power == 4) || (Power == 5)) { Castings = 1; }
else if (Power == 6) { Castings = 2; }
} else if (Rank == 5) {
if ((Power == 5) || (Power == 6)) { Castings = 1; }
}
console.log(" Rank: " + Rank + " Power: " + Power + " Castings: " + Castings);
setAttrs({repeating_spells_spellCastings: Castings, repeating_spells_spellExpended: 0});
} else {
console.log(" Craft: " + Craft + " not a spell so Rank is irrelevant");
};
});
});
// Check whether new Spell adds a new Craft, hence increases Shame
// Note - there is no reduction in shame for 'unlearning' a Craft
// - no shamge for Hamr(Shape), Hugr(Thought), Fylgja(Follower), Hamingja(Luck), Minni(Memory) i.e. Gifts of Nature
on("change:repeating_spells:craft", function(eventInfo) {
let Craft = eventInfo.newValue;
let Source = eventInfo.sourceAttribute;
console.log("****** Spell Craft Change *****");
console.log(" newValue: " + Craft);
console.log(" for:" + Source);
getAttrs(["craftsOfShame", "repeating_spells_spellCraft"], function(values) {
let Craft = values.repeating_spells_spellCraft;
// Ensure that the entry is a Spell not a Gift
// Spellcraft: Galdar, Spacraft are Will Spells, Gand, Lyf, Runar, Seidt are Wits Spells
if ((Craft == "Galdar") || (Craft == "Gand") || (Craft == "Lyf") || (Craft == "Runar") || (Craft == "Seidt") || (Craft == "Spacraft")) {
let Power = values.power;
let curCastings = values.repeating_spells_spellCastings;
console.log(" curCastings: " + curCastings);
if (curCastings == "&infin;" || curCastings == "&#8734;") {
console.log(" skip over Gifts (infinite): " + curCastings);
return;
}
let Castings = 0;
if (Rank == 0) {
Castings = parseInt(Power) + 1;
} else if (Rank == 1) {
if (Power == 1) { Castings = 1; }
else if ((Power > 1) && (Power < 5)) { Castings = 2; }
else if ((Power == 5) || (Power == 6)) { Castings = 3; }
} else if (Rank == 2) {
if ((Power == 2) || (Power == 3)) { Castings = 1; }
else if ((Power == 4) || (Power == 5)) { Castings = 2; }
else if (Power == 6) { Castings = 3; }
} else if (Rank == 3) {
if ((Power == 3) || (Power == 4)) { Castings = 1; }
else if ((Power == 5) || (Power == 6)) { Castings = 2; }
} else if (Rank == 4) {
if ((Power == 4) || (Power == 5)) { Castings = 1; }
else if (Power == 6) { Castings = 2; }
} else if (Rank == 5) {
if ((Power == 5) || (Power == 6)) { Castings = 1; }
}
console.log(" Rank: " + Rank + " Power: " + Power + " Castings: " + Castings);
setAttrs({repeating_spells_spellCastings: Castings, repeating_spells_spellExpended: 0});
} else {
console.log(" Craft: " + Craft + " not a spell so Rank is irrelevant");
};
});
});
//Walkthrough of repeating_spells to recalcuate the total castings if Power changes or the sheet is opened
on('sheet:opened change:power change:spirit', () => {
console.log("In repeating_spells, recalc Castings");
getSectionIDs(`repeating_spells`, function(idArray) {
// create a variable to hold all the needed attribute names
let fieldnames = [];
for(let i = 0; i < idArray.length; i++) {
fieldnames.push("repeating_spells_" + idArray[i] + "_spellName" ); // Needed only for debugging
fieldnames.push("repeating_spells_" + idArray[i] + "_spellRank" );
fieldnames.push("repeating_spells_" + idArray[i] + "_spellCraft" ); // Neeeded to differentiate between Spells (Power) and Gifts (Spirit)
fieldnames.push("repeating_spells_" + idArray[i] + "_spellCastings" );
}
// if you need any other attributes in your worker, dont forget to include those
fieldnames.push("power");
fieldnames.push("spirit");
getAttrs(fieldnames, function(values) {
// get the Power & Spirit value
let Power = parseInt(values.power) || 0;
let Spirit = parseInt(values.spirit) || 0;
console.log(" Walkthough for " + idArray.length + " entries with POWER now " + Power + " and SPIRIT now " + Spirit );
for(let i = 0; i < idArray.length; i++) {
// Extract used skill points
let Name = values["repeating_spells_" + idArray[i] + "_spellName"];
console.log(" Name: " + Name + " Rank '" + values["repeating_spells_" + idArray[i] + "_spellRank"] + "'");
if (values["repeating_spells_" + idArray[i] + "_spellRank"] == '') {
console.log(" Skip Unranked entry: ");
continue;
}
let curCastings = values["repeating_spells_" + idArray[i] + "_spellCastings"];
if (curCastings == "&infin;" || curCastings == "&#8734;"){
console.log(" Skip Infinity for " + Name );
continue;
}
curCastings = Number(curCastings);
// Determine whether Gift or Spell
let Craft = values["repeating_spells_" + idArray[i] + "_spellCraft"];
//Spellcraft: Galdar, Spacraft are Will Spells, Gand, Lyf, Runar, Seidt are Wits Spells
if ((Craft == "Galdar") || (Craft == "Gand") || (Craft == "Lyf") || (Craft == "Runar") || (Craft == "Seidt") || (Craft == "Spacraft")) {
let Rank = Number(values["repeating_spells_" + idArray[i] + "_spellRank"]) ||0;
curCastings = Number(values["repeating_spells_" + idArray[i] + "_spellCastings"]) ||0;
let Castings = 0;
// Make an assumption about Power > 6, i.e. does not go to zero but maintains would be better
if (Rank == 0) {
Castings = Power + 1;
} else if (Rank == 1) {
if (Power == 1) { Castings = 1; }
else if ((Power > 1) && (Power < 5)) { Castings = 2; }
else if (Power >= 5) { Castings = 3; }
} else if (Rank == 2) {
if ((Power == 2) || (Power == 3)) { Castings = 1; }
else if ((Power == 4) || (Power == 5)) { Castings = 2; }
else if (Power >= 6) { Castings = 3; }
} else if (Rank == 3) {
if ((Power == 3) || (Power == 4)) { Castings = 1; }
else if (Power >= 5) { Castings = 2; }
} else if (Rank == 4) {
if ((Power == 4) || (Power == 5)) { Castings = 1; }
else if (Power >= 6) { Castings = 2; }
} else if (Rank == 5) {
if (Power >= 5) { Castings = 1; }
}
console.log(" Spell Name: " + Name + " Rank: " + Rank + " curCastings: " + curCastings + " Castings: " + Castings);
if (curCastings != Castings) {
setAttrs({ ["repeating_spells_" + idArray[i] + "_spellCastings"] : Castings });
console.log(" reset to: " + Castings);
}
} else {
// Gift
curCastings = Number(values["repeating_spells_" + idArray[i] + "_spellCastings"]) ||0;
Castings = Spirit + 1;
console.log(" Gift Name: " + Name + " Spirit: " + Spirit + " curCastings: " + curCastings + " Castings: " + Castings);
if (curCastings != Castings) {
setAttrs({ ["repeating_spells_" + idArray[i] + "_spellCastings"] : Castings });
console.log(" reset to: " + Castings);
}
}
}
});
});
});
</script>