diff --git a/Tales from the Loop Official/src/js/sheetworkers.js b/Tales from the Loop Official/src/js/sheetworkers.js index 7334b7f65f..bd0986c742 100644 --- a/Tales from the Loop Official/src/js/sheetworkers.js +++ b/Tales from the Loop Official/src/js/sheetworkers.js @@ -1,17 +1,18 @@ on("sheet:opened", eventInfo => { - getAttrs(["sheet_version"], values => { - if (values["sheet_version"] !== "1") { + getAttrs(["sheet_version",], values => { + if (+values["sheet_version"] < 1) { getAttrs(["song", "iconic", "totalluck"], values => { - const set_attrs = {}; - - set_attrs["favourite_song"] = values["song"]; - set_attrs["iconic_item"] = values["iconic"]; - set_attrs["luck_max"] = values["totalluck"]; - set_attrs["sheet_version"] = 1; - - setAttrs(set_attrs); + const {song, iconic, totalluck} = values || false; + const updateAttrs = {}; + if (song && iconic && totalluck) { + updateAttrs["favourite_song"] = values["song"]; + updateAttrs["iconic_item"] = values["iconic"]; + updateAttrs["luck_max"] = values["totalluck"]; + } + updateAttrs["sheet_version"] = "1"; + setAttrs(updateAttrs); }) } - }) + }); }); \ No newline at end of file diff --git a/Tales from the Loop Official/src/pug/rolltemplates.pug b/Tales from the Loop Official/src/pug/rolltemplates.pug index 59dce708c4..8f7147d7c2 100644 --- a/Tales from the Loop Official/src/pug/rolltemplates.pug +++ b/Tales from the Loop Official/src/pug/rolltemplates.pug @@ -62,9 +62,16 @@ rolltemplate.sheet-rolltemplate-tftl span ({{broken}}) | {{/rollGreater() broken 0}} .sheet-tftl-roll + | {{#rollGreater() pool_size 0}} span {{roll}} span Successes + | {{/rollGreater() pool_size 0}} + | {{#^rollGreater() pool_size 0}} + span {{min1}} + span Successes + | {{/^rollGreater() pool_size 0}} .sheet-tftl-buttons + | {{#rollGreater() pool_size 0}} | {{#reroll1}} each number in [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] | {{#rollTotal() roll #{number}}} @@ -72,4 +79,8 @@ rolltemplate.sheet-rolltemplate-tftl | {{/rollTotal() roll #{number}}} .sheet-tftl-buttontext(data-i18n="Spend a point of luck, or take a condition") Spend a point of luck, or take a condition | {{/reroll1}} + | {{/rollGreater() pool_size 0}} + | {{#^rollGreater() pool_size 0}} + | {{reroll_only1}} + | {{/^rollGreater() pool_size 0}} .sheet-tftl-footer \ No newline at end of file diff --git a/Tales from the Loop Official/src/pug/tftl.pug b/Tales from the Loop Official/src/pug/tftl.pug index 02812441bd..59e6a84e15 100644 --- a/Tales from the Loop Official/src/pug/tftl.pug +++ b/Tales from the Loop Official/src/pug/tftl.pug @@ -5,12 +5,23 @@ each number in [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] `{{name=Reroll}}`, `{{character_name=@{character_name}}}`, `{{reroll_dice=${number}}}`, + `{{pool_size=[[${number}+0]]}}`, `{{roll=[[${number}d6>6]]}}`, ].join(" "); - button.hidden(name=`roll_reroll${number}`, type="roll", value=reroll) + button.sheet-hidden(name=`roll_reroll${number}`, type="roll", value=reroll) +- + const reroll1 = [ + `&{template:tftl}`, + `{{name=Reroll}}`, + `{{character_name=@{character_name}}}`, + `{{reroll_dice=1}}`, + `{{pool_size=[[1]]}}`, + `{{roll=[[1d6>6]]}}`, + ].join(" "); +button.sheet-hidden(name=`roll_rerollonly1`, type="roll", value=reroll1) input(data-i18n-value="Reroll", name="attr_translation_luck", type="hidden", value="Reroll") -input(name="attr_sheet_version", type="hidden") +input(name="attr_sheet_version", type="hidden", value="1") .tftl-wrapper .tftl-logo @@ -27,6 +38,8 @@ input(name="attr_sheet_version", type="hidden") `{{name=${attribute}}}`, `{{character_name=@{character_name}}}`, `{{roll=[[[[@{${attribute.toLowerCase()}}+?{Bonus Dice|0}-@{upset}-@{scared}-@{exhausted}-@{injured}-@{broken}]]d6>6]]}}`, + `{{pool_size=[[@{${attribute.toLowerCase()}}+?{Bonus Dice|0}-@{upset}-@{scared}-@{exhausted}-@{injured}-@{broken}]]}}`, + `{{min1=[[1d6>6]]}}`, `{{stat_value=@{${attribute.toLowerCase()}}}}`, `{{stat_title=${attribute.toLowerCase()}}}`, `{{bonus_dice=?{Bonus Dice|0}}}`, @@ -35,6 +48,7 @@ input(name="attr_sheet_version", type="hidden") `{{exhausted=[[@{exhausted}]]}}`, `{{injured=[[@{injured}]]}}`, `{{broken=[[@{broken}]]}}`, + `{{reroll_only1=[@{translation_luck}](~@{character_id}|rerollonly1)}}`, ],...button_array].join(" "); .tftl-panel__row(class=`background-rand-${Math.floor(Math.random() * 10)+1}`) button.tftl-panel__label--button(data-i18n=attribute, type="roll", value=roll)=attribute @@ -58,6 +72,8 @@ input(name="attr_sheet_version", type="hidden") `{{name=${skill.name}}}`, `{{character_name=@{character_name}}}`, `{{roll=[[[[@{${skill.stat.toLowerCase()}}+@{${skill.name.toLowerCase()}}+?{Bonus Dice|0}-@{upset}-@{scared}-@{exhausted}-@{injured}-@{broken}]]d6>6]]}}`, + `{{pool_size=[[@{${skill.stat.toLowerCase()}}+@{${skill.name.toLowerCase()}}+?{Bonus Dice|0}-@{upset}-@{scared}-@{exhausted}-@{injured}-@{broken}]]}}`, + `{{min1=[[1d6>6]]}}`, `{{stat_value=@{${skill.stat.toLowerCase()}}}}`, `{{stat_title=${skill.stat.toLowerCase()}}}`, `{{skill_value=@{${skill.name.toLowerCase()}}}}`, diff --git a/Tales from the Loop Official/tftl.css b/Tales from the Loop Official/tftl.css index 37d1112fbc..50d6df83c2 100644 --- a/Tales from the Loop Official/tftl.css +++ b/Tales from the Loop Official/tftl.css @@ -1,4 +1,5 @@ @import url("https://fonts.googleapis.com/css?family=Catamaran:800|Montserrat:700|Baltimore%20Typewriter:400|&display=swap"); + .sheet-hidden { display: none; } diff --git a/Tales from the Loop Official/tftl.html b/Tales from the Loop Official/tftl.html index f3c61455de..54349c464b 100644 --- a/Tales from the Loop Official/tftl.html +++ b/Tales from the Loop Official/tftl.html @@ -1,126 +1,127 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - +
