Files
roll20-character-sheets/OperaRPG/operarpg.html
T
2020-12-10 17:16:43 -05:00

1800 lines
74 KiB
HTML

<div class="main-container">
<!-- Header -->
<div class="header">
<div class="logo main-font">
<img
src="https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/OperaRPG/assets/logo_opera.png" />
</div>
<div class="flex-column grow">
<div class="header-row">
<span class="label secondary-font" data-i18n="name">Nome</span>
<input name="attr_character_name" type="text" title="@{character_name}" />
</div>
<div class="header-row">
<span class="label secondary-font" data-i18n="attribute_points">Pontos de Atributo</span>
<div class="header-grid row-item-margin">
<span class="column-header secondary-font" data-i18n="max">Max</span>
<span class="column-header secondary-font" data-i18n="used">Usado</span>
<input name="attr_max_attribute_points" type="number" title="@{max_attribute_points}" value="18" />
<input name="attr_used_attribute_points" type="number" disabled="true" title="@{used_attribute_points}"
value="@{charphysique} + @{chardexterity} + @{charintelligence}" />
</div>
<span class="label secondary-font" data-i18n="creation_points">Pontos de Criação</span>
<div class="header-grid">
<span class="column-header secondary-font" data-i18n="max">Max</span>
<span class="column-header secondary-font" data-i18n="used">Usado</span>
<input name="attr_max_creation_points" type="number" title="@{max_creation_points}" value="0" />
<input name="attr_used_creation_points" type="number" disabled="true" title="@{used_creation_points}"
value="@{powers_total_cost} + @{skills_total_cost} + @{features_total_cost} + @{fightcost}" />
</div>
</div>
</div>
</div>
<div class="header-row2">
<div class="actions header-box">
<div class="actions-label">
<span class="label secondary-font actions-label" data-i18n="physical_actions">Ações Físicas</span>
</div>
<div class="actions-grid">
<span class="column-header secondary-font" data-i18n="base">Base</span>
<span class="column-header secondary-font" data-i18n="effect">Efeito</span>
<span class="column-header secondary-font" data-i18n="total">Total</span>
<input name="attr_physical_actionsbase" type="number" title="@{physical_actionsbase}" value="2" />
<input name="attr_physical_actionseffect" type="text" readonly="true" title="@{physical_actionseffect}" />
<input name="attr_physical_actionstotal" type="number" disabled="true" title="@{physical_actionstotal}"
value="@{physical_actionsbase} @{physical_actionseffect}" />
</div>
</div>
<div class="actions header-box">
<div class="actions-label">
<span class="label secondary-font actions-label" data-i18n="mind_actions">Ações Mentais</span>
</div>
<div class="actions-grid">
<span class="column-header secondary-font" data-i18n="base">Base</span>
<span class="column-header secondary-font" data-i18n="effect">Efeito</span>
<span class="column-header secondary-font" data-i18n="total">Total</span>
<input name="attr_mind_actionsbase" type="number" title="@{mind_actionsbase}" value="2" />
<input name="attr_mind_actionseffect" type="text" readonly="true" title="@{mind_actionseffect}" />
<input name="attr_mind_actionstotal" type="number" disabled="true" title="@{mind_actionstotal}"
value="@{mind_actionsbase} @{mind_actionseffect}" />
</div>
</div>
<div class="init header-box">
<div class="actions-label">
<button type="roll" class="roll-button" name="roll_initiative_check" title="@{initiative_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{initiative}}} {{value=[[@{initiativetotal}]]}} {{result=[[2d6cs>2cf<5+@{initiativetotal}}+?{@{modifier}|0}]]}}"></button>
<span class="label secondary-font" data-i18n="initiative">Iniciativa</span>
</div>
<div class="init-grid">
<span class="column-header secondary-font" data-i18n="base">Base</span>
<span class="column-header secondary-font" data-i18n="effect">Effect</span>
<span class="column-header secondary-font" data-i18n="modifier">Mod</span>
<span class="column-header secondary-font" data-i18n="total">Total</span>
<input name="attr_initiativebase" type="number" disabled="true" title="@{initiativebase}"
value="@{chardexterity}" />
<input type="text" readonly="true" name="attr_initiativefeatureeffect" value="+0"
title="@{initiativefeatureeffect}">
<input name="attr_initiativemod" type="number" title="@{initiativemod}" value="0" />
<input name="attr_initiativetotal" type="number" disabled="true" title="@{initiativetotal}"
value="@{initiativebase} @{initiativefeatureeffect} + @{initiativemod}" />
</div>
</div>
<div class="dodge header-box">
<div class="actions-label">
<button type="roll" class="roll-button" name="roll_dodge_check" title="@{dodge_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{dodge}}} {{value=[[@{dodgetotal}]]}} {{result=[[2d6cs>2cf<5+@{dodgetotal}}+?{@{modifier}|0}]]}}"></button>
<span class="label secondary-font" data-i18n="dodge">Esquiva</span>
</div>
<div class="dodge-grid">
<span class="column-header secondary-font" data-i18n="base">Base</span>
<span class="column-header secondary-font" data-i18n="effect">Effect</span>
<span class="column-header secondary-font" data-i18n="fight">Briga</span>
<span class="column-header secondary-font" data-i18n="modifier">Mod</span>
<span class="column-header secondary-font" data-i18n="total">Total</span>
<input name="attr_dodgebase" type="number" disabled="true" title="@{dodgebase}" value="@{chardexterity}" />
<input type="text" readonly="true" name="attr_dodgefeatureeffect" value="+0" title="@{dodgefeatureeffect}">
<input name="attr_fightdodgebonus" type="number" readonly="true" title="@{fightdodgebonus}" value="0" />
<input name="attr_dodgemod" type="number" title="@{dodgemod}" value="0" />
<input name="attr_dodgetotal" type="number" disabled="true" title="@{dodgetotal}"
value="@{dodgebase} @{dodgefeatureeffect} + @{fightdodgebonus} + @{dodgemod}" />
</div>
</div>
<div class="header-box damage">
<span class="label secondary-font" data-i18n="physical_damage">Dano por Físico</span>
<input type="text" readonly="true" name="attr_physicaldamage" title="@{physicaldamage}" value="0" />
</div>
</div>
<!-- Tab navigation -->
<div class="tab-panel">
<button type="action" name="act_profile" data-i18n="profile">Perfil</button>
<button type="action" name="act_journal" data-i18n="journal">Diário</button>
<button type="action" name="act_configuration" data-i18n="configuration">Configuração</button>
</div>
<input type='hidden' class='tabcontrol' name='attr_tabcontrol' value='profile' />
<!-- Profile Tab -->
<div class="profiletab">
<!-- Middle -->
<div class="middle">
<!-- Middle column 1-->
<div class="middle-column">
<div class="box flex-column">
<span class="box-title main-font" data-i18n="attributes">Atributos</span>
<div class="attributes-grid">
<div></div>
<div></div>
<span class="column-header secondary-font" data-i18n="original">Orig</span>
<span class="column-header secondary-font special-mod" data-i18n="special_modifier">Mod Espec</span>
<!-- The Mod label actually references the effect field of the attributes -->
<span class="column-header secondary-font" data-i18n="modifier">Mod</span>
<span class="column-header secondary-font" data-i18n="damage">Dano</span>
<span class="column-header secondary-font" data-i18n="total">Total</span>
<button type="roll" class="roll-button" name="roll_physique_check" title="@{physique_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{physique}}} {{value=[[@{charphysique}]]}} {{result=[[?{@{normalorcontest} | @{normal}, 2d6cs<5cf>2 | @{contest}, 2d6cs>2cf<5+@{charphysique}}+?{@{modifier}|0}]]}}"></button>
<span class="label secondary-font" data-i18n="physique">Físico</span>
<input name="attr_charphysique" type="number" title="@{charphysique}" value="0" />
<select class="select" name="attr_charphysiquemodoperator" title="@{physiquemodoperator}">
<option value="*" selected="selected">x</option>
<option value="/">/</option>
</select>
<input name="attr_charphysiquemod" type="number" title="@{charphysiquemod}" value="0" />
<input name="attr_charphysicalfeatureeffect" type="text" readonly="true"
title="@{charphysicalfeatureeffect}" />
<input name="attr_charphysiquedamage" type="number" title="@{charphysiquedamage}" value="0" />
<input name="attr_charphysiquetotal" type="number" disabled="true" title="@{charphysiquetotal}"
value="floor(@{charphysique} @{charphysicalfeatureeffect}) - @{charphysiquedamage}" />
<button type="roll" class="roll-button" name="roll_dexterity_check" title="@{dexterity_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{dexterity}}} {{value=[[@{chardexterity}]]}} {{result=[[?{@{normalorcontest} | @{normal}, 2d6cs<5cf>2 | @{contest}, 2d6cs>2cf<5+@{chardexterity}}+?{@{modifier}|0}]]}}"></button>
<span class="label secondary-font" data-i18n="dexterity">Destreza</span>
<input name="attr_chardexterity" type="number" title="@{chardexterity}" value="0" />
<select class="select" name="attr_chardexteritymodoperator" title="@{dexteritymodoperator}">
<option value="*" selected="selected">x</option>
<option value="/">/</option>
</select>
<input name="attr_chardexteritymod" type="number" title="@{chardexteritymod}" value="0" />
<input name="attr_chardexterityfeatureeffect" type="text" readonly="true"
title="@{chardexterityfeatureeffect}" />
<input name="attr_chardexteritydamage" type="number" title="@{chardexteritydamage}" value="0" />
<input name="attr_chardexteritytotal" type="number" disabled="true" title="@{chardexteritytotal}"
value="floor(@{chardexterity} @{chardexterityfeatureeffect}) - @{chardexteritydamage}" />
<button type="roll" class="roll-button" name="roll_intelligence_check" title="@{intelligence_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{intelligence}}} {{value=[[@{charintelligence}]]}} {{result=[[?{@{normalorcontest} | @{normal}, 2d6cs<5cf>2 | @{contest}, 2d6cs>2cf<5+@{charintelligence}}+?{@{modifier}|0}]]}}"></button>
<span class="label secondary-font" data-i18n="intelligence">Inteligência</span>
<input name="attr_charintelligence" type="number" title="@{charintelligence}" value="0" />
<select class="select" name="attr_charintelligencemodoperator" title="@{intelligencemodoperator}">
<option value="*" selected="selected">x</option>
<option value="/">/</option>
</select>
<input name="attr_charintelligencemod" type="number" title="@{charintelligencemod}" value="0" />
<input name="attr_charintelligencefeatureeffect" type="text" readonly="true"
title="@{charintelligencefeatureeffect}" />
<input name="attr_charintelligencedamage" type="number" title="@{charintelligencedamage}" value="0" />
<input name="attr_charintelligencetotal" type="number" disabled="true" title="@{charintelligencetotal}"
value="floor(@{charintelligence} @{charintelligencefeatureeffect}) - @{charintelligencedamage}" />
<button type="roll" class="roll-button" name="roll_perception_check" title="@{perception_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{perception}}} {{value=[[@{charperception}]]}} {{result=[[?{@{normalorcontest} | @{normal}, 2d6cs<5cf>2 | @{contest}, 2d6cs>2cf<5+@{charperception}}+?{@{modifier}|0}]]}}"></button>
<span class="label secondary-font" data-i18n="perception">Percepção</span>
<input name="attr_charperception" type="number" title="@{charperception}" value="0" />
<select class="select" name="attr_charperceptionmodoperator" title="@{perceptionmodoperator}">
<option value="*" selected="selected">x</option>
<option value="/">/</option>
</select>
<input name="attr_charperceptionmod" type="number" title="@{charperceptionmod}" value="0" />
<input name="attr_charperceptionfeatureeffect" type="text" readonly="true"
title="@{charperceptionfeatureeffect}" />
<input name="attr_charperceptiondamage" type="number" title="@{charperceptiondamage}" value="0" />
<input name="attr_charperceptiontotal" type="number" disabled="true" title="@{charperceptiontotal}"
value="floor(@{charperception} @{charperceptionfeatureeffect}) - @{charperceptiondamage}" />
<button type="roll" class="roll-button" name="roll_will_check" title="@{will_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{will}}} {{value=[[@{charwill}]]}} {{result=[[?{@{normalorcontest} | @{normal}, 2d6cs<5cf>2 | @{contest}, 2d6cs>2cf<5+@{charwill}}+?{@{modifier}|0}]]}}"></button>
<span class="label secondary-font" data-i18n="will">Vontade</span>
<input name="attr_charwill" type="number" title="@{charwill}" value="6" />
<select class="select" name="attr_charwillmodoperator" title="@{willmodoperator}">
<option value="*" selected="selected">x</option>
<option value="/">/</option>
</select>
<input name="attr_charwillmod" type="number" title="@{charwillmod}" value="0" />
<input name="attr_charwillfeatureeffect" type="text" readonly="true" title="@{charwillfeatureeffect}" />
<input name="attr_charwilldamage" type="number" title="@{charwilldamage}" value="0" />
<input name="attr_charwilltotal" type="number" disabled="true" title="@{charwilltotal}"
value="floor(@{charwill} @{charwillfeatureeffect}) - @{charwilldamage}" />
<button type="roll" class="roll-button" name="roll_mind_check" title="@{mind_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{mind}}} {{value=[[@{charmind}]]}} {{result=[[?{@{normalorcontest} | @{normal}, 2d6cs<5cf>2 | @{contest}, 2d6cs>2cf<5+@{charmind}}+?{@{modifier}|0}]]}}"></button>
<span class="label secondary-font" data-i18n="mind">Mente</span>
<input name="attr_charmind" type="number" title="@{charmind}" value="8" />
<select class="select" name="attr_charmindmodoperator" title="@{mindmodoperator}">
<option value="*" selected="selected">x</option>
<option value="/">/</option>
</select>
<input name="attr_charmindmod" type="number" title="@{charmindmod}" value="0" />
<input name="attr_charmindfeatureeffect" type="text" readonly="true" title="@{charmindfeatureeffect}" />
<input name="attr_charminddamage" type="number" title="@{charminddamage}" value="0" />
<input name="attr_charmindtotal" type="number" disabled="true" title="@{charmindtotal}"
value="floor(@{charmind} @{charmindfeatureeffect}) - @{charminddamage}" />
<button type="roll" class="roll-button" name="roll_magic_check" title="@{magic_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{magic}}} {{value=[[@{charmagic}]]}} {{result=[[?{@{normalorcontest} | @{normal}, 2d6cs<5cf>2 | @{contest}, 2d6cs>2cf<5+@{charmagic}}+?{@{modifier}|0}]]}}"></button>
<span class="label secondary-font" data-i18n="magic">Magia</span>
<input name="attr_charmagic" type="number" title="@{charmagic}" value="0" />
<select class="select" name="attr_charmagicmodoperator" title="@{charmagicmodoperator}">
<option value="*" selected="selected">x</option>
<option value="/">/</option>
</select>
<input name="attr_charmagicmod" type="number" title="@{charmagicmod}" value="0" />
<input name="attr_charmagicfeatureeffect" type="text" readonly="true" title="@{charmagicfeatureeffect}" />
<input name="attr_charmagicdamage" type="number" title="@{charmagicdamage}" value="0" />
<input name="attr_charmagictotal" type="number" disabled="true" title="@{charmagictotal}"
value="floor(@{charmagic} @{charmagicfeatureeffect}) - @{charmagicdamage}" />
<button type="roll" class="roll-button" name="roll_luck_check" title="@{luck_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{luck}}} {{value=[[@{charluck}]]}} {{result=[[?{@{normalorcontest} | @{normal}, 2d6cs<5cf>2 | @{contest}, 2d6cs>2cf<5+@{charluck}}+?{@{modifier}|0}]]}}"></button>
<span class="label secondary-font" data-i18n="luck">Sorte</span>
<input name="attr_charluck" type="number" title="@{charluck}" value="0" />
<select class="select" name="attr_charluckmodoperator" title="@{luckmodoperator}">
<option value="*" selected="selected">x</option>
<option value="/">/</option>
</select>
<input name="attr_charluckmod" type="number" title="@{charluckmod}" value="0" />
<input name="attr_charluckfeatureeffect" type="text" readonly="true" title="@{charluckfeatureeffect}" />
<input name="attr_charluckdamage" type="number" title="@{charluckdamage}" value="0" />
<input name="attr_charlucktotal" type="number" disabled="true" title="@{charlucktotal}"
value="floor(@{charluck} @{charluckfeatureeffect}) - @{charluckdamage}" />
</div>
</div>
<div class="box flex-column">
<span class="box-title main-font" data-i18n="features">Características</span>
<div class="showhidebutton configtype corner-position">
<input type="checkbox" name="attr_features_showhide_checkbox" value="1" />
<span></span>
</div>
<!-- Hidden checkbox that controls show/hide section. See Sheet Workers-->
<input class="toggle-checkbox" type="checkbox" name="attr_features_showhide_checkbox_invisible" value="1" />
<div class="showhide">
<div class="select-hidden-grid">
<button type="action" class="add-button" name="act_ambidexterity"></button>
<span class="label secondary-font" data-i18n="ambidexterity">Ambidestria</span>
<button type="action" class="add-button" name="act_obvious_feature"></button>
<span class="label secondary-font" data-i18n="obvious_feature">Característica Óbvia</span>
<button type="action" class="add-button" name="act_contortion"></button>
<span class="label secondary-font" data-i18n="contortion" data-i18n-title="contortion-description"
title="Cada 2 níveis atribuí +1 de Esquiva">Contorcionismo</span>
<button type="action" class="add-button" name="act_slow_reflexes"></button>
<span class="label secondary-font" data-i18n="slow_reflexes" data-i18n-title="slow_reflexes-description"
title="Cada nível atribuí -1 de Esquiva">Reflexos Lentos</span>
<button type="action" class="add-button" name="act_fast_reflexes"></button>
<span class="label secondary-font" data-i18n="fast_reflexes" data-i18n-title="fast_reflexes-description"
title="Cada nível atribuí +1 de Esquiva">Reflexos Rápidos</span>
<button type="action" class="add-button" name="act_increased_senses"></button>
<span class="label secondary-font" data-i18n="increased_senses"
data-i18n-title="increased_senses-description" title="Cada nível atribuí +1 de Percepção">Sentidos
Ampliados</span>
<button type="action" class="add-button" name="act_reduced_senses"></button>
<span class="label secondary-font" data-i18n="reduced_senses" data-i18n-title="reduced_senses-description"
title="Cada nível atribuí -1 de Percepção">Sentidos Reduzidos</span>
<button type="action" class="add-button" name="act_increased_mind"></button>
<span class="label secondary-font" data-i18n="increased_mind" data-i18n-title="increased_mind-description"
title="Cada nível atribuí +1 de Mente">Ampliação Mental</span>
<button type="action" class="add-button" name="act_post"></button>
<span class="label secondary-font" data-i18n="post">Cargo</span>
<button type="action" class="add-button" name="act_readiness"></button>
<span class="label secondary-font" data-i18n="readiness">Prontidão</span>
<button type="action" class="add-button" name="act_reduced_mind"></button>
<span class="label secondary-font" data-i18n="reduced_mind" data-i18n-title="reduced_mind-description"
title="Cada nível atribuí -1 de Mente">Redução Mental</span>
<button type="action" class="add-button" name="act_strong_will"></button>
<span class="label secondary-font" data-i18n="strong_will" data-i18n-title="strong_will-description"
title="Cada nível atribuí +1 de Vontade">Vontade Forte</span>
<button type="action" class="add-button" name="act_weak_will"></button>
<span class="label secondary-font" data-i18n="weak_will" data-i18n-title="weak_will-description"
title="Cada nível atribuí -1 de Vontade">Vontade Fraca</span>
<button type="action" class="add-button" name="act_additional_limbs"></button>
<span class="label secondary-font" data-i18n="additional_limbs"
data-i18n-title="additional_limbs-description"
title="Cada dois níveis, atribuí a expressão “x(nível/2+1)” ao atributo Destreza. Adiciona seu (nível/2) ao número de ações físicas ao personagem">Membros
Adicionais</span>
<button type="action" class="add-button" name="act_increased_size"></button>
<span class="label secondary-font" data-i18n="increased_size" data-i18n-title="increased_size-description"
title="Comprada a partir do nível 2. Atribuí a expressão “x(nível)” ao atributo Físico">Tamanho
Ampliado</span>
<button type="action" class="add-button" name="act_reduced_size"></button>
<span class="label secondary-font" data-i18n="reduced_size" data-i18n-title="reduced_size-description"
title="Comprada a partir do nível 2. Atribuí a expressão “/(nível)” ao atributo Físico">Tamanho
Reduzido</span>
</div>
</div>
<div class="repeatable-grid features">
<span class="column-header secondary-font" data-i18n="feature">Característica</span>
<span class="column-header secondary-font" data-i18n="level">Nível</span>
<span class="column-header secondary-font" data-i18n="cost">Custo</span>
<div></div>
</div>
<input type="hidden" name="attr_features_total_cost" />
<fieldset class="repeating_features">
<div class="repeatable-item">
<div class="repeatable-grid features">
<input name="attr_feature" type="text" title="@{feature}" />
<input name="attr_featurelevel" type="text" title="@{featurelevel}" value="1" />
<input name="attr_featurecost" type="text" title="@{featurecost}" value="0" />
<input type="hidden" name="attr_featureid" />
<div class="showhidebutton arrowtype">
<input type="checkbox" name="attr_showhide_checkbox" value="1" />
<span></span>
</div>
</div>
<!-- Hidden checkbox that controls show/hide section. See Sheet Workers-->
<input class="toggle-checkbox" type="checkbox" name="attr_showhide_checkbox_invisible" value="1" />
<div class="showhide flex-column">
<span class="column-header secondary-font" data-i18n="description">Descrição</span>
<textarea name="attr_featuredescription" title="@{featuredescription}"></textarea>
</div>
</div>
</fieldset>
</div>
<div class="box flex-column">
<span class="box-title main-font" data-i18n="powers">Poderes</span>
<div class="showhidebutton configtype corner-position">
<input type="checkbox" name="attr_powers_showhide_checkbox" value="1" />
<span></span>
</div>
<!-- Hidden checkbox that controls show/hide section. See Sheet Workers-->
<input class="toggle-checkbox" type="checkbox" name="attr_powers_showhide_checkbox_invisible" value="1" />
<div class="showhide">
<div class="select-hidden-grid">
<button type="action" class="add-button" name="act_increased_dexterity"></button>
<span class="label secondary-font" data-i18n="increased_dexterity"
data-i18n-title="increased_dexterity-description"
title="Comprada a partir do nível 2. Atribuí a expressão “x(nível)” ao atributo Destreza. Adiciona seu (nível-1) ao número de ações físicas ao personagem.">Ampliação
de Destreza</span>
<button type="action" class="add-button" name="act_increased_physical"></button>
<span class="label secondary-font" data-i18n="increased_physical"
data-i18n-title="increased_physical-description"
title="Comprada a partir do nível 2. Atribuí a expressão “x(nível)” ao atributo Físico">Ampliação de
Físico</span>
<button type="action" class="add-button" name="act_increased_intelligence"></button>
<span class="label secondary-font" data-i18n="increased_intelligence"
data-i18n-title="increased_intelligence-description"
title="Comprada a partir do nível 2. Atribuí a expressão “x(nível)” ao atributo Inteligência. Adiciona seu (nível-1) ao número de ações mentais ao personagem.">Ampliação
de Inteligência</span>
<button type="action" class="add-button" name="act_reduced_dexterity"></button>
<span class="label secondary-font" data-i18n="reduced_dexterity"
data-i18n-title="reduced_dexterity-description"
title="Comprada a partir do nível 2. Atribuí a expressão “/(nível)” ao atributo Destreza">Redução de
Destreza</span>
<button type="action" class="add-button" name="act_reduced_physical"></button>
<span class="label secondary-font" data-i18n="reduced_physical"
data-i18n-title="reduced_physical-description"
title="Comprada a partir do nível 2. Atribuí a expressão “/(nível)” ao atributo Físico">Redução de
Físico</span>
<button type="action" class="add-button" name="act_reduced_intelligence"></button>
<span class="label secondary-font" data-i18n="reduced_intelligence"
data-i18n-title="reduced_dexterity-description"
title="Comprada a partir do nível 2. Atribuí a expressão “/(nível)” ao atributo Inteligência">Redução de
Inteligência</span>
</div>
</div>
<div class="repeatable-grid powers">
<span class="column-header secondary-font" data-i18n="name">Nome</span>
<span class="column-header secondary-font" data-i18n="level">Nível</span>
<span class="column-header secondary-font" data-i18n="cost">Custo</span>
<div></div>
</div>
<input type="hidden" name="attr_powers_total_cost" />
<fieldset class="repeating_powers">
<div class="repeatable-item">
<div class="repeatable-grid powers">
<input name="attr_power" type="text" title="@{power}" />
<input name="attr_powerlevel" type="text" title="@{powerlevel}" value="1" />
<input name="attr_powercost" type="text" title="@{powercost}" value="0" />
<input type="hidden" name="attr_powerid" />
<div class="showhidebutton arrowtype">
<input type="checkbox" name="attr_showhide_checkbox" value="1" />
<span></span>
</div>
</div>
<!-- Hidden checkbox that controls show/hide section. See Sheet Workers-->
<input class="toggle-checkbox" type="checkbox" name="attr_showhide_checkbox_invisible" value="1" />
<div class="showhide flex-column">
<span class="column-header secondary-font" data-i18n="description">Descrição</span>
<textarea name="attr_powerdescription" title="@{powerdescription}"></textarea>
</div>
</div>
</fieldset>
</div>
</div>
<!-- Middle column 2 -->
<div class="middle-column">
<div class="box flex-column">
<span class="box-title main-font" data-i18n="skills">Habilidades</span>
<div class="repeatable-grid skills">
<div></div>
<span class="column-header secondary-font" data-i18n="skill">Habilidade</span>
<span class="column-header secondary-font" data-i18n="attribute">Atributo</span>
<span class="column-header secondary-font" data-i18n="level">Nível</span>
<span class="column-header secondary-font" data-i18n="cost">Custo</span>
<span class="column-header secondary-font" data-i18n="total">Total</span>
<div></div>
</div>
<div class="repeatable-grid skills">
<button type="roll" class="roll-button" name="roll_fight_check" title="@{fight_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{fight}}} {{value=[[@{fighttotal}]]}} {{result=[[?{@{normalorcontest} | @{normal}, 2d6cs<5cf>2 | @{contest}, 2d6cs>2cf<5+@{fighttotal}}+?{@{modifier}|0}]]}}"></button>
<input class="row-item-margin" readonly="true" name="attr_fight_name" type="text" title="@{fight_name}"
data-i18n-placeholder="fight" placeholder="Briga" />
<span class="secondary-font" data-i18n="dexterity">Destreza</span>
<input type="hidden" name="attr_fightattribute" value="@{chardexterity}" />
<select class="select row-item-margin" name="attr_fightlevel" title="@{fightlevel}">
<option value="0" selected="selected">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<input class="row-item-margin" name="attr_fightcost" type="text" readonly title="@{fightcost}" value="1" />
<input class="row-item-margin" name="attr_fighttotal" type="number" disabled="true" title="@{fighttotal}"
value="@{fightattribute} + @{fightlevel}" />
<div>
</div>
</div>
<input type="hidden" name="attr_skills_total_cost" />
<fieldset class="repeating_skills">
<div class="repeatable-item">
<div class="repeatable-grid skills">
<button type="roll" class="roll-button" name="roll_skill_check" title="@{skill_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{skill}}} {{value=[[@{skilltotal}]]}} {{result=[[?{@{normalorcontest} | @{normal}, 2d6cs<5cf>2 | @{contest}, 2d6cs>2cf<5+@{skilltotal}}+?{@{modifier}|0}]]}}"></button>
<input class="row-item-margin" name="attr_skill" type="text" title="@{skill}" />
<select class="select row-item-margin" name="attr_skillattribute" title="@{skillattribute}">
<option value="@{charphysique}" data-i18n="physique" selected="selected">Físico</option>
<option value="@{chardexterity}" data-i18n="dexterity">Destreza</option>
<option value="@{charintelligence}" data-i18n="intelligence">Inteligência</option>
<option value="@{charwill}" data-i18n="will">Vontade</option>
<option value="@{charmind}" data-i18n="mind">Mente</option>
<option value="@{charmagic}" data-i18n="magic">Magia</option>
<option value="@{charperception}" data-i18n="perception">Percepção</option>
<option value="@{charluck}" data-i18n="luck">Sorte</option>
</select>
<select class="select row-item-margin" name="attr_skilllevel" title="@{skilllevel}">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<input class="row-item-margin" name="attr_skillcost" type="text" readonly title="@{skillcost}"
value="1" />
<input class="row-item-margin" name="attr_skilltotal" type="number" disabled="true"
title="@{skilltotal}" value="@{skillattribute} + @{skilllevel}" />
<div class="showhidebutton arrowtype">
<input type="checkbox" name="attr_showhide_checkbox" value="1" />
<span></span>
</div>
</div>
<!-- Hidden checkbox that controls show/hide section. See Sheet Workers-->
<input class="toggle-checkbox" type="checkbox" name="attr_showhide_checkbox_invisible" value="1" />
<div class="showhide flex-column">
<span class="column-header secondary-font" data-i18n="description">Descrição</span>
<textarea name="attr_skilldescription" title="@{skilldescription}"></textarea>
</div>
</div>
</fieldset>
</div>
<div class="box flex-column">
<span class="box-title main-font" data-i18n="protection">Proteção</span>
<div class="repeatable-grid protection">
<span class="column-header secondary-font" data-i18n="name">Nome</span>
<span class="column-header secondary-font" data-i18n="protected_areas">Áreas Protegidas</span>
<span class="column-header secondary-font absortion" data-i18n="absortion">Absorção</span>
<span class="column-header secondary-font" data-i18n="penalty">Penalidade</span>
<div></div>
</div>
<fieldset class="repeating_protection">
<div class="repeatable-item">
<div class="repeatable-grid protection">
<input class="row-item-margin" name="attr_protectionname" type="text" title="@{protectionname}" />
<input class="row-item-margin" name="attr_protectionprotectedareas" type="text"
title="@{protectionprotectedarreas}" />
<div class="flex-row">
<input class="row-item-margin" name="attr_protectionnormalabsortion" type="number"
title="@{protectionnormalabsortion}" />
<span class="row-item-margin">/</span>
<input class="row-item-margin" name="attr_protectionhighabsortion" type="number"
title="@{protectionhighabsortion}" />
</div>
<input class="row-item-margin" name="attr_protectionpenalty" type="number" title="@{protectionpenalty}"
value="0" />
<div class="showhidebutton arrowtype">
<input type="checkbox" name="attr_showhide_checkbox" value="1" />
<span></span>
</div>
</div>
<!-- Hidden checkbox that controls show/hide section. See Sheet Workers-->
<input class="toggle-checkbox" type="checkbox" name="attr_showhide_checkbox_invisible" value="1" />
<div class="showhide flex-column">
<span class="column-header secondary-font" data-i18n="description">Descrição</span>
<textarea name="attr_protectiondescription" title="@{protectiondescription}"></textarea>
</div>
</div>
</fieldset>
<div class="penalty">
<span class="column-header secondary-font" data-i18n="totalpenalty">Penalidade Total</span>
<input class="row-item-margin" name="attr_totalpenalty" readonly type="number" title="@{totalpenalty}" />
</div>
</div>
<div class="box flex-column">
<span class="box-title main-font" data-i18n="equipments">Equipamentos</span>
<fieldset class="repeating_equipments">
<div class="repeatable-item">
<div class="repeatable-row">
<input name="attr_equipment" type="text" data-i18n-placeholder="equipment" placeholder="Equipamento"
title="@{equipment}" />
<div class="showhidebutton arrowtype">
<input type="checkbox" name="attr_showhide_checkbox" value="1" />
<span></span>
</div>
</div>
<!-- Hidden checkbox that controls show/hide section. See Sheet Workers-->
<input class="toggle-checkbox" type="checkbox" name="attr_showhide_checkbox_invisible" value="1" />
<div class="showhide flex-column">
<span class="column-header secondary-font" data-i18n="description">Descrição</span>
<textarea name="attr_equipmentdescription" title="@{equipmentdescription}"></textarea>
</div>
</div>
</fieldset>
</div>
<div class="experience-points">
<span class="label secondary-font" data-i18n="experience_points">Pontos de Experiência</span>
<input name="attr_xp" type="number" title="@{xp}" />
</div>
</div>
</div>
<div class="box flex-column">
<span class="box-title main-font" data-i18n="weapons">Armas</span>
<div class="repeatable-grid weapons">
<span class="column-header secondary-font" data-i18n="weapon">Arma</span>
<span class="column-header secondary-font" data-i18n="level">Nível</span>
<div>
<span class="column-header secondary-font" data-i18n="damage">Dano</span>
<div class="weapons-subheader-grid">
<span class="column-subheader secondary-font" data-i18n="base">Base</span>
<span class="column-subheader secondary-font" data-i18n="total">Total</span>
</div>
</div>
<div>
<span class="column-header secondary-font" data-i18n="blow">Golpe</span>
<div class="weapons-subheader-grid">
<span class="column-subheader secondary-font" data-i18n="base">Base</span>
<span class="column-subheader secondary-font" data-i18n="total">Total</span>
</div>
</div>
<div>
<span class="column-header secondary-font" data-i18n="parry">Aparo</span>
<div class="weapons-subheader-grid">
<span class="column-subheader secondary-font" data-i18n="base">Base</span>
<span class="column-subheader secondary-font" data-i18n="total">Total</span>
</div>
</div>
<span class="column-header secondary-font" data-i18n="fast_shot">Tiro Rápido</span>
<span class="column-header secondary-font" data-i18n="aimed_shot">Tiro Mirado</span>
<span class="column-header secondary-font" data-i18n="rate_of_fire">Cad</span>
<div></div>
</div>
<div class="repeatable-grid weapons">
<input class="row-item-margin" readonly="true" name="attr_fight_name" type="text" title="@{fight_name}"
data-i18n-placeholder="fight" placeholder="Briga" />
<input class="row-item-margin" readonly="true" name="attr_fightlevel" type="text" title="@{fightlevel}" />
<div class="weapons-subheader-grid">
<input class="weapons-damage-base" readonly="true" name="attr_fightdamage" type="text" title="@{fightdamage}"
value="d2-1" />
<input class="weapons-damage-total" readonly="true" name="attr_fightdamagetotal" type="text"
title="@{fightdamagetotal}" value="0" />
</div>
<div class="weapons-subheader-grid">
<input class="weapons-base" readonly="true" name="attr_fightblow" type="text" title="@{fightblow}"
value="0" />
<input class="weapons-base" disabled="true" name="attr_fightblowtotal" type="text"
title="@{fightblowtotal}" value="@{fightblow} + (@{chardexterity} @{weaponeffect})" />
<button type="roll" class="roll-button" name="roll_fightblow_check" title="@{fightblow_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{fight}}} {{value=@{blow}}} {{damage=[[@{fightdamage}+@{physicaldamage}]]}} {{bodyroll=[[2d6cs0cf0]]}} {{result=[[2d6cs>2cf<5 + @{fightblow} + (@{chardexterity} @{weaponeffect}) + ?{@{modifier}|0} ]] }}"></button>
</div>
<div class="weapons-subheader-grid">
<input class="weapons-base" readonly="true" name="attr_fightparry" type="text" title="@{fightparry}"
value="0" />
<input class="weapons-base" disabled="true" name="attr_fightparrytotal" type="text"
title="@{fightparrytotal}" value="@{fightparry} + (@{chardexterity} @{weaponeffect})" />
<button type="roll" class="roll-button" name="roll_fightparry_check" title="@{fightparry_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{fight}}} {{value=@{parry}}} {{result=[[2d6cs>2cf<5 + @{fightparry} + (@{chardexterity} @{weaponeffect}) + ?{@{modifier}|0} ]] }}"></button>
</div>
<div class="fight-span"></div>
</div>
<input type="hidden" name="attr_weaponeffect" value="+0" />
<fieldset class="repeating_weapons">
<div class="repeatable-item">
<div class="repeatable-grid weapons">
<input class="row-item-margin" name="attr_weaponname" type="text" title="@{weaponname}" />
<input class="row-item-margin" name="attr_weaponlevel" type="text" title="@{weaponlevel}" value="0" />
<div class="weapons-subheader-grid">
<input class="weapons-damage-base" name="attr_weapondamage" type="text" title="@{weapondamage}" value="0" />
<input class="weapons-damage-total" readonly="true" name="attr_weapondamagetotal" type="text"
title="@{weapondamagetotal}" value="0" />
</div>
<div class="weapons-subheader-grid">
<input class="weapons-base" name="attr_weaponblow" type="text" title="@{weaponblow}" value="0" />
<input class="weapons-base" name="attr_weaponblowtotal" type="text" title="@{weaponblowtotal}"
disabled="true" value="@{weaponlevel} + @{weaponblow} + @{fightblow} + (@{chardexterity} @{weaponeffect})" />
<button type="roll" class="roll-button" name="roll_weaponblow_check" title="@{weaponblow_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{weaponname}}} {{value=@{blow}}} {{damage=[[@{weapondamage}+@{physicaldamage}]]}} {{bodyroll=[[2d6cs0cf0]]}} {{result=[[2d6cs>2cf<5 + @{weaponlevel} + @{weaponblow} + @{fightblow} + (@{chardexterity} @{weaponeffect}) + ?{@{modifier}|0} ]] }}"></button>
</div>
<div class="weapons-subheader-grid">
<input class="weapons-base" name="attr_weaponparry" type="text" title="@{weaponparry}" value="0" />
<input class="weapons-base" name="attr_weaponparrytotal" type="text" title="@{weaponparrytotal}"
disabled="true" value="@{weaponlevel} + @{weaponparry} + @{fightparry} + (@{chardexterity} @{weaponeffect})" />
<button type="roll" class="roll-button" name="roll_weaponparry_check" title="@{weaponparry_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{weaponname}}} {{value=@{parry}}} {{result=[[2d6cs>2cf<5 + @{weaponlevel} + @{weaponparry} + @{fightparry} + (@{chardexterity} @{weaponeffect}) + ?{@{modifier}|0} ]] }}"></button>
</div>
<div class="weapons-die-label">
<input class="row-item-margin" name="attr_weaponfastshot" type="number" title="@{weaponfastshot}"
value="0" />
<button type="roll" class="roll-button" name="roll_weaponfastshot_check" title="@{weaponfastshot_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{weaponname}}} {{value=@{fast_shot}}} {{damage=[[@{weapondamage}]]}} {{bodyroll=[[2d6cs0cf0]]}} {{result=[[2d6cs<5cf>2 + @{chardexterity} + @{weaponlevel} + @{weaponfastshot} + ?{@{modifier}|0} ]] }}"></button>
</div>
<div class="weapons-die-label">
<input class="row-item-margin" name="attr_weaponaimedshot" type="number" title="@{weaponaimedshot}"
value="0" />
<button type="roll" class="roll-button" name="roll_weaponaimedshot_check" title="@{weaponaimedshot_check}"
value="&{template:main} {{charname=@{character_name}}} {{action=@{weaponname}}} {{value=@{aimed_shot}}} {{damage=[[@{weapondamage}]]}} {{bodyroll=[[2d6cs0cf0]]}} {{result=[[2d6cs<5cf>2 + @{chardexterity} + @{weaponlevel} + @{weaponaimedshot} + ?{@{modifier}|0} ]] }}"></button>
</div>
<input class="row-item-margin" name="attr_weaponrateoffire" type="number" title="@{weaponrateoffire}"
value="0" />
<div class="showhidebutton arrowtype">
<input type="checkbox" name="attr_showhide_checkbox" value="1" />
<span></span>
</div>
</div>
<!-- Hidden checkbox that controls show/hide section. See Sheet Workers-->
<input class="toggle-checkbox" type="checkbox" name="attr_showhide_checkbox_invisible" value="1" />
<div class="showhide flex-column">
<div class="repeatable-grid weapon-hidden">
<span class="column-header secondary-font" data-i18n="shots">Carga</span>
<span class="column-header secondary-font" data-i18n="reload_actions">Ações de Recarga</span>
<span class="column-header secondary-font" data-i18n="range">Alcance</span>
<input class="row-item-margin" name="attr_weaponrshots" type="number" title="@{weaponshots}" value="0" />
<input class="row-item-margin" name="attr_weaponreloadactions" type="number"
title="@{weaponreloadactions}" value="0" />
<input class="row-item-margin" name="attr_weaponrange" type="text" title="@{weaponrange}" />
</div>
<span class="column-header secondary-font" data-i18n="description">Descrição</span>
<textarea name="attr_weapondescription" title="@{weapondescription}"></textarea>
</div>
</div>
</fieldset>
</div>
<div class="box flex-column">
<span class="box-title main-font" data-i18n="notes">Anotações</span>
<textarea name="attr_notes" title="@{notes}"></textarea>
</div>
</div>
<!-- Journal Tab -->
<div class='journaltab'>
<h2>Journal/Notes</h2>
<span>Journal/Notes Stuff Goes here</span>
</div>
<!-- Config tab-->
<div class='configurationtab'>
<h2>Config/Settings</h2>
<span>Sheet Config/Settings goes here</span>
</div>
<!-- Footer -->
<div class="footer secondary-font">
<span data-i18n="copyright">Copyright OPERA RPG © 2020. Todos os direitos reservados.</span>
</div>
</div>
<!-- end of sheet -->
<!-- Roll Templates -->
<rolltemplate class="sheet-rolltemplate-main">
<div class="template-container">
<div class="template-row template-header template-label secondary-font">
{{charname}}
</div>
{{#action}}
<div class="template-row">
<span class="template-label secondary-font">{{action}}: {{value}}</span>
{{#text}}
<p>{{text}}</p>
{{/text}}
</div>
{{/action}}
{{#result}}
<div class="template-row">
<span class="template-label secondary-font" data-i18n="result">Resultado</span>
{{result}}
</div>
{{/result}}
{{#damage}}
<div class="template-row">
<span class="template-label secondary-font" data-i18n="damage">Dano</span>
{{damage}}
</div>
{{/damage}}
{{#bodyroll}}
<div class="template-row">
<span class="template-label secondary-font" data-i18n="body_area">Área do Corpo Atingida</span>
{{bodyroll}}
{{#rollBetween() bodyroll 11 12}}
<span class="template-label secondary-font" data-i18n="head_a">Cabeça(A)</span>
{{/rollBetween() bodyroll 11 12}}
{{#rollTotal() bodyroll 2}}
<span class="template-label secondary-font" data-i18n="heart_b">Coração(B)</span>
{{/rollTotal() bodyroll 2}}
{{#rollBetween() bodyroll 6 8}}
<span class="template-label secondary-font" data-i18n="belly_c">Barriga(C)</span>
{{/rollBetween() bodyroll 6 8}}
{{#rollTotal() bodyroll 3}}
<span class="template-label secondary-font" data-i18n="sensitive_parts_d">Partes sensíveis(D)</span>
{{/rollTotal() bodyroll 3}}
{{#rollTotal() bodyroll 4}}
<span class="template-label secondary-font" data-i18n="right_arm_e">Braço direito(E)</span>
{{/rollTotal() bodyroll 4}}
{{#rollTotal() bodyroll 10}}
<span class="template-label secondary-font" data-i18n="left_arm_f">Braço esquerdo(F)</span>
{{/rollTotal() bodyroll 10}}
{{#rollTotal() bodyroll 5}}
<span class="template-label secondary-font" data-i18n="right_leg_f">Perna direita(G)</span>
{{/rollTotal() bodyroll 5}}
{{#rollTotal() bodyroll 9}}
<span class="template-label secondary-font" data-i18n="left_leg_h">Perna esquerda(H)</span>
{{/rollTotal() bodyroll 9}}
</div>
{{/bodyroll}}
</div>
</rolltemplate>
<!-- Strings translations for Roll Queries-->
<div style="display: none;">
<span data-i18n="no">Não</span>
<span data-i18n="result">Resultado</span>
<span data-i18n="check">Teste</span>
<span data-i18n="normal">Normal</span>
<span data-i18n="contest">Disputa</span>
<span data-i18n="normalorcontest">Normal ou Disputa?</span>
<span data-i18n="head_a">Cabeça(A)</span>
<span data-i18n="heart_b">Coração(B)</span>
<span data-i18n="belly_c">Barriga(C)</span>
<span data-i18n="sensitive_parts_d">Partes sensíveis(D)</span>
<span data-i18n="right_arm_e">Braço direito(E)</span>
<span data-i18n="left_arm_f">Braço esquerdo(F)</span>
<span data-i18n="right_leg_f">Perna direita(G)</span>
<span data-i18n="left_leg_h">Perna esquerda(H)</span>
</div>
<!--Sheet Workers -->
<script type="text/worker">
const buttonlist = ["profile","journal","configuration"];
/*config tabs control */
buttonlist.forEach(button => {
on(`clicked:${button}`, function() {
setAttrs({
tabcontrol: button
});
});
});
/*Controls show hide checkbox button from repeating sections*/
on("change:repeating_equipments:showhide_checkbox " +
"change:repeating_weapons:showhide_checkbox " +
"change:repeating_protection:showhide_checkbox " +
"change:repeating_skills:showhide_checkbox " +
"change:powers_showhide_checkbox " +
"change:repeating_powers:showhide_checkbox " +
"change:features_showhide_checkbox " +
"change:repeating_features:showhide_checkbox" , function(eventInfo) {
let source = eventInfo.sourceAttribute;
let changeAttributes = new Object();
let targetId = source + '_invisible';
changeAttributes[targetId] = eventInfo.newValue;
setAttrs(changeAttributes);
});
function setRollTotal(factors, target) {
getAttrs(factors, values => {
let total = '';
let out = {};
for (let i = 0; i < factors.length; i++) {
let v = factors[i];
total += `(${values[v]})`;
if ((i+1) != factors.length) {
total += '+';
}
}
console.log('total');
console.log(total);
out[target] = total;
setAttrs(out);
});
}
/*Controling fight damage total*/
on('sheet:opened change:fightdamage change:physicaldamage', function(eventInfo) {
setRollTotal(['fightdamage', 'physicaldamage'], 'fightdamagetotal');
});
/*Controling weapons damage total*/
on('change:repeating_weapons:weapondamage change:physicaldamage', function(eventInfo) {
console.log('weapon damage total');
setRollTotal(['repeating_weapons_weapondamage', 'physicaldamage'], 'repeating_weapons_weapondamagetotal');
});
/* calculating physical damage */
on('sheet:opened change:charphysique change:charphysicalfeatureeffect', function(eventInfo) {
getAttrs(['charphysique', 'charphysicalfeatureeffect'], values => {
let parse = '';
let factor = 0;
let total = 0;
parse += values.charphysique;
parse += values.charphysicalfeatureeffect;
factor = Math.floor(eval(parse));
total = Math.floor(factor/8);
setAttrs({
physicaldamage: total
});
});
});
//Repeating Sum [https://wiki.roll20.net/RepeatingSum]
const repeatingSum = (destinations, section, fields) => {
if (!Array.isArray(destinations)) destinations = [destinations.replace(/\s/g, '').split(',')];
if (!Array.isArray(fields)) fields = [fields.replace(/\s/g, '').split(',')];
getSectionIDs(`repeating_${section}`, idArray => {
const attrArray = idArray.reduce((m, id) => [...m, ...(fields.map(field => `repeating_${section}_${id}_${field}`))], []);
getAttrs([...attrArray], v => {
const getValue = (section, id, field) => v[`repeating_${section}_${id}_${field}`] === 'on' ? 1 : parseFloat(v[`repeating_${section}_${id}_${field}`]) || 0;
const commonMultipliers = (fields.length <= destinations.length) ? [] : fields.splice(destinations.length, fields.length - destinations.length);
const output = {};
destinations.forEach((destination, index) => {
output[destination] = idArray.reduce((total, id) => total + getValue(section, id, fields[index]) * commonMultipliers.reduce((subtotal, mult) => subtotal * getValue(section, id, mult), 1), 0);
});
setAttrs(output);
});
});
};
/* calculating total protection penalty */
on('sheet:opened change:repeating_protection remove:repeating_protection', function() {
repeatingSum("totalpenalty","protection", "protectionpenalty");
});
/* calculating total powers cost */
on('sheet:opened change:repeating_powers remove:repeating_powers', function() {
repeatingSum("powers_total_cost","powers", "powercost");
});
/* calculating total skills cost */
on('sheet:opened change:repeating_skills remove:repeating_skills', function() {
repeatingSum("skills_total_cost","skills", "skillcost");
});
/* calculating total features cost */
on('sheet:opened change:repeating_features remove:repeating_features', function() {
repeatingSum("features_total_cost","features", "featurecost");
});
function getSkillCost(skillLevel) {
let skillCost = 0;
switch (skillLevel) {
case '1':
skillCost = 1;
break;
case '2':
skillCost = 3;
break;
case '3':
skillCost = 6;
break;
case '4':
skillCost = 10;
break;
}
return skillCost;
}
/* controlling skill cost due to skill level selection */
on('change:repeating_skills:skilllevel', function(eventInfo) {
const skillLevel = eventInfo.newValue;
let skillCost = getSkillCost(skillLevel);
setAttrs({
repeating_skills_skillcost: skillCost
});
});
const fightParameters = [
{
fightblow: 0,
fightparry: 0,
fightdodgebonus: 0,
fightdamage: 'd2-1'
},
{
fightblow: 1,
fightparry: 0,
fightdodgebonus: 0,
fightdamage: 'd2-1'
},
{
fightblow: 1,
fightparry: 1,
fightdodgebonus: 1,
fightdamage: '1'
},
{
fightblow: 2,
fightparry: 2,
fightdodgebonus: 1,
fightdamage: '1'
},
{
fightblow: 3,
fightparry: 3,
fightdodgebonus: 2,
fightdamage: '1'
}
];
/* controlling fight cost, damage, dodge, parry and blow due to fight level selection */
on('change:fightlevel', function(eventInfo) {
const skillLevel = eventInfo.newValue;
out = {};
let skillCost = getSkillCost(skillLevel);
let fightParams = fightParameters[skillLevel];
out.fightcost = skillCost;
out = Object.assign(out, fightParams);
setAttrs(out);
});
/*config Roll Queries translations */
on("sheet:opened", function(eventInfo){
setAttrs({
no: getTranslationByKey("no"),
result: getTranslationByKey("result"),
check: getTranslationByKey("check"),
normal: getTranslationByKey("normal"),
contest: getTranslationByKey("contest"),
normalorcontest: getTranslationByKey("normalorcontest"),
modifier: getTranslationByKey("modifier"),
physique: getTranslationByKey("physique"),
dexterity: getTranslationByKey("dexterity"),
intelligence: getTranslationByKey("intelligence"),
will: getTranslationByKey("will"),
mind: getTranslationByKey("mind"),
magic: getTranslationByKey("magic"),
perception: getTranslationByKey("perception"),
luck: getTranslationByKey("luck"),
fast_shot: getTranslationByKey("fast_shot"),
aimed_shot: getTranslationByKey("aimed_shot"),
parry: getTranslationByKey("parry"),
blow: getTranslationByKey("blow"),
initiative: getTranslationByKey("initiative"),
dodge: getTranslationByKey("dodge"),
fight: getTranslationByKey("fight"),
});
});
const OperationEnum = {
SUM: 0,
MULT: 1
};
/* Configuring all the fields that have an effect applied
For the effect fields from the attributes, you have to specify the name of the mod field on the attributeMod property.
*/
const effectsTargets = {
charperceptionfeatureeffect: {
attributeMod: 'charperceptionmod'
},
charphysicalfeatureeffect: {
attributeMod: 'charphysiquemod'
},
chardexterityfeatureeffect: {
attributeMod: 'chardexteritymod'
},
charintelligencefeatureeffect: {
attributeMod: 'charintelligencemod'
},
charwillfeatureeffect: {
attributeMod: 'charwillmod'
},
charmindfeatureeffect: {
attributeMod: 'charmindmod'
},
charmagicfeatureeffect: {
attributeMod: 'charmagicmod'
},
charluckfeatureeffect: {
attributeMod: 'charluckmod'
},
dodgefeatureeffect: {},
physical_actionseffect:{},
mind_actionseffect:{},
initiativefeatureeffect: {},
weaponeffect: {}
};
/* Pre configured feature and power effects. Every feature object will have:
- button: An act button associated (the add button);
- name: The translated feature's name;
- cost: how much does it cost to purchase;
- effects: An array of effects objects. Each of these objects consist of:
- target: The sheet's attribute where the effect will be applied;
- value: A function that returns a calculated formula of the value of the effect;
- operation: If it is a sum or multiplication(division if the value is negative). This value is used
later to calculate the mod to be applied on the target sheet's attribute. The formula
will be explained in the function that deals with it.
*/
const features = {
ambidexterity:
{
name: getTranslationByKey('ambidexterity'),
cost: 3
},
obvious_feature:
{
name: getTranslationByKey('obvious_feature'),
cost: 0
},
contortion:
{
name: getTranslationByKey('contortion'),
cost: 2,
effects: [
{
target: 'dodgefeatureeffect',
value: level => Math.floor(level/2),
operation: OperationEnum.SUM
}
]
},
slow_reflexes:
{
name: getTranslationByKey('slow_reflexes'),
cost: -5,
effects: [
{
target: 'dodgefeatureeffect',
value: level => (-1)*level,
operation: OperationEnum.SUM
}
]
},
fast_reflexes:
{
name: getTranslationByKey('fast_reflexes'),
cost: 5,
effects: [
{
target: 'dodgefeatureeffect',
value: level => level,
operation: OperationEnum.SUM
}
]
},
increased_senses: {
name: getTranslationByKey('increased_senses'),
cost: 8,
effects: [
{
target: 'charperceptionfeatureeffect',
value: level => level,
operation: OperationEnum.SUM
}
]
},
reduced_senses:
{
name: getTranslationByKey('reduced_senses'),
cost: -8,
effects: [
{
target: 'charperceptionfeatureeffect',
value: level => (-1)*level,
operation: OperationEnum.SUM
}
]
},
increased_mind: {
name: getTranslationByKey('increased_mind'),
cost: 3,
effects: [
{
target: 'charmindfeatureeffect',
value: level => level,
operation: OperationEnum.SUM
}
]
},
post:
{
name: getTranslationByKey('post'),
cost: 2
},
readiness:
{
name: getTranslationByKey('readiness'),
cost: 4
},
reduced_mind:
{
name: getTranslationByKey('reduced_mind'),
cost: -3,
effects: [
{
target: 'charmindfeatureeffect',
value: level => (-1)*level,
operation: OperationEnum.SUM
}
]
},
strong_will:
{
name: getTranslationByKey('strong_will'),
cost: 6,
effects: [
{
target: 'charwillfeatureeffect',
value: level => level,
operation: OperationEnum.SUM
}
]
},
weak_will:
{
name: getTranslationByKey('weak_will'),
cost: -6,
effects: [
{
target: 'charwillfeatureeffect',
value: level => (-1)*level,
operation: OperationEnum.SUM
}
]
},
additional_limbs:
{
name: getTranslationByKey('additional_limbs'),
cost: 6,
effects: [
{
target: 'chardexterityfeatureeffect',
value: level => Math.floor(level/2)+1,
operation: OperationEnum.MULT
},
{
target: 'initiativefeatureeffect',
value: level => level,
operation: OperationEnum.SUM
},
{
target: 'dodgefeatureeffect',
value: level => level,
operation: OperationEnum.SUM
},
{
target: 'weaponeffect',
value: level => level,
operation: OperationEnum.SUM
},
{
target: 'physical_actionseffect',
value: level => Math.floor(level/2),
operation: OperationEnum.SUM
}
]
},
increased_size:
{
name: getTranslationByKey('increased_size'),
cost: 11,
level: 2,
effects: [
{
target: 'charphysicalfeatureeffect',
value: level => level,
operation: OperationEnum.MULT
}
]
},
reduced_size:
{
name: getTranslationByKey('reduced_size'),
cost: -12,
level: 2,
effects: [
{
target: 'charphysicalfeatureeffect',
value: level => (-1)*level,
operation: OperationEnum.MULT
}
]
}
};
/* POWERS CONFIG*/
const powers = {
increased_dexterity:
{
name: getTranslationByKey('increased_dexterity'),
cost: 14,
level: 2,
effects: [
{
target: 'chardexterityfeatureeffect',
value: level => level,
operation: OperationEnum.MULT
},
{
target: 'initiativefeatureeffect',
value: level => level,
operation: OperationEnum.SUM
},
{
target: 'dodgefeatureeffect',
value: level => level,
operation: OperationEnum.SUM
},
{
target: 'weaponeffect',
value: level => level,
operation: OperationEnum.SUM
},
{
target: 'physical_actionseffect',
value: level => level-1,
operation: OperationEnum.SUM
}
]
},
increased_physical:
{
name: getTranslationByKey('increased_physical'),
cost: 16,
level: 2,
effects: [
{
target: 'charphysicalfeatureeffect',
value: level => level,
operation: OperationEnum.MULT
}
]
},
increased_intelligence:
{
name: getTranslationByKey('increased_intelligence'),
cost: 12,
level: 2,
effects: [
{
target: 'charintelligencefeatureeffect',
value: level => level,
operation: OperationEnum.MULT
},
{
target: 'mind_actionseffect',
value: level => level-1,
operation: OperationEnum.SUM
}
]
},
reduced_dexterity:
{
name: getTranslationByKey('reduced_dexterity'),
cost: -14,
level: 2,
effects: [
{
target: 'chardexterityfeatureeffect',
value: level => (-1)*level,
operation: OperationEnum.MULT
}
]
},
reduced_physical:
{
name: getTranslationByKey('reduced_physical'),
cost: -16,
level: 2,
effects: [
{
target: 'charphysicalfeatureeffect',
value: level => (-1)*level,
operation: OperationEnum.MULT
}
]
},
reduced_intelligence:
{
name: getTranslationByKey('reduced_intelligence'),
cost: -12,
level: 2,
effects: [
{
target: 'charintelligencefeatureeffect',
value: level => (-1)*level,
operation: OperationEnum.MULT
}
]
}
};
/*setting preconfigured powers and features add buttons */
setPreconfiguredSections(features, 'feature');
setPreconfiguredSections(powers, 'power');
/* Sets preconfigured sections add buttons, like features and powers */
function setPreconfiguredSections(values, sectionName) {
for (let button in values) {
on(`clicked:${button}`, function() {
var newrowid = generateRowID();
var newrowattrs = {};
newrowattrs[`repeating_${sectionName}s_${newrowid}_${sectionName}`] = values[button].name;
newrowattrs[`repeating_${sectionName}s_${newrowid}_${sectionName}cost`] = values[button].cost;
if (values[button].hasOwnProperty('level')) {
newrowattrs[`repeating_${sectionName}s_${newrowid}_${sectionName}level`] = values[button].level;
}
if (values[button].effects !== undefined) {
newrowattrs[`repeating_${sectionName}s_${newrowid}_${sectionName}id`] = button;
}
setAttrs(newrowattrs);
});
}
}
/* adds the list of the character's attributes to the array of values to be retrieved */
function addAttributesMods(attributesArray) {
for(target in effectsTargets) {
if (effectsTargets[target].hasOwnProperty('attributeMod')) {
attributesArray.push(effectsTargets[target].attributeMod);
attributesArray.push(effectsTargets[target].attributeMod + 'operator');
}
}
}
/* build the repeating section's list of attributes which values should be retrieved */
function buildSectionAttributesArray(sectionRowIds, sectionName, attributesArray) {
for(var i=0; i < sectionRowIds.length; i++) {
const id = sectionRowIds[i];
attributesArray.push(`repeating_${sectionName}s_${id}_${sectionName}level`);
attributesArray.push(`repeating_${sectionName}s_${id}_${sectionName}id`);
}
return attributesArray;
}
/* Calculate the totals for the effects of a repeating section
sectionConfig: The const object with the configuration of the effects and its formulas;
sectionName: The name of the sheet's repeating section which effects will be calculated. Should be in singular (ex: power, instead of powers);
values: The values object retrieved from the getAttrs function;
sectionIds: the array of ids from the repeating section;
totals: the totals object that will store all the calculations to set the formulas on all effects fields on the sheet
*/
function calculateEffectsAndMods(sectionConfig, sectionName, values, sectionIds, totals) {
for(var i=0; i < sectionIds.length; i++) {
const id = sectionIds[i];
const level = parseInt(values[`repeating_${sectionName}s_${id}_${sectionName}level`])||0;
const itemID = values[`repeating_${sectionName}s_${id}_${sectionName}id`];
let effects;
if (itemID !== undefined && itemID !== '') {
if (sectionConfig[itemID].hasOwnProperty('effects')) {
effects = sectionConfig[itemID].effects;
}
if (effects !== undefined) {
sumEffects(effects, level, totals);
}
}
}
}
/* setting and calculating feature effects */
on('sheet:opened change:repeating_features remove:repeating_features '+
'change:repeating_powers remove:repeating_powers ' +
'change:charphysiquemod change:charphysiquemodoperator '+
'change:chardexteritymod change:chardexteritymodoperator '+
'change:charintelligencemod change:charintelligencemodoperator '+
'change:charperceptionmod change:charperceptionmodoperator '+
'change:charwillmod change:charwillmodoperator '+
'change:charmindmod change:charmindmodoperator '+
'change:charmagicmod change:charmagicmodoperator '+
'change:charluckmod change:charluckmodoperator' , function() {
let totals = {};
let out = {};
getSectionIDs('features', function(featuresIdarray) {
getSectionIDs('powers', function(powersIdarray) {
let attributesArray = [];
buildSectionAttributesArray(featuresIdarray, 'feature', attributesArray);
buildSectionAttributesArray(powersIdarray, 'power', attributesArray);
addAttributesMods(attributesArray);
getAttrs(attributesArray, function(values) {
calculateEffectsAndMods(features, 'feature', values, featuresIdarray, totals);
calculateEffectsAndMods(powers, 'power', values, powersIdarray, totals);
out = generateEffectFormulas(totals, values);
setAttrs(out);
});
});
});
});
function initTotal() {
return {
totalSum: 0,
totalMult: 0
}
}
function sumEffects(effects, level, totals) {
effects.forEach(effect => {
if (!totals.hasOwnProperty(effect.target)) {
const target = effect.target;
totals[target] = initTotal();
}
const value = effect.value(level);
switch(effect.operation) {
case OperationEnum.SUM:
totals[effect.target].totalSum += value;
break;
case OperationEnum.MULT:
totals[effect.target].totalMult += value;
break;
}
});
}
/* The effect formula is like this:
If the total multiplication is negative, then we have to do a division.
If the total multiplication is positive, then we have to do a multiplication.
If the total multiplication is zero, then it is not added to the formula.
The total sum is just summed at the end of the formula.
Example:
feature A gives a x4 bonus to physique.
feature B gives a /2 penalty to physique.
multiplication counts as positive.
division counts as negative.
We have to do the sum of multiplications minus the sum of divisions to determine the bonus formula.
For simplicity, we store on the effects, a negative value on the mult field when it is a division.
physique's featureMod will then have the formula:
(4 - 2) = 2, which is positive. So it will be a multiplication:
formula = *2;
Then, physique in the end will be = orig*2.
*/
function generateEffectFormulas(totals, values) {
let targetAttributes = {};
for (target in effectsTargets) {
let formula = ``;
treatAttributesMods(target, values, totals);
if (totals.hasOwnProperty(target)) {
if (totals[target].totalMult > 0) {
formula += `*${totals[target].totalMult}`;
}
if (totals[target].totalMult < 0) {
formula += `/${Math.abs(totals[target].totalMult)}`;
}
if (totals[target].totalSum > 0) {
formula += `+${totals[target].totalSum}`;
}
if (totals[target].totalSum < 0) {
formula += `${totals[target].totalSum}`;
}
}
if (formula == ``) {
formula = '+0';
}
targetAttributes[target] = formula;
}
return targetAttributes;
}
function treatAttributesMods(target, values, totals) {
if (effectsTargets[target].hasOwnProperty('attributeMod')) {
const attributeMod = effectsTargets[target].attributeMod;
const attributeModValue = Math.abs(parseInt(values[attributeMod])||0);
const attributeModOperator = values[attributeMod+'operator'];
if (!totals.hasOwnProperty(target)) {
totals[target] = initTotal();
}
switch(attributeModOperator) {
case '*':
totals[target].totalMult += attributeModValue;
break;
case '/':
totals[target].totalMult -= attributeModValue;
break;
}
}
}
</script>