diff --git a/Ironsworn/src/components/moves/mixins/container.pug b/Ironsworn/src/components/moves/mixins/container.pug index 0a9bb53b06..6d46d693d7 100644 --- a/Ironsworn/src/components/moves/mixins/container.pug +++ b/Ironsworn/src/components/moves/mixins/container.pug @@ -1,3 +1,56 @@ +mixin progressRoll(opts) + button( + type="roll" + title=opts.title + name=`roll${opts.name}` + class='hide' + value=`&{template:ironsworn_progress} {{header=@{character_name}}} {{progress_name=${opts.title}}} {{progress=[[?{Filled Progress|0}]]}} {{challenge1=[[d10]]}} {{challenge2=[[d10]]}}` + ) + +mixin oracleRoll(opts) + button( + type="roll" + title=opts.title + name=`roll${opts.name}` + class='hide' + value=`&{template:${opts.type}} {{header=${opts.title}}} {{${opts.name}=[[d100]]}}` + ) + +mixin rarityRoll(opts) + button( + type="roll" + title=`${opts.title} Move` + class='hide' + name=`roll${opts.name}` + value!=`&{template:ironsworn_moves} {{header=@{character_name}}} {{name=${opts.title}}} {{rarityAction=[[d6+${opts.stat}+(?{Modifier|0})]]}} {{negate1=[[1+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate2=[[2+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate3=[[3+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate4=[[4+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate5=[[5+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate6=[[6+${opts.stat_repeat}+(?{Modifier|0})]]}} {{challenge1=[[d10]]}} {{challenge2=[[d10]]}} {{momentum=[[@{momentum}]]}} {{modifiers=[[${opts.stat_repeat}+(?{Modifier|0})]]}} {{add=[[(?{Modifier|0})]]}} {{stat=[[${opts.stat_repeat}]]}} {{rarityDie6=[[6+${opts.stat_repeat}+(?{Modifier|0})]]}} {{rarityDie5=[[5+${opts.stat_repeat}+(?{Modifier|0})]]}} {{rarityDie1=[[1+${opts.stat_repeat}+(?{Modifier|0})]]}}` + ) + +mixin owlRoll(opts) + button( + type="roll" + title=`${opts.title} Move` + class='hide' + name=`roll${opts.name}` + value!=`&{template:ironsworn_moves} {{header=@{character_name}}} {{name=${opts.title}}} {{action=[[d6+${opts.stat}+(?{Modifier|0})]]}} {{owl=[[?{Owl Companion|No,0|Yes,?{Owl's Health|0}}]]}} {{negate1=[[1+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate2=[[2+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate3=[[3+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate4=[[4+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate5=[[5+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate6=[[6+${opts.stat_repeat}+(?{Modifier|0})]]}} {{challenge1=[[d10]]}} {{challenge2=[[d10]]}} {{momentum=[[@{momentum}+(?{Owl Companion})]]}} {{modifiers=[[${opts.stat_repeat}+(?{Modifier|0})]]}} {{add=[[(?{Modifier|0})]]}} {{stat=[[${opts.stat_repeat}]]}}` + ) + +mixin movesRoll(opts) + button( + type="roll" + title=`${opts.title} Move` + class='hide' + name=`roll${opts.name}` + value!=`&{template:ironsworn_moves} {{header=@{character_name}}} {{name=${opts.title}}} {{action=[[d6+${opts.stat}+(?{Modifier|0})]]}} {{negate1=[[1+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate2=[[2+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate3=[[3+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate4=[[4+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate5=[[5+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate6=[[6+${opts.stat_repeat}+(?{Modifier|0})]]}} {{challenge1=[[d10]]}} {{challenge2=[[d10]]}} {{momentum=[[@{momentum}]]}} {{modifiers=[[${opts.stat_repeat}+(?{Modifier|0})]]}} {{add=[[(?{Modifier|0})]]}} {{stat=[[${opts.stat_repeat}]]}}` + ) + +mixin rollLabel + label.roll-label Roll + block + +mixin rollListLabel + label.roll-list-label Roll + block + mixin container(opts) input(type='radio' name='attr_move_preview' class=`${opts.class} hide` value=opts.radio) div(class=`${opts.class} showhide`) @@ -5,50 +58,37 @@ mixin container(opts) if opts.roll div.roll-viewer if opts.progress - label.roll-label Roll Progress - button( - type="roll" - title=opts.title - name=`roll${opts.name}` - class='hide' - value=`&{template:ironsworn_progress} {{header=@{character_name}}} {{progress_name=${opts.title}}} {{progress=[[?{Filled Progress|0}]]}} {{challenge1=[[d10]]}} {{challenge2=[[d10]]}}` - ) + +rollLabel + +progressRoll(opts) else if opts.oracle - label.roll-label Roll Oracle - button( - type="roll" - title=opts.title - name=`roll${opts.name}` - class='hide' - value=`&{template:${opts.type}} {{header=${opts.title}}} {{${opts.name}=[[d100]]}}` - ) + +rollLabel + +oracleRoll(opts) else if opts.rarity - label.roll-label Roll - button( - type="roll" - title=`${opts.title} Move` - class='hide' - name=`roll${opts.name}` - value!=`&{template:ironsworn_moves} {{header=@{character_name}}} {{name=${opts.title}}} {{rarityAction=[[d6+${opts.stat}+(?{Modifier|0})]]}} {{negate1=[[1+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate2=[[2+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate3=[[3+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate4=[[4+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate5=[[5+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate6=[[6+${opts.stat_repeat}+(?{Modifier|0})]]}} {{challenge1=[[d10]]}} {{challenge2=[[d10]]}} {{momentum=[[@{momentum}]]}} {{modifiers=[[${opts.stat_repeat}+(?{Modifier|0})]]}} {{add=[[(?{Modifier|0})]]}} {{stat=[[${opts.stat_repeat}]]}} {{rarityDie6=[[6+${opts.stat_repeat}+(?{Modifier|0})]]}} {{rarityDie5=[[5+${opts.stat_repeat}+(?{Modifier|0})]]}} {{rarityDie1=[[1+${opts.stat_repeat}+(?{Modifier|0})]]}}` - ) + +rollLabel + +rarityRoll(opts) else if opts.owl - label.roll-label Roll - button( - type="roll" - title=`${opts.title} Move` - class='hide' - name=`roll${opts.name}` - value!=`&{template:ironsworn_moves} {{header=@{character_name}}} {{name=${opts.title}}} {{action=[[d6+${opts.stat}+(?{Modifier|0})]]}} {{owl=[[?{Owl Companion|No,0|Yes,?{Owl's Health|0}}]]}} {{negate1=[[1+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate2=[[2+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate3=[[3+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate4=[[4+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate5=[[5+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate6=[[6+${opts.stat_repeat}+(?{Modifier|0})]]}} {{challenge1=[[d10]]}} {{challenge2=[[d10]]}} {{momentum=[[@{momentum}+(?{Owl Companion})]]}} {{modifiers=[[${opts.stat_repeat}+(?{Modifier|0})]]}} {{add=[[(?{Modifier|0})]]}} {{stat=[[${opts.stat_repeat}]]}}` - ) + +rollLabel + +owlRoll(opts) else - label.roll-label Roll - button( - type="roll" - title=`${opts.title} Move` - class='hide' - name=`roll${opts.name}` - value!=`&{template:ironsworn_moves} {{header=@{character_name}}} {{name=${opts.title}}} {{action=[[d6+${opts.stat}+(?{Modifier|0})]]}} {{negate1=[[1+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate2=[[2+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate3=[[3+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate4=[[4+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate5=[[5+${opts.stat_repeat}+(?{Modifier|0})]]}} {{negate6=[[6+${opts.stat_repeat}+(?{Modifier|0})]]}} {{challenge1=[[d10]]}} {{challenge2=[[d10]]}} {{momentum=[[@{momentum}]]}} {{modifiers=[[${opts.stat_repeat}+(?{Modifier|0})]]}} {{add=[[(?{Modifier|0})]]}} {{stat=[[${opts.stat_repeat}]]}}` - ) + +rollLabel + +movesRoll(opts) div.move-description block - div.oracle-footer.move-page-footer=opts.page \ No newline at end of file + div.oracle-footer.move-page-footer=opts.page + +mixin listButton(opts) + if opts.progress + +rollListLabel + +progressRoll(opts) + else if opts.oracle + +rollListLabel + +oracleRoll(opts) + else if opts.rarity + +rollListLabel + +rarityRoll(opts) + else if opts.owl + +rollListLabel + +owlRoll(opts) + else + +rollListLabel + +movesRoll(opts) \ No newline at end of file diff --git a/Ironsworn/src/components/moves/moves.pug b/Ironsworn/src/components/moves/moves.pug index 011770b55b..484f85d6d7 100644 --- a/Ironsworn/src/components/moves/moves.pug +++ b/Ironsworn/src/components/moves/moves.pug @@ -33,6 +33,7 @@ input(type='radio' class='hide full-move-list' name='attr_move_view' value='1' c h3=group.title each move in group.moves .move-list + +listButton(moveList[move.value]) label.move input(type='radio' class='hide selected-move' name='attr_selected_move' value=move.value) input(type='checkbox' class='hide move-highlight' name=`attr_${move.value}_highlight`) diff --git a/Ironsworn/src/workers/scripts/stats.js b/Ironsworn/src/workers/scripts/stats.js index dc5690a488..d6dc24c31c 100644 --- a/Ironsworn/src/workers/scripts/stats.js +++ b/Ironsworn/src/workers/scripts/stats.js @@ -1,18 +1,3 @@ -//Reset Health if set above Max -on('change:health', function(healthChange) { - getAttrs(["max_health"], function(values) { - if (parseInt(healthChange.newValue) > parseInt(values.max_health)) { - setAttrs({health: values.max_health}); - } - }); -}); - -on('change:health_reset', function() { - getAttrs(["max_health"], function(values) { - setAttrs({health: values.max_health}); - }); -}); - //Cannot increase Health while Wounded //Health reaching 0 marks Wounded on('change:health', function(eventinfo) { @@ -40,50 +25,12 @@ on('change:spirit', function(eventinfo) { //Cannot increase Supply while Unprepared //Supply reaching 0 marks Unprepared on('change:supply', function(eventinfo) { - getAttrs(["unprepared"], function(values) { + getAttrs(["debilUnprepared"], function(values) { if(values.unprepared == "on") { if (parseInt(eventinfo.newValue) > parseInt(eventinfo.previousValue)) { setAttrs({supply: eventinfo.previousValue}); } } }); - if (parseInt(eventinfo.newValue) === 0) setAttrs({unprepared_button: "on"}); + if (parseInt(eventinfo.newValue) === 0) setAttrs({debilUnprepared: "on"}); }); - -// Edge sets Speed value -on('change:edge', function(eventinfo) { - setAttrs({speed: speedValues[eventinfo.newValue].full}); -}); - -const speedValues = { - '8': { full: '40ft/20ft. 12m/6m. 8/4', imperial: '40ft/20ft', metric: '12 m/6 m. ', units: '8/4' }, - '7': { full: '40ft/20ft. 12m/6m. 8/4', imperial: '40ft/20ft',metric: '12m/6m. ', units: '8/4' }, - '6': { full: '35ft/15ft. 10.5m/4.5m. 7/3', imperial: '35ft/15ft',metric: '10.5m/4.5m.', units: '7/3' }, - '5': { full: '35ft/15ft. 10.5m/4.5m. 7/3', imperial: '35ft/15ft',metric: '10.5m/4.5m.', units: '7/3' }, - '4': { full: '30ft/15ft. 9m/4.5m. 6/3', imperial: '30ft/15ft',metric: '9m/4.5m.', units: '6/3' }, - '3': { full: '30ft/15ft. 9m/4.5m. 6/3', imperial: '30ft/15ft',metric: '9m/4.5m.', units: '6/3' }, - '2': { full: '25ft/10ft. 7.5m/3m. 5/2', imperial: '25ft/10ft',metric: '7.5m/3m.', units: '5/2' }, - '1': { full: '25ft/10ft. 7.5m/3m. 5/2', imperial: '25ft/10ft',metric: '7.5m/3m.', units: '5/2' }, - '0': { full: '25ft/10ft. 7.5m/3m. 5/2', imperial: '25ft/10ft',metric: '7.5m/3m.', units: '5/2' } -} - -// Heart sets Resilience value -on('change:heart', function(eventinfo) { - let resValue = parseInt(eventinfo.newValue) + 1 - setAttrs({resilience: resValue}); -}); - -// Iron sets Max Load value -on('change:iron', function(eventinfo) { - let loadValue = parseInt(eventinfo.newValue) + 4 - setAttrs({max_load: loadValue}); -}); - -// Setting Encumbered if load is over max -on('change:load', function(eventinfo) { - getAttrs(['max_load'], function(values) { - if (parseInt(eventinfo.newValue) > parseInt(values.max_load)) { - setAttrs({encumbered: 'on'}); - } - }); -}); \ No newline at end of file