Add Initiative button and more to-hit tooltips

This commit is contained in:
James Fleming
2022-01-05 08:39:15 -05:00
parent d7ef4d9dd0
commit 2f0c9e3b05
2 changed files with 81 additions and 37 deletions
+21 -8
View File
@@ -152,8 +152,6 @@
top:.17em;
text-align: center;
/* It's a fade intheinthe original */
margin-left: .125em;
margin-right: .125em;
margin-top: 0em;
padding-left: .125em;
padding-right: .125em;
@@ -189,6 +187,7 @@
.sheet-rolltemplate-cast-spell .sheet-container,
.sheet-rolltemplate-attack .sheet-container,
.sheet-rolltemplate-initiative .sheet-container,
.sheet-rolltemplate-turnorder .sheet-container,
.sheet-rolltemplate-description .sheet-container
{
background-color: #ffffff;
@@ -202,6 +201,7 @@
.sheet-rolltemplate-cast-spell .sheet-container h1,
.sheet-rolltemplate-attack .sheet-container h1,
.sheet-rolltemplate-initiative .sheet-container h1,
.sheet-rolltemplate-turnorder .sheet-container h1,
.sheet-rolltemplate-description .sheet-container h1
{
color: rgb(126, 45, 64);
@@ -216,6 +216,7 @@
.sheet-rolltemplate-cast-spell .sheet-container h2,
.sheet-rolltemplate-attack .sheet-container h2,
.sheet-rolltemplate-initiative .sheet-container h2,
.sheet-rolltemplate-turnorder .sheet-container h2,
.sheet-rolltemplate-description .sheet-container h2
{
color: rgb(126, 45, 64);
@@ -225,7 +226,6 @@
letter-spacing: -.01em;
}
.sheet-rolltemplate-description .sheet-container h1
{
font-style: normal;
@@ -236,6 +236,7 @@
.sheet-rolltemplate-cast-spell div,
.sheet-rolltemplate-attack div,
.sheet-rolltemplate-initiative div,
.sheet-rolltemplate-turnorder div,
.sheet-rolltemplate-description div
{
padding: 2.5px;
@@ -248,6 +249,7 @@
.sheet-rolltemplate-cast-spell span,
.sheet-rolltemplate-attack span,
.sheet-rolltemplate-initiative span,
.sheet-rolltemplate-turnorder span,
.sheet-rolltemplate-description span
{
color: rgb(126, 45, 64);
@@ -264,6 +266,7 @@
.sheet-rolltemplate-cast-spell .sheet-arrow-right,
.sheet-rolltemplate-attack .sheet-arrow-right,
.sheet-rolltemplate-initiative .sheet-arrow-right,
.sheet-rolltemplate-turnorder .sheet-arrow-right,
.sheet-rolltemplate-description .sheet-arrow-right
{
border-bottom: 2px solid transparent;
@@ -286,7 +289,11 @@
.sheet-rolltemplate-cast-spell .inlinerollresult,
.sheet-rolltemplate-cast-spell .inlinerollresult.fullcrit,
.sheet-rolltemplate-cast-spell .inlinerollresult.fullfail,
.sheet-rolltemplate-cast-spell .inlinerollresult.importantroll
.sheet-rolltemplate-cast-spell .inlinerollresult.importantroll,
.sheet-rolltemplate-turnorder .inlinerollresult,
.sheet-rolltemplate-turnorder .inlinerollresult.fullcrit,
.sheet-rolltemplate-turnorder .inlinerollresult.fullfail,
.sheet-rolltemplate-turnorder .inlinerollresult.importantroll
{
display: inline-block;
min-width: 1.5em;
@@ -298,7 +305,8 @@
.sheet-rolltemplate-stat-check3 .sheet-template-dice .inlinerollresult,
.sheet-rolltemplate-stat-check4 .sheet-template-dice .inlinerollresult,
.sheet-rolltemplate-attack .sheet-template-dice .inlinerollresult,
.sheet-rolltemplate-cast-spell .sheet-template-dice .inlinerollresult
.sheet-rolltemplate-cast-spell .sheet-template-dice .inlinerollresult,
.sheet-rolltemplate-initiative .sheet-template-dice .inlinerollresult
{
font-family: dicefontd6;
font-size: 2.5em;
@@ -330,14 +338,17 @@
.sheet-rolltemplate-attack .sheet-keyvalue span:first-child,
.sheet-rolltemplate-cast-spell .sheet-keyvalue span:first-child,
.sheet-rolltemplate-description .sheet-keyvalue span:first-child,
.sheet-rolltemplate-initiative .sheet-keyvalue span:first-child
.sheet-rolltemplate-initiative .sheet-keyvalue span:first-child,
.sheet-rolltemplate-turnorder .sheet-keyvalue span:first-child
{
font-weight: 550;
}
.sheet-rolltemplate-attack .sheet-description,
.sheet-rolltemplate-cast-spell .sheet-description,
.sheet-rolltemplate-description .sheet-description {
.sheet-rolltemplate-description .sheet-description,
.sheet-rolltemplate-turnorder .sheet-description
{
font-style: italic;
}
@@ -345,7 +356,9 @@
.sheet-rolltemplate-stat-check4 .sheet-capitalize,
.sheet-rolltemplate-attack .sheet-capitalize,
.sheet-rolltemplate-cast-spell .sheet-capitalize,
.sheet-rolltemplate-description .sheet-capitalize {
.sheet-rolltemplate-turnorder .sheet-capitalize,
.sheet-rolltemplate-description .sheet-capitalize
{
text-transform: capitalize;
}
+60 -29
View File
@@ -88,18 +88,21 @@
</div>
</div>
<div class="sheet-combat sheet-block">
<div> <!-- just to stop from wrapping -->
<div> <!-- stops from stretching -->
<div class=sheet-flex-centered style='margin-bottom: .5rem'>
<button class=sheet-dice-button type="action" title="Add yourself to Turn Order." name="act_turnorder">Turn Order</button>
<button class=sheet-dice-button type="action" title="Roll team Initiative." name="act_initiative">Initiative</button>
</div>
<div class=sheet-flex-centered>
<button type=roll title="Add yourself to Turn Order." value="&{template:initiative} {{character_name=@{character_name}}} {{initiative=[[@{DX}[DEX] &{tracker}]]}}"><b style='font-size: .8em;'>Initiative</b></button>
<span>
<span class='sheet-label sheet-first-word' style='width: 5rem' title="Current Strength adjusted by Wounds and Fatigue.">Health </span>
<span class=sheet-stat-final name="attr_stcurrent"/>
</span>
<span>
<button class=sheet-dice-button type="action" title="3d6 Health Check" name="act_health_check3">3</button>
<button class=sheet-dice-button type="action" title="4d6 Health Check" name="act_health_check4">4</button>
</span>
</div>
<div >
<span class='sheet-label sheet-first-word' style='width: 5rem' title="Current Strength adjusted by Wounds and Fatigue.">Health </span>
<span class=sheet-stat-final name="attr_stcurrent"/>
</div>
<div class=sheet-nowrap>
<span class=sheet-label style='width: 5rem;' title="Damage done to your Health, must be healed.">Wounds </span>
<input type=number class=sheet-stat-input name="attr_Hits" value="0"/>
@@ -158,12 +161,12 @@
<div class=sheet-flex-centered>
<span class="sheet-label sheet-first-word" title="Roll to attack with selected Weapon or cast Spell at a given to-hit value.">Attack/Cast&nbsp;</span>
<span class=sheet-nowrap>
<button class=sheet-attack-button type="action" name="act_attack-6">-6</button>
<button class=sheet-attack-button title="Against invisible" type="action" name="act_attack-6">-6</button>
<button class=sheet-attack-button type="action" name="act_attack-5">-5</button>
<button class=sheet-attack-button title="Ranged at Prone behind cover" type="action" name="act_attack-4">-4</button>
<button class=sheet-attack-button title="Projectiles against Prone behind cover or Flying" type="action" name="act_attack-4">-4</button>
<button class=sheet-attack-button title="Health at 3 or less" type="action" name="act_attack-3">-3</button>
<button class=sheet-attack-button title="Severely Wounded (-5 or more) last turn" type="action" name="act_attack-2">-2</button>
<button class=sheet-attack-button type="action" name="act_attack-1">-1</button>
<button class=sheet-attack-button title="Projectiles per 10 vertical feet" type="action" name="act_attack-1">-1</button>
<button class=sheet-attack-button type="action" name="act_attack0">0</button>
<button class=sheet-attack-button type="action" name="act_attack1">1</button>
<button class=sheet-attack-button title="Flank Attack" type="action" name="act_attack2">2</button>
@@ -731,22 +734,37 @@
</div>
</rolltemplate>
<!-- For initiative, just nice to have a template -->
<!-- For Initiative order -->
<rolltemplate class="sheet-rolltemplate-initiative">
<div class=container>
<div><h1>
{{character_name}} takes initiative!
</h1></div>
<div class=arrow-container><div class=arrow-right></div></div>
<div class=keyvalue>
<span>Dexterity: </span><span>{{initiative}}</span>
<div>
<div>
<span class=template-dice>{{computed::roll1}}</span>
</div>
</div>
</div>
</rolltemplate>
<!-- For Descriptions, just nice to have a template -->
<!-- For turn order -->
<rolltemplate class="sheet-rolltemplate-turnorder">
<div class=container>
<div><h1>
{{character_name}}'s Turn Order
</h1></div>
<div class=arrow-container><div class=arrow-right></div></div>
<div class=keyvalue>
<span>Dexterity: </span><span>{{turnorder}}</span>
</div>
</div>
</rolltemplate>
<!-- For Descriptions -->
<rolltemplate class="sheet-rolltemplate-description">
<div class=container>
<div><h1>
@@ -831,23 +849,23 @@
const diceArrayToString = function(rolls) {
let diceString = '';
for (i = 0; i < rolls.length; ++i) {
let roll = rolls[i];
if (roll == 1) diceString += 'a';
else if (roll == 2) diceString += 'b';
else if (roll == 3) diceString += 'c';
else if (roll == 4) diceString += 'd';
else if (roll == 5) diceString += 'e';
else diceString += 'f';
if (i < rolls.length -1)
diceString += '&#8239;' // '&thinsp;'
if (rolls) {
for (i = 0; i < rolls.length; ++i) {
let roll = rolls[i];
if (roll == 1) diceString += 'a';
else if (roll == 2) diceString += 'b';
else if (roll == 3) diceString += 'c';
else if (roll == 4) diceString += 'd';
else if (roll == 5) diceString += 'e';
else diceString += 'f';
if (i < rolls.length -1)
diceString += '&#8239;' // '&thinsp;'
}
}
return diceString;
}
const finishRollWithDiceString = function(rolls, rollId) {
const finishRollWithDiceString = function(rollId, rolls) {
let diceString = diceArrayToString(rolls);
finishRoll(
rollId,
@@ -860,7 +878,12 @@
const doRollWithDiceString = function(macro) {
macro += ' {{character_name=@{cname}}}';
startRoll(macro, (results) => {
finishRollWithDiceString(results.results.roll1.dice, results.rollId);
if ('roll1' in results.results) {
finishRollWithDiceString(results.rollId, results.results.roll1.dice);
}
else {
finishRollWithDiceString(results.rollId);
}
});
}
@@ -1012,6 +1035,15 @@
doRollWithDiceString("&{template:stat-check4} {{stat_a=a}} {{stat_name=health}} {{stat=[[@{stcurrent}[HEALTH]]]}} {{roll1=[[4d6]]}}");
});
on('clicked:initiative', (info) => {
doRollWithDiceString("&{template:initiative} {{roll1=[[1d6]]}}");
});
on('clicked:turnorder', (info) => {
doRollWithDiceString("&{template:turnorder} {{character_name=@{character_name}}} {{turnorder=[[@{DX}[DEX] &{tracker}]]}}");
});
/* TALENT HANDLERS */
// Expand or describe a talent.
@@ -1418,7 +1450,6 @@
});
});
// Update unspent iq points.
on('sheet:opened '
+ 'change:repeating_talents remove:repeating_talents '