Files
roll20-character-sheets/GoddessSaveTheQueen/goddesssavethequeen.html
T

1142 lines
39 KiB
HTML

<div class="main-container">
<!-- Header -->
<div class="header">
<span class="box-title main-font title1" data-i18n="form-title">Cadastro de agente de campo</span>
<div class="header-row">
<span class="label main-font" data-i18n="codename">Codinome</span>
<input class="header-right-margin" name="attr_character_name" type="text" title="{@character_name}" />
<span class="label main-font" data-i18n="age">Idade</span>
<input name="attr_age" type="number" title="{@age}" />
</div>
<div class="header-row">
<span class="label main-font" data-i18n="specialty">Especialidade</span>
<select class="header-right-margin" name="attr_specialty_select">
<option selected="selected" value="custom" data-i18n="custom">Personalizada</option>
<option value="engineering" data-i18n="engineering">Engenharia</option>
<option value="scholarship" data-i18n="scholarship">Estudiosa</option>
<option value="infiltration" data-i18n="infiltration">Infiltração</option>
<option value="military" data-i18n="military">Militar</option>
<option value="piloting" data-i18n="piloting">Pilotagem</option>
</select>
<input class="specialty-selected" type="hidden" name="attr_selected_specialty" value="custom" />
<input class="custom-specialty header-right-margin" name="attr_custom_specialty" type="text" title="{@custom_specialty}" />
<span class="label main-font" data-i18n="origin">Colônia de Origem</span>
<input name="attr_origin" type="text" title="{@origin}" />
</div>
<div class="header-row">
<span class="label main-font align-top" data-i18n="curriculum">Currículo</span>
<textarea name="attr_curriculum" title="{@curriculum}"></textarea>
</div>
</div>
<div class="box buttons-section">
<!-- 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>
<div class="flex-row">
<button type="action" name="act_clearall" data-i18n="begin-session" data-i18n-title="begin-session-button-title"
title="Prepara a ficha para a nova sessão, limpando todas as caixas de seleção da pilha de dados, incluindo as caixas de Destinos de Heróina">Iniciar
Sessão</button>
<button type="action" name="act_cleardicepool" data-i18n="clearpool" data-i18n-title="reset-button-title"
title="Limpa a pilha de dados para nova rolagem, desmarcando todas as caixas da ficha, com execeção das caixas de Ímpeto e de Destinos de Heróina.">Limpar
Pilha</button>
<span class="help" name="act_help" data-i18n-title="help"
title="Marque as caixas da Ação, habilidade da Nacionalidade, habilidades da Especialidade e dos Pertences para montar a pilha de dados.">
?</span>
</div>
</div>
<input type='hidden' class='tabcontrol' name='attr_tabcontrol' value='profile' />
<!-- Profile Tab -->
<div class="profiletab">
<div class="dice-roller-row">
<div class="dice-roller-box">
<span class="secondary-font" data-i18n="base-dice">Base</span>
<div class="dice-row-circle">
<input name="attr_base-dice" type="number" title="{@base-dice}" value="1" />
</div>
</div>
<div class="plus">
+
</div>
<div class="dice-roller-box">
<span class="secondary-font" data-i18n="action">Ação</span>
<div class="dice-row-circle">
<input readonly name="attr_action-dice" type="number" title="{@action-dice}" value="0" />
</div>
</div>
<div class="plus">
+
</div>
<div class="dice-roller-box">
<span class="secondary-font" data-i18n="specialty">Especialidade</span>
<div class="dice-row-circle">
<input readonly name="attr_specialty-dice" type="number" title="{@specialty-dice}" value="0" />
</div>
</div>
<div class="plus">
+
</div>
<div class="dice-roller-box">
<span class="secondary-font" data-i18n="nationality">Nacionalidade</span>
<div class="dice-row-circle">
<input readonly name="attr_nationality-dice" type="number" title="{@nationality-dice}" value="0" />
</div>
</div>
<div class="plus">
+
</div>
<div class="dice-roller-box">
<span class="secondary-font" data-i18n="belongings">Pertences</span>
<div class="dice-row-circle">
<input readonly name="attr_belongings-dice" type="number" title="{@belongings-dice}" value="0" />
</div>
</div>
<div class="plus">
+
</div>
<div class="dice-roller-box">
<span class="secondary-font" data-i18n="destinies">Destinos</span>
<div class="dice-row-circle">
<input readonly name="attr_destinies-dice" type="number" title="{@destinies-dice}" value="0" />
</div>
</div>
<div class="plus">
-
</div>
<div class="dice-roller-box">
<span class="secondary-font" data-i18n="impetus">Ímpeto</span>
<div class="dice-row-circle">
<input readonly name="attr_impetus-dice" type="number" title="{@impetus-dice}" value="0" />
</div>
</div>
<div class="plus">
=
</div>
<div class="dice-roller-box">
<span class="secondary-font" data-i18n="total">Total</span>
<div class="dice-row-circle">
<input readonly name="attr_dicetotal" type="number" title="{@dicetotal}" value="0" />
</div>
</div>
<button type="roll" class="roll-button" name="roll_dice_pool" title="{@dice_pool}"
value="/r @{dicetotal}d6cs5cs6s"></button>
</div>
<!-- Middle -->
<div class="middle">
<div class="box actions">
<span class="title2 box-title secondary-font" data-i18n="be-a-hero">Ser Heróina</span>
<div class="dice-row">
<input class="dice-row-margin" type="checkbox" value="1" name='attr_chk_be_a_hero1' />
<div class="plus dice-row-margin">
+
</div>
<div class="die-icon dice-row-margin">
</div>
<span class="main-font label" data-i18n="character-in-danger">Houver outra personagem em perigo</span>
</div>
<div class="dice-row">
<input class="dice-row-margin" type="checkbox" value="1" name='attr_chk_be_a_hero2' />
<div class="plus dice-row-margin">
+
</div>
<div class="die-icon dice-row-margin">
</div>
<span class="main-font label" data-i18n="in-disadvantage">Se estiver em desvantagem evidente</span>
</div>
<div class="dice-row">
<input class="dice-row-margin" type="checkbox" value="1" name='attr_chk_be_a_hero3' />
<div class="plus dice-row-margin">
+
</div>
<div class="die-icon dice-row-margin">
</div>
<span class="main-font label" data-i18n="acting-alone">Se estiver agindo sozinha</span>
</div>
</div>
<div class="box actions">
<span class="title2 box-title secondary-font" data-i18n="be-relentless">Ser Implacável</span>
<div class="dice-row">
<input class="dice-row-margin" type="checkbox" value="1" name='attr_chk_be_relentless1' />
<div class="plus dice-row-margin">
+
</div>
<div class="die-icon dice-row-margin">
</div>
<span class="main-font label" data-i18n="act-impulsively">Agir impulsivamente</span>
</div>
<div class="dice-row">
<input class="dice-row-margin" type="checkbox" value="1" name='attr_chk_be_relentless2' />
<div class="plus dice-row-margin">
+
</div>
<div class="die-icon dice-row-margin">
</div>
<span class="main-font label" data-i18n="is-in-danger">Estiver em grande perigo</span>
</div>
<div class="dice-row">
<input class="dice-row-margin" type="checkbox" value="1" name='attr_chk_be_relentless3' />
<div class="plus dice-row-margin">
+
</div>
<div class="die-icon dice-row-margin">
</div>
<span class="main-font label" data-i18n="ignoring-help">Se estiver ignorando um pedido de ajuda</span>
</div>
</div>
<div class="box actions">
<span class="title2 box-title secondary-font" data-i18n="be-safe">Estar Segura</span>
<div class="dice-row">
<input class="dice-row-margin" type="checkbox" value="1" name='attr_chk_be_safe1' />
<div class="plus dice-row-margin">
+
</div>
<div class="die-icon dice-row-margin">
</div>
<span class="main-font label" data-i18n="stay-hidden">Manter-se oculta na cena</span>
</div>
<div class="dice-row">
<input class="dice-row-margin" type="checkbox" value="1" name='attr_chk_be_safe2' />
<div class="plus dice-row-margin">
+
</div>
<div class="die-icon dice-row-margin">
</div>
<span class="main-font label" data-i18n="against-resistance">Não agir diretamente contra uma
Resistência</span>
</div>
<div class="dice-row">
<input class="dice-row-margin" type="checkbox" value="1" name='attr_chk_be_safe3' />
<div class="plus dice-row-margin">
+
</div>
<div class="die-icon dice-row-margin">
</div>
<span class="main-font label" data-i18n="familiar-place">Agindo em um lugar familiar</span>
</div>
</div>
<div class="flex-column">
<div class="box flex-column">
<span class="title2 box-title secondary-font" data-i18n="nationality">Nacionalidade</span>
<div class="dice-row">
<input class="dice-row-margin" type="checkbox" value="1" name='attr_chk_nationality' />
<div class="plus dice-row-margin">
+
</div>
<div class="die-icon dice-row-margin">
</div>
<textarea name="attr_nationality_ability" type="text" title="{@nationality_ability}"> </textarea>
</div>
</div>
<div class="box flex-column">
<span class="title2 box-title secondary-font" data-i18n="heroine-destinies">Destinos de Heroína</span>
<fieldset class="repeating_destinies">
<div class="repeatable-item">
<div class="repeatable-dice-row">
<input type="hidden" value="no" name='attr_generated_value' />
<input class="dice-row-margin" type="checkbox" value="1" name='attr_chk_destiny' />
<textarea name="attr_destiny" type="text" title="{@destiny}"></textarea>
</div>
</div>
</fieldset>
</div>
</div>
<div class="box flex-column">
<span class="title2 box-title secondary-font" data-i18n="specialty">Especialidade</span>
<fieldset class="repeating_specialty-abilities">
<div class="repeatable-item">
<div class="repeatable-dice-row">
<input type="hidden" value="no" name='attr_generated_value' />
<input class="dice-row-margin" type="checkbox" value="1" name='attr_chk_specialty_ability' />
<div class="plus dice-row-margin">
+
</div>
<div class="die-icon dice-row-margin">
</div>
<textarea name="attr_special_ability" type="text" title="{@special_ability}"></textarea>
</div>
</div>
</fieldset>
</div>
<div class="box flex-column">
<span class="title2 box-title secondary-font" data-i18n="belongings">Pertences</span>
<fieldset class="repeating_belongings">
<div class="repeatable-item">
<div class="repeatable-row">
<input class="row-item-margin" name="attr_belongingname" type="text" data-i18n-placeholder="name"
placeholder="Nome" />
</div>
<div class="repeatable-row">
<div class="repeatable-dice-row">
<input class="dice-row-margin" type="checkbox" value="1" name='attr_chk_belonging1' />
<div class="plus dice-row-margin">
+
</div>
<div class="die-icon dice-row-margin">
</div>
</div>
<input class="row-item-margin" name="attr_belonginglabel1" type="text" data-i18n-placeholder="label"
placeholder="Rótulo" />
<div class="repeatable-row-box">
<span class="label main-font" data-i18n="level">Nível</span>
<input class="row-item-margin" name="attr_belonginglevel1" type="number" value="0" />
</div>
</div>
<div class="repeatable-row">
<div class="repeatable-dice-row">
<input class="dice-row-margin" type="checkbox" value="1" name='attr_chk_belonging2' />
<div class="plus dice-row-margin">
+
</div>
<div class="die-icon dice-row-margin">
</div>
</div>
<input class="row-item-margin" name="attr_belonginglabel2" type="text" data-i18n-placeholder="label"
placeholder="Rótulo" />
<div class="repeatable-row-box">
<span class="label main-font" data-i18n="level">Nível</span>
<input class="row-item-margin" name="attr_belonginglevel2" type="number" value="0" />
</div>
</div>
</div>
</fieldset>
</div>
</div>
<div class="flex-row">
<div class="box flex-column grow">
<span class="title2 box-title secondary-font" data-i18n="karmas">Karmas</span>
<span class="label main-font" data-i18n="objective">Objetivo</span>
<div class="karma-row">
<div class="karma-clock">
<div class="clock-div clock-0deg"></div>
<div class="clock-div clock-90deg"></div>
<input class="clock-input" type="radio" name="attr_objective_clock" value="0" checked="checked" />
<span></span>
<input class="clock-input" type="radio" name="attr_objective_clock" value="1" />
<input class="clock-input" type="radio" name="attr_objective_clock" value="2" />
<input class="clock-input" type="radio" name="attr_objective_clock" value="3" />
<input class="clock-input" type="radio" name="attr_objective_clock" value="4" />
<div class="clock-paint"></div>
</div>
<textarea name="attr_objective" title="{@objective}"></textarea>
</div>
<span class="label main-font" data-i18n="belief">Crença</span>
<div class="karma-row">
<div class="karma-clock">
<div class="clock-div clock-0deg"></div>
<div class="clock-div clock-90deg"></div>
<input class="clock-input" type="radio" name="attr_belief_clock" value="0" checked="checked" />
<span></span>
<input class="clock-input" type="radio" name="attr_belief_clock" value="1" />
<input class="clock-input" type="radio" name="attr_belief_clock" value="2" />
<input class="clock-input" type="radio" name="attr_belief_clock" value="3" />
<input class="clock-input" type="radio" name="attr_belief_clock" value="4" />
<div class="clock-paint"></div>
</div>
<textarea name="attr_belief" title="{@belief}"></textarea>
</div>
<span class="label main-font" data-i18n="commitment">Compromisso</span>
<div class="karma-row">
<div class="karma-clock">
<div class="clock-div clock-0deg"></div>
<div class="clock-div clock-90deg"></div>
<input class="clock-input" type="radio" name="attr_commitment_clock" value="0" checked="checked" />
<span></span>
<input class="clock-input" type="radio" name="attr_commitment_clock" value="1" />
<input class="clock-input" type="radio" name="attr_commitment_clock" value="2" />
<input class="clock-input" type="radio" name="attr_commitment_clock" value="3" />
<input class="clock-input" type="radio" name="attr_commitment_clock" value="4" />
<div class="clock-paint"></div>
</div>
<textarea name="attr_commitment" title="{@commitment}"></textarea>
</div>
</div>
<div class="box independence">
<span class="title2 box-title secondary-font" data-i18n="independence-points">Pontos de Independência</span>
<div class="flex-row">
<div class="circle-box independence-circle-size">
<input class="independence-checkbox" type="checkbox" name="attr_independence_chk1"
title="{@independence_chk1}" />
<div class="blank-circle independence-circle-size circle"></div>
<div class="black-circle independence-circle-size circle"></div>
</div>
<div class="circle-box independence-circle-size">
<input class="independence-checkbox" type="checkbox" name="attr_independence_chk2"
title="{@independence_chk2}" />
<div class="blank-circle independence-circle-size circle"></div>
<div class="black-circle independence-circle-size circle"></div>
</div>
<div class="circle-box independence-circle-size">
<input class="independence-checkbox" type="checkbox" name="attr_independence_chk3"
title="{@independence_chk3}" />
<div class="blank-circle independence-circle-size circle"></div>
<div class="black-circle independence-circle-size circle"></div>
</div>
<div class="circle-box independence-circle-size">
<input class="independence-checkbox" type="checkbox" name="attr_independence_chk4"
title="{@independence_chk4}" />
<div class="blank-circle independence-circle-size circle"></div>
<div class="black-circle independence-circle-size circle"></div>
</div>
<div class="circle-box independence-circle-size">
<input class="independence-checkbox" type="checkbox" name="attr_independence_chk5"
title="{@independence_chk5}" />
<div class="blank-circle independence-circle-size circle"></div>
<div class="black-circle independence-circle-size circle"></div>
</div>
<div class="circle-box independence-circle-size">
<input class="independence-checkbox" type="checkbox" name="attr_independence_chk6"
title="{@independence_chk6}" />
<div class="blank-circle independence-circle-size circle"></div>
<div class="black-circle independence-circle-size circle"></div>
</div>
<div class="circle-box independence-circle-size">
<input class="independence-checkbox" type="checkbox" name="attr_independence_chk7"
title="{@independence_chk7}" />
<div class="blank-circle independence-circle-size circle"></div>
<div class="black-circle independence-circle-size circle"></div>
</div>
<div class="circle-box independence-circle-size">
<input class="independence-checkbox" type="checkbox" name="attr_independence_chk8"
title="{@independence_chk8}" />
<div class="blank-circle independence-circle-size circle"></div>
<div class="black-circle independence-circle-size circle"></div>
</div>
<div class="circle-box independence-circle-size">
<input class="independence-checkbox" type="checkbox" name="attr_independence_chk9"
title="{@independence_chk9}" />
<div class="blank-circle independence-circle-size circle"></div>
<div class="black-circle independence-circle-size circle"></div>
</div>
<div class="circle-box independence-circle-size">
<input class="independence-checkbox" type="checkbox" name="attr_independence_chk10"
title="{@independence_chk10}" />
<div class="blank-circle independence-circle-size circle"></div>
<div class="black-circle independence-circle-size circle"></div>
</div>
</div>
<div class="logo">
</div>
</div>
</div>
<div class="flex-row">
<div class="box flex-column">
<span class="title2 box-title secondary-font" data-i18n="impetus">Ímpeto</span>
<div class="impetus-clock-container">
<div class="impetus-clock">
<div class="clock-div clock-45deg"></div>
<div class="clock-div clock-90deg"></div>
<div class="clock-div clock-135deg"></div>
<div class="clock-div clock-180deg"></div>
<input class="clock-input" type="radio" name="attr_impetus_clock" value="0" checked="checked" />
<span></span>
<input class="clock-input" type="radio" name="attr_impetus_clock" value="1" />
<input class="clock-input" type="radio" name="attr_impetus_clock" value="2" />
<input class="clock-input" type="radio" name="attr_impetus_clock" value="3" />
<input class="clock-input" type="radio" name="attr_impetus_clock" value="4" />
<input class="clock-input" type="radio" name="attr_impetus_clock" value="5" />
<input class="clock-input" type="radio" name="attr_impetus_clock" value="6" />
<input class="clock-input" type="radio" name="attr_impetus_clock" value="7" />
<div class="clock-paint"></div>
</div>
<span class="main-font impetus-label determined" data-i18n="determined">Determinada</span>
<span class="main-font impetus-label tired" data-i18n="tired">Cansada</span>
<div class="flex-column weak main-font">
<span class="impetus-label" data-i18n="weak">Fraca</span>
<div class="impetus-die-box">
<div class="impetus-die-number">
-1
</div>
<div class="die-icon impetus-die-icon">
</div>
</div>
</div>
<div class="flex-row shaken main-font">
<div class="impetus-die-box">
<div class="impetus-die-number">
-2
</div>
<div class="die-icon impetus-die-icon">
</div>
</div>
<span class="impetus-label" data-i18n="shaken">Abalada</span>
</div>
<span class="main-font trauma impetus-label" data-i18n="trauma">Trauma</span>
</div>
</div>
<div class="box traumas">
<span class="title2 box-title secondary-font" data-i18n="traumas">Traumas</span>
<div class="traumas-box">
<textarea name="attr_trauma1" title="{@trauma1}" data-i18n-placeholder="first-trauma"
placeholder="1º Trauma"></textarea>
<textarea name="attr_trauma2" title="{@trauma2}" data-i18n-placeholder="second-trauma"
placeholder="2º Trauma"></textarea>
<textarea name="attr_trauma3" title="{@trauma3}" data-i18n-placeholder="third-trauma"
placeholder="3º Trauma"></textarea>
<textarea name="attr_trauma4" title="{@trauma4}" data-i18n-placeholder="fourth-trauma"
placeholder="4º Trauma"></textarea>
</div>
</div>
</div>
<div class="flex-row">
<div class="box flex-column notes-box">
<span class="title2 box-title secondary-font" data-i18n="notes">Anotações</span>
<textarea name="attr_notes" title="{@notes}"></textarea>
</div>
</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 main-font">
<span data-i18n="copyright">Goddess Save The Queen é um jogo escrito por Carol Neves e Julio Matos.</span>
</div>
</div>
<!-- end of sheet -->
<!-- General strings translations for Roll Queries and Sheet Workers-->
<div style="display: none;">
<span data-i18n="engineering_ability1">Quando estiver consertando ou criando um artefato ou ferramenta mecânica</span>
<span data-i18n="engineering_ability2">Se estiver avaliando ou interagindo com um mecanismo</span>
<span data-i18n="engineering_ability3">Quando pressionada a agir de forma rápida</span>
<span data-i18n="engineering_ability4">Quando puder se expressar através de desenhos e fórmulas</span>
<span data-i18n="engineering_ability5">Se teve tempo para se preparar antes da situação</span>
<span data-i18n="scholarship_ability1">Quando lidar com resquícios de civilizações perdidas</span>
<span data-i18n="scholarship_ability2">Se estiver debatendo uma tese</span>
<span data-i18n="scholarship_ability3">Se algo totalmente desconhecido e antinatural estiver na Cena</span>
<span data-i18n="scholarship_ability4">Ao lidar com linguagens atuais ou esquecidas</span>
<span data-i18n="scholarship_ability5">Quando procura por coisas escondidas</span>
<span data-i18n="infiltration_ability1">Se estiver tentando passar despercebida na Cena</span>
<span data-i18n="infiltration_ability2">Se estiver promovendo uma farsa</span>
<span data-i18n="infiltration_ability3">Quando estiver tentando invadir ou escapar de um local protegido</span>
<span data-i18n="infiltration_ability4">Falar com alguém que nunca conheceu antes</span>
<span data-i18n="infiltration_ability5">Quando estiver perseguindo ou fugindo de alguém</span>
<span data-i18n="military_ability1">Quando estiver sob fogo cruzado</span>
<span data-i18n="military_ability2">Ao usar qualquer tipo de equipamento bélico na Cena</span>
<span data-i18n="military_ability3">Se estiver em uma situação de risco de falha definitiva da missão</span>
<span data-i18n="military_ability4">Quando estiver resistindo a um interrogatório</span>
<span data-i18n="military_ability5">Se estiver ferida fisicamente</span>
<span data-i18n="piloting_ability1">Se estiver pilotando qualquer tipo de veículo mecanizado</span>
<span data-i18n="piloting_ability2">Quando estiver se locomovendo em altíssima velocidade</span>
<span data-i18n="piloting_ability3">Quando lida com contatos do submundo</span>
<span data-i18n="piloting_ability4">Quando estiver auxiliando diretamente uma aliada</span>
<span data-i18n="piloting_ability5">Estiver lidando com uma situação “Tudo ou Nada”</span>
<span data-i18n="military_destiny1">Subjugar um inimigo quando você está em evidente desvantagem.</span>
<span data-i18n="military_destiny2">Provocar inimigos perigosos com uma bravata.</span>
<span data-i18n="engineering_destiny1">Resolver um problema tendo uma epifania do tipo “Esperem, tive uma ideia!”.</span>
<span data-i18n="engineering_destiny2">Explicar um plano complexo usando uma metáfora mecânica.</span>
<span data-i18n="infiltration_destiny1">Usar uma frase de efeito ao encontrar um inimigo recorrente.</span>
<span data-i18n="infiltration_destiny2">Enganar um grupo grande de pessoas com um truque.</span>
<span data-i18n="piloting_destiny1">Ser dada como morta ao desaparecer em alguma proeza e retornar triunfante.</span>
<span data-i18n="piloting_destiny2">Tratar um veículo como se fosse uma pessoa.</span>
<span data-i18n="scholarship_destiny1">Descrever algo desconhecido com um tom professoral.</span>
<span data-i18n="scholarship_destiny2">Apresentar a resposta para um problema citando um livro ou um cientista.</span>
</div>
<!--Sheet Workers -->
<script type="text/worker">
const buttonlist = ["profile","journal","configuration"];
const generatedAttributeName = "generated_value";
/*config tabs control */
buttonlist.forEach(button => {
on(`clicked:${button}`, function() {
setAttrs({
tabcontrol: button
});
});
});
/* Delete pre-generated values from a repeating section */
function clearGeneratedValues(targetSection) {
getSectionIDs(targetSection, function(idarray) {
let attributes = [];
let ids = {};
for(var i=0; i < idarray.length; i++) {
let generatedAttribute = targetSection + "_" + idarray[i] + "_" + generatedAttributeName;
attributes.push(generatedAttribute);
ids[generatedAttribute] = idarray[i];
}
getAttrs(attributes, function(values) {
attributes.forEach(attribute => {
let isGenerated = values[attribute];
if (isGenerated == "yes") {
removeRepeatingRow(targetSection + "_" + ids[attribute]);
}
});
});
});
/*reseting dice pool for consistency */
clearAll(true);
}
/* load pre-generated data on repeating section */
function loadSpecialtyData(specialty, translationType, targetSection, targetAttribute, quantity) {
let newRowAttrs = {};
/* first, clear all pre-generated-values */
clearGeneratedValues(targetSection);
for (let i=1; i <= quantity; i++) {
let newId = generateRowID();
let translationKey = specialty + "_" + translationType + i;
newRowAttrs[targetSection + "_" + newId + "_" + generatedAttributeName] = "yes";
newRowAttrs[targetSection + "_" + newId + "_" + targetAttribute] = getTranslationByKey(translationKey);
}
setAttrs(newRowAttrs);
}
/* sets the selected value to the hidden selected_specialty attribute.
this attribute is used to control wether the sheet will show the custom specialty input*/
function changeSpecialtySelectedControl(selected) {
setAttrs(
{
selected_specialty: selected
}
);
}
function updateDicePoolOfItemRemoved(eventInfo, chkName, targetPool) {
let chkAttribute = eventInfo.sourceAttribute + "_" + chkName;
/* if it is checked, then update the dice pool */
if (eventInfo.removedInfo[chkAttribute] == "1") {
updateDicePoolValue("0", 1, targetPool);
}
}
/*update dice pool when a destiny is deleted */
on("remove:repeating_destinies", function(eventInfo) {
updateDicePoolOfItemRemoved(eventInfo, "chk_destiny", "destinies-dice");
});
/*update dice pool when a special ability is deleted */
on("remove:repeating_specialty-abilities", function(eventInfo) {
updateDicePoolOfItemRemoved(eventInfo, "chk_specialty_ability", "specialty-dice");
});
/*update dice pool when a special ability is deleted */
on("remove:repeating_belongings", function(eventInfo) {
let incrementToUpdate = 0;
/* if it is checked, then update the dice pool */
for (let i = 1; i <= 2; i++) {
let chkBelonging = eventInfo.sourceAttribute + "_chk_belonging" + i;
let belongingLevel = eventInfo.sourceAttribute + "_belonginglevel" + i;
if (eventInfo.removedInfo[chkBelonging] == "1") {
incrementToUpdate += parseInt(eventInfo.removedInfo[belongingLevel])||0;;
}
}
if (incrementToUpdate > 0) {
updateDicePoolValue("0", incrementToUpdate, "belongings-dice");
}
});
/*specialty selection*/
on("change:specialty_select", function(eventInfo) {
const selected = eventInfo.newValue;
let abilitiesSection = "repeating_specialty-abilities";
let destiniesSection = "repeating_destinies";
changeSpecialtySelectedControl(selected);
if (selected != 'custom') {
loadSpecialtyData(selected, "ability", abilitiesSection, "special_ability", 5);
loadSpecialtyData(selected, "destiny", destiniesSection, "destiny", 2);
} else {
clearGeneratedValues(abilitiesSection);
clearGeneratedValues(destiniesSection);
}
});
function clearRepeatingSection(targetSection, targetAttr) {
let targetObject = new Object();
getSectionIDs(targetSection, function(idarray) {
for(var i=0; i < idarray.length; i++) {
let chkName = targetSection + "_" + idarray[i] + "_" + targetAttr;
targetObject[chkName] = '0';
}
setAttrs(targetObject);
});
}
function clearDicePool(clearDestiny) {
dice = ["action-dice", "specialty-dice", "nationality-dice", "belongings-dice", "destinies-dice"];
let targetObject = new Object();
dice.forEach(die => {
if (!(die == 'destinies-dice' && !clearDestiny)) {
targetObject[die] = 0;
}
});
getAttrs(["base-dice", "impetus-dice"], function(values) {
let baseDiceValue = parseInt(values["base-dice"])||0;
let impetusDiceValue = parseInt(values["impetus-dice"])||0;
let totalValue = baseDiceValue - impetusDiceValue;
if (totalValue < 0) {
totalValue = 0;
}
targetObject["dicetotal"] = totalValue;
setAttrs(targetObject);
});
}
function clearAll(clearDestiny) {
let targetObject = new Object();
const checkboxes = ["chk_be_a_hero1", "chk_be_a_hero2", "chk_be_a_hero3",
"chk_be_relentless1", "chk_be_relentless2", "chk_be_relentless3",
"chk_be_safe1", "chk_be_safe2", "chk_be_safe3",
"chk_nationality"];
checkboxes.forEach(chk => {
targetObject[chk] = '0';
});
if (clearDestiny) {
clearRepeatingSection('repeating_destinies', 'chk_destiny');
}
clearRepeatingSection('repeating_specialty-abilities', 'chk_specialty_ability');
clearRepeatingSection('repeating_belongings', 'chk_belonging1');
clearRepeatingSection('repeating_belongings', 'chk_belonging2');
setAttrs(targetObject);
clearDicePool(clearDestiny);
}
/* Clear dice pool and all checks, except for impetus */
on("clicked:clearall", function(eventInfo) {
clearAll(true);
});
/* Clear dice pool and all checks, except for impetus and destinies */
on("clicked:cleardicepool", function(eventInfo) {
clearAll(false);
});
function updateDicePoolValue(checked, increment, target) {
getAttrs([target], function(values) {
let currentValue = parseInt(values[target])||0;
let updatedValue = 0;
let targetObject = new Object();
/* if it is checked */
if (checked == '1') {
updatedValue = currentValue+increment;
} else {
updatedValue = currentValue-increment;
}
if (updatedValue < 0) {
updatedValue = 0;
}
targetObject[target] = updatedValue;
setAttrs(targetObject);
});
}
/* setting action checkboxes listener */
on(`change:chk_be_a_hero1 change:chk_be_a_hero2 change:chk_be_a_hero3
change:chk_be_relentless1 change:chk_be_relentless2 change:chk_be_relentless3
change:chk_be_safe1 change:chk_be_safe2 change:chk_be_safe3`, function(eventInfo) {
const checkedValue = eventInfo.newValue;
let target = "action-dice";
updateDicePoolValue(checkedValue, 1, target);
});
/* setting specialty checkboxes listener */
on("change:repeating_specialty-abilities:chk_specialty_ability", function(eventInfo) {
const checkedValue = eventInfo.newValue;
let target = "specialty-dice";
updateDicePoolValue(checkedValue, 1, target);
});
/* setting nationality checkboxes listener */
on("change:chk_nationality", function(eventInfo) {
const checkedValue = eventInfo.newValue;
let target = "nationality-dice";
updateDicePoolValue(checkedValue, 1, target);
});
/* setting belongings checkboxes listener */
on("change:repeating_belongings:chk_belonging1 change:repeating_belongings:chk_belonging2", function(eventInfo) {
const source = eventInfo.sourceAttribute;
const checkedValue = eventInfo.newValue;
let target = "belongings-dice";
const levelNumber = source[source.length-1];
const levelName = "repeating_belongings_belonginglevel" + levelNumber;
getAttrs([levelName], function(values) {
let newValue = parseInt(values[levelName])||0;
updateDicePoolValue(checkedValue, newValue, target);
});
});
/* setting belongings levels listener.
If a belonging level is changed and that belonging is checked, then the dice value
has to be updated */
on("change:repeating_belongings:belonginglevel1 change:repeating_belongings:belonginglevel2", function(eventInfo) {
const source = eventInfo.sourceAttribute;
let newValue = parseInt(eventInfo.newValue)||0;
let oldValue = parseInt(eventInfo.previousValue)||0;
let increment = newValue - oldValue;
let target = "belongings-dice";
const chkNumber = source[source.length-1];
const chkName = "repeating_belongings_chk_belonging" + chkNumber;
getAttrs([chkName], function(values) {
const checkedValue = values[chkName];
/* Se estiver marcado, atualiza o valor dos dados */
if (checkedValue == '1') {
updateDicePoolValue(checkedValue, increment, target);
}
});
});
/* setting destinies checkboxes listener */
on("change:repeating_destinies:chk_destiny", function(eventInfo) {
const checkedValue = eventInfo.newValue;
let target = "destinies-dice";
updateDicePoolValue(checkedValue, 1, target);
});
/* setting impetus clock listener */
on("change:impetus_clock", function(eventInfo) {
const impetusValue = eventInfo.newValue;
let targetValue = 0;
let target = 'impetus-dice';
let targetObject = new Object();
switch(impetusValue) {
case '5':
targetValue = 1;
break;
case '6':
case '7':
targetValue = 2;
break;
}
targetObject[target] = targetValue;
setAttrs(targetObject);
});
function recalculateDiceTotal() {
let dice = ["base-dice", "action-dice", "specialty-dice", "nationality-dice", "belongings-dice", "destinies-dice", "impetus-dice"];
let total = 0;
getAttrs(dice, function(values) {
dice.forEach(die => {
let parsedValue = parseInt(values[die])||0;
if (die == 'impetus-dice') {
total -= parsedValue;
} else {
total += parsedValue;
}
if (total < 0) {
total = 0;
}
setAttrs({
dicetotal: total
});
});
});
}
/* setting dice total listener */
on(`change:base-dice change:action-dice change:specialty-dice change:nationality-dice
change:belongings-dice change:destinies-dice change:impetus-dice`, function(eventInfo) {
recalculateDiceTotal();
});
</script>