merged + table rolls target icon like parsed rolls

This commit is contained in:
Bodo Hüsemann
2022-01-16 21:58:10 +01:00
parent 9f268f6f84
commit 29561aa3ca
3 changed files with 142 additions and 96 deletions
+16 -9
View File
@@ -627,7 +627,7 @@ input[type='radio'] {
}
.charsheet #conditions{
grid-area: cond;
padding: 0px 20px 0px 0px;
padding: 0px 0px 0px 0px;
border-bottom: var(--solidborder);
}
.charsheet #conditions-nested{
@@ -725,7 +725,10 @@ input[type='radio'] {
display: block;
}
/* Parsed rolls */
.ui-dialog .charsheet :is(button[type="roll"], button[type="action"][class="parsed-rolls"], button[type="action"][class="parsed-rolls crosshair"]) {
.ui-dialog .charsheet :is(
button[type="roll"],
button[type="roll"][class~="table-rolls"],
button[type="action"][class~="parsed-rolls"]) {
font-size: 1.3em;
background: transparent;
border: none;
@@ -739,21 +742,25 @@ input[type='radio'] {
height: 100%;
vertical-align: middle;
}
.ui-dialog .charsheet :is(button[type="roll"], button[type="action"][class="parsed-rolls"]):hover {
.ui-dialog .charsheet :is(
button[type="roll"][class~="table-rolls"],
button[type="action"][class~="parsed-rolls"]):hover {
opacity: .5;
}
.ui-dialog .charsheet :is(button[type="roll"], button[type="action"][class="parsed-rolls"])::before {
/* change D20 to system-appropriate D12 */
font-family: "dicefontd12" !important;
content: "0" !important;
}
.ui-dialog .charsheet button.crosshair::before {
.ui-dialog .charsheet button[class~="crosshair"]::before {
/* change D12 to target-appropriate crosshairs */
font-family: "Pictos Custom" !important;
content: "[" !important;
color: inherit;
opacity: 0.3;
}
.ui-dialog .charsheet :is(
button[type="roll"][class~="table-rolls"],
button[type="action"][class~="parsed-rolls"])::before {
/* change D20 to system-appropriate D12 */
font-family: "dicefontd12";
content: "0" ;
}
.charsheet input.config-parsed-rolls ~ div .parsed-rolls,
.charsheet input.config-parsed-rolls:checked ~ div .table-rolls {
display: none;
+123 -84
View File
@@ -80,7 +80,7 @@
<span><input name="attr_treasure" value="0" type="number"></span></span>
<span><label data-i18n="adventure-points-total">Adv. Total</label></span>
<span><label data-i18n="skill-points-total">Skill Total</label></span>
<span><label data-i18n="treasure-rating">Treasure Rating</label></span>
<span><label data-i18n="treasure-rating">Treasure<br />Rating</label></span>
</div>
</div>
<div id="strength">
@@ -244,12 +244,14 @@
<input type="hidden" name="attr_axes_roll1" />
<button type="roll" class="table-rolls" name="roll_axescheck1" value="@{axes_roll1}"></button>
<input type="hidden" name="attr_axes_roll2" />
<button type="roll" class="table-rolls" name="roll_axescheck2" value="@{axes_roll2}"></button>
<span class="parsed-rolls">
<button type="action" name="act_axes" id="roll_axes" class="parsed-rolls" title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_axes_target" id="roll_axes_target" class="parsed-rolls crosshair" title="Use this button when you have an adversary token to target. "></button>
&nbsp;
</span>
<button type="roll" class="table-rolls crosshair" name="roll_axescheck2" value="@{axes_roll2}"></button>
<span class="parsed-rolls">
<button type="action" name="act_axes" id="roll_axes" class="parsed-rolls"
title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_axes_target" id="roll_axes_target" class="parsed-rolls crosshair"
title="Use this button when you have an adversary token to target. "></button>
</span>
&nbsp;
<!-- <button type="action" class="parsed-rolls" name="act_axes" id="roll_axes"></button> -->
<label data-i18n="axes">Axes</label>
<div class="sheet-hover-info" data-i18n="axes-description"></div>
@@ -268,12 +270,14 @@
<input type="hidden" name="attr_bows_roll1" />
<button type="roll" class="table-rolls" name="roll_bowscheck1" value="@{bows_roll1}"></button>
<input type="hidden" name="attr_bows_roll2" />
<button type="roll" class="table-rolls" name="roll_bowscheck2" value="@{bows_roll2}"></button>
<span class="parsed-rolls">
<button type="action" name="act_bows" id="roll_bows" class="parsed-rolls" title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_bows_target" id="roll_bows_target" class="parsed-rolls crosshair" title="Use this button when you have an adversary token to target. "></button>
&nbsp;
</span>
<button type="roll" class="table-rolls crosshair" name="roll_bowscheck2" value="@{bows_roll2}"></button>
<span class="parsed-rolls">
<button type="action" name="act_bows" id="roll_bows" class="parsed-rolls"
title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_bows_target" id="roll_bows_target" class="parsed-rolls crosshair"
title="Use this button when you have an adversary token to target. "></button>
</span>
&nbsp;
<!-- <button type="action" class="parsed-rolls" name="act_bows" id="roll_bows"></button> -->
<label data-i18n="bows">Bows</label>
<div class="sheet-hover-info" data-i18n="bows-description"></div>
@@ -292,12 +296,16 @@
<input type="hidden" name="attr_spears_roll1" />
<button type="roll" class="table-rolls" name="roll_spearscheck1" value="@{spears_roll1}"></button>
<input type="hidden" name="attr_spears_roll2" />
<button type="roll" class="table-rolls" name="roll_spearscheck2" value="@{spears_roll2}"></button>
<span class="parsed-rolls">
<button type="action" name="act_spears" id="roll_spears" class="parsed-rolls" title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_spears_target" id="roll_spears_target" class="parsed-rolls crosshair" title="Use this button when you have an adversary token to target. "></button>
&nbsp;
</span>
<button type="roll" class="table-rolls crosshair" name="roll_spearscheck2"
value="@{spears_roll2}"></button>
<span class="parsed-rolls">
<button type="action" name="act_spears" id="roll_spears" class="parsed-rolls"
title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_spears_target" id="roll_spears_target"
class="parsed-rolls crosshair"
title="Use this button when you have an adversary token to target. "></button>
</span>
&nbsp;
<!-- <button type="action" class="parsed-rolls" name="act_spears" id="roll_spears"></button> -->
<label data-i18n="spears">Spears</label>
<div class="sheet-hover-info" data-i18n="spears-description"></div>
@@ -316,12 +324,16 @@
<input type="hidden" name="attr_swords_roll1" />
<button type="roll" class="table-rolls" name="roll_swordscheck1" value="@{swords_roll1}"></button>
<input type="hidden" name="attr_swords_roll2" />
<button type="roll" class="table-rolls" name="roll_swordscheck2" value="@{swords_roll2}"></button>
<span class="parsed-rolls">
<button type="action" name="act_swords" id="roll_swords" class="parsed-rolls" title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_swords_target" id="roll_swords_target" class="parsed-rolls crosshair" title="Use this button when you have an adversary token to target. "></button>
&nbsp;
</span>
<button type="roll" class="table-rolls crosshair" name="roll_swordscheck2"
value="@{swords_roll2}"></button>
<span class="parsed-rolls">
<button type="action" name="act_swords" id="roll_swords" class="parsed-rolls"
title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_swords_target" id="roll_swords_target"
class="parsed-rolls crosshair"
title="Use this button when you have an adversary token to target. "></button>
</span>
&nbsp;
<!-- <button type="action" class="parsed-rolls" name="act_swords" id="roll_swords"></button> -->
<label data-i18n="swords">Swords</label>
<div class="sheet-hover-info" data-i18n="swords-description"></div>
@@ -664,11 +676,14 @@
title="Keen: Attack rolls made with a Keen weapon score a Piercing Blow also on a result of 9 on the Feat die">K</label>
<label>Notes</label>
<span class="table-rolls" />
<span class="parsed-rolls">
<button type="action" name="act_weapon_1" id="roll_weapon1" class="parsed-rolls" title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_weapon_1_target" id="roll_weapon1_target" class="parsed-rolls crosshair" title="Use this button when you have an adversary token to target. "></button>
&nbsp;
</span>
<span class="parsed-rolls">
<button type="action" name="act_weapon_1" id="roll_weapon1" class="parsed-rolls"
title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_weapon_1_target" id="roll_weapon1_target"
class="parsed-rolls crosshair"
title="Use this button when you have an adversary token to target. "></button>
&nbsp;
</span>
<input name="attr_weapon_skill_name_1" type="text"></input>
<select name="attr_weapon_combat_prof_1">
<option value="" selected default></option>
@@ -685,11 +700,14 @@
<input type="checkbox" class="center" value="1" name="attr_weapon_keen_1">
<input name="attr_weapon_note_1" type="text">
<span class="table-rolls" />
<span class="parsed-rolls">
<button type="action" name="act_weapon_2" id="roll_weapon2" class="parsed-rolls" title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_weapon_2_target" id="roll_weapon2_target" class="parsed-rolls crosshair" title="Use this button when you have an adversary token to target. "></button>
&nbsp;
</span>
<span class="parsed-rolls">
<button type="action" name="act_weapon_2" id="roll_weapon2" class="parsed-rolls"
title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_weapon_2_target" id="roll_weapon2_target"
class="parsed-rolls crosshair"
title="Use this button when you have an adversary token to target. "></button>
&nbsp;
</span>
<input name="attr_weapon_skill_name_2" type="text">
<select name="attr_weapon_combat_prof_2">
<option value="" selected default></option>
@@ -706,11 +724,14 @@
<input type="checkbox" class="center" name="attr_weapon_keen_2">
<input name="attr_weapon_note_2" type="text">
<span class="table-rolls" />
<span class="parsed-rolls">
<button type="action" name="act_weapon_3" id="roll_weapon3" class="parsed-rolls" title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_weapon_3_target" id="roll_weapon3_target" class="parsed-rolls crosshair" title="Use this button when you have an adversary token to target. "></button>
&nbsp;
</span>
<span class="parsed-rolls">
<button type="action" name="act_weapon_3" id="roll_weapon3" class="parsed-rolls"
title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_weapon_3_target" id="roll_weapon3_target"
class="parsed-rolls crosshair"
title="Use this button when you have an adversary token to target. "></button>
&nbsp;
</span>
<input name="attr_weapon_skill_name_3" type="text">
<select name="attr_weapon_combat_prof_3">
<option value="" selected default></option>
@@ -727,11 +748,14 @@
<input type="checkbox" class="center" name="attr_weapon_keen_3">
<input name="attr_weapon_note_3" type="text">
<span class="table-rolls" />
<span class="parsed-rolls">
<button type="action" name="act_weapon_4" id="roll_weapon4" class="parsed-rolls" title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_weapon_4_target" id="roll_weapon4_target" class="parsed-rolls crosshair" title="Use this button when you have an adversary token to target. "></button>
&nbsp;
</span>
<span class="parsed-rolls">
<button type="action" name="act_weapon_4" id="roll_weapon4" class="parsed-rolls"
title="Use this button when you don't have a Parry Rating to enter manually. "></button>
<button type="action" name="act_weapon_4_target" id="roll_weapon4_target"
class="parsed-rolls crosshair"
title="Use this button when you have an adversary token to target. "></button>
&nbsp;
</span>
<input name="attr_weapon_skill_name_4" type="text">
<select name="attr_weapon_combat_prof_4">
<option value="" selected default></option>
@@ -1099,7 +1123,6 @@
"stanceattack_active", "stanceattackbonus", "stancedamagebonus"
]);
clog(`Weary: ${attrs.weary}, Miserable: ${attrs.miserable}`);
clog(`${attrs.weary}`);
let wearyStr = (attrs.weary == "on" || attrs.weary == 1) ? "{{weary=Weary}}" : "",
weary = (attrs.weary == "on" || attrs.weary == 1) ? 1 : 0;
miserableStr = (attrs.miserable == "on" || attrs.miserable == 1) ? "{{miserable=Miserable}}" : "",
@@ -1110,7 +1133,7 @@
stanceAttackActive = int(attrs.stanceattack_active),
stanceAttackBonus = int(attrs.stanceattackbonus),
stanceDamageBonus = int(attrs.stancedamagebonus);
clog(`Weary: ${wearyStr}, Miserable: ${miserableStr}, Favourill_id: ${favourill_id}, StanceAttackActive: ${stanceAttackActive}, StanceAttackBonus: ${stanceAttackBonus}, StanceDamageBonus: ${stanceDamageBonus}`);
clog(`Weary Str: ${wearyStr}, Miserable Str: ${miserableStr}, Favourill_id: ${favourill_id}, StanceAttackActive: ${stanceAttackActive}, StanceAttackBonus: ${stanceAttackBonus}, StanceDamageBonus: ${stanceDamageBonus}`);
// GET MODIFIER AND FAVOURED HERE
if (rolltype.startsWith("protection") ) {
@@ -1192,53 +1215,69 @@
rollSuccess = int(rollresult.results.r1.result,0),
rollFeat = int(rollresult.results.feat.result,0);
clog(`Roll: ${JSON.stringify(rollresult)}`);
if ( parrymodStr !== "") {
clog(`Parry mod: ${JSON.stringify(rollresult.results.parrymod.result)}`);
clog(`Roll: ${JSON.stringify(rollresult)}`);
if ( parrymodStr !== "") {
clog(`Parry mod: ${JSON.stringify(rollresult.results.parrymod.result)}`);
}
if (rolltype.startsWith("combat") ) {
clog(`TN before parry modification: ${tn}`);
tn = int(tn) + int(rollresult.results.parrymod.result);
clog(`TN after parry modification: ${tn}`);
}
}
if (rolltype.startsWith("combat") ) {
clog(`TN before parry modification: ${tn}`);
tn = int(tn) + int(rollresult.results.parrymod.result);
clog(`TN after parry modification: ${tn}`);
}
// FEAT DIE AND MISERABLE
// Outcomes: Failure = 0, Success = 1, Feat success = 2, Piercing blow = 3, Weary failure = -1, Miserable failure = -2
clog(`Roll result results I: ${JSON.stringify(rollresult.results)}`);
// Miserable logic, if Feat die is 0 (eye) then fail automatically, overrides all of below
outcome = (miserable === 1 && rollFeat === 0) ? -2 : outcome;
clog(`Outcome after Miserable: ${outcome}`);
if ( rollFeat === 11 ) {
outcome = 2; // outcome 2 = Feat Success
//rollFeat = 0; // Gandalf rune face doesnt have a value, also doesnt matter with regards to success since it always succeeds
clog(`Roll result results: ${JSON.stringify(rollresult.results)}`);
// Outcome: switch success criteria depending on loremaster or pc roll
if (lm){
clog("Loremaster roll!")
fumble = 11; // gandalf
crit = 0;
} else {
clog("Player roll!")
fumble = 0 // Eye of Sauron
crit = 11;
}
clog(`Outcome after Gandalf rune: ${outcome}`);
let rollTotal = rollSuccess + rollFeat,
rollDiff = rollTotal - int(tn);
clog(`rollSuccess: ${rollSuccess}, rollTotal: ${rollTotal}, Target Number: ${tn}, Diff: ${rollDiff}`);
clog(`Testing logic: ${!!(outcome !== 2 || outcome !== -2)}`);
outcome = (outcome === 2 || outcome === -2) ? outcome : ((rollTotal >= tn) ? 1 : 0);
clog(`Outcome after successes: ${outcome}`);
// WEARY LOGIC
// Weary logic, if weary then disregard all rolls below or equal to 3.
clog(`Crit: ${crit} - Fumble: ${fumble}`);
// weary success dice logic
if (weary === 1) {
// remove the 1, 2, 3, results, still add any closefitting bonus for protection rolls (already done)
// Weary condition affects protections rolls, see discussion here: https://boardgamegeek.com/thread/2031462/protection-tests-when-weary
rollSuccess = (_.reduce(rollresult.results.r1.dice, (memo, num) => { if(num <= 3) {return memo} else {return memo+num} }, 0));
rollTotal = rollSuccess + rollFeat;
rollDiff = rollTotal - int(tn);
outcome = (outcome === 2 || outcome === -2) ? outcome : ((rollTotal >= tn) ? 1 : -1);
clog(`Weary successes: ${rollSuccess}, Weary total: ${rollTotal}, Weary diff: ${rollDiff}, outcome: ${outcome}`);
clog(`Outcome after Weary: ${outcome}`);
clog(`Weary successes: ${rollSuccess}`);
} else {
clog(`Normal successes: ${rollSuccess}`);
}
// totals
let rollTotal = rollSuccess + rollFeat,
rollDiff = rollTotal - int(tn);
clog(`rollFeat: ${rollFeat}, rollTotal: ${rollTotal}, Target Number: ${tn}, Diff: ${rollDiff}`);
// Miserable logic, if Feat die is 0 (eye) then fail automatically, overrides all of below (adversaries don't get miserable)
if (miserable == 1 && rollFeat == fumble){
outcome = -2;
clog(`Outcome after Miserable: ${outcome}`);
} else if ( rollFeat == crit ) { // outcome 2 = Feat Success (Gandalf or Eye of Sauron)
outcome = 2;
//rollFeat = 0; // crit success doesnt have a value, also doesnt matter with regards to success since it always succeeds
clog(`Outcome after critical success: ${outcome}`);
} else if (rollTotal >= tn) {
outcome = 1; // normal success
clog(`Outcome after normal success: ${outcome}`);
} else if (weary == 1) {
outcome = -1; // weary failure
clog(`Outcome after weary failure: ${outcome}`);
} else {
outcome = 0; // normal failure
clog(`Outcome: ${outcome}`);
}
// GREATNESS & FEAT DIE
// If feat die = 11 (Gandalf rune) then automatical success, 1s12-1 already covers for Eye side = 0
// outcome = featSuccess === 11 ? 2 : outcome; // outcome 2 = Feat Success // Handled above
// Test for piercing blow on a Gandalf rune or 10
outcome = (rolltype === "combat") && (outcome === 1 || outcome === 2) && (rollFeat === 11 || rollFeat === 10) ? 3 : outcome;
// Test for piercing blow on crit success or 10
outcome = (rolltype === "combat") && (outcome === 1 || outcome === 2) && (rollFeat === crit || rollFeat === 10) ? 3 : outcome;
clog(`Outcome after Piercing: ${outcome}`);
// Piercing blow also at 9 if the weapon used is keen
outcome = rolltype === "combat" && keen > 0 && rollFeat === 9 && (outcome === 1 || outcome === 2) ? 3 : outcome;
@@ -1248,8 +1287,8 @@
clog(`Roll r1 : ${JSON.stringify(rollresult.results.r1.dice)}`);
successDegree = (outcome === 1 || outcome === 2 || outcome === 3) ? _.reduce(rollresult.results.r1.dice, (memo, num) => { if(num == 6) {return ++memo} else {return memo} }, 0) : 0;
clog(`Calculated degree of success: ${successDegree}`);
// Remove the 11 for Gandalf Rune, if three
rollTotal = rollFeat === 11 ? rollTotal-11 : rollTotal;
// Remove the 11 for Gandalf Rune, if there
rollTotal = rollFeat === 11 ? 0 : rollTotal;
// PASSTHROUGH DATA
// Storing all the passthrough data required for the next roll in an Object helps for larger rolls
+3 -3
View File
@@ -127,7 +127,7 @@
"experience": "Experience",
"experience-description": "Experience is a measure of a character’s having been affected by or gained knowledge or skill through direct observation or participation over a period of time.",
"treasure": "Treasure",
"treasure-rating": "Treasure Rating",
"treasure-rating": "Treasure<br/>Rating",
"standing": "Standing",
"background": "Background",
"notes": "Notes",
@@ -166,9 +166,9 @@
"special-damage": "Special Damage",
"general": "General",
"flaws": "Flaws",
"adventure-points": "Adv. Points",
"adventure-points": "Advancement<br/>Points",
"skill-points": "Skill Points",
"adventure-points-total": "Adv. Total",
"adventure-points-total": "Advancement<br/>Total",
"skill-points-total": "Skill Total",
"treasure-load-title": "Treasure Load (carried)",
"rating": "Rating",