Merge pull request #10522 from bhuesemann/tor2e_02-12-00

[The One Ring 2e] - 2.12.0 - new feature: selectable weapon and armour qualities
This commit is contained in:
Nic Bradley
2022-05-05 09:03:42 -07:00
committed by GitHub
4 changed files with 369 additions and 82 deletions
+10
View File
@@ -4,6 +4,16 @@ This is a rewrite based on the early 2e (basic) and 1e edition that also include
# Release History
## 02.12.00 (Build 15)
### Features
- changed keen, grievieous, fell weapon spec from checkbox into selectable valued options
- changed cunning make, close fit, reinforced armour spec from checkbox into selectable valued options
- added release log to archive data migration messages (button on the bottom of the sheet to toggle)
PLEASE NOTE: due to the changes a data migration will make changes to the values of weapon and armour values. As the new sheet will automatically incorporate all necessary bonus to Damage/Injury/Load/Parry etc. the data migration will automatically correct those values depending on the flags (keen, grievous, fell, cunning make, close fitting, reinforced). You can check everything that happened in the release log (click button to show it). Please inform the players about the new semantics of the sheet to avoid confusion.
## 02.11.00 (Build 14)
### Features
+19 -3
View File
@@ -130,7 +130,7 @@
border-radius: 0;
border-bottom: 2px solid rgba(0, 0, 0, .15);
text-align: left;
margin-bottom: 5px;
margin-bottom: 2px;
}
.charsheet input[type="text"] {
@@ -159,7 +159,7 @@
border-right: 0;
border-top: 0;
line-height: 18px;
height: 17px;
height: 20px;
padding: 0px 4px 0px 4px;
}
@@ -743,11 +743,19 @@
text-align: left;
}
.charsheet #war-gear-nested input[type="checkbox"] {
.charsheet #war-gear-nested input[type="checkbox"],
.charsheet #armour-nested input[type="checkbox"] {
text-align: center;
vertical-align: sub;
}
.charsheet #war-gear-nested select,
.charsheet #armour-nested select {
appearance: none;
justify-self: center;
text-align: center;
}
.charsheet #armour {
grid-area: armo;
z-index: 1;
@@ -828,6 +836,14 @@
display: block;
}
.charsheet #releaselog {
display: none;
}
.charsheet .sheet-releaselogtoggle[value="1"]~#releaselog {
display: block;
}
.charsheet #notes-nested {
display: grid;
grid-template-columns: minmax(245px, 1fr) 10fr;
+329 -68
View File
@@ -1,4 +1,4 @@
<input type="hidden" name="attr_version" value="02-11-00" />
<input type="hidden" name="attr_version" value="02-12-00" />
<input type="hidden" class="sheet-tabstoggle" name="attr_sheetTab" />
<input type="checkbox" name="attr_parsedrolls" value="1" class="hidden config-parsed-rolls" checked="checked" hidden
readonly />
@@ -194,7 +194,8 @@
checked="checked">Shield</label>
</div>
<span class="diamond-small">
<span><input name="attr_shieldparry" value="0" type="number"></span></span>
<span><input name="attr_shieldparry_total" value="0" type="number"
readonly="readonly"></span></span>
<div class="center">
<span class="diamond-small">
<span><input name="attr_otherparry" value="0" type="number"></span></span>
@@ -749,8 +750,8 @@
<label class="center" data-i18n="weapon-injury">Inj.</label>
<label class="center" data-i18n="weapon-load">Load</label>
<label class="center" data-i18n="weapon-fell" data-i18n-title="weapon-fell-description">F</label>
<label class="center" data-i18n="weapon-grievieous"
data-i18n-title="weapon-grievieous-description">G</label>
<label class="center" data-i18n="weapon-grievous"
data-i18n-title="weapon-grievous-description">G</label>
<label class="center" data-i18n="weapon-keen" data-i18n-title="weapon-keen-description">K</label>
<label data-i18n="notes">Notes</label>
<span class="table-rolls" />
@@ -780,9 +781,21 @@
<input name="attr_weapon_damage_1" value="0" class="center number" type="number">
<input name="attr_weapon_injury_1" value="0" class="center number" type="number">
<input name="attr_weapon_load_1" value="0" class="center number" type="number">
<input type="checkbox" class="center" value="1" name="attr_weapon_fell_1">
<input type="checkbox" class="center" value="1" name="attr_weapon_grievous_1">
<input type="checkbox" class="center" value="1" name="attr_weapon_keen_1">
<select name="attr_weapon_fell_val_1">
<option value="0" selected default></option>
<option value="2">+2</option>
<option value="4">+4</option>
</select>
<select name="attr_weapon_grievous_val_1">
<option value="0" selected default></option>
<option value="1">+1</option>
<option value="2">+2</option>
</select>
<select name="attr_weapon_keen_val_1">
<option value="10" selected default></option>
<option value="9">9+</option>
<option value="8">8+</option>
</select>
<input name="attr_weapon_note_1" type="text">
<span class="table-rolls" />
<span class="parsed-rolls">
@@ -811,9 +824,21 @@
<input name="attr_weapon_damage_2" value="0" class="center number" type="number">
<input name="attr_weapon_injury_2" value="0" class="center number" type="number">
<input name="attr_weapon_load_2" value="0" class="center number" type="number">
<input type="checkbox" class="center" name="attr_weapon_fell_2">
<input type="checkbox" class="center" name="attr_weapon_grievous_2">
<input type="checkbox" class="center" name="attr_weapon_keen_2">
<select name="attr_weapon_fell_val_2">
<option value="0" selected default></option>
<option value="2">+2</option>
<option value="4">+4</option>
</select>
<select name="attr_weapon_grievous_val_2">
<option value="0" selected default></option>
<option value="1">+1</option>
<option value="2">+2</option>
</select>
<select name="attr_weapon_keen_val_2">
<option value="10" selected default></option>
<option value="9">9+</option>
<option value="8">8+</option>
</select>
<input name="attr_weapon_note_2" type="text">
<span class="table-rolls" />
<span class="parsed-rolls">
@@ -842,9 +867,21 @@
<input name="attr_weapon_damage_3" value="0" class="center number" type="number">
<input name="attr_weapon_injury_3" value="0" class="center number" type="number">
<input name="attr_weapon_load_3" value="0" class="center number" type="number">
<input type="checkbox" class="center" name="attr_weapon_fell_3">
<input type="checkbox" class="center" name="attr_weapon_grievous_3">
<input type="checkbox" class="center" name="attr_weapon_keen_3">
<select name="attr_weapon_fell_val_3">
<option value="0" selected default></option>
<option value="2">+2</option>
<option value="4">+4</option>
</select>
<select name="attr_weapon_grievous_val_3">
<option value="0" selected default></option>
<option value="1">+1</option>
<option value="2">+2</option>
</select>
<select name="attr_weapon_keen_val_3">
<option value="10" selected default></option>
<option value="9">9+</option>
<option value="8">8+</option>
</select>
<input name="attr_weapon_note_3" type="text">
<span class="table-rolls" />
<span class="parsed-rolls">
@@ -873,9 +910,21 @@
<input name="attr_weapon_damage_4" value="0" class="center number" type="number">
<input name="attr_weapon_injury_4" value="0" class="center number" type="number">
<input name="attr_weapon_load_4" value="0" class="center number" type="number">
<input type="checkbox" class="center" name="attr_weapon_fell_4">
<input type="checkbox" class="center" name="attr_weapon_grievous_4">
<input type="checkbox" class="center" name="attr_weapon_keen_4">
<select name="attr_weapon_fell_val_4">
<option value="0" selected default></option>
<option value="2">+2</option>
<option value="4">+4</option>
</select>
<select name="attr_weapon_grievous_val_4">
<option value="0" selected default></option>
<option value="1">+1</option>
<option value="2">+2</option>
</select>
<select name="attr_weapon_keen_val_4">
<option value="10" selected default></option>
<option value="9">9+</option>
<option value="8">8+</option>
</select>
<input name="attr_weapon_note_4" type="text">
<span class="table-rolls" />
<span class="parsed-rolls">
@@ -904,9 +953,21 @@
<input name="attr_weapon_damage_5" value="0" class="center number" type="number">
<input name="attr_weapon_injury_5" value="0" class="center number" type="number">
<input name="attr_weapon_load_5" value="0" class="center number" type="number">
<input type="checkbox" class="center" value="1" name="attr_weapon_fell_5">
<input type="checkbox" class="center" value="1" name="attr_weapon_grievous_5">
<input type="checkbox" class="center" value="1" name="attr_weapon_keen_5">
<select name="attr_weapon_fell_val_5">
<option value="0" selected default></option>
<option value="2">+2</option>
<option value="4">+4</option>
</select>
<select name="attr_weapon_grievous_val_5">
<option value="0" selected default></option>
<option value="1">+1</option>
<option value="2">+2</option>
</select>
<select name="attr_weapon_keen_val_5">
<option value="10" selected default></option>
<option value="9">9+</option>
<option value="8">8+</option>
</select>
<input name="attr_weapon_note_5" type="text">
<span class="table-rolls" />
<span class="parsed-rolls">
@@ -935,9 +996,21 @@
<input name="attr_weapon_damage_6" value="0" class="center number" type="number">
<input name="attr_weapon_injury_6" value="0" class="center number" type="number">
<input name="attr_weapon_load_6" value="0" class="center number" type="number">
<input type="checkbox" class="center" value="1" name="attr_weapon_fell_6">
<input type="checkbox" class="center" value="1" name="attr_weapon_grievous_6">
<input type="checkbox" class="center" value="1" name="attr_weapon_keen_6">
<select name="attr_weapon_fell_val_6">
<option value="0" selected default></option>
<option value="2">+2</option>
<option value="4">+4</option>
</select>
<select name="attr_weapon_grievous_val_6">
<option value="0" selected default></option>
<option value="1">+1</option>
<option value="2">+2</option>
</select>
<select name="attr_weapon_keen_val_6">
<option value="10" selected default></option>
<option value="9">9+</option>
<option value="8">8+</option>
</select>
<input name="attr_weapon_note_6" type="text">
</div>
</div>
@@ -958,16 +1031,32 @@
data-i18n-placeholder="armour-placeholder" name="attr_armour">
<input class="center number" type="number" name="attr_armourprot" value="0">
<input class="center number" type="number" name="attr_armourload" value="0">
<input type="checkbox" class="center gridcol4" value="1" name="attr_armourcf"></checkbox>
<input type="checkbox" class="center gridcol5" value="1" name="attr_armourcm"></checkbox>
<select name="attr_armourcf_val" class="center gridcol4">
<option value="0" selected default></option>
<option value="2">+2</option>
<option value="3">+3</option>
</select>
<select name="attr_armourcm_val" class="center gridcol5">
<option value="0" selected default></option>
<option value="-2">-2</option>
<option value="-3">-3</option>
</select>
<input type="checkbox" name="attr_helmprot_active" value=1 checked="checked">
<input class="text" type="text" placeholder="Helm" title="Helm" data-i18n-title="helm"
data-i18n-placeholder="helm-placeholder" name="attr_helm">
<input class="center number" type="number" name="attr_helmprot" value="0">
<input class="center number" type="number" name="attr_helmload" value="0">
<input type="checkbox" class="center gridcol4" value="1" name="attr_helmetcf"></checkbox>
<input type="checkbox" class="center gridcol5" value="1" name="attr_helmetcm"></checkbox>
<select name="attr_helmetcf_val" class="center gridcol4">
<option value="0" selected default></option>
<option value="2">+2</option>
<option value="3">+3</option>
</select>
<select name="attr_helmetcm_val" class="center gridcol5">
<option value="0" selected default></option>
<option value="-2">-2</option>
<option value="-3">-3</option>
</select>
<input type="checkbox" name="attr_otherprot_active" value=1 checked="checked">
<input type="text" class="text" name="attr_otherprot_name" placeholder="Other"
@@ -975,8 +1064,16 @@
data-i18n-placeholder="other-placeholder">
<input class="center number" type="number" name="attr_otherprot" value="0">
<input class="center number" type="number" name="attr_otherload" value="0">
<input type="checkbox" class="center gridcol4" value="1" name="attr_othercf"></checkbox>
<input type="checkbox" class="center gridcol5" value="1" name="attr_othercm"></checkbox>
<select name="attr_othercf_val" class="center gridcol4">
<option value="0" selected default></option>
<option value="2">+2</option>
<option value="3">+3</option>
</select>
<select name="attr_othercm_val" class="center gridcol5">
<option value="0" selected default></option>
<option value="-2">-2</option>
<option value="-3">-3</option>
</select>
<span></span>
<label data-i18n="shield">Shield</label>
@@ -991,8 +1088,16 @@
data-i18n-placeholder="shield-placeholder" name="attr_shield">
<input class="center number" type="number" name="attr_shieldparry" value="0">
<input class="center number" type="number" name="attr_shieldload" value="0">
<input type="checkbox" class="center gridcol4" value="1" name="attr_shieldreinf"></checkbox>
<input type="checkbox" class="center gridcol5" value="1" name="attr_shieldcm"></checkbox>
<select name="attr_shieldreinf_val" class="center gridcol4">
<option value="0" selected default></option>
<option value="1">+1</option>
<option value="2">+2</option>
</select>
<select name="attr_shieldcm_val" class="center gridcol5">
<option value="0" selected default></option>
<option value="-2">-2</option>
<option value="-3">-3</option>
</select>
</div>
</div>
<div id="mount">
@@ -1235,9 +1340,14 @@
<div class="center">
<button type="action" name="act_isPC" data-i18n="sheet-type-Player-Character">Player Character</button>
<button type="action" name="act_isAdversary" data-i18n="sheet-type-Adversary">Adversary</button>
<button type="action" name="act_releaselog">Releaselog</button>
<br />
<h6>Version <span name="attr_version"></span></h6>
</div>
<input type="hidden" class="sheet-releaselogtoggle" name="attr_releaselogactive"/>
<div id="releaselog">
<textarea name="attr_releaselog" readonly="readonly"/>
</div>
<div style="display: none;">
<input name="attr_wearytype">
<input name="attr_awe_roll">
@@ -1280,6 +1390,11 @@
console.log(output, textStyle);
}
};
const hlog = (text, msg = {msg: ""}) => {
msg.msg = msg.msg + text + "\n";
return msg;
};
const capitalize = (str) => {
return str.charAt(0).toUpperCase() + str.slice(1);
};
@@ -1287,6 +1402,8 @@
const stripaction = (str) => {
return str.replace(/_action/g,'');
};
const range = (start, stop, step=1) => Array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i * step));
// ASYNC ATTRIBUTE METHODS (see https://app.roll20.net/forum/post/10346883/adventures-with-startroll)
const asw = (() => {
@@ -1410,7 +1527,11 @@
parrymodStr = "",
stanceattackmodStr = "",
targetnameStr = "",
target;
target,
closefit="",
closefitStr="",
keen="",
match=[];
act = capitalize(act);
act = (act === "Wisdom" || act === "Valour") ? "Shadow test: "+act : act;
@@ -1492,10 +1613,12 @@
favouredStr = favId == 2 ? "{{favoured=Favoured}}" : ( favId == 0 ? "{{favoured=Ill-favoured}}" : "" );
// REWARDS, KEEN WEAPONS AND CLOSE FITTING ARMOUR
keen = (additional.match(/Keen/g) || []).length;
if( keen > 0 ) { clog("Weapon is keen!"); }
closefit = int((additional.match(/Close fitting/g) || []).length)*2;
let closefitStr = "";
match = additional.match(/keen='(.*)';/);
keen = match ? match[1] : 10;
if( keen < 10 ) { clog(`Weapon is keen: ${keen}`); }
match = additional.match(/closefit='(.*)';/);
closefit = match ? match[1] : 0;
closefitStr = "";
if( closefit > 0 ) {
clog(`Armour is close fitting: ${closefit}`);
closefitStr = `+${closefit}[Close fit]`;
@@ -1555,7 +1678,10 @@
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));
// Headsup: rollresult.results.r1.dice only includes the dice (excluding a bonus e.g. for closefit)
let wearydice = (_.reduce(rollresult.results.r1.dice, (memo, num) => { if(num <= 3) {return memo} else {return memo+num} }, 0));
let nonwearydice = (_.reduce(rollresult.results.r1.dice, (memo, num) => {return memo+num}, 0));
rollSuccess = rollSuccess - (nonwearydice - wearydice);
clog(`Weary successes: ${rollSuccess}`);
} else {
clog(`Normal successes: ${rollSuccess}`);
@@ -1590,12 +1716,12 @@
}
// GREATNESS & FEAT DIE
// 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" && (outcome === 1 || outcome === 2) && rollFeat === 9 && keen > 0 ? 3 : outcome;
clog(`Outcome after Keen: ${outcome}`);
// Test for piercing blow on crit success
outcome = rolltype === "combat" && (outcome === 2) ? 3 : outcome;
clog(`Outcome after Crit: ${outcome}`);
// Piercing blow also at 10 or 8/9 if the used weapon is keen
outcome = rolltype === "combat" && (outcome === 1) && (rollFeat >= keen && rollFeat <= 10) ? 3 : outcome;
clog(`Outcome after Piercing or Keen: ${outcome}`);
// count number of 6s in success, great or extraordinary success
// Count the number of sixes rolled, to report degree of success
clog(`Roll r1 : ${JSON.stringify(rollresult.results.r1.dice)}`);
@@ -1662,6 +1788,16 @@
});
});
// toggle release notes visibility
on( "clicked:releaselog", function(){
getAttrs(["releaselogactive"], function(values){
let state = int(values.releaselogactive);
let newstate = 1-state; // xor
setAttrs({releaselogactive:newstate});
console.log("Releaselog state: " + newstate);
});
});
/*==========================
defaults
============================*/
@@ -1850,11 +1986,13 @@
// calc total load on change events for weapons, armour and treasure
on( "change:weapon_load_1 change:weapon_load_2 change:weapon_load_3 change:weapon_load_4 change:weapon_load_5 change:weapon_load_6 " +
"change:armourload change:helmload change:shieldload change:otherload change:treasureload " +
"change:armourcm_val change:helmetcm_val change:othercm_val change:shieldcm_val " +
"change:armourprot_active change:shieldparry_active change:helmprot_active change:otherprot_active " +
"change:weapon_active_1 change:weapon_active_2 change:weapon_active_3 change:weapon_active_4 change:weapon_active_5 change:weapon_active_6 " +
"change:fatigue change:load sheet:opened", function() {
getAttrs(["weapon_load_1","weapon_load_2","weapon_load_3","weapon_load_4","weapon_load_5","weapon_load_6",
"armourload","shieldload","helmload", "otherload", "fatigue","treasureload",
"armourload","shieldload","helmload","otherload","fatigue","treasureload",
"armourcm_val","shieldcm_val","helmetcm_val","othercm_val",
"armourprot_active", "helmprot_active", "shieldparry_active", "otherprot_active",
"weapon_active_1", "weapon_active_2", "weapon_active_3", "weapon_active_4", "weapon_active_5", "weapon_active_6"], function(values) {
const weaponload1 = (int(values.weapon_active_1) == 1) ? int(values.weapon_load_1) : 0,
@@ -1863,12 +2001,13 @@
weaponload4 = (int(values.weapon_active_4) == 1) ? int(values.weapon_load_4) : 0,
weaponload5 = (int(values.weapon_active_5) == 1) ? int(values.weapon_load_5) : 0,
weaponload6 = (int(values.weapon_active_6) == 1) ? int(values.weapon_load_6) : 0,
armourload = (int(values.armourprot_active) == 1) ? int(values.armourload) : 0,
shieldload = (int(values.shieldparry_active) == 1) ? int(values.shieldload) : 0,
helmload = (int(values.helmprot_active) == 1) ? int(values.helmload) : 0,
otherload = (int(values.otherprot_active) == 1) ? int(values.otherload) : 0,
armourload = (int(values.armourprot_active) == 1) ? int(values.armourload) + int(values.armourcm_val) : 0,
shieldload = (int(values.shieldparry_active) == 1) ? int(values.shieldload) + int(values.shieldcm_val) : 0,
helmload = (int(values.helmprot_active) == 1) ? int(values.helmload) + int(values.helmetcm_val) : 0,
otherload = (int(values.otherprot_active) == 1) ? int(values.otherload) + int(values.othercm_val) : 0,
treasureload = int(values.treasureload),
load = armourload + shieldload + helmload + otherload + weaponload1 + weaponload2 + weaponload3 + weaponload4 + weaponload5 + weaponload6 + treasureload; // Removed Fatigue, used to calculate vs Current Endurance and Weary condition below.
clog(`Shieldparry_active: ${values.shieldparry_active}`);
setAttrs({
load: load,
});
@@ -1928,17 +2067,18 @@
// calc total parry on change events for the check boxes and values
on( "change:shieldparry_active change:otherparry_active change:stanceparry_active " +
"change:parry change:shieldparry change:otherparry change:stanceparry " +
"change:parry change:shieldparry change:otherparry change:stanceparry change:shieldreinf_val " +
"change:totalparry sheet:opened", function() {
getAttrs(["parry", "shieldparry", "stanceparry", "otherparry",
"shieldparry_active", "stanceparry_active", "otherparry_active"], function(values) {
getAttrs(["parry", "shieldparry", "stanceparry", "otherparry", "shieldreinf_val",
"shieldparry_active", "stanceparry_active", "otherparry_active"], function(values) {
let parry = int(values.parry);
let shieldparry = (values.shieldparry_active == 1) ? int(values.shieldparry) : 0;
let shieldparry = (values.shieldparry_active == 1) ? int(values.shieldparry) + int(values.shieldreinf_val) : 0;
let stanceparry = (values.stanceparry_active == 1) ? int(values.stanceparry) : 0;
let otherparry = (values.otherparry_active == 1) ? int(values.otherparry) : 0;
let parrytotal = parry + shieldparry + stanceparry + otherparry;
setAttrs({
totalparry: parrytotal,
shieldparry_total: int(values.shieldparry) + int(values.shieldreinf_val),
});
console.log("Updated total parry to " + parrytotal
+ " - parry: " + parry + " - shieldparry: " + shieldparry
@@ -1950,20 +2090,28 @@
on('clicked:protection_action', async (ev) => {
clog(`Starting first roll`);
let action = 'protection',
data = await asw.getAttrs(['character_name', action, 'protection', 'armourcf', 'armourcm', 'helmetcf', 'helmetcm', 'othercf', 'othercm', 'sheetTab', 'protection_favoured']),
data = await asw.getAttrs(['character_name', action, 'protection',
'armourcf', 'armourcm', 'helmetcf', 'helmetcm', 'othercf', 'othercm',
'armourcf_val', 'armourcm_val', 'helmetcf_val', 'helmetcm_val', 'othercf_val', 'othercm_val',
'armourprot_active', 'helmprot_active', 'otherprot_active',
'sheetTab', 'protection_favoured']),
actdice = int(data.protection),
actfav = data.protection_favoured,
lm = data.sheetTab ==="isAdversary" ? true : false;
let additionalStr = "";
additionalStr = additionalStr + ((data.armourcf == "1") ? "Close fitting armour, " : "");
additionalStr = additionalStr + ((data.helmetcf == "1") ? "Close fitting helm, " : "");
additionalStr = additionalStr + ((data.othercf == "1") ? "Close fitting other, " : "");
additionalStr = additionalStr + ((data.armourcm == "1") ? "Cunning made armour, " : "");
additionalStr = additionalStr + ((data.helmetcm == "1") ? "Cunning made helm, " : "");
additionalStr = additionalStr + ((data.helmetcm == "1") ? "Other Cunning made, " : "");
additionalStr = additionalStr + ((data.armourcf_val != "0" && data.armourprot_active === "1") ? "Close fit armour, " : "");
additionalStr = additionalStr + ((data.helmetcf_val != "0" && data.helmprot_active === "1") ? "Close fit helm, " : "");
additionalStr = additionalStr + ((data.othercf_val != "0" && data.otherprot_active === "1") ? "Close fit other, " : "");
additionalStr = additionalStr + ((data.armourcm_val != "0" && data.armourprot_active === "1") ? "Cunning armour, " : "");
additionalStr = additionalStr + ((data.helmetcm_val != "0" && data.helmprot_active === "1") ? "Cunning helm, " : "");
additionalStr = additionalStr + ((data.othercm_val != "0" && data.otherprot_active === "1") ? "Cunning other, " : "");
additionalStr = additionalStr.slice(0,-2);
clog(`First roll: ${JSON.stringify(data)}, Action : ${action}, protection value: ${actdice}, Additional: ${additionalStr}, Favoured: ${actfav}`);
await rollFirst(data.character_name, action, actdice, "0", actfav, "protection", `additional='${additionalStr}';`, lm);
let closefit =
int(data.armourprot_active) * int(data.armourcf_val)
+ int(data.helmprot_active) * int(data.helmetcf_val)
+ int(data.otherprot_active) * int(data.othercf_val);
clog(`First roll: ${JSON.stringify(data)}, Action : ${action}, Protection value: ${actdice}, Closefit: ${closefit}, Additional: ${additionalStr}, Favoured: ${actfav}`);
await rollFirst(data.character_name, action, actdice, "0", actfav, "protection", `additional='${additionalStr}';closefit='${closefit}';`, lm);
clog(`Completed first roll`);
});
@@ -2132,7 +2280,11 @@
let options = stripaction((ev.triggerName).slice(18)).split("_"),
index = options[0],
target = options[1] || "",
data = await asw.getAttrs(['character_name', `weapon_skill_name_${index}`,`weapon_rating_${index}`, `weapon_damage_${index}`, `weapon_injury_${index}`, 'favorill', 'favourill_id']),
data = await asw.getAttrs([
'character_name', `weapon_skill_name_${index}`,
`weapon_rating_${index}`, `weapon_damage_${index}`,
`weapon_injury_${index}`, 'favorill', 'favourill_id']
),
action = data[`weapon_skill_name_${index}`],
actdice = data[`weapon_rating_${index}`],
damage = data[`weapon_damage_${index}`],
@@ -2180,7 +2332,9 @@
clog(`Starting first roll: weapon_${index}, target: ${target}`);
let data = await asw.getAttrs([
'character_name', 'strengthtn', `weapon_skill_name_${index}`, `weapon_combat_prof_${index}`, `weapon_damage_${index}`,
`weapon_injury_${index}`, `weapon_note_${index}`, `weapon_fell_${index}`, `weapon_grievous_${index}`, `weapon_keen_${index}`,
`weapon_injury_${index}`, `weapon_note_${index}`,
`weapon_fell_${index}`, `weapon_grievous_${index}`, `weapon_keen_${index}`,
`weapon_fell_val_${index}`, `weapon_grievous_val_${index}`, `weapon_keen_val_${index}`,
'stanceattack_active', 'stanceattackbonus', 'stancedamagebonus',
'axes', 'bows', 'spears', 'swords']),
action = data[`weapon_skill_name_${index}`],
@@ -2188,16 +2342,20 @@
damage = data[`weapon_damage_${index}`],
injury = data[`weapon_injury_${index}`],
note = data[`weapon_note_${index}`],
keen = int(data[`weapon_keen_${index}`],0) === 0 ? "" : "Keen, ",
fell = int(data[`weapon_fell_${index}`],0) === 0 ? "" : "Fell, ",
grievous = int(data[`weapon_grievous_${index}`],0) === 0 ? "" : "Grievous, ",
fell_val = int(data[`weapon_fell_val_${index}`],0),
grievous_val = int(data[`weapon_grievous_val_${index}`],0),
keen_val = int(data[`weapon_keen_val_${index}`],0),
fell = fell_val === 0 ? "" : "Fell, ",
grievous = grievous_val === 0 ? "" : "Grievous, ",
keen = keen_val === 10 ? "" : "Keen, ",
actdice = int(data[`${combatprof}`]),
stanceattack_active = int(data['stanceattack_active']),
stanceattackbonus = int(data['stanceattackbonus']),
stancedamagebonus = int(data['stancedamagebonus']);
damage = (stanceattack_active == 1) ? `${damage} + ${stancedamagebonus}` : damage;
clog(`First roll: ${JSON.stringify(data)}, Action: ${action}, Dice: ${actdice}, Keen: ${keen}, tn: ${data.strengthtn}`);
await rollFirst(data.character_name, action, actdice, data.strengthtn, 0, "combat"+target, `weapon='${keen}${fell}${grievous}Damage: ${damage}, Injury: ${injury}'; additional='Notes: ${note}';`);
damage = (stanceattack_active == 1 || grievous_val > 0) ? `${damage}+${stancedamagebonus + grievous_val}` : damage;
injury = (fell_val > 0) ? `${injury}+${fell_val}` : injury;
clog(`First roll: ${JSON.stringify(data)}, Action: ${action}, Dice: ${actdice}, tn: ${data.strengthtn}`);
await rollFirst(data.character_name, action, actdice, data.strengthtn, 0, "combat"+target, `weapon='${keen}${fell}${grievous}Damage:${damage}, Injury:${injury}'; additional='Notes: ${note}';keen='${keen_val}';`, false);
clog(`Completed first roll: weapon_${index}`);
});
@@ -2269,6 +2427,109 @@
});
}
}
if (build < 15) {
attrs["build"] = 15;
let releaselog = {msg:""};
hlog(`Migration 02.12.00 - ${new Date().toLocaleString()}`, releaselog);
if (v.sheettab === "isPC"){
getAttrs([
'weapon_skill_name_1', 'weapon_skill_name_2', 'weapon_skill_name_3', 'weapon_skill_name_4', 'weapon_skill_name_5', 'weapon_skill_name_6',
'weapon_damage_1', 'weapon_damage_2', 'weapon_damage_3', 'weapon_damage_4', 'weapon_damage_5', 'weapon_damage_6',
'weapon_injury_1', 'weapon_injury_2', 'weapon_injury_3', 'weapon_injury_4', 'weapon_injury_5', 'weapon_injury_6',
'weapon_fell_1', 'weapon_fell_2', 'weapon_fell_3', 'weapon_fell_4', 'weapon_fell_5', 'weapon_fell_6',
'weapon_grievous_1', 'weapon_grievous_2','weapon_grievous_3','weapon_grievous_4','weapon_grievous_5','weapon_grievous_6',
'weapon_keen_1', 'weapon_keen_2','weapon_keen_3','weapon_keen_4','weapon_keen_5','weapon_keen_6',
'weapon_fell_val_1', 'weapon_fell_val_2','weapon_fell_val_3','weapon_fell_val_4','weapon_fell_val_5','weapon_fell_val_6',
'weapon_grievous_val_1', 'weapon_grievous_val_2', 'weapon_grievous_val_3', 'weapon_grievous_val_4', 'weapon_grievous_val_5', 'weapon_grievous_val_6',
'weapon_keen_val_1', 'weapon_keen_val_2','weapon_keen_val_3','weapon_keen_val_4','weapon_keen_val_5','weapon_keen_val_6',
'armourcf', 'armourcm', 'helmetcf', 'helmetcm', 'othercf', 'othercm', 'shieldreinf', 'shieldcm',
'armourload', 'helmload', 'otherload', 'shieldload', 'shieldparry',
'releaselog',
], function(values){
for (let index of range(1,6)){
if (values[`weapon_skill_name_${index}`] != ""){
hlog(`Migration of Weapon ${index}:`, releaselog);
// fell migration if checked on the old sheet we set grievous +2 and injury -2
let fell_check = values[`weapon_fell_${index}`];
let fell_val = ["on", "1"].includes(fell_check) ? 2 : 0;
if (fell_val == 2){
attrs[`weapon_fell_val_${index}`] = fell_val;
hlog(`'Fell' property: changing old checkbox value: ${fell_check} into new combox value: ${fell_val}`, releaselog);
let injury_old = int(values[`weapon_injury_${index}`]);
let injury_new = (injury_old -2);
attrs[`weapon_injury_${index}`] = injury_new;
hlog(`'Injury' property: changing old value: ${injury_old} into new value: ${injury_new} - the bonus is now expressed by 'Fell' property!`, releaselog);
}
// grievous migration if checked on the old sheet we set grievous +1 and damage -1
let grievous_check = values[`weapon_grievous_${index}`];
let grievous_val = ["on", "1"].includes(grievous_check) ? 1 : 0;
if (grievous_val == 1) {
attrs[`weapon_grievous_val_${index}`] = grievous_val;
hlog(`'Grievous' property: changing old checkbox value: ${grievous_check} into new combox value: ${grievous_val}`, releaselog);
let damage_old = int(values[`weapon_damage_${index}`]);
let damage_new = (damage_old -1);
attrs[`weapon_damage_${index}`] = damage_new;
hlog(`'Damage' property: changing old value: ${damage_old} into new value: ${damage_new} - the bonus is now expressed by 'Grievous' property!`, releaselog);
}
// keen migration: if checked on the old sheet we set it to 9+
let keen_check = values[`weapon_keen_${index}`];
let keen_val = ["on", "1"].includes(keen_check) ? 9 : 10;
if (keen_val == 9) {
hlog(`'Keen' property: changing old checkbox value: ${keen_check} into new combox value: ${keen_val}. The roll template will automatically note this to calculate a Piercing Blow.`, releaselog);
attrs[`weapon_keen_val_${index}`] = keen_val;
}
}
}
hlog(`Migration of Armour:`, releaselog);
// close fitting armour -> protection bonus +2
let cfs = ['armourcf', 'helmetcf', 'othercf'];
cfs.forEach(cf => {
let cf_check = values[`${cf}`];
let cf_val = ["on", "1"].includes(cf_check) ? 2 : 0;
if (cf_val == 2) {
hlog(`'${cf}' property: changing old checkbox value: ${cf_check} into new combox value: ${cf_val}. You can see the bonus as part of the d6 dice of the Protection roll!`, releaselog);
attrs[`${cf}_val`] = cf_val;
}
});
// cunning make armour -> load reduction -2
let cms = ['armourcm', 'helmetcm', 'othercm', 'shieldcm'];
cms.forEach(cm => {
let cm_prefix = cm.slice(0,-2);
cm_prefix = cm_prefix == "helmet" ? "helm" : cm_prefix; // handle naming inconsistency helm/helmet
let cm_check = values[`${cm}`];
let cm_val = ["on", "1"].includes(cm_check) ? -2 : 0;
if (cm_val == -2) {
hlog(`'${cm}' property: changing old checkbox value: ${cm_check} into new combox value: ${cm_val}. You can see the Load reduction as part of the 'Total Load' if equipped!`, releaselog);
attrs[`${cm}_val`] = cm_val;
let load_old = int(values[`${cm_prefix}load`]);
let load_new = (load_old +2);
attrs[`${cm_prefix}load`] = load_new;
hlog(`'${cm_prefix} Load' property: changing old value: ${load_old} into new value: ${load_new} - the Load bonus is now expressed by 'Cunning Make' property!`, releaselog);
}
});
// reinforced shield -> parry bonus +1
let ri_check = values["shieldreinf"];
let ri_val = ["on", "1"].includes(ri_check) ? 1 : 0;
if (ri_val == 1) {
hlog(`'Reinforced Shield' property: changing old checkbox value: ${ri_check} into new combox value: ${ri_val}. You can see the bonus as part of the 'Total Parry' if equipped!`, releaselog);
attrs[`shieldreinf_val`] = ri_val;
let parry_old = int(values['shieldparry']);
let parry_new = (parry_old -1);
attrs['shieldparry'] = parry_new;
hlog(`'Shield Parry' property: changing old value: ${parry_old} into new value: ${parry_new} - the Shield Parry bonus is now expressed by 'Reinforced' shield property!`, releaselog);
}
hlog("Migration end!", releaselog);
hlog("==============", releaselog);
attrs['releaselog'] = releaselog.msg + values['releaselog'];
if (Object.keys(attrs).length) {
setAttrs(attrs);
}
});
}
}
/*
if (build === 9) {
attrs["build"] = 8;
+11 -11
View File
@@ -13,9 +13,9 @@
"resolve": "Resolve",
"parry-and-shield": "Parry &amp; Shield",
"armour": "Armour",
"helm": "Helm",
"helm": "Helmet",
"armour-placeholder": "[Armour]",
"helm-placeholder": "[Helm]",
"helm-placeholder": "[Helmet]",
"skills": "Skills",
"custom": "Custom",
"perception": "Perception",
@@ -27,11 +27,11 @@
"weapon-load": "Load",
"weapon-injury": "Inj.",
"weapon-fell": "F",
"weapon-fell-description": "Fell: Add 2 to the Injury rating of the selected weapon",
"weapon-grievieous": "G",
"weapon-grievieous-description": "Grievious: Add 1 to the damage rating of the weapon",
"weapon-fell-description": "Fell: Injury +2 (superior weapons: +4)",
"weapon-grievous": "G",
"weapon-grievous-description": "Grievous: Damage +1 (superior weapons: +2)",
"weapon-keen": "K",
"weapon-keen-description": "Keen: Attack rolls made with a Keen weapon score a Piercing Blow also on a result of 9 on the Feat die",
"weapon-keen-description": "Keen: Piercing Blow if Feat die 9+ (superior weapons: 8+) or Gandalf Rune",
"weapon-called-shot": "Called Shot",
"special-abilities": "Special Abilities",
"hope": "Hope",
@@ -200,13 +200,13 @@
"bows-description": "The BOWS Combat Proficiency enables a Player-hero to make ranged attacks using a bow or a great bow.",
"spears-description": "The SPEARS Combat Proficiency allows a hero to make and close combat attacks using a short spear or a spear, or to fight in close combat using a great spear.",
"swords-description": "The SWORDS Combat Proficiency enables a Player-hero to attack in close combat using short swords, swords, and long swords.",
"other-placeholder": "Other",
"other-placeholder": "[Other]",
"close-fitting": "CF",
"close-fitting-description": "Close Fitting: When you make a parsed PROTECTION roll while wearing a close-­fitting armour or helm you add +2 to the result",
"close-fitting-description": "Close Fitting: Protection +2 (Ancient armour: +3)",
"cunning-make": "CM",
"cunning-make-description": "Cunning make: reduce the Load rating of the item by 2 (to a minimum of 0 Load)",
"cunning-make-description": "Cunning make: Load -2 (Ancient armour: -3)",
"reinforced": "RI",
"reinforced-description": "Reinforced: add 1 to your shield’s Parry bonus.",
"reinforced-description": "Reinforced: Parry +1 (Superior shield: +2)",
"stance-attack-modifier": "Attack Mod.",
"stance-attack-modifier-description": "Depending on stance the attack modifier will be forward:1/open:0/defensive:-1/rearward:0. This attack modifier is the default value for attack bonus dice. If a character is in defensive stance fighting against more then one adversary player can use the bonus dice query to set this to -2/-3 according to the number of adversaries. ",
"conditions-modifiers": "Conditions / Modifiers",
@@ -224,5 +224,5 @@
"custom-tn": "TN:",
"custom-successdice": "Success:",
"custom-featdie": "Feat:",
"custom-rollname-placeholder": "Roll Text"
"custom-rollname-placeholder": "[Roll Text]"
}