Add shield rush roll template

This commit is contained in:
James Fleming
2022-01-06 15:54:50 -05:00
parent e63db11a9e
commit 553174109e
2 changed files with 84 additions and 2 deletions
+14 -1
View File
@@ -185,6 +185,7 @@
.sheet-rolltemplate-stat-check .sheet-container,
.sheet-rolltemplate-cast-spell .sheet-container,
.sheet-rolltemplate-attack .sheet-container,
.sheet-rolltemplate-shield-rush .sheet-container,
.sheet-rolltemplate-initiative .sheet-container,
.sheet-rolltemplate-turnorder .sheet-container,
.sheet-rolltemplate-description .sheet-container
@@ -198,6 +199,7 @@
.sheet-rolltemplate-stat-check .sheet-container h1,
.sheet-rolltemplate-cast-spell .sheet-container h1,
.sheet-rolltemplate-attack .sheet-container h1,
.sheet-rolltemplate-shield-rush .sheet-container h1,
.sheet-rolltemplate-initiative .sheet-container h1,
.sheet-rolltemplate-turnorder .sheet-container h1,
.sheet-rolltemplate-description .sheet-container h1
@@ -212,6 +214,7 @@
.sheet-rolltemplate-stat-check .sheet-container h2,
.sheet-rolltemplate-cast-spell .sheet-container h2,
.sheet-rolltemplate-attack .sheet-container h2,
.sheet-rolltemplate-shield-rush .sheet-container h2,
.sheet-rolltemplate-initiative .sheet-container h2,
.sheet-rolltemplate-turnorder .sheet-container h2,
.sheet-rolltemplate-description .sheet-container h2
@@ -235,7 +238,6 @@
letter-spacing: -.01em;
}
.sheet-rolltemplate-description .sheet-container h1
{
font-style: normal;
@@ -244,6 +246,7 @@
.sheet-rolltemplate-stat-check div,
.sheet-rolltemplate-cast-spell div,
.sheet-rolltemplate-attack div,
.sheet-rolltemplate-shield-rush div,
.sheet-rolltemplate-initiative div,
.sheet-rolltemplate-turnorder div,
.sheet-rolltemplate-description div
@@ -256,6 +259,7 @@
.sheet-rolltemplate-stat-check span,
.sheet-rolltemplate-cast-spell span,
.sheet-rolltemplate-attack span,
.sheet-rolltemplate-shield-rush span,
.sheet-rolltemplate-initiative span,
.sheet-rolltemplate-turnorder span,
.sheet-rolltemplate-description span
@@ -272,6 +276,7 @@
.sheet-rolltemplate-stat-check .sheet-arrow-right,
.sheet-rolltemplate-cast-spell .sheet-arrow-right,
.sheet-rolltemplate-attack .sheet-arrow-right,
.sheet-rolltemplate-shield-rush .sheet-arrow-right,
.sheet-rolltemplate-initiative .sheet-arrow-right,
.sheet-rolltemplate-turnorder .sheet-arrow-right,
.sheet-rolltemplate-description .sheet-arrow-right
@@ -289,6 +294,10 @@
.sheet-rolltemplate-attack .inlinerollresult.fullcrit,
.sheet-rolltemplate-attack .inlinerollresult.fullfail,
.sheet-rolltemplate-attack .inlinerollresult.importantroll,
.sheet-rolltemplate-shield-rush .inlinerollresult,
.sheet-rolltemplate-shield-rush .inlinerollresult.fullcrit,
.sheet-rolltemplate-shield-rush .inlinerollresult.fullfail,
.sheet-rolltemplate-shield-rush .inlinerollresult.importantroll,
.sheet-rolltemplate-cast-spell .inlinerollresult,
.sheet-rolltemplate-cast-spell .inlinerollresult.fullcrit,
.sheet-rolltemplate-cast-spell .inlinerollresult.fullfail,
@@ -307,6 +316,7 @@
/* Used to show dice */
.sheet-rolltemplate-stat-check .sheet-template-dice .inlinerollresult,
.sheet-rolltemplate-attack .sheet-template-dice .inlinerollresult,
.sheet-rolltemplate-shield-rush .sheet-template-dice .inlinerollresult,
.sheet-rolltemplate-cast-spell .sheet-template-dice .inlinerollresult,
.sheet-rolltemplate-initiative .sheet-template-dice .inlinerollresult
{
@@ -321,6 +331,7 @@
.sheet-rolltemplate-stat-check .sheet-success,
.sheet-rolltemplate-attack .sheet-success,
.sheet-rolltemplate-shield-rush .sheet-success,
.sheet-rolltemplate-cast-spell .sheet-success
{
font-weight: bold;
@@ -329,6 +340,7 @@
.sheet-rolltemplate-stat-check .sheet-failure,
.sheet-rolltemplate-cast-spell .sheet-failure,
.sheet-rolltemplate-shield-rush .sheet-failure,
.sheet-rolltemplate-attack .sheet-failure
{
font-weight: bold;
@@ -336,6 +348,7 @@
}
.sheet-rolltemplate-attack .sheet-keyvalue span:first-child,
.sheet-rolltemplate-shield-rush .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,
+70 -1
View File
@@ -532,7 +532,7 @@
<div class=success>Success!</div>
{{/flavor}}
{{#damage}}
<div>Damage: {{damage}}</div>
<div class=keyvalue><span>Damage: </span><span>{{damage}}</span></div>
{{/damage}}
{{#rollTotal() computed::success 4}}
<div class=success>Critical: Triple Damage or Effect!</div>
@@ -588,6 +588,36 @@
</div>
</rolltemplate>
<!-- Shield Rush -->
<rolltemplate class="sheet-rolltemplate-shield-rush">
<div class=container>
<div><h1>{{character_name}} makes a Shield Rush save.</h1></div>
{{#weaker}}
<div><h2>Rusher is weaker</h2></div>
{{/weaker}}
{{^weaker}}
<div><h2>Rusher is equal or stronger</h2></div>
{{/weaker}}
<div class=arrow-container><div class=arrow-right></div></div>
<div>
<span class=template-dice>{{computed::roll1}}</span>
= {{roll1}} vs {{stat}}
</div>
<!-- Success! -->
{{#rollGreater() computed::success 0}}
<div class=success>Remains standing!<div>
{{/rollGreater() computed::success 0}}
<!-- Failure -->
{{#rollLess() computed::success 0}}
<div class=failure>Falls prone!<div>
{{#rollTotal() computed::success -2}}
<div class=failure>Automatic Failure.</div>
{{/rollTotal() computed::success -2}}
{{/rollLess() computed::success 0}}
</div>
</rolltemplate>
<!-- For Descriptions -->
<rolltemplate class="sheet-rolltemplate-description">
<div class=container>
@@ -926,6 +956,45 @@
doRollWithDiceString("&{template:turnorder} {{character_name=@{character_name}}} {{turnorder=[[@{DX}[DEX] &{tracker}]]}}");
});
// Do a roll with stats.
const doShieldRush = function(macro) {
// returns success level. positive is success.
// negative is failure.
const successLevel = function(results) {
let roll = results.roll1.result;
let stat = results.stat.result;
// Check all the crits first.
if (results.roll1.dice.length == 3) {
// 3d6
if (roll >= 16) return -2; // auto fail
}
else {
// 2d6
if (roll == 12) return -2;
}
// Normal to-hit check.
return (roll <= stat) ? 1 : -1;
}
macro += ' {{character_name=@{cname}}}';
macro += rollTemplateValue('success', 0, true); // level of success, crits, etc.
startRoll(macro, (results) => {
let level = successLevel(results.results);
let diceString = diceArrayToString(results.results.roll1.dice);
finishRoll( results.rollId, {
'roll1': diceString,
'success': level
});
});
}
on('clicked:shieldrushweaker', (info) => {
doShieldRush("&{template:shield-rush} {{weaker=1}} {{stat=[[@{DX}[DEX]]]}} {{roll1=[[2d6]]}}");
});
on('clicked:shieldrushstronger', (info) => {
doShieldRush("&{template:shield-rush} {{stat=[[@{DX}[DEX]]]}} {{roll1=[[3d6]]}}");
});
/* TALENT HANDLERS */