-added hit determination section

- hit det mods are global and will apply to all attacks
- expanded weapon row
This commit is contained in:
vince
2025-09-08 00:11:45 -07:00
parent ad1a70e031
commit 9c356b035b
3 changed files with 591 additions and 66 deletions
+146 -18
View File
@@ -23,6 +23,17 @@
width: 100%;
}
.ui-dialog .tab-content .charsheet label:has(input[type="checkbox"]):hover,
.ui-dialog .tab-content .charsheet label:has(input[type="radio"]):hover {
cursor: pointer;
}
.ui-dialog .tab-content .charsheet label:has(input[type="checkbox"]:checked) > span,
.ui-dialog .tab-content .charsheet label:has(input[type="checkbox"]):hover > span {
text-shadow: 0 0 black;
background-color: #cbcbcb;
}
.ui-dialog .tab-content .charsheet .flex-row > label {
display: flex;
flex: 1 1 6em;
@@ -64,6 +75,16 @@
margin-inline: -7px;
}
.ui-dialog .tab-content .charsheet details summary > * {
display: inline;
}
.ui-dialog .tab-content .charsheet details > summary {
display: list-item;
position: relative;
cursor: pointer;
}
.ui-dialog .tab-content .charsheet button[type=roll]:before {
content: "t";
font-family: "dicefontd20";
@@ -71,6 +92,25 @@
top: 2px;
}
.ui-dialog .tab-content .charsheet button[type="action"] {
line-height: normal;
margin-inline: auto;
margin-left: -8px;
width: max-content;
}
.ui-dialog .tab-content .charsheet .hit-determination-grid [type="action"] {
margin-left: -8px;
}
.ui-dialog .tab-content .charsheet .reset-image::after {
content: '1';
display: inline-block;
font-family: 'Pictos';
position: relative;
top: -1px;
}
.ui-dialog .tab-content .charsheet .logo-text {
color: red;
float: left;
@@ -104,7 +144,8 @@
}
.ui-dialog .tab-content .charsheet label,
.ui-dialog .tab-content .charsheet label span {
.ui-dialog .tab-content .charsheet label > span {
display: inline-block;
font-size: 1em;
margin: 2px;
}
@@ -116,19 +157,27 @@
color: #777;
cursor: default;
max-width: 3em;
text-align: center;
}
.ui-dialog .tab-content .charsheet input.larger {
max-width: 3.75em;
}
.ui-dialog .tab-content .charsheet nav {
display: inline-block;
margin-block: .5em 1em;
}
.ui-dialog .tab-content .charsheet input.tab {
border: 5px #888888;
cursor: pointer;
height: 20px;
left: 6px;
margin: 10px -1.5px;
min-width: 132px;
margin-top: 6px;
outline: none;
padding: 0;
position: relative;
width: 132px;
width: 95px;
z-index: 1;
}
@@ -142,7 +191,7 @@
font-size: 16px;
height: 20px;
text-align: center;
width: 150px;
width: 95px;
}
.ui-dialog .tab-content .charsheet input.tab:checked::before {
@@ -155,18 +204,18 @@
display: none;
}
.ui-dialog .tab-content .charsheet input.tab1:checked ~ div.tab1,
.ui-dialog .tab-content .charsheet input.tab2:checked ~ div.tab2,
.ui-dialog .tab-content .charsheet input.tab3:checked ~ div.tab3,
.ui-dialog .tab-content .charsheet input.tab4:checked ~ div.tab4,
.ui-dialog .tab-content .charsheet input.tab5:checked ~ div.tab5,
.ui-dialog .tab-content .charsheet input.tab6:checked ~ div.tab6 {
.ui-dialog .tab-content .charsheet nav:has(input.tab1:checked) ~ div.tab1,
.ui-dialog .tab-content .charsheet nav:has(input.tab2:checked) ~ div.tab2,
.ui-dialog .tab-content .charsheet nav:has(input.tab3:checked) ~ div.tab3,
.ui-dialog .tab-content .charsheet nav:has(input.tab4:checked) ~ div.tab4,
.ui-dialog .tab-content .charsheet nav:has(input.tab5:checked) ~ div.tab5,
.ui-dialog .tab-content .charsheet nav:has(input.tab6:checked) ~ div.tab6 {
display: block;
}
.ui-dialog .tab-content .charsheet .instruction {
font-size: 0.8em;
font-style: italic;
font-family: monospace;
font-size: 1.1rem;
padding-bottom: 10px;
}
@@ -189,18 +238,95 @@
.ui-dialog .tab-content .charsheet .hit-determination-grid {
background-color: #dddddd;
column-gap: 2px;
display: grid;
grid-template-columns: auto auto auto;
justify-content: space-around;
gap: 4px;
grid-template-columns: repeat(3, minmax(18em, 1fr));
margin-bottom: 1em;
min-width: min-content;
outline: 1px solid #000;
padding: 5px;
}
.ui-dialog .tab-content .charsheet .mph {
display: none;
}
.ui-dialog .tab-content .charsheet select:has(.show-mph:checked) + .mph {
align-items: center;
display: inline-flex;
margin: -1em auto 1em auto;
}
.ui-dialog .tab-content .charsheet .hit-determination-misc {
margin-block: 0 .5em;
max-width: 33%;
}
.ui-dialog .tab-content .charsheet .hit-determination-misc[open] {
background-color: #fff;
margin-bottom: 5px;
outline: 1px solid #000;
padding-left: 4px;
position: relative;
max-width: 100%;
}
.ui-dialog .tab-content .charsheet details[open] > summary::after {
content: '*';
opacity: .35;
font-family: 'Pictos';
float: right;
margin-right: 8px;
margin-top: 4px;
}
.ui-dialog .tab-content .charsheet details[open] > summary:hover::after {
opacity: 1;
}
.ui-dialog .tab-content .charsheet .hit-determination-misc label {
font-weight: normal;
}
.ui-dialog .tab-content .charsheet .hit-determination-automatic-grid {
display: grid;
grid-template-columns: 4em repeat(10, auto);
height: min-content;
margin: -3em auto 0 auto;
max-width: 28em;
text-align: center;
width: 55%;
}
.ui-dialog .tab-content .charsheet .range-of-target {
align-self: center;
margin-bottom: -1em;
margin-inline: auto -2em;
max-width: 16em;
outline: 1px solid #000;
outline-offset: .5em;
width: 70%;
}
.ui-dialog .tab-content .charsheet .range-of-target span {
display: inline-flex;
width: 100%;
justify-content: space-evenly;
}
.ui-dialog .tab-content .charsheet .range-of-target span > * {
flex: 0 1 3em;
}
.charsheet .hit-determination-automatic-grid > span,
.charsheet .hit-determination-automatic-grid > input {
width: 14px;
}
.ui-dialog .tab-content .charsheet .weapons-grid {
display: grid;
gap: 2px;
grid-template-columns: 2em minmax(12em, 3fr) minmax(8em, 1.5fr) 4em 2.5em 5em 3em 3em 3em 3em 3em;
grid-template-columns: 2em minmax(12em, 3fr) 3em 3em 3em 3em 3.5em 4em 3em 7em 4em 5em 3.5em;
padding-bottom: 2px;
}
@@ -215,6 +341,7 @@
}
.ui-dialog .tab-content .charsheet .weapon-range-modifier-column {
border-bottom: 1px solid #000;
grid-column: span 4;
margin-bottom: -1.5em;
}
@@ -222,6 +349,7 @@
.ui-dialog .tab-content .charsheet .general-column-header {
font-weight: bold;
text-align: center;
width: auto;
}
.ui-dialog .tab-content .charsheet .full-width-element {
+444 -46
View File
@@ -20,12 +20,14 @@
<span class="general-column-header nowrap">Code Name <input type="text" name="attr_CodeName" title="@{CodeName}"></span>
</div>
</div>
<input type="radio" name="attr_tab" class="tab tab1" value="1" title="Traits" checked="checked" /><span></span>
<input type="radio" name="attr_tab" class="tab tab2" value="2" title="Stats" /><span></span>
<input type="radio" name="attr_tab" class="tab tab3" value="3" title="Equipment" /><span></span>
<input type="radio" name="attr_tab" class="tab tab4" value="4" title="Knowledge" /><span></span>
<input type="radio" name="attr_tab" class="tab tab5" value="5" title="People" /><span></span>
<input type="radio" name="attr_tab" class="tab tab6" value="6" title="Misc" /><span></span>
<nav>
<input type="radio" name="attr_tab" class="tab tab1" value="1" title="Traits" checked="checked" /><span></span>
<input type="radio" name="attr_tab" class="tab tab2" value="2" title="Stats" /><span></span>
<input type="radio" name="attr_tab" class="tab tab3" value="3" title="Equipment" /><span></span>
<input type="radio" name="attr_tab" class="tab tab4" value="4" title="Knowledge" /><span></span>
<input type="radio" name="attr_tab" class="tab tab5" value="5" title="People" /><span></span>
<input type="radio" name="attr_tab" class="tab tab6" value="6" title="Misc" /><span></span>
</nav>
<div class='tab-content tab1'>
<div class='three-column-fit'>
@@ -171,72 +173,249 @@
<div class='section-title'>WEAPONS</div>
<div class="hit-determination-grid">
<div class="span-all"><label>HIT DETERMINATION</label></div>
<span class="general-column-header">Range of Target</span>
<span class="general-column-header">Movement of Shooter</span>
<span class="general-column-header">Movement of Target</span>
<span style="display: inline-flex">
<label><span>PB</span><input type="radio" name="attr_range_of_target" value="0" /></label>
<label><span>S</span><input type="radio" name="attr_range_of_target" value="1" /></label>
<label><span>M</span><input type="radio" name="attr_range_of_target" value="2" /></label>
<label><span>L</span><input type="radio" name="attr_range_of_target" value="3" /></label>
<div class="span-all">
<span>
<span class="general-column-header">HIT DETERMINATION</span>
<span class="instruction">(Applies to all weapon rolls.)</span>
</span>
<div style="float: right;">
<button type="action" class="btn reset-image" name="act_hitDetResetAll" title="Reset all Hit Determination modifiers.">
<span style="margin-right: 5px;">Reset All</span>
</button>
</div>
</div>
<!-- movement of shooter -->
<span>
<span class="general-column-header">Movement of Shooter</span>
<input type="text" name="attr_hit_det_move_of_shooter_total" value="0" title="@{hit_det_move_of_shooter_total}" readonly/>
<button type="action" class="btn reset-image" name="act_hitDetResetMovementOfShooter" title="Reset Movement of Shooter modifiers."></button>
<select name="attr_hit_det_move_of_shooter" title="@{hit_det_move_of_shooter}">
<option value="0" selected>Stationary 0</option>
<option value="1">Stationary and prone +5</option>
<option value="2">Walking -5</option>
<option value="3">Wading -10</option>
<option value="4">Crawling -10</option>
<option value="5">Running and dodging -30</option>
<option value="6">Running -20</option>
<option class="show-mph" value="7">Vehicular Movement -10</option>
<option value="8">Drops Prone -20</option>
</select>
<label class="mph">
<span class="general-column-header">Speed of Shooter</span>
<input type="text" name="attr_hit_det_shooter_speed_multiplier" class="trait-box" value="0" title="@{hit_det_shooter_speed_multiplier}" />
<span>MPH</span>
</label>
</span>
<!-- movement of target -->
<span>
<span class="general-column-header">Movement of Target</span>
<input type="text" name="attr_hit_det_move_of_target_total" value="0" title="@{hit_det_move_of_target_total}" readonly />
<button type="action" class="btn reset-image" name="act_hitDetResetMovementOfTarget" title="Reset Movement of Target modifiers."></button>
<select name="attr_hit_det_move_of_target" title="@{hit_det_move_of_target}">
<option value="0" selected>Stationary 0</option>
<option value="1">Walking -5</option>
<option value="2">Wading -5</option>
<option value="3">Crawling -5</option>
<option value="4">Running -10</option>
<option value="5">Running and dodging -20</option>
<option value="6" class="show-mph">Vehicular Movement -10</option>
<option value="7">Drops Prone -5</option>
</select>
<label class="mph">
<span class="general-column-header">Speed of Target</span>
<input type="text" name="attr_hit_det_target_speed_multiplier" class="trait-box" value="0" title="@{hit_det_target_speed_multiplier}" />
<span>MPH</span>
</label>
</span>
<!-- wounds -->
<span>
<span class="general-column-header">Wounds</span>
<input type="text" name="attr_hit_det_wounds_total" value="0" title="@{hit_det_wounds_total}" readonly />
<button type="action" class="btn reset-image" name="act_hitDetResetWounds" title="Reset Wounds modifiers."></button>
<select name="attr_hit_det_wounds" title="@{hit_det_wounds}">
<option value="0" selected>Character firing is not wounded 0</option>
<option value="-5">Character firing is wounded, but Life Level is more than ½ normal -5</option>
<option value="-20">Character firing is wounded and Life Level is ½ or below -20</option>
</select>
</span>
<select name="attr_move_of_shooter"></select>
<select name="attr_move_of_target"></select>
<span class="general-column-header">Wounds</span>
<span class="general-column-header">Miscellaneous</span>
<span class="general-column-header">Automatic</span>
<!-- misc. -->
<details class="hit-determination-misc span-all">
<summary>
<span class="general-column-header">Miscellaneous</span>
<input type="text" name="attr_hit_det_misc_total" value="0" title="@{hit_det_misc_total}" readonly />
<button type="action" class="btn reset-image" name="act_hitDetResetMisc" title="Reset Misc. modifiers."></button>
</summary>
<label>
<span>
<input type="checkbox" name="attr_hit_det_misc_weapon_at_rest" value="10" title="@{hit_det_misc_weapon_at_rest}" />
<span>Weapon at rest on solid object (not possible the phase weapon is first aimed at target) +10</span>
</span>
</label>
<label>
<span>
<input type="checkbox" name="attr_hit_det_misc_2nd_consecutive" value="-10" title="@{hit_det_misc_2nd_consecutive}" />
<span>Second consecutive shot by one character<strong>*</strong> -10</span>
</span>
</label>
<div>
<span>
<label>
<input type="checkbox" name="attr_hit_det_misc_additional_consecutive" value="-10" title="@{hit_det_misc_additional_consecutive}" />
<span>Each additional consecutive shot -10 per shot by one character<strong>*</strong> (cumulative)</span>
</label>
<span>Which Shot?</span><input type="text" class="trait-box" name="attr_hit_det_misc_additional_consecutive_multiplier" value="1" title="@{hit_det_misc_additional_consecutive_multiplier}" />
</span>
</div>
<label>
<span>
<input type="checkbox" name="attr_hit_det_misc_wrong_hand" value="-10" title="@{hit_det_misc_wrong_hand}" />
<span>Shooting with the wrong hand (with left hand if right-handed, etc.) -10</span>
</span>
</label>
<div>
<span>
<label>
<input type="checkbox" name="attr_hit_det_misc_wounded_gun_hand" value="-5" title="@{hit_det_misc_wounded_gun_hand}" />
<span>Shooter wounded in gun arm/hand -5 per injury point</span>
</label>
<span>Injury Points?</span>
<input type="text" class="trait-box" name="attr_hit_det_misc_wounded_gun_hand_multiplier" value="1" title="@{hit_det_misc_wounded_gun_hand_multiplier}" />
</span>
</div>
<label>
<span>
<input type="checkbox" name="attr_hit_det_misc_two_weapons" value="-30" title="@{hit_det_misc_two_weapons}" />
<span>Firing two weapons -30</span>
</span>
</label>
<label>
<span>
<input type="checkbox" name="attr_hit_det_misc_hip_shooting" value="-10" title="@{hit_det_misc_hip_shooting}" />
<span>Hipshooting -10</span>
</span>
</label>
<label>
<span>
<input type="checkbox" name="attr_hit_det_misc_obscured" value="-10" title="@{hit_det_misc_obscured}" />
<span>Target obscured (50% or less of target is visible or prone) -10</span>
</span>
</label>
<label>
<span>
<input type="checkbox" name="attr_hit_det_misc_gyrojet" value="10" title="@{hit_det_misc_gyrojet}" />
<span>Using gyrojet ammunition +10</span>
</span>
</label>
<span class="instruction"><strong>*</strong>Note that if at any point a character takes a "steadying phase”, all consecutive shot penalties revert back to zero.</span>
</details>
<!-- range -->
<span class="range-of-target">
<div class="general-column-header">Range of Target</div>
<span title="@{hit_det_range_of_target}">
<span class="nowrap"><input type="radio" name="attr_hit_det_range_of_target" value="0" checked /><span>PB</span></span>
<span class="nowrap"><input type="radio" name="attr_hit_det_range_of_target" value="1" /><span>S</span></span>
<span class="nowrap"><input type="radio" name="attr_hit_det_range_of_target" value="2" /><span>M</span></span>
<span class="nowrap"><input type="radio" name="attr_hit_det_range_of_target" value="3" /><span>L</span></span>
</span>
</span>
<!-- automatic weapons -->
<div class="hit-determination-automatic-grid span-2">
<div class="span-all nowrap">
<span class="general-column-header">Automatic Weapons</span>
<input type="text" name="attr_hit_det_automatic_total" class="larger" value="0" title="@{hit_det_automatic_total}" readonly />
<button type="action" class="btn reset-image" name="act_hitDetResetAutomaticWeapons" title="Reset Automatic Weapons. modifiers."></button>
</div>
<select name="attr_wounds"></select>
<select name="attr_miscellaneous"></select>
<select name="attr_automatic"></select>
<span>Shot#</span>
<span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span><span>10+</span>
<span>Auto</span>
<input type="radio" name="attr_hit_det_automatic" value="0" title="0" checked />
<input type="radio" name="attr_hit_det_automatic" value="-11" title="-11" />
<input type="radio" name="attr_hit_det_automatic" value="-22" title="-22" />
<input type="radio" name="attr_hit_det_automatic" value="-33" title="-33" />
<input type="radio" name="attr_hit_det_automatic" value="-46" title="-46" />
<input type="radio" name="attr_hit_det_automatic" value="-63" title="-63" />
<input type="radio" name="attr_hit_det_automatic" value="-85" title="-85" />
<input type="radio" name="attr_hit_det_automatic" value="-100" title="-100" />
<input type="radio" name="attr_hit_det_automatic" value="-150" title="-150" />
<input type="radio" name="attr_hit_det_automatic" value="-200" title="-200" />
<span>Semi</span>
<input type="radio" name="attr_hit_det_automatic" value="0 " title="0" checked />
<input type="radio" name="attr_hit_det_automatic" value="-11 " title="-11" />
<input type="radio" name="attr_hit_det_automatic" value="-21" title="-21" />
<input type="radio" name="attr_hit_det_automatic" value="-32" title="-32" />
<input type="radio" name="attr_hit_det_automatic" value="-44" title="-44" />
<input type="radio" name="attr_hit_det_automatic" value="-57" title="-57" />
<input type="radio" name="attr_hit_det_automatic" value="-73" title="-73" />
<input type="radio" name="attr_hit_det_automatic" value="-96" title="-96" />
<input type="radio" name="attr_hit_det_automatic" value="-130" title="-130" />
<input type="radio" name="attr_hit_det_automatic" value="-180" title="-180" />
</div>
<div class="span-all">
<span style="float: right;margin-top: -1em;">
<span class="general-column-header" title="Does not include range modifiers.">TOTAL</span>
<input type="text" name="attr_hit_det_total" class="larger" value="0" title="@{hit_det_total}" readonly="">
</span>
</div>
</div>
<div class='weapons-grid'>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span class='weapon-range-modifier-column'>Range Modifier</span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span class='weapon-column'>WEAPON</span>
<span class='weapon-speed-column'>Weapon Speed</span>
<span class='weapon-base-speed-column'>BASE SPEED</span>
<span class='weapon-pwv-column'>PWV</span>
<span class='weapon-base-accuracy-column'>BASE ACCURACY</span>
<span class='weapon-range-modifier-subcolumn'>PB</span>
<span class='weapon-range-modifier-subcolumn'>S</span>
<span class='weapon-range-modifier-subcolumn'>M</span>
<span class='weapon-range-modifier-subcolumn'>L</span>
<span class='weapon-speed-column'>WS</span>
<span class='weapon-rate-column'>Rate</span>
<span class='weapon-rate-column'>Ammo</span>
<span class='weapon-base-speed-column'>BASE SPEED</span>
<span class='weapon-base-accuracy-column'>BASE ACCURACY</span>
<span>HIT DET</span>
</div>
<fieldset class="repeating_Weapons">
<div class='weapons-grid'>
<button type="roll" name="roll_attack" title="%{repeating_Weapons_$X_attack}" value="&{template:default} {{name=@{character_name} - Attack}} {{PB Range=[[ 1d100cs<[[ [[@{BaseAccuracy} [base] ]] + ([[ @{RangeModifierPB} [range] ]]) + ([[ ?{Additional Modifier|0} ]]) ]] ]] vs [[ [[@{BaseAccuracy} [base] ]] + ([[ @{RangeModifierPB} [range] ]]) + ([[ ?{Additional Modifier|0} ]]) ]]}} {{S Range=[[ 1d100cs<[[ [[@{BaseAccuracy} [base] ]] + ([[ @{RangeModifierS} [range] ]]) + ([[ ?{Additional Modifier|0} ]]) ]] ]] vs [[ [[@{BaseAccuracy} [base] ]] + ([[ @{RangeModifierS} [range] ]]) + ([[ ?{Additional Modifier|0} ]]) ]]}} {{M Range=[[ 1d100cs<[[ [[@{BaseAccuracy} [base] ]] + ([[ @{RangeModifierM} [range] ]]) + ([[ ?{Additional Modifier|0} ]]) ]] ]] vs [[ [[@{BaseAccuracy} [base] ]] + ([[ @{RangeModifierM} [range] ]]) + ([[ ?{Additional Modifier|0} ]]) ]]}} {{L Range=[[ 1d100cs<[[ [[@{BaseAccuracy} [base] ]] + ([[ @{RangeModifierL} [range] ]]) + ([[ ?{Additional Modifier|0} ]]) ]] ]] vs [[ [[@{BaseAccuracy} [base] ]] + ([[ @{RangeModifierL} [range] ]]) + ([[ ?{Additional Modifier|0} ]]) ]]}}"></button>
<input type='text' class='weapon-column' name='attr_Weapon' title="@{repeating_Weapons_$X_Weapon}"/>
<input type='text' class='weapon-pwv-column' name='attr_PWV' value="0" title="@{repeating_Weapons_$X_PWV}"/>
<input type='text' class='weapon-range-modifier-subcolumn' name='attr_RangeModifierPB' value='0' title="@{repeating_Weapons_$X_RangeModifierPB}" />
<input type='text' class='weapon-range-modifier-subcolumn' name='attr_RangeModifierS' value='0' title="@{repeating_Weapons_$X_RangeModifierS}" />
<input type='text' class='weapon-range-modifier-subcolumn' name='attr_RangeModifierM' value='0' title="@{repeating_Weapons_$X_RangeModifierM}" />
<input type='text' class='weapon-range-modifier-subcolumn larger' name='attr_RangeModifierL' value='0' title="@{repeating_Weapons_$X_RangeModifierL}" />
<select name='attr_WeaponSpeedModifier' title="@{repeating_Weapons_$X_WeaponSpeedModifier}" class='weapon-speed-column'>
<option value="-10">Very Slow</option>
<option value="-5">Slow</option>
<option value="-3">Below Average</option>
<option value="0">Average</option>
<option value="5">Fast</option>
<option value="10">Very Fast</option>
<option value="-10" title="very slow">VS</option>
<option value="-5" title="slow">S</option>
<option value="-3" title="below average">BA</option>
<option value="0" title="average">A</option>
<option value="5" title="fast">F</option>
<option value="10" title="very fast">VF</option>
</select>
<input type='text' class='weapon-base-speed-column' name='attr_BaseSpeed' title="@{repeating_Weapons_$X_BaseSpeed | @{WeaponSpeedModifier} + @{Offense}}" value='0' readonly/>
<input type='text' class='weapon-pwv-column' name='attr_PWV' title="@{repeating_Weapons_$X_PWV}"/>
<input type='text' class='weapon-rate-column' name='attr_Rate' value='1' title="@{repeating_Weapons_$X_Rate}" />
<span>
<input type='text' class='trait-box' name='attr_ammo' value='0' title="@{repeating_Weapons_$X_ammo}" />
<span class="division">/</span>
<input type='text' class='trait-box' name='attr_ammo_max' value='0' title="@{repeating_Weapons_$X_ammo|max}" />
</span>
<input type='text' class='weapon-base-speed-column' name='attr_BaseSpeed' value='0' title="@{repeating_Weapons_$X_BaseSpeed | @{WeaponSpeedModifier} + @{Offense}}" readonly/>
<input type='text' class='weapon-base-accuracy-column' name='attr_BaseAccuracy' title="@{repeating_Weapons_$X_BaseAccuracy | @{PWV} + @{Offense}" value='0' readonly/>
<input type='text' class='weapon-range-modifier-subcolumn' name='attr_RangeModifierPB' title="@{repeating_Weapons_$X_RangeModifierPB}" value='0'/>
<input type='text' class='weapon-range-modifier-subcolumn' name='attr_RangeModifierS' title="@{repeating_Weapons_$X_RangeModifierS}" value='0'/>
<input type='text' class='weapon-range-modifier-subcolumn' name='attr_RangeModifierM' title="@{repeating_Weapons_$X_RangeModifierM}" value='0'/>
<input type='text' class='weapon-range-modifier-subcolumn' name='attr_RangeModifierL' title="@{repeating_Weapons_$X_RangeModifierL}" value='0'/>
<input type='text' class='weapon-pwv-column larger' name='attr_hit_det' value="0" title="@{repeating_Weapons_$X_hit_det}" readonly/>
<!--<input type='text' class='weapon-range-modifier-column' name='attr_RangeModifier' title="@{repeating_Weapons_$X_RangeModifier}"-->
<input type='text' class='weapon-rate-column' name='attr_Rate' title="@{repeating_Weapons_$X_Rate}" value='0'/>
</div>
</fieldset>
</div>
@@ -526,16 +705,18 @@
});
// weapon calcs
on('change:repeating_weapons:weaponspeedmodifier change:repeating_weapons:pwv', (eventInfo) => {
on('change:repeating_weapons', (eventInfo) => {
console.log(`Change detected: ${eventInfo.sourceAttribute}`);
const id = eventInfo.sourceAttribute.split('_')[2];
getAttrs(['offense', `repeating_weapons_${id}_weaponspeedmodifier`, `repeating_weapons_${id}_pwv`], (v) => {
getAttrs(['offense', 'hit_det_total', `repeating_weapons_${id}_weaponspeedmodifier`, `repeating_weapons_${id}_pwv`], (v) => {
const output = {};
const offense = +v.offense || 0;
const weaponSpeed = +v[`repeating_weapons_${id}_weaponspeedmodifier`] || 0;
const PWV = +v[`repeating_weapons_${id}_pwv`] || 0;
const hitDetTotal = v.hit_det_total || 0;
output[`repeating_weapons_${id}_basespeed`] = offense + weaponSpeed;
output[`repeating_weapons_${id}_baseaccuracy`] = offense + PWV;
output[`repeating_weapons_${id}_hit_det`] = hitDetTotal;
setAttrs(output, {silent: true});
});
});
@@ -562,6 +743,223 @@
});
});
// hit determination chart
// movement of shooter
on('change:hit_det_move_of_shooter change:hit_det_shooter_speed_multiplier clicked:hitDetResetAll clicked:hitDetResetMovementOfShooter', (eventInfo) => {
console.log(`Change detected: ${eventInfo.sourceAttribute}`);
getAttrs(['hit_det_move_of_shooter', 'hit_det_shooter_speed_multiplier'], (v) => {
const output = {};
let actionButton = eventInfo.triggerName;
actionButton = actionButton.replace('clicked:', '');
if (actionButton !== 'hitdetresetmovementofshooter' && actionButton !== 'hitdetresetall') {
let moveShooter = +v['hit_det_move_of_shooter'] || 0;
let speedMult = 0;
if (moveShooter === 7) {
speedMult = +Math.max(0, v['hit_det_shooter_speed_multiplier'] || 0);
}
const moveShooterValues = {
0: 0, // Stationary
1: 5, // Stationary and prone
2: -5, // Walking
3: -10, // Wading
4: -10, // Crawling
5: -30, // Running and dodging
6: -20, // Running
7: -10, // Vehicular Movement
8: -20, // Drops Prone
};
moveShooter = moveShooterValues[moveShooter] || 0;
output.hit_det_move_of_shooter_total = moveShooter - speedMult;
output.hit_det_shooter_speed_multiplier = speedMult;
} else {
console.log(`Change detected: Reset`);
output.hit_det_move_of_shooter_total = 0;
output.hit_det_move_of_shooter = 0;
output.hit_det_shooter_speed_multiplier = 0;
}
setAttrs(output);
});
});
// movement of target
on('change:hit_det_move_of_target change:hit_det_target_speed_multiplier clicked:hitDetResetAll clicked:hitDetResetMovementOfTarget', (eventInfo) => {
console.log(`Change detected: ${eventInfo.sourceAttribute}`);
getAttrs(['hit_det_move_of_target', 'hit_det_target_speed_multiplier'], (v) => {
const output = {};
let actionButton = eventInfo.triggerName;
actionButton = actionButton.replace('clicked:', '');
if (actionButton !== 'hitdetresetmovementoftarget' && actionButton !== 'hitdetresetall') {
let moveTarget = +v['hit_det_move_of_target'] || 0;
let speedMult = 0;
if (moveTarget === 6) {
speedMult = +Math.max(0, v['hit_det_target_speed_multiplier'] || 0);
}
const moveTargetValues = {
0: 0, // Stationary
1: -5, // Walking
2: -5, // Wading
3: -5, // Crawling
4: -10, // Running
5: -20, // Running and dodging
6: -10, // Vehicular Movement
7: -5, // Drops Prone
};
moveTarget = moveTargetValues[moveTarget] || 0;
output.hit_det_move_of_target_total = moveTarget - speedMult;
output.hit_det_target_speed_multiplier = speedMult;
} else {
console.log(`Change detected: Reset`);
output.hit_det_move_of_target_total = 0;
output.hit_det_move_of_target = 0;
output.hit_det_target_speed_multiplier = 0;
}
setAttrs(output);
});
});
// wounds
on('change:hit_det_wounds clicked:hitDetResetAll clicked:hitDetResetWounds', (eventInfo) => {
console.log(`Change detected: ${eventInfo.sourceAttribute}`);
getAttrs(['hit_det_wounds'], (v) => {
const output = {};
let actionButton = eventInfo.triggerName;
actionButton = actionButton.replace('clicked:', '');
if (actionButton !== 'hitdetresetwounds' && actionButton !== 'hitdetresetall') {
const valWounds = +v['hit_det_wounds'] || 0;
output.hit_det_wounds_total = valWounds;
} else {
console.log(`Change detected: Reset`);
output.hit_det_wounds_total = 0;
output.hit_det_wounds = 0;
}
setAttrs(output);
});
});
// miscellaneous
on(
'change:hit_det_misc_weapon_at_rest change:hit_det_misc_2nd_consecutive change:hit_det_misc_additional_consecutive change:hit_det_misc_additional_consecutive_multiplier change:hit_det_misc_wrong_hand change:hit_det_misc_wounded_gun_hand change:hit_det_misc_wounded_gun_hand_multiplier change:hit_det_misc_two_weapons change:hit_det_misc_hip_shooting change:hit_det_misc_obscured change:hit_det_misc_gyrojet change:hit_det_misc_total clicked:hitDetResetAll clicked:hitDetResetMisc',
(eventInfo) => {
console.log(`Change detected: ${eventInfo.sourceAttribute}`);
getAttrs(
[
'hit_det_misc_weapon_at_rest',
'hit_det_misc_2nd_consecutive',
'hit_det_misc_additional_consecutive',
'hit_det_misc_additional_consecutive_multiplier',
'hit_det_misc_wrong_hand',
'hit_det_misc_wounded_gun_hand',
'hit_det_misc_wounded_gun_hand_multiplier',
'hit_det_misc_two_weapons',
'hit_det_misc_hip_shooting',
'hit_det_misc_obscured',
'hit_det_misc_gyrojet',
'hit_det_misc_total',
],
(v) => {
const output = {};
let actionButton = eventInfo.triggerName;
actionButton = actionButton.replace('clicked:', '');
if (actionButton !== 'hitdetresetmisc' && actionButton !== 'hitdetresetall') {
const valWeapon_at_rest = +v.hit_det_misc_weapon_at_rest || 0;
const val2nd_consecutive = +v.hit_det_misc_2nd_consecutive || 0;
const valAdditional_consecutive = +v.hit_det_misc_additional_consecutive || 0;
const valAdditional_consecutive_multiplier = +v.hit_det_misc_additional_consecutive_multiplier || 0;
const valWrong_hand = +v.hit_det_misc_wrong_hand || 0;
const valWounded_gun_hand = +v.hit_det_misc_wounded_gun_hand || 0;
const valWounded_gun_hand_multiplier = +v.hit_det_misc_wounded_gun_hand_multiplier || 0;
const valTwo_weapons = +v.hit_det_misc_two_weapons || 0;
const valHip_shooting = +v.hit_det_misc_hip_shooting || 0;
const valObscured = +v.hit_det_misc_obscured || 0;
const valGyrojet = +v.hit_det_misc_gyrojet || 0;
output.hit_det_misc_weapon_at_rest = valWeapon_at_rest;
output.hit_det_misc_2nd_consecutive = val2nd_consecutive;
output.hit_det_misc_additional_consecutive = valAdditional_consecutive;
output.hit_det_misc_additional_consecutive_multiplier = valAdditional_consecutive_multiplier;
output.hit_det_misc_wrong_hand = valWrong_hand;
output.hit_det_misc_wounded_gun_hand = valWounded_gun_hand;
output.hit_det_misc_wounded_gun_hand_multiplier = valWounded_gun_hand_multiplier;
output.hit_det_misc_two_weapons = valTwo_weapons;
output.hit_det_misc_hip_shooting = valHip_shooting;
output.hit_det_misc_obscured = valObscured;
output.hit_det_misc_gyrojet = valGyrojet;
output.hit_det_misc_total =
valWeapon_at_rest +
val2nd_consecutive +
valAdditional_consecutive * valAdditional_consecutive_multiplier +
valWrong_hand +
valWounded_gun_hand * valWounded_gun_hand_multiplier +
valTwo_weapons +
valHip_shooting +
valObscured +
valGyrojet;
} else {
console.log(`Change detected: Reset`);
output.hit_det_misc_weapon_at_rest = 0;
output.hit_det_misc_2nd_consecutive = 0;
output.hit_det_misc_additional_consecutive = 0;
output.hit_det_misc_additional_consecutive_multiplier = 1;
output.hit_det_misc_wrong_hand = 0;
output.hit_det_misc_wounded_gun_hand = 0;
output.hit_det_misc_wounded_gun_hand_multiplier = 1;
output.hit_det_misc_two_weapons = 0;
output.hit_det_misc_hip_shooting = 0;
output.hit_det_misc_obscured = 0;
output.hit_det_misc_gyrojet = 0;
output.hit_det_misc_total = 0;
}
setAttrs(output);
},
);
},
);
// automatic weapons
on('change:hit_det_automatic clicked:hitDetResetAll clicked:hitDetResetAutomaticWeapons', (eventInfo) => {
console.log(`Change detected: ${eventInfo.sourceAttribute}`);
getAttrs(['hit_det_automatic'], (v) => {
const output = {};
let actionButton = eventInfo.triggerName;
actionButton = actionButton.replace('clicked:', '');
if (actionButton !== 'hitdetresetautomaticweapons' && actionButton !== 'hitdetresetall') {
const valAutomatic = +v['hit_det_automatic'] || 0;
output.hit_det_automatic_total = valAutomatic;
} else {
console.log(`Change detected: Reset`);
output.hit_det_automatic_total = 0;
output.hit_det_automatic = 0;
}
setAttrs(output);
});
});
// hit determination total
on('change:hit_det_move_of_shooter_total change:hit_det_move_of_target_total change:hit_det_wounds_total change:hit_det_misc_total change:hit_det_automatic_total', (eventInfo) => {
console.log(`Change detected: ${eventInfo.sourceAttribute}`);
getSectionIDs('repeating_weapons', (idArray) => {
const output = {};
const fields = ['hit_det_move_of_shooter_total', 'hit_det_move_of_target_total', 'hit_det_wounds_total', 'hit_det_misc_total', 'hit_det_automatic_total'];
_.each(idArray, (id) => {
fields.push(section_attribute('weapons', id, 'hit_det'));
});
getAttrs(fields, (v) => {
const hit_det_move_of_shooter_total = +v.hit_det_move_of_shooter_total || 0;
const hit_det_move_of_target_total = +v.hit_det_move_of_target_total || 0;
const hit_det_wounds_total = +v.hit_det_wounds_total || 0;
const hit_det_misc_total = +v.hit_det_misc_total || 0;
const hit_det_automatic_total = +v.hit_det_automatic_total || 0;
const hitDetTotal = hit_det_move_of_shooter_total + hit_det_move_of_target_total + hit_det_wounds_total + hit_det_misc_total + hit_det_automatic_total;
output.hit_det_total = hitDetTotal;
idArray.forEach((id) => {
output[section_attribute('weapons', id, 'hit_det')] = hitDetTotal;
});
setAttrs(output, {silent: true});
});
});
});
// one-time update
on('sheet:opened', (eventInfo) => {
console.log(`Change detected: sheet_version check`);
+1 -2
View File
@@ -4,6 +4,5 @@
"authors": "Richard Gavin (@rocketheadent)",
"roll20userid": "1649310",
"preview": "TopSecret.png",
"instructions": "",
"legacy": true
"instructions": ""
}