Files
roll20-character-sheets/Broken Compass/brokencompass.html
T
2023-03-22 12:51:26 +01:00

1427 lines
69 KiB
HTML

<div class="character-sheet">
<div class="row">
<div class="col-8 character-details">
<div class="flex">
<label data-i18n="I-am">I am</label>
<input type="text" class="transparent" name="attr_character_name" title="@{character_name}" spellcheck="false">
</div>
<div class="flex">
<label data-i18n="call-me-if-you-need-a">Call me if you need a</label>
<input type="text" class="transparent" name="attr_call_me">
</div>
<div class="flex center-inputs">
<label data-i18n="place-i-call-home">Place I call home</label>
<div class="input-with-subtext">
<input type="text" class="transparent">
<p data-i18n="heritage" name="attr_heritage">Heritage</p>
</div>
<div class="input-with-subtext">
<input type="text" class="transparent">
<p data-i18n="homeland" name="attr_homeland">Homeland</p>
</div>
<div class="input-with-subtext">
<input type="text" class="transparent">
<p data-i18n="workplace" name="attr_workplace">Workplace</p>
</div>
</div>
<div class="input-with-subtext center-inputs">
<input type="text" class="transparent" name="attr_motto">
<p data-i18n="words-to-live-by">Words to live by</p>
</div>
</div>
<div class="col-4">
<br><br>
<label class="secret-roll"><input type="checkbox" value="/w gm" name="attr_secret_roll"> <span data-i18n="make-the-roll-secret">Make the roll secret</span></label>
<button type="roll" class="coin-flip-button" data-i18n="flip-the-coin" value="@{secret_roll} &{template:coin-flip} {{character_name=@{character_name}}} {{character_id=@{character_id}}} {{roll-name=^{flip-the-coin}}} {{roll=[[1d2]]}}">Flip the coin</button>
</div>
</div>
<div class="row">
<div class="col-4">
<div class="attribute-box">
<div class="attribute-label">
<button type="action" name="act_roll" data-i18n="action" data-attribute="action" data-skill="">Action</button>
<input type="hidden" name="attr_action_calc" value="2">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_action" id="action_value_3" value="3" />
<label class="diamond-checkbox" for="action_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_action" id="action_value_2" value="2" checked="checked" />
<label class="diamond-checkbox" for="action_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_action" id="action_value_1" value="1" />
<label class="diamond-checkbox" for="action_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-box">
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="fight" data-attribute="action" data-skill="fight">Fight</button>
<input type="hidden" name="attr_fight_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_fight" id="fight_value_3" value="3" />
<label class="diamond-checkbox" for="fight_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_fight" id="fight_value_2" value="2" />
<label class="diamond-checkbox" for="fight_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_fight" id="fight_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="fight_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="leadership" data-attribute="action" data-skill="leadership">Leadership</button>
<input type="hidden" name="attr_leadership_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_leadership" id="leadership_value_3" value="3" />
<label class="diamond-checkbox" for="leadership_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_leadership" id="leadership_value_2" value="2" />
<label class="diamond-checkbox" for="leadership_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_leadership" id="leadership_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="leadership_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="stunt" data-attribute="action" data-skill="stunt">Stunt</button>
<input type="hidden" name="attr_stunt_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_stunt" id="stunt_value_3" value="3" />
<label class="diamond-checkbox" for="stunt_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_stunt" id="stunt_value_2" value="2" />
<label class="diamond-checkbox" for="stunt_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_stunt" id="stunt_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="stunt_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
</div>
</div>
<div class="attribute-box">
<div class="attribute-label">
<button type="action" name="act_roll" data-i18n="guts" data-attribute="guts" data-skill="">Guts</button>
<input type="hidden" name="attr_guts_calc" value="2">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_guts" id="guts_value_3" value="3" />
<label class="diamond-checkbox" for="guts_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_guts" id="guts_value_2" value="2" checked="checked" />
<label class="diamond-checkbox" for="guts_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_guts" id="guts_value_1" value="1" />
<label class="diamond-checkbox" for="guts_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-box">
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="cool" data-attribute="guts" data-skill="cool">cool</button>
<input type="hidden" name="attr_cool_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_cool" id="cool_value_3" value="3" />
<label class="diamond-checkbox" for="cool_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_cool" id="cool_value_2" value="2" />
<label class="diamond-checkbox" for="cool_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_cool" id="cool_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="cool_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="drive" data-attribute="guts" data-skill="drive">drive</button>
<input type="hidden" name="attr_drive_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_drive" id="drive_value_3" value="3" />
<label class="diamond-checkbox" for="drive_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_drive" id="drive_value_2" value="2" />
<label class="diamond-checkbox" for="drive_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_drive" id="drive_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="drive_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="shoot" data-attribute="guts" data-skill="shoot">shoot</button>
<input type="hidden" name="attr_shoot_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_shoot" id="shoot_value_3" value="3" />
<label class="diamond-checkbox" for="shoot_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_shoot" id="shoot_value_2" value="2" />
<label class="diamond-checkbox" for="shoot_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_shoot" id="shoot_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="shoot_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
</div>
</div>
<div class="attribute-box">
<div class="attribute-label">
<button type="action" name="act_roll" data-i18n="knowledge" data-attribute="knowledge" data-skill="">knowledge</button>
<input type="hidden" name="attr_knowledge_calc" value="2">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_knowledge" id="knowledge_value_3" value="3" />
<label class="diamond-checkbox" for="knowledge_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_knowledge" id="knowledge_value_2" value="2" checked="checked" />
<label class="diamond-checkbox" for="knowledge_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_knowledge" id="knowledge_value_1" value="1" />
<label class="diamond-checkbox" for="knowledge_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-box">
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="culture" data-attribute="knowledge" data-skill="culture">culture</button>
<input type="hidden" name="attr_culture_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_culture" id="culture_value_3" value="3" />
<label class="diamond-checkbox" for="culture_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_culture" id="culture_value_2" value="2" />
<label class="diamond-checkbox" for="culture_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_culture" id="culture_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="culture_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="first_aid" data-attribute="knowledge" data-skill="first_aid">first_aid</button>
<input type="hidden" name="attr_first_aid_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_first_aid" id="first_aid_value_3" value="3" />
<label class="diamond-checkbox" for="first_aid_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_first_aid" id="first_aid_value_2" value="2" />
<label class="diamond-checkbox" for="first_aid_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_first_aid" id="first_aid_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="first_aid_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="tech" data-attribute="knowledge" data-skill="tech">tech</button>
<input type="hidden" name="attr_tech_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_tech" id="tech_value_3" value="3" />
<label class="diamond-checkbox" for="tech_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_tech" id="tech_value_2" value="2" />
<label class="diamond-checkbox" for="tech_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_tech" id="tech_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="tech_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
</div>
</div>
<div class="attribute-box">
<div class="attribute-label">
<button type="action" name="act_roll" data-i18n="society" data-attribute="society" data-skill="">society</button>
<input type="hidden" name="attr_society_calc" value="2">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_society" id="society_value_3" value="3" />
<label class="diamond-checkbox" for="society_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_society" id="society_value_2" value="2" checked="checked" />
<label class="diamond-checkbox" for="society_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_society" id="society_value_1" value="1" />
<label class="diamond-checkbox" for="society_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-box">
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="charm" data-attribute="society" data-skill="charm">charm</button>
<input type="hidden" name="attr_charm_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_charm" id="charm_value_3" value="3" />
<label class="diamond-checkbox" for="charm_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_charm" id="charm_value_2" value="2" />
<label class="diamond-checkbox" for="charm_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_charm" id="charm_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="charm_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="eloquence" data-attribute="society" data-skill="eloquence">eloquence</button>
<input type="hidden" name="attr_eloquence_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_eloquence" id="eloquence_value_3" value="3" />
<label class="diamond-checkbox" for="eloquence_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_eloquence" id="eloquence_value_2" value="2" />
<label class="diamond-checkbox" for="eloquence_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_eloquence" id="eloquence_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="eloquence_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="observation" data-attribute="society" data-skill="observation">observation</button>
<input type="hidden" name="attr_observation_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_observation" id="observation_value_3" value="3" />
<label class="diamond-checkbox" for="observation_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_observation" id="observation_value_2" value="2" />
<label class="diamond-checkbox" for="observation_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_observation" id="observation_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="observation_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
</div>
</div>
<div class="attribute-box">
<div class="attribute-label">
<button type="action" name="act_roll" data-i18n="wild" data-attribute="wild" data-skill="">wild</button>
<input type="hidden" name="attr_wild_calc" value="2">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_wild" id="wild_value_3" value="3" />
<label class="diamond-checkbox" for="wild_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_wild" id="wild_value_2" value="2" checked="checked" />
<label class="diamond-checkbox" for="wild_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_wild" id="wild_value_1" value="1" />
<label class="diamond-checkbox" for="wild_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-box">
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="scout" data-attribute="wild" data-skill="scout">scout</button>
<input type="hidden" name="attr_scout_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_scout" id="scout_value_3" value="3" />
<label class="diamond-checkbox" for="scout_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_scout" id="scout_value_2" value="2" />
<label class="diamond-checkbox" for="scout_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_scout" id="scout_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="scout_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="survival" data-attribute="wild" data-skill="survival">survival</button>
<input type="hidden" name="attr_survival_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_survival" id="survival_value_3" value="3" />
<label class="diamond-checkbox" for="survival_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_survival" id="survival_value_2" value="2" />
<label class="diamond-checkbox" for="survival_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_survival" id="survival_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="survival_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="tough" data-attribute="wild" data-skill="tough">tough</button>
<input type="hidden" name="attr_tough_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_tough" id="tough_value_3" value="3" />
<label class="diamond-checkbox" for="tough_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_tough" id="tough_value_2" value="2" />
<label class="diamond-checkbox" for="tough_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_tough" id="tough_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="tough_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
</div>
</div>
<div class="attribute-box">
<div class="attribute-label">
<button type="action" name="act_roll" data-i18n="crime" data-attribute="crime" data-skill="">crime</button>
<input type="hidden" name="attr_crime_calc" value="2">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_crime" id="crime_value_3" value="3" />
<label class="diamond-checkbox" for="crime_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_crime" id="crime_value_2" value="2" checked="checked" />
<label class="diamond-checkbox" for="crime_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_crime" id="crime_value_1" value="1" />
<label class="diamond-checkbox" for="crime_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-box">
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="caution" data-attribute="crime" data-skill="caution">caution</button>
<input type="hidden" name="attr_caution_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_caution" id="caution_value_3" value="3" />
<label class="diamond-checkbox" for="caution_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_caution" id="caution_value_2" value="2" />
<label class="diamond-checkbox" for="caution_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_caution" id="caution_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="caution_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="dexterity" data-attribute="crime" data-skill="dexterity">dexterity</button>
<input type="hidden" name="attr_dexterity_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_dexterity" id="dexterity_value_3" value="3" />
<label class="diamond-checkbox" for="dexterity_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_dexterity" id="dexterity_value_2" value="2" />
<label class="diamond-checkbox" for="dexterity_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_dexterity" id="dexterity_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="dexterity_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
<div class="skill-label">
<button type="action" name="act_roll" data-i18n="stealth" data-attribute="crime" data-skill="stealth">stealth</button>
<input type="hidden" name="attr_stealth_calc" value="1">
<div class="diamond-checkboxes">
<input class="diamond-input" type="checkbox" name="attr_stealth" id="stealth_value_3" value="3" />
<label class="diamond-checkbox" for="stealth_value_3">
<span class="diamond-down"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_stealth" id="stealth_value_2" value="2" />
<label class="diamond-checkbox" for="stealth_value_2">
<span class="diamond-up"></span>
</label>
<input class="diamond-input" type="checkbox" name="attr_stealth" id="stealth_value_1" value="1" checked="checked" />
<label class="diamond-checkbox" for="stealth_value_1">
<span class="diamond-down"></span>
</label>
</div>
</div>
</div>
</div>
</div>
<div class="col-8">
<div class="row">
<div class="col-7">
<div class="luck-box">
<div class="luck-box-inner">
<label class="title-label" data-i18n="luck">Luck</label>
<input class="circle-input" type="checkbox" name="attr_luck" id="luck_value_1" value="10" />
<input class="circle-input" type="checkbox" name="attr_luck" id="luck_value_1" value="9" />
<input class="circle-input" type="checkbox" name="attr_luck" id="luck_value_1" value="8" />
<input class="circle-input" type="checkbox" name="attr_luck" id="luck_value_1" value="7" />
<input class="circle-input" type="checkbox" name="attr_luck" id="luck_value_1" value="6" />
<input class="circle-input" type="checkbox" name="attr_luck" id="luck_value_1" value="5" />
<input class="circle-input" type="checkbox" name="attr_luck" id="luck_value_1" value="4" />
<input class="circle-input" type="checkbox" name="attr_luck" id="luck_value_1" value="3" />
<input class="circle-input" type="checkbox" name="attr_luck" id="luck_value_1" value="2" />
<input class="circle-input" type="checkbox" name="attr_luck" id="luck_value_1" value="1" />
</div>
<div class="luck-input-box">
<input type="text" class="luck-input" name="attr_luck_number" value="1">
</div>
</div>
</div>
<div class="col-5">
<img src="https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/BrokenCompass/Images/logo-pl.png" alt="">
</div>
</div>
<div class="row">
<div class="col-8" style="margin-bottom: 50px;">
<label class="title-label center" data-i18n="i-feel">I feel</label>
<div class="feel-box">
<label class="feel-input">
<div class="diamond-checkbox">
<input type="checkbox" class="diamond-input" name="attr_action_modifier" value="1">
<span class="diamond-down"><span data-i18n="powerful">Powerful</span> <i>+</i></span>
</div>
</label>
<span data-i18n="action">Action</span>
<label class="feel-input">
<div class="diamond-checkbox">
<input type="checkbox" class="diamond-input" name="attr_action_modifier" value="-1">
<span class="diamond-up"><span data-i18n="bleeding">Bleeding</span> <i>-</i></span>
</div>
</label>
</div>
<div class="feel-box">
<label class="feel-input">
<div class="diamond-checkbox">
<input type="checkbox" class="diamond-input" name="attr_guts_modifier" value="1">
<span class="diamond-down"><span data-i18n="daring">Daring</span> <i>+</i></span>
</div>
</label>
<span data-i18n="guts">Guts</span>
<label class="feel-input">
<div class="diamond-checkbox">
<input type="checkbox" class="diamond-input" name="attr_guts_modifier" value="-1">
<span class="diamond-up"><span data-i18n="shocked">Shocked</span> <i>-</i></span>
</div>
</label>
</div>
<div class="feel-box">
<label class="feel-input">
<div class="diamond-checkbox">
<input type="checkbox" class="diamond-input" name="attr_knowledge_modifier" value="1">
<span class="diamond-down"><span data-i18n="focused">Focused</span> <i>+</i></span>
</div>
</label>
<span data-i18n="knowledge">Knowledge</span>
<label class="feel-input">
<div class="diamond-checkbox">
<input type="checkbox" class="diamond-input" name="attr_knowledge_modifier" value="-1">
<span class="diamond-up"><span data-i18n="dizzy">Dizzy</span> <i>-</i></span>
</div>
</label>
</div>
<div class="feel-box">
<label class="feel-input">
<div class="diamond-checkbox">
<input type="checkbox" class="diamond-input" name="attr_society_modifier" value="1">
<span class="diamond-down"><span data-i18n="confident">Confident</span> <i>+</i></span>
</div>
</label>
<span data-i18n="society">Society</span>
<label class="feel-input">
<div class="diamond-checkbox">
<input type="checkbox" class="diamond-input" name="attr_society_modifier" value="-1">
<span class="diamond-up"><span data-i18n="embarassed">Embarassed</span> <i>-</i></span>
</div>
</label>
</div>
<div class="feel-box">
<label class="feel-input">
<div class="diamond-checkbox">
<input type="checkbox" class="diamond-input" name="attr_wild_modifier" value="1">
<span class="diamond-down"><span data-i18n="fierce">Fierce</span> <i>+</i></span>
</div>
</label>
<span data-i18n="wild">Wild</span>
<label class="feel-input">
<div class="diamond-checkbox">
<input type="checkbox" class="diamond-input" name="attr_wild_modifier" value="-1">
<span class="diamond-up"><span data-i18n="broken">Broken</span> <i>-</i></span>
</div>
</label>
</div>
<div class="feel-box">
<label class="feel-input">
<div class="diamond-checkbox">
<input type="checkbox" class="diamond-input" name="attr_crime_modifier" id="attr_crime_modifier-plus" value="1">
<span class="diamond-down"><span data-i18n="untouchable">Untouchable</span> <i>+</i></span>
</div>
</label>
<span data-i18n="crime">Crime</span>
<label class="feel-input">
<div class="diamond-checkbox">
<input type="checkbox" class="diamond-input" name="attr_crime_modifier" id="attr_crime_modifier-minus" value="-1">
<span class="diamond-up"><span data-i18n="scared">Scared</span> <i>-</i></span>
</div>
</label>
</div>
<fieldset class="repeating_feelings">
<div class="feel-box">
<label class="feel-input">
<div class="diamond-checkbox">
<input type="checkbox" class="diamond-input" name="attr_feel_modifier" value="1">
<span class="diamond-down without-line"><input type="text" name="attr_new_feel_plus"> <i>+</i></span>
</div>
</label>
<span><br></span>
<label class="feel-input">
<div class="diamond-checkbox">
<input type="checkbox" class="diamond-input" name="attr_feel_modifier" value="-1">
<span class="diamond-up without-line"><input type="text" name="attr_new_feel_minus"> <i>-</i></span>
</div>
</label>
</div>
</fieldset>
</div>
<div class="col-4 expertise-box">
<label class="subtitle-label" data-i18n="expertise">Expertise</label>
<fieldset class="repeating_expertise">
<input class="flex-1" type="text" name="attr_expertise_name">
</fieldset>
</div>
</div>
<div class="row">
<div class="col-12">
<label class="title-label" data-i18n="weapon-and-gear">Weapon & Gear</label>
<div class="fieldset-labels center">
<span class="flex-1 mini-title" data-i18n="name">Name</span>
<span class="flex-2 mini-title" data-i18n="description">Description</span>
</div>
<div class="gear-rep-list">
<fieldset class="repeating_gear">
<input class="flex-1 gear-input" type="text" name="attr_gear_name">
<input class="flex-2" type="text" name="attr_gear_desc">
</fieldset>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-4">
<label class="subtitle-label" data-i18n="scars-and-experiences">Scars and Experiences</label>
<fieldset class="repeating_scars">
<input class="flex-1" type="text" name="attr_scars">
</fieldset>
</div>
<div class="col-4">
<label class="subtitle-label" data-i18n="pockets">Pockets</label>
<fieldset class="repeating_pockets">
<input class="flex-1" type="text" name="attr_pockets">
</fieldset>
<label class="subtitle-label" data-i18n="bag">Bag</label>
<fieldset class="repeating_bag">
<input class="flex-1" type="text" name="attr_bag">
</fieldset>
</div>
<div class="col-4">
<div class="backpack-box">
<label class="subtitle-label" data-i18n="backpack">backpack</label>
<fieldset class="repeating_backpack">
<input class="flex-1" type="text" name="attr_backpack">
</fieldset>
</div>
<label class="subtitle-label" data-i18n="mags">Mags</label>
<div class="fieldset-labels center">
<span class="flex-3 mini-title"></span>
<span class="flex-1 mini-title" data-i18n="pockets">pockets</span>
<span class="flex-1 mini-title" data-i18n="bag">bag</span>
<span class="flex-1 mini-title" data-i18n="backpack">backpack</span>
</div>
<fieldset class="repeating_mag">
<input class="flex-3" type="text" name="attr_mag_name">
<input class="flex-1" type="number" min="0" max="2" name="attr_mag_pockets">
<input class="flex-1" type="number" min="0" max="2" name="attr_mag_bag">
<input class="flex-1" type="number" min="0" max="9" name="attr_mag_backpack">
</fieldset>
<div class="fieldset-labels mag-max-clips">
<span class="flex-3 mini-title" style="position: relative;z-index: -1;"></span>
<span class="flex-1 mini-title">/2</span>
<span class="flex-1 mini-title">/2</span>
<span class="flex-1 mini-title">/9</span>
</div>
</div>
</div>
<input type="hidden" name="attr_null_calc" value="0">
<input type="hidden" name="attr_pair_one_sum" value="0">
<input type="hidden" name="attr_pair_two_sum" value="0">
<input type="hidden" name="attr_pair_three_sum" value="0">
<input type="hidden" name="attr_pair_four_sum" value="0">
<input type="hidden" name="attr_pair_five_sum" value="0">
<input type="hidden" name="attr_pair_six_sum" value="0">
<input type="hidden" name="attr_dice_for_reroll" value="0">
</div>
<!-- Roll Templates -->
<rolltemplate class="sheet-rolltemplate-coin-flip">
<div class="template-wrap">
<div class="template-header">
{{#character_name}}
{{#character_id}}[{{character_name}}](https://journal.roll20.net/character/{{character_id}}){{/character_id}}
{{^character_id}}{{character_name}}{{/character_id}}
{{/character_name}}
</div>
<div class="template-subtitle">
{{roll-name}}
</div>
{{#rollWasCrit() roll}}
<div class="template-subtitle green" data-i18n="success">Success</div>
<div class="template-center">
<img src="https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/BrokenCompass/Images/coin-heads.png?v=3" alt="">
</div>
{{/rollWasCrit() roll}}
{{#rollWasFumble() roll}}
<div class="template-subtitle red" data-i18n="fail">Fail</div>
<div class="template-center">
<img src="https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/BrokenCompass/Images/coin-tails.png?v=3" alt="">
</div>
{{/rollWasFumble() roll}}
</div>
</rolltemplate>
<rolltemplate class="sheet-rolltemplate-brokencompass">
<div class="template-wrap">
<div class="template-header">
{{#character_name}}
{{#character_id}}[{{character_name}}](https://journal.roll20.net/character/{{character_id}}){{/character_id}}
{{^character_id}}{{character_name}}{{/character_id}}
{{/character_name}}
</div>
<div class="template-subtitle">
{{#expertise_title}}
{{expertise_title}}
{{/expertise_title}}
{{#risk_title}}
{{risk_title}}
{{/risk_title}}
{{roll-name}}
</div>
<div class="template-dice-stats">
<div><label class="template-label" data-i18n="result:">Result:</label></div>
<div><span data-i18n="total-dices">Total dices</span> {{baseDice}}</div>
</div>
<div class="template-grid-item-box">
{{#rollGreater() computed::pair_of_one 1}}
<div class="template-grid-item">
<div class="template-roll-between"><span class="template-roll-dice">1</span></div>
<div class="template-roll-between"><span class="template-roll-dice">1</span></div>
{{#rollGreater() computed::pair_of_one 2}}
<div class="template-roll-between"><span class="template-roll-dice">1</span></div>
{{/rollGreater() computed::pair_of_one 2}}
{{#rollGreater() computed::pair_of_one 3}}
<div class="template-roll-between"><span class="template-roll-dice">1</span></div>
{{/rollGreater() computed::pair_of_one 3}}
{{#rollGreater() computed::pair_of_one 4}}
<div class="template-roll-between"><span class="template-roll-dice">1</span></div>
{{/rollGreater() computed::pair_of_one 4}}
{{#rollGreater() computed::pair_of_one 5}}
<div class="template-roll-between"><span class="template-roll-dice">1</span></div>
{{/rollGreater() computed::pair_of_one 5}}
</div>
{{/rollGreater() computed::pair_of_one 1}}
{{#rollGreater() computed::pair_of_two 1}}
<div class="template-grid-item">
<div class="template-roll-between"><span class="template-roll-dice">2</span></div>
<div class="template-roll-between"><span class="template-roll-dice">2</span></div>
{{#rollGreater() computed::pair_of_two 2}}
<div class="template-roll-between"><span class="template-roll-dice">2</span></div>
{{/rollGreater() computed::pair_of_two 2}}
{{#rollGreater() computed::pair_of_two 3}}
<div class="template-roll-between"><span class="template-roll-dice">2</span></div>
{{/rollGreater() computed::pair_of_two 3}}
{{#rollGreater() computed::pair_of_two 4}}
<div class="template-roll-between"><span class="template-roll-dice">2</span></div>
{{/rollGreater() computed::pair_of_two 4}}
{{#rollGreater() computed::pair_of_two 5}}
<div class="template-roll-between"><span class="template-roll-dice">2</span></div>
{{/rollGreater() computed::pair_of_two 5}}
</div>
{{/rollGreater() computed::pair_of_two 1}}
{{#rollGreater() computed::pair_of_three 1}}
<div class="template-grid-item">
<div class="template-roll-between"><span class="template-roll-dice">3</span></div>
<div class="template-roll-between"><span class="template-roll-dice">3</span></div>
{{#rollGreater() computed::pair_of_three 2}}
<div class="template-roll-between"><span class="template-roll-dice">3</span></div>
{{/rollGreater() computed::pair_of_three 2}}
{{#rollGreater() computed::pair_of_three 3}}
<div class="template-roll-between"><span class="template-roll-dice">3</span></div>
{{/rollGreater() computed::pair_of_three 3}}
{{#rollGreater() computed::pair_of_three 4}}
<div class="template-roll-between"><span class="template-roll-dice">3</span></div>
{{/rollGreater() computed::pair_of_three 4}}
{{#rollGreater() computed::pair_of_three 5}}
<div class="template-roll-between"><span class="template-roll-dice">3</span></div>
{{/rollGreater() computed::pair_of_three 5}}
</div>
{{/rollGreater() computed::pair_of_three 1}}
{{#rollGreater() computed::pair_of_four 1}}
<div class="template-grid-item">
<div class="template-roll-between"><span class="template-roll-dice">4</span></div>
<div class="template-roll-between"><span class="template-roll-dice">4</span></div>
{{#rollGreater() computed::pair_of_four 2}}
<div class="template-roll-between"><span class="template-roll-dice">4</span></div>
{{/rollGreater() computed::pair_of_four 2}}
{{#rollGreater() computed::pair_of_four 3}}
<div class="template-roll-between"><span class="template-roll-dice">4</span></div>
{{/rollGreater() computed::pair_of_four 3}}
{{#rollGreater() computed::pair_of_four 4}}
<div class="template-roll-between"><span class="template-roll-dice">4</span></div>
{{/rollGreater() computed::pair_of_four 4}}
{{#rollGreater() computed::pair_of_four 5}}
<div class="template-roll-between"><span class="template-roll-dice">4</span></div>
{{/rollGreater() computed::pair_of_four 5}}
</div>
{{/rollGreater() computed::pair_of_four 1}}
{{#rollGreater() computed::pair_of_five 1}}
<div class="template-grid-item">
<div class="template-roll-between"><span class="template-roll-dice">5</span></div>
<div class="template-roll-between"><span class="template-roll-dice">5</span></div>
{{#rollGreater() computed::pair_of_five 2}}
<div class="template-roll-between"><span class="template-roll-dice">5</span></div>
{{/rollGreater() computed::pair_of_five 2}}
{{#rollGreater() computed::pair_of_five 3}}
<div class="template-roll-between"><span class="template-roll-dice">5</span></div>
{{/rollGreater() computed::pair_of_five 3}}
{{#rollGreater() computed::pair_of_five 4}}
<div class="template-roll-between"><span class="template-roll-dice">5</span></div>
{{/rollGreater() computed::pair_of_five 4}}
{{#rollGreater() computed::pair_of_five 5}}
<div class="template-roll-between"><span class="template-roll-dice">5</span></div>
{{/rollGreater() computed::pair_of_five 5}}
</div>
{{/rollGreater() computed::pair_of_five 1}}
{{#rollGreater() computed::pair_of_six 1}}
<div class="template-grid-item">
<div class="template-roll-between"><span class="template-roll-dice">6</span></div>
<div class="template-roll-between"><span class="template-roll-dice">6</span></div>
{{#rollGreater() computed::pair_of_six 2}}
<div class="template-roll-between"><span class="template-roll-dice">6</span></div>
{{/rollGreater() computed::pair_of_six 2}}
{{#rollGreater() computed::pair_of_six 3}}
<div class="template-roll-between"><span class="template-roll-dice">6</span></div>
{{/rollGreater() computed::pair_of_six 3}}
{{#rollGreater() computed::pair_of_six 4}}
<div class="template-roll-between"><span class="template-roll-dice">6</span></div>
{{/rollGreater() computed::pair_of_six 4}}
{{#rollGreater() computed::pair_of_six 5}}
<div class="template-roll-between"><span class="template-roll-dice">6</span></div>
{{/rollGreater() computed::pair_of_six 5}}
</div>
{{/rollGreater() computed::pair_of_six 1}}
{{#rollGreater() computed::base_dice_1 0}}
<div class="template-grid-item">
<div class="template-roll-between"><span class="template-roll-dice">1</span></div>
</div>
{{/rollGreater() computed::base_dice_1 0}}
{{#rollGreater() computed::base_dice_2 0}}
<div class="template-grid-item">
<div class="template-roll-between"><span class="template-roll-dice">2</span></div>
</div>
{{/rollGreater() computed::base_dice_2 0}}
{{#rollGreater() computed::base_dice_3 0}}
<div class="template-grid-item">
<div class="template-roll-between"><span class="template-roll-dice">3</span></div>
</div>
{{/rollGreater() computed::base_dice_3 0}}
{{#rollGreater() computed::base_dice_4 0}}
<div class="template-grid-item">
<div class="template-roll-between"><span class="template-roll-dice">4</span></div>
</div>
{{/rollGreater() computed::base_dice_4 0}}
{{#rollGreater() computed::base_dice_5 0}}
<div class="template-grid-item">
<div class="template-roll-between"><span class="template-roll-dice">5</span></div>
</div>
{{/rollGreater() computed::base_dice_5 0}}
{{#rollGreater() computed::base_dice_6 0}}
<div class="template-grid-item">
<div class="template-roll-between"><span class="template-roll-dice">6</span></div>
</div>
{{/rollGreater() computed::base_dice_6 0}}
</div>
{{#rollGreater() computed::riskLost 0}}
<div class="template-grid-item-flex">
<label class="template-small-label sheet-red" data-i18n="you-lost-one-success">You lost one success</label>
</div>
{{/rollGreater() computed::riskLost 0}}
{{#rollGreater() computed::allOrNothingLost 0}}
<div class="template-grid-item-flex">
<label class="template-small-label sheet-red" data-i18n="you-lost-all-your-successes">You lost all your successes</label>
</div>
{{/rollGreater() computed::allOrNothingLost 0}}
<div class="template-dice-stats">
<div><span data-i18n="basic">Basic</span> {{computed::basic}}</div>
<div><span data-i18n="critical">Critical</span> {{computed::critical}}</div>
</div>
<div class="template-dice-stats">
<div><span data-i18n="extreme">Extreme</span> {{computed::extreme}}</div>
<div><span data-i18n="impossible">Impossible</span> {{computed::impossible}}</div>
</div>
{{#rollGreater() computed::what_a_hero 0}}
<div class="sheet-template-subtitle sheet-green" data-i18n="what-a-hero">What a hero!</div>
{{/rollGreater() computed::what_a_hero 0}}
{{#rollGreater() computed::dice_for_reroll 0}}
<div class="template-dice-actions">
{{#expertise}}
<div>
<div class="template-button">
[<span data-i18n="i-have-expertise"></span>](~{{character_name}}|roll||expertise|{{attribute}}|{{skill}}|{{baseDice}}|{{computed::dice_for_reroll}})
</div>
</div>
{{/expertise}}
{{#risk}}
{{#rollGreater() computed::any_success 0}}
<div>
<div class="template-button">
[<span data-i18n="risk"></span>](~{{character_name}}|roll||risk|{{attribute}}|{{skill}}|{{baseDice}}|{{computed::dice_for_reroll}})
</div>
</div>
{{/rollGreater() computed::any_success 0}}
{{/risk}}
{{#all_or_nothing}}
<div>
<div class="template-button">
[<span data-i18n="all-or-nothing"></span>](~{{character_name}}|roll||allOrNothing|{{attribute}}|{{skill}}|{{baseDice}}|{{computed::dice_for_reroll}})
</div>
</div>
{{/all_or_nothing}}
</div>
{{/rollGreater() computed::dice_for_reroll 0}}
</div>
</rolltemplate>
<script type="text/worker">
const stats = ["action", "fight", "leadership", "stunt", "guts", "cool", "drive", "shoot", "knowledge", "culture", "first_aid", "tech", "society", "charm", "eloquence", "observation", "wild", "scout", "survival", "tough", "crime", "caution", "dexterity", "stealth"];
stats.forEach(stat => {
on(`change:${stat}`, () => {
getAttrs([stat], values => {
const stat_base = values[stat];
getAttrs([`${stat}_calc`], function(test) {
setAttrs({
[`${stat}_calc`]: stat_base
});
});
});
});
});
const savedDiceAttr = ["dice_for_reroll", "pair_one_sum", "pair_two_sum", "pair_three_sum", "pair_four_sum", "pair_five_sum", "pair_six_sum"];
on('clicked:roll', async (info) => {
var risk = true;
var riskTitle = '';
var runRiskFunc = false;
var expertise = true;
var expertiseTitle = '';
var runExpertiseFunc = false;
var allOrNothing = '';
var allOrNothingTitle = '';
var runAllOrNothingFunc = false;
var attribute = info.htmlAttributes['data-attribute'];
var skill = info.htmlAttributes['data-skill'];
if (skill == '') {
skill = 'null';
}
var baseDiceTotal = '@{'+attribute+'_calc} + @{'+skill+'_calc} + @{'+attribute+'_modifier} + ?{Modifiers|0}';
var baseDiceTotalToRoll = baseDiceTotal;
if (info.originalRollId != null) {
var attr_and_skill = info.originalRollId.split('|');
var action = attr_and_skill[0];
if (action == 'expertise') {
expertiseTitle = "{{expertise_title=^{i-have-expertise} }}";
expertise = '';
runExpertiseFunc = true;
risk = '';
allOrNothing = true;
} else if(action == 'risk') {
riskTitle = "{{risk_title=^{risk} }}";
risk = '';
runRiskFunc = true;
expertise = '';
allOrNothing = true;
} else if(action == 'allOrNothing') {
allOrNothingTitle = "{{all_or_nothing_title=^{all-or-nothing} }}";
allOrNothing = '';
runAllOrNothingFunc = true;
expertise = '';
risk = '';
}
attribute = attr_and_skill[1];
skill = attr_and_skill[2];
baseDiceTotal = attr_and_skill[3];
baseDiceTotalToRoll = attr_and_skill[4].split("'>")[1];
}
if (skill == 'null') {
var rollName = attribute;
} else {
var rollName = skill;
}
const rollBase = '@{secret_roll} &{template:brokencompass} {{character_name=@{character_name}}} {{character_id=@{character_id}}} {{attribute='+attribute+'}} {{skill='+skill+'}} {{risk='+risk+'}} '+riskTitle+' {{expertise='+expertise+'}} '+expertiseTitle+' {{roll-name=^{'+rollName+'} }} {{baseDice=[[ '+baseDiceTotal+' ]] }} {{dices=[[('+baseDiceTotalToRoll+')d6m]]}} {{pair_of_one=[[1d6]]}} {{pair_of_two=[[1d6]]}} {{pair_of_three=[[1d6]]}} {{pair_of_four=[[1d6]]}} {{pair_of_five=[[1d6]]}} {{pair_of_six=[[1d6]]}} {{basic=[[1d6]]}} {{critical=[[1d6]]}} {{extreme=[[1d6]]}} {{impossible=[[1d6]]}} {{what_a_hero=[[1d6]]}} {{base_dice_1=[[1d6]]}} {{base_dice_2=[[1d6]]}} {{base_dice_3=[[1d6]]}} {{base_dice_4=[[1d6]]}} {{base_dice_5=[[1d6]]}} {{base_dice_6=[[1d6]]}} {{previous_pairs=@{pair_one_sum}}} {{any_success=[[1d6]]}} {{dice_for_reroll=[[1d6]]}} {{riskLost=[[1d6]]}} {{all_or_nothing='+allOrNothing+'}} {{allOrNothingLost=[[1d6]]}}' + allOrNothingTitle;
let rollResult = await startRoll(rollBase);
let tableOfPairs = await calcDice(rollResult);
let removeSuccess = false;
if (runRiskFunc) {
removeSuccess = await riskTaken(tableOfPairs);
}
let removeAllSuccesses = false;
if (runAllOrNothingFunc) {
removeAllSuccesses = await riskTaken(tableOfPairs);
}
if (runExpertiseFunc || runRiskFunc || runAllOrNothingFunc) {
tableOfPairs = await mergeWithSavedDice(tableOfPairs);
}
let computedValues = await calcComputedValues(tableOfPairs, removeSuccess, removeAllSuccesses);
if (!runExpertiseFunc && !runRiskFunc) {
await updateSavedDiceAttr(computedValues, tableOfPairs);
}
finishRoll(
rollResult.rollId,
computedValues
);
});
// Update attr for expertise
const updateSavedDiceAttr = async (computedValues, tableOfPairs) => {
savedDiceAttr.forEach((attr, index) => {
if (index == 0) {
setAttrs({
[`${attr}`]: computedValues.dice_for_reroll
});
} else {
setAttrs({
[`${attr}`]: tableOfPairs[index]
});
}
});
}
// Get saved dices
const getSavedDiceAttr = async () => {
var savedDiceTable = await asw.getAttrs(savedDiceAttr);
savedDiceTable = Object.values(savedDiceTable);
return savedDiceTable;
}
// Helper for calc dice table
const calcDice = async (rollResult, expertise) => {
const dices = rollResult.results.dices.dice;
var table = [0,0,0,0,0,0,0];
for (i = 0; dices.length > i; i++) {
table[dices[i]] += 1;
}
return table;
}
// Helper for risk taken
const riskTaken = async (table) => {
var savedDiceTable = await getSavedDiceAttr();
var removeSuccess = true;
for (k = 1; table.length > k; k++) {
if (table[k] > 0 && savedDiceTable[k] > 1) {
removeSuccess = false;
} else if (table[k] > 1) {
removeSuccess = false;
}
}
return removeSuccess;
}
// helper for merging saved dices
const mergeWithSavedDice = async (table) => {
var savedDiceTable = await getSavedDiceAttr();
for (j = 1; savedDiceTable.length > j; j++) {
if (savedDiceTable[j] > 1) {
table[j] += savedDiceTable[j];
}
}
return table;
}
// Helper for calc computed values
const calcComputedValues = async (table, removeSuccess, removeAllSuccesses) => {
var success = { basic: 0, critical: 0, extreme: 0, impossible: 0, what_a_hero: 0 };
var rest_dices = { 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0 };
var dice_for_reroll = 0;
var any_success = 0;
var allOrNothingLost = 0;
if (!removeAllSuccesses) {
for (k = 1; table.length > k; k++) {
if (table[k] === 1) {
rest_dices[k] = k;
dice_for_reroll += 1;
} else if(table[k] >= 2) {
any_success += 1;
if (table[k] === 2) {
success.basic++;
} else if (table[k] === 3) {
success.critical++;
} else if (table[k] === 4) {
success.extreme++;
} else if (table[k] === 5) {
success.impossible++;
} else if (table[k] >= 6) {
success.what_a_hero++;
}
}
}
} else {
allOrNothingLost = 1;
for (k = 1; table.length > k; k++) {
if (table[k] === 1) {
rest_dices[k] = k;
}
}
}
var riskLost = 0;
if (removeSuccess) {
riskLost = 1;
if (success.basic > 0) {
success.basic--;
} else if (success.critical > 0) {
success.critical--;
} else if (success.extreme > 0) {
success.extreme--;
} else if (success.impossible > 0) {
success.impossible--;
} else if (success.what_a_hero > 0) {
success.what_a_hero--;
}
}
let results = {
pair_of_one: table[1],
pair_of_two: table[2],
pair_of_three: table[3],
pair_of_four: table[4],
pair_of_five: table[5],
pair_of_six: table[6],
basic: success.basic,
critical: success.critical,
extreme: success.extreme,
impossible: success.impossible,
what_a_hero: success.what_a_hero,
base_dice_1: rest_dices[1],
base_dice_2: rest_dices[2],
base_dice_3: rest_dices[3],
base_dice_4: rest_dices[4],
base_dice_5: rest_dices[5],
base_dice_6: rest_dices[6],
dice_for_reroll: dice_for_reroll,
any_success: any_success,
riskLost: riskLost,
allOrNothingLost: allOrNothingLost,
};
return results;
}
const asw = (() => {
const setActiveCharacterId = function(charId){
let oldAcid=getActiveCharacterId();
let ev = new CustomEvent("message");
ev.data={"id":"0", "type":"setActiveCharacter", "data":charId};
self.dispatchEvent(ev);
return oldAcid;
};
const promisifyWorker = (worker, parameters) => {
let acid=getActiveCharacterId();
let prevAcid=null;
return new Promise((res,rej)=>{
prevAcid=setActiveCharacterId(acid);
try {if (worker===0) getAttrs(parameters[0]||[],(v)=>res(v));
else if (worker===1) setAttrs(parameters[0]||{}, parameters[1]||{},(v)=>res(v));
else if (worker===2) getSectionIDs(parameters[0]||'',(v)=>res(v));
} catch(err) {rej(console.error(err))}
}).finally(()=>setActiveCharacterId(prevAcid));
}
return {
getAttrs(attrArray) {return promisifyWorker(0, [attrArray])},
setAttrs(attrObj, options) {return promisifyWorker(1, [attrObj, options])},
getSectionIDs(section) {return promisifyWorker(2, [section])},
setActiveCharacterId,
}
})();
</script>