[Zafir] Will attacks

This commit is contained in:
Randy Knapp
2020-05-26 13:29:42 -07:00
parent 81cb0de04a
commit d492e37e3c
2 changed files with 152 additions and 19 deletions
+47 -12
View File
@@ -524,7 +524,9 @@ button[type=roll].sheet-btn::before {
}
/* // Roll Template /////////////////////////////////////////////*/
.sheet-rolltemplate-zafir div.sheet-template-container {
.sheet-rolltemplate-zafir div.sheet-template-container,
.sheet-rolltemplate-zafirwillattack div.sheet-template-container {
border: 2px solid #AAA;
border-radius: 8px;
padding-top: 8px;
@@ -533,21 +535,32 @@ button[type=roll].sheet-btn::before {
font-family: "Montserrat"
}
.sheet-rolltemplate-zafir .sheet-template-header {
.sheet-rolltemplate-zafirwillattack div.sheet-template-container {
border: 2px solid #8a58ad;
}
.sheet-rolltemplate-zafir .sheet-template-header,
.sheet-rolltemplate-zafirwillattack .sheet-template-header {
color: #555;
font-weight: bold;
margin: 0px 8px 0px 8px;
border-bottom: 1px solid #AAA
}
.sheet-rolltemplate-zafir .sheet-template-row {
.sheet-rolltemplate-zafirwillattack .sheet-template-header {
color: #8a58ad;
}
.sheet-rolltemplate-zafir .sheet-template-row,
.sheet-rolltemplate-zafirwillattack .sheet-template-row {
line-height: 2em;
margin: 8px 0px 0px 0px;
padding: 0px 8px 0px 8px;
font-weight: bold;
}
.sheet-rolltemplate-zafir .sheet-hit {
.sheet-rolltemplate-zafir .sheet-hit,
.sheet-rolltemplate-zafirwillattack .sheet-hit {
background: repeating-linear-gradient(
-45deg,
#dbffe1,
@@ -558,7 +571,8 @@ button[type=roll].sheet-btn::before {
color: #1c752a;
}
.sheet-rolltemplate-zafir .sheet-crit-hit {
.sheet-rolltemplate-zafir .sheet-crit-hit,
.sheet-rolltemplate-zafirwillattack .sheet-crit-hit {
color: white;
font-weight: bolder;
text-shadow:
@@ -590,7 +604,10 @@ button[type=roll].sheet-btn::before {
.sheet-rolltemplate-zafir .sheet-hit .inlinerollresult,
.sheet-rolltemplate-zafir .sheet-miss .inlinerollresult,
.sheet-rolltemplate-zafir .sheet-crit-hit .inlinerollresult {
.sheet-rolltemplate-zafir .sheet-crit-hit .inlinerollresult,
.sheet-rolltemplate-zafirwillattack .sheet-hit .inlinerollresult,
.sheet-rolltemplate-zafirwillattack .sheet-miss .inlinerollresult,
.sheet-rolltemplate-zafirwillattack .sheet-crit-hit .inlinerollresult {
color: black;
font-weight: bold;
text-shadow: none;
@@ -607,31 +624,49 @@ button[type=roll].sheet-btn::before {
color: #852419;
}
.sheet-rolltemplate-zafir .sheet-notes {
.sheet-rolltemplate-zafirwillattack .sheet-miss {
background: repeating-linear-gradient(
-45deg,
#f4e3ff,
#f4e3ff 10px,
#e2b8ff 10px,
#e2b8ff 20px
);
color: #4e1573;
}
.sheet-rolltemplate-zafir .sheet-notes,
.sheet-rolltemplate-zafirwillattack .sheet-notes {
font-style: italic;
font-weight: normal;
color: gray;
padding-left: 20px;
margin-top: -4px;
}
.sheet-rolltemplate-zafir .inlinerollresult {
display: inline-block;
.sheet-rolltemplate-zafir .inlinerollresult,
.sheet-rolltemplate-zafirwillattack .inlinerollresult {
display: inline;
min-width: 1em;
line-height: 1.3em;
text-align: center;
border: 2px solid #AAA;
float: right;
margin-top: 2px;
background-color: white;
}
.sheet-rolltemplate-zafir .inlinerollresult.fullcrit {
.sheet-rolltemplate-zafir .inlinerollresult.fullcrit,
.sheet-rolltemplate-zafirwillattack .inlinerollresult.fullcrit {
border: 2px solid #AAA;
}
.sheet-rolltemplate-zafir .inlinerollresult.fullfail {
.sheet-rolltemplate-zafir .inlinerollresult.fullfail,
.sheet-rolltemplate-zafirwillattack .inlinerollresult.fullfail {
border: 2px solid #AAA;
}
.sheet-rolltemplate-zafir .inlinerollresult.importantroll {
.sheet-rolltemplate-zafir .inlinerollresult.importantroll,
.sheet-rolltemplate-zafirwillattack .inlinerollresult.importantroll {
border: 2px solid #AAA;
}
+105 -7
View File
@@ -84,22 +84,50 @@
<label>Bonus Aim:</label><input style="width:18%;position:relative;right:3px;margin-right:93px;" type="number" value="0" name="attr_atkotheraim" />
<label>Bonus Crit:</label><input style="width:18%;position:relative;right:3px;" type="number" value="0" name="attr_atkothercrit" />
<div class="attack clearfix">
<button type="roll" name="roll_attackprimary" class="btn" value="&{template:zafir} {{name=@{wpname} Attack}} {{aim=[[(@{wpattackaimdice})d6>5]]}} {{crit=[[(@{wpattackcritdice})d6>6]]}} {{damage=[[(@{wpattackdamage})]]}} {{critdmg=[[(@{wpattackdamage}) + (@{wpcritdmg})]]}} {{notes=@{wpnotes}}}">Attack</button>
<button type="roll" name="roll_attackprimary" class="btn" value="&{template:zafir} {{name=Attack: @{wpname}}} {{aim=[[(@{wpattackaimdice})d6>5]]}} {{crit=[[(@{wpattackcritdice})d6>6]]}} {{damage=[[(@{wpattackdamage})]]}} {{critdmg=[[(@{wpattackdamage}) + (@{wpcritdmg})]]}} {{notes=@{wpnotes}}}">Attack</button>
<label style="width:110px"><span name="attr_wpname"></span></label>
<label>+<span name="attr_wpattackaimdice"></span> aim&nbsp;&nbsp;&nbsp;+<span name="attr_wpattackcritdice"></span> crit&nbsp;&nbsp;&nbsp;damage: <span name="attr_wpattackdamage"></span></label>
</div>
<div class="attack clearfix">
<button type="roll" name="roll_attacksecondary" class="btn" value="&{template:zafir} {{name=@{wsname} Attack}} {{aim=[[(@{wsattackaimdice})d6>5]]}} {{crit=[[(@{wsattackcritdice})d6>6]]}} {{damage=[[(@{wsattackdamage})]]}} {{critdmg=[[(@{wsattackdamage}) + (@{wscritdmg})]]}} {{notes=@{wsnotes}}}">Attack</button>
<button type="roll" name="roll_attacksecondary" class="btn" value="&{template:zafir} {{name=Attack: @{wsname}}} {{aim=[[(@{wsattackaimdice})d6>5]]}} {{crit=[[(@{wsattackcritdice})d6>6]]}} {{damage=[[(@{wsattackdamage})]]}} {{critdmg=[[(@{wsattackdamage}) + (@{wscritdmg})]]}} {{notes=@{wsnotes}}}">Attack</button>
<label style="width:110px"><span name="attr_wsname"></span></label>
<label>+<span name="attr_wsattackaimdice"></span> aim&nbsp;&nbsp;&nbsp;+<span name="attr_wsattackcritdice"></span> crit&nbsp;&nbsp;&nbsp;damage: <span name="attr_wsattackdamage"></span></label>
</div>
<div class="customattack attack clearfix">
<button type="roll" name="roll_attackcustom" class="btn" value="&{template:zafir} {{name=@{custattackname} Attack}} {{aim=[[(@{custattackaimdice})d6>5]]}} {{crit=[[(@{custattackcritdice})d6>6]]}} {{damage=[[(@{custattackdamage})]]}} {{critdmg=[[(@{custattackdamage}) + (@{custcritdamage})]]}}">Attack</button>
<button type="roll" name="roll_attackcustom" class="btn" value="&{template:zafir} {{name=Attack: @{custattackname}}} {{aim=[[(@{custattackaimdice})d6>5]]}} {{crit=[[(@{custattackcritdice})d6>6]]}} {{damage=[[(@{custattackdamage})]]}} {{critdmg=[[(@{custattackdamage}) + (@{custcritdamage})]]}}">Attack</button>
<input type="text" name="attr_custattackname" spellcheck="false" style="width:110px;margin-right:10px;">
<label>+<span name="attr_custattackaimdice"></span> aim&nbsp;&nbsp;&nbsp;+<span name="attr_custattackcritdice"></span> crit&nbsp;&nbsp;&nbsp;damage: <input type="text" name="attr_custattackdamage" spellcheck="false"><span class="tooltip">(+<input type="number" name="attr_custcritdamage">)<span class="tooltiptext">Crit Damage</span></span></span></label>
<label>+<span name="attr_custattackaimdice"></span> aim&nbsp;&nbsp;&nbsp;+<span name="attr_custattackcritdice"></span> crit&nbsp;&nbsp;&nbsp;damage: <input type="text" name="attr_custattackdamage" spellcheck="false"><span class="tooltip">(+<input type="number" name="attr_custcritdamage">)<span class="tooltiptext">Crit Damage</span></span></label>
</div>
<hr />
<h3>Will Attack</h3>
<label>Wounded:</label><select name="attr_willatkwounded">
<option value="No">Target at Full Health (+0)</option>
<option value="Yes">Target Wounded (+1 will)</option>
</select><br />
<label>Conditions:</label><select name="attr_willatkcondition">
<option value="No">None (+0)</option>
<option value="Yes">Target has Negative Condition (+1 will)</option>
</select><br />
<label>Isolated:</label><select name="attr_willatkisolated">
<option value="No">No (+0)</option>
<option value="Yes">Target is Isolated (no allies within 4 tiles) (+1 will)</option>
</select><br />
<label>Ally Panic:</label><select name="attr_willatkallypanic">
<option value="No">No (+0)</option>
<option value="Yes">Target's Ally is Panicked (+1 will)</option>
</select><br />
<label>Target Panic:</label><select name="attr_willatkpanic">
<option value="No">No (+0)</option>
<option value="Yes">Target is Panicked (+2 crit)</option>
</select><br />
<label>Bonus Will:</label><input style="width:18%;position:relative;right:3px;margin-right:93px;" type="number" value="0" name="attr_bonuswill" />
<label>Bonus Crit:</label><input style="width:18%;position:relative;right:3px;" type="number" value="0" name="attr_bonuswillcrit" /><br />
<label>Enemy Will:</label><input style="width:18%;position:relative;right:3px;" type="number" value="0" name="attr_enemywill" />
<div class="attack clearfix">
<button type="roll" name="roll_willattack" class="btn" value="&{template:zafirwillattack} {{name=@{custwillattackname}}} {{aim=[[(@{willattackaimdice})d6>5]]}} {{crit=[[(@{willattackcritdice})d6>6]]}} {{resist=[[(@{willattackresistdice})d6>6]]}}">Will Attack</button>
<input type="text" name="attr_custwillattackname" spellcheck="false" style="width:110px;margin-right:10px;">
<label>+<span name="attr_willattackaimdice"></span> will&nbsp;&nbsp;&nbsp;+<span name="attr_willattackcritdice"></span> crit&nbsp;&nbsp;&nbsp;+<span name="attr_willattackresistdice"></span> resist</label>
</div>
</div>
<div class="col2">
<h3>Ammo Tracker</h3>
@@ -422,6 +450,36 @@
</div>
</rolltemplate>
<rolltemplate class="sheet-rolltemplate-zafirwillattack">
<div class="sheet-template-container">
{{#name}}
<div class="sheet-template-header">{{name}}</div>
{{/name}}
{{^name}}
<div class="sheet-template-header">Will Attack</div>
{{/name}}
{{#rollGreater() aim 0}}
{{#rollGreater() resist 0}}
<div class="sheet-template-row sheet-miss">RESISTED! {{resist}}</div>
{{/rollGreater() resist 0}}
{{#rollTotal() resist 0}}
{{#rollGreater() crit 0}}
<div class="sheet-template-row sheet-crit-hit">CRITICAL SUCCESS! {{crit}} {{aim}}</div>
{{/rollGreater() crit 0}}
{{#rollTotal() crit 0}}
<div class="sheet-template-row sheet-hit">SUCCESS! {{aim}}</div>
{{/rollTotal() crit 0}}
{{/rollTotal() resist 0}}
{{#notes}}
<div class="sheet-template-row sheet-notes">{{notes}}</div>
{{/notes}}
{{/rollGreater() aim 0}}
{{#rollTotal() aim 0}}
<div class="sheet-template-row sheet-miss">FAILED! {{aim}}</div>
{{/rollTotal() aim 0}}
</div>
</rolltemplate>
<!-- // Sheet Workers //////////////////////////////////////////////////////////////// -->
<script type="text/worker">
// Main tab bar
@@ -459,9 +517,9 @@ function sheetOpenAndAttrChanged(inputs) {
}
// Setting the aim dice for weapon attacks
const inputs = ["wpaimdice", "wpcritdice", "wpdamage", "wsaimdice", "wscritdice", "wsdamage", "aim", "atkcover", "atkelevation", "atkrange", "atkotheraim", "atkothercrit" ];
on(sheetOpenAndAttrChanged(inputs), function() {
getAttrs(inputs, function(values) {
const attackDiceInputs = ["wpaimdice", "wpcritdice", "wpdamage", "wsaimdice", "wscritdice", "wsdamage", "aim", "atkcover", "atkelevation", "atkrange", "atkotheraim", "atkothercrit" ];
on(sheetOpenAndAttrChanged(attackDiceInputs), function() {
getAttrs(attackDiceInputs, function(values) {
let wpaimdice = parseInt(values.wpaimdice)||0;
let wpcritdice = parseInt(values.wpcritdice)||0;
let wpdamage = values.wpdamage;
@@ -510,6 +568,46 @@ on(sheetOpenAndAttrChanged(inputs), function() {
});
});
const willAttackInputs = ["will", "bonuswill", "bonuswillcrit", "enemywill", "willatkwounded", "willatkcondition", "willatkisolated", "willatkallypanic", "willatkpanic"];
on(sheetOpenAndAttrChanged(willAttackInputs), function() {
getAttrs(willAttackInputs, function(values) {
let will = parseInt(values.will)||0;
let extraWill = parseInt(values.bonuswill)||0;
let extraCrit = parseInt(values.bonuswillcrit)||0;
let enemywill = parseInt(values.enemywill)||0;
let willatkwounded = values.willatkwounded;
let willatkcondition = values.willatkcondition;
let willatkisolated = values.willatkisolated;
let willatkallypanic = values.willatkallypanic;
let willatkpanic = values.willatkpanic;
let willBonus = 0;
let critBonus = 0;
if (willatkwounded == "Yes") {
willBonus += 1;
}
if (willatkcondition == "Yes") {
willBonus += 1;
}
if (willatkisolated == "Yes") {
willBonus += 1;
}
if (willatkallypanic == "Yes") {
willBonus += 1;
}
if (willatkpanic == "Yes") {
critBonus += 2;
}
setAttrs({
willattackaimdice: Math.max(will + extraWill + willBonus, 0),
willattackcritdice: Math.max(extraCrit + critBonus, 0),
willattackresistdice: Math.max(enemywill, 0)
});
});
});
on("clicked:initcombat", function() {
console.log("initcombat");
});