Merge pull request #10348 from Darth-John/BESM4eExtras_Dev
[BESM4eExtras] v1.6.2
This commit is contained in:
+179
-130
@@ -30,7 +30,7 @@
|
||||
<div class="row padt padb"><h3 class="col-1 center border"><span>Sheet Options</span></h3></div>
|
||||
<div class="row center padb">
|
||||
<div class="col-1-5 padr"><h4 class="center border"><span>Sheet Version
|
||||
<input type="text" class="center" name="attr_version" value="1.6.1" readonly />
|
||||
<input type="text" class="center" name="attr_version" value="1.6.2" readonly />
|
||||
<input type="hidden" name="attr_global_version" value="0.0.0" readonly />
|
||||
</span></h4></div>
|
||||
<div class="col-1-5 padr"><h4 class="center border"><span>Sheet Type
|
||||
@@ -938,7 +938,7 @@
|
||||
<div class="flex-container-evenlyspace">
|
||||
<div class="flex-1-8"><input class="center border" type="text" name="attr_dynamic_roll_base" value="0" readonly /></div>
|
||||
<div class="flex-7-10"><select class="border" name="attr_static_roll_type_selection"><option value="2d6">2d6</option><option value="acv">ACV</option><option value="dcv">DCV</option><option value="initiative">Initiative</option><option value="perception">Perception</option><option value="stat">Stat</option></select></div>
|
||||
<div class="flex-1-24"><button class="button d6button" type="roll" name="roll_dynamicrolls" value="@{dynamic_roll_value}"></button><input type="hidden" name="attr_dynamic_roll_value" value="" readonly /></div>
|
||||
<div class="flex-1-24"><button class="button d6button" type="roll" name="roll_dynamicrolls" value="@{dynamic_roll_value}"></button><input type="hidden" name="attr_dynamic_roll_value" value="&{template:besmDefault} {{rolls=1}} {{character_name=@{charactername}}} {{pronoun=@{pronoun}}} {{twodsix=1}} {{title=Roll 2d6}} {{total=[[[[?{Roll is|Normal, 2d6|Minor Edge, 3d6kh2|Minor Obstacle, 3d6kl2|Major Edge, 4d6kh2|Major Obstacle, 4d6kl2}]]+[[0]] ]]}} {{roll=$[[0]]}}" readonly /></div>
|
||||
</div>
|
||||
</span></h4>
|
||||
</div>
|
||||
@@ -3181,6 +3181,52 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" class="block-switch" name="attr_showmeleeclass" value="1" />
|
||||
<div class="block-a"></div>
|
||||
<div class="block-b">
|
||||
<div class="col-1 padr">
|
||||
<h4 class="center border">
|
||||
<span>Weapon Class</span>
|
||||
<select name="attr_weaponclass">
|
||||
<option value=""></option>
|
||||
<option disabled style="background:gray;font-weight:bold;color:white;">Melee</option>
|
||||
<option value="exotic">Exotic</option>
|
||||
<option value="hafted">Hafted</option>
|
||||
<option value="hilted">Hilted</option>
|
||||
<option value="polearm">Polearm</option>
|
||||
<option value="shield">Shield</option>
|
||||
<option value="unarmed">Unarmed</option>
|
||||
</select>
|
||||
</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" class="block-switch" name="attr_showrangedclass" value="1" />
|
||||
<div class="block-a"></div>
|
||||
<div class="block-b">
|
||||
<div class="col-1 padr">
|
||||
<h4 class="center border">
|
||||
<span>Weapon Class</span>
|
||||
<select name="attr_weaponclass">
|
||||
<option value=""></option>
|
||||
<option disabled style="background:gray;font-weight:bold;color:white;">Ranged</option>
|
||||
<option value="archery">Archery</option>
|
||||
<option value="artillery">Artillery</option>
|
||||
<option value="handgun">Hand Gun</option>
|
||||
<option value="heavyweapon">Heavy Weapon</option>
|
||||
<option value="longgun">Long Gun</option>
|
||||
<option value="special">Special</option>
|
||||
<option value="thrownweapon">Thrown Weapon</option>
|
||||
<option value="weaponry">Weaponry</option>
|
||||
</select>
|
||||
</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" class="block-switch" name="attr_showdefenseclass" value="1" />
|
||||
<div class="block-a"></div>
|
||||
@@ -8108,7 +8154,7 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
function setStatCost(debug, timer, eventInfo, setObj, sourceAttr) {
|
||||
function setStatCost(debug, timer, eventInfo, value, setObj, sourceAttr) {
|
||||
const newValue = parseInt(eventInfo.newValue) || 0;
|
||||
const previousValue = parseInt(eventInfo.previousValue) || 0;
|
||||
const diffValue = newValue - previousValue;
|
||||
@@ -8121,7 +8167,8 @@
|
||||
(((newValue - 12) * 8) + 48) - (previousValue * 4) :
|
||||
newValue <= 12 && previousValue > 12 ?
|
||||
(newValue * 4) - (((previousValue - 12) * 8) + 48) : 0;
|
||||
setObj[`stat_cost_${sourceAttr}`] = statCost;
|
||||
//setObj[`stat_cost_${sourceAttr}`] = statCost;
|
||||
writeValues(debug, timer, value, `stat_cost_${sourceAttr}`, statCost, setObj);
|
||||
clog(debug, timer, 'statCost =', statCost, 'setStatCost()');
|
||||
}
|
||||
|
||||
@@ -8721,7 +8768,7 @@
|
||||
//setObj[`stat_total_${stat}`] = result;
|
||||
writeValues(debug, timer, value, `stat_total_${stat}`, result, setObj);
|
||||
clog(debug, timer, 'result =', result, 'setAllAspectStats()');
|
||||
setStatCost(debug, timer, eventInfo, setObj, stat);
|
||||
setStatCost(debug, timer, eventInfo, value, setObj, stat);
|
||||
setStatAspectLevels(debug, timer, attrdb, value, stat, result, setObj)
|
||||
}
|
||||
|
||||
@@ -8741,7 +8788,8 @@
|
||||
})
|
||||
.value();
|
||||
_.each(minorstats, (minorstat, i) => {
|
||||
setObj[`stat_total_${minorstat}`] = result[i];
|
||||
//setObj[`stat_total_${minorstat}`] = result[i];
|
||||
writeValues(debug, timer, value, `stat_total_${minorstat}`, result[i], setObj);
|
||||
});
|
||||
clog(debug, timer, 'result:', result, 'setStatAspectLevels()');
|
||||
}
|
||||
@@ -8894,22 +8942,24 @@
|
||||
derivedvalue == 'social' ?
|
||||
Math.round((bodyormind + soul) / 2) + bonus + temp :
|
||||
0;
|
||||
setObj[`stat_total_${derivedvalue}`] = result;
|
||||
//setObj[`stat_total_${derivedvalue}`] = result;
|
||||
writeValues(debug, timer, value, `stat_total_${derivedvalue}`, result, setObj);
|
||||
clog(debug, timer, derivedvalue, result, 'setDerivedValue()');
|
||||
}
|
||||
|
||||
function setTotalShock(debug, timer, attrdb, setObj, sourceAttr) {
|
||||
function setTotalShock(debug, timer, value, attrdb, setObj) {
|
||||
const health =
|
||||
parseInt(setObj.stat_total_health) ||
|
||||
parseInt(value.stat_total_health) || 0;
|
||||
const hardboiled =
|
||||
getSumOfActiveSubAttrRanks(attrdb, 'combattechnique', 'hardboiled') || 0;
|
||||
const result = Math.round(health / 5) + hardboiled;
|
||||
setObj.stat_total_shock = result;
|
||||
//setObj.stat_total_shock = result;
|
||||
writeValues(debug, timer, value, 'stat_total_shock', result, setObj);
|
||||
clog(debug, timer, 'result =', result, 'setTotalShock()');
|
||||
}
|
||||
|
||||
function setTotalMovement(debug, timer, value, attrdb, setObj, sourceAttr) {
|
||||
function setTotalMovement(debug, timer, value, attrdb, setObj) {
|
||||
const body =
|
||||
parseInt(setObj.stat_total_body) ||
|
||||
parseInt(value.stat_total_body) || 0;
|
||||
@@ -10900,6 +10950,8 @@
|
||||
'showenemy',
|
||||
'showextraarms',
|
||||
'showimmunityrole',
|
||||
'showmeleeclass',
|
||||
'showrangedclass',
|
||||
'showseeinto',
|
||||
'showskillgroup',
|
||||
'showsupersense',
|
||||
@@ -10909,44 +10961,43 @@
|
||||
'showweaponclass'
|
||||
];
|
||||
const settingsObj = {
|
||||
'showcollectiontype':'absorption',
|
||||
'showarmorlayer':'armor',
|
||||
'showaugmentedstat':'augmented',
|
||||
'showcapacitytype':'capacity',
|
||||
'showseeinto':'cognition',
|
||||
'showconversiontype':'conversion',
|
||||
'showdefect':'defect',
|
||||
'showvariablestat':'dynamicpowers',
|
||||
'showenemy':'enemyattack',
|
||||
'showenemy':'enemydefense',
|
||||
'showextraarms':'extraarms',
|
||||
'showvariablestat':'features',
|
||||
'showimmunityrole':'immunity',
|
||||
'showvariablestat':'immutable',
|
||||
'showvariablestat':'immutable',
|
||||
'showweaponclass':'meleeattack',
|
||||
'showweaponclass':'meleedefense',
|
||||
'showvariablestat':'metamorphosis',
|
||||
'showattrsrc':'mimic',
|
||||
'showattrsrc':'nullify',
|
||||
'showvariablestat':'nullify',
|
||||
'showvariablestat':'powerflux',
|
||||
'showvariablestat':'powervariation',
|
||||
'showdefenseclass':'rangeddefense',
|
||||
'showcollectiontype':'regeneration',
|
||||
'showskillgroup':'skill',
|
||||
'showsupersense':'supersense',
|
||||
'showvariablestat':'transmute',
|
||||
'showunaffected':'unaffected',
|
||||
'showattrsrc':'unaffected',
|
||||
'showdamagetype':'weapon',
|
||||
'showweaponclass':'weapon'
|
||||
'absorption':['showcollectiontype'],
|
||||
'armor':['showarmorlayer'],
|
||||
'augmented':['showaugmentedstat'],
|
||||
'capacity':['showcapacitytype'],
|
||||
'cognition':['showseeinto'],
|
||||
'conversion':['showconversiontype'],
|
||||
'defect':['showdefect'],
|
||||
'dynamicpowers':['showvariablestat'],
|
||||
'enemyattack':['showenemy'],
|
||||
'enemydefense':['showenemy'],
|
||||
'extraarms':['showextraarms'],
|
||||
'features':['showvariablestat'],
|
||||
'immunity':['showimmunityrole'],
|
||||
'immutable':['showvariablestat'],
|
||||
'meleeattack':['showmeleeclass'],
|
||||
'meleedefense':['showmeleeclass'],
|
||||
'metamorphosis':['showvariablestat'],
|
||||
'mimic':['showattrsrc'],
|
||||
'nullify':['showattrsrc','showvariablestat'],
|
||||
'powerflux':['showvariablestat'],
|
||||
'powervariation':['showvariablestat'],
|
||||
'rangedattack':['showrangedclass'],
|
||||
'rangeddefense':['showdefenseclass'],
|
||||
'regeneration':['showcollectiontype'],
|
||||
'skill':['showskillgroup'],
|
||||
'supersense':['showsupersense'],
|
||||
'transmute':['showvariablestat'],
|
||||
'unaffected':['showunaffected','showattrsrc'],
|
||||
'weapon':['showdamagetype','showweaponclass']
|
||||
};
|
||||
const result = _.map(settings, setting => {
|
||||
const set = settingsObj[setting] === attribute ? 1 : 0;
|
||||
setObj[`${source}_${setting}`] = set;
|
||||
return `${setting} = ${set}`;
|
||||
});
|
||||
const settings_array = settingsObj[attribute] || [];
|
||||
const result =
|
||||
_.map(settings, setting => {
|
||||
const set = settings_array.indexOf(setting) !== -1 ? 1 : 0;
|
||||
setObj[`${source}_${setting}`] = set;
|
||||
return `${setting} = ${set}`;
|
||||
});
|
||||
clog(debug, timer, 'result:', result,'exposeAttrSettingsOnAttributeChange()');
|
||||
}
|
||||
|
||||
@@ -11075,39 +11126,29 @@
|
||||
setObj[`protection_${attr}${layer}${type}_ar`] = rating;
|
||||
}
|
||||
|
||||
function setAugmented(isActive, debug, timer, value, rowID, setObj) {
|
||||
const stat = value[`repeating_attr_${rowID}_augmentedstat`] || "";
|
||||
const level = parseInt(value[`repeating_attr_${rowID}_effectivelevel`]) || 0;
|
||||
function setAugmented(isActive, debug, timer, value, attrdb, rowID, setObj) {
|
||||
const stat = value[`repeating_attr_${rowID}_augmentedstat`] || ""; //body, mind, soul
|
||||
const base = parseInt(value[`static_stat_base_${stat}`]) || 0;
|
||||
let adj = parseInt(value[`stat_adj_${stat}`]) || 0;
|
||||
let total = 0;
|
||||
adj = (isActive) ? adj + level : adj - level;
|
||||
total = base + adj;
|
||||
setObj[`stat_adj_${stat}`] = adj;
|
||||
setObj[`stat_total_${stat}`] = total;
|
||||
const augmented = _.chain(attrdb.augmented)
|
||||
.map( a => {
|
||||
const augStat =
|
||||
a.focus === stat && a.rowID === rowID && isActive ?
|
||||
a.level :
|
||||
a.focus === stat && a.rowID !== rowID ?
|
||||
a.level :
|
||||
0;
|
||||
return augStat;
|
||||
})
|
||||
.reduce((memo, num) => { return memo + num; }, 0)
|
||||
.value();
|
||||
const result = base + augmented;
|
||||
writeValues(debug, timer, value, `stat_total_${stat}`, result, setObj);
|
||||
clog(debug, timer, 'stat =', stat, 'setAugmented()');
|
||||
clog(debug, timer, 'level = ', level);
|
||||
clog(debug, timer, 'base = ', base);
|
||||
clog(debug, timer, 'adj = ', adj);
|
||||
clog(debug, timer, 'total = ', total);
|
||||
clog(debug, timer, 'augmented = ', augmented);
|
||||
clog(debug, timer, 'result = ', result);
|
||||
}
|
||||
/*
|
||||
function setEnergized(isActive, debug, value, rowID, sourceAttr, setObj) {
|
||||
const level = parseInt(value[`repeating_attr_${rowID}_effectivelevel`]) * 10 || 0,
|
||||
mind = parseInt(value[`static_stat_base_mind`]) || 0,
|
||||
soul = parseInt(value[`static_stat_base_soul`]) || 0,
|
||||
prevAdj = parseInt(value[`stat_adj_energy`]) || 0,
|
||||
newAdj = (isActive) ? prevAdj + level : prevAdj - level,
|
||||
energy = ((mind + soul) * 5) + newAdj;
|
||||
setObj.stat_total_energy = energy;
|
||||
setObj.stat_adj_energy = newAdj;
|
||||
if (debug) {
|
||||
console.log(`[setEnergized(${sourceAttr})] prevAdj = ${prevAdj}`);
|
||||
console.log(`[setEnergized(${sourceAttr})] newAdj = ${newAdj}`);
|
||||
console.log(`[setEnergized(${sourceAttr})] energy = ${energy}`);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
function setExtraArms(isActive, debug, timer, extraarmIDs, value, rowID, sourceAttr, setObj, isTelekinesis = false) {
|
||||
const extraarms = isTelekinesis ? 2 :
|
||||
parseInt(value[`repeating_attr_${rowID}_extraarms`]) || 0;
|
||||
@@ -11157,21 +11198,7 @@
|
||||
clog(debug, timer, 'extraarms =', extraarms, 'setExtraArms()]');
|
||||
clog(debug, timer, 'label = ', label);
|
||||
}
|
||||
/*
|
||||
function getPerception(debug, value, sourceAttr, setObj) {
|
||||
const mind = parseInt(setObj.static_stat_base_mind) || parseInt(value.static_stat_base_mind) || 0,
|
||||
augmented = parseInt(setObj.stat_adj_mind) || parseInt(value.stat_adj_mind) || 0,
|
||||
shortcoming = parseInt(setObj.stat_adj_per) || parseInt(value.stat_adj_per) || 0,
|
||||
result = mind + augmented + shortcoming;
|
||||
if (debug) {
|
||||
console.log(`[getPerception(${sourceAttr}) mind = ${mind}]`);
|
||||
console.log(`[getPerception(${sourceAttr}) augmented = ${augmented}]`);
|
||||
console.log(`[getPerception(${sourceAttr}) shortcoming = ${shortcoming}]`);
|
||||
console.log(`[getPerception(${sourceAttr}) result = ${result}]`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
*/
|
||||
|
||||
function getPerceptionRollBase(debug, timer, value, attrdb, setObj) {
|
||||
const perception = parseInt(setObj.stat_total_per) ||
|
||||
parseInt(value.stat_total_per) || 0;
|
||||
@@ -11961,7 +11988,7 @@
|
||||
clog(debug, timer, 'rollstring =', rollstring);
|
||||
}
|
||||
|
||||
function setAttrEffects(debug, timer, isActive, value, attrdb, extraarmIDs, attrIDs, sectionName, rowID, sourceAttr, setObj) {
|
||||
function setAttrEffects(debug, timer, isActive, value, attrdb, extraarmIDs, attrIDs, skillIDs, sectionName, rowID, sourceAttr, setObj) {
|
||||
const attribute = removeWhiteSpace(value[`repeating_attr_${rowID}_attribute`]);
|
||||
const level = parseInt(value[`repeating_attr_${rowID}_effectivelevel`]);
|
||||
switch (attribute) {
|
||||
@@ -11974,11 +12001,13 @@
|
||||
case "attackmastery":
|
||||
case "defensemastery":
|
||||
setAttrdb(isActive, debug, timer, value, attrdb, attrIDs, rowID, sourceAttr, attribute, setObj);
|
||||
setDynamicRollValue(debug, timer, {}, value, attrdb, rowID, sourceAttr, setObj);
|
||||
setActiveAttribute(isActive, debug, timer, value, rowID, attrdb, setObj, attribute, level);
|
||||
break;
|
||||
case "augmented":
|
||||
setAttrdb(isActive, debug, timer, value, attrdb, attrIDs, rowID, sourceAttr, attribute, setObj);
|
||||
setAugmented(isActive, debug, timer, value, rowID, setObj);
|
||||
setAugmented(isActive, debug, timer, value, attrdb, rowID, setObj);
|
||||
updateSkillRolls(debug, timer, value, skillIDs, sourceAttr, setObj);
|
||||
setActiveAttribute(isActive, debug, timer, value, rowID, attrdb, setObj, attribute, level);
|
||||
break;
|
||||
case "combattechnique":
|
||||
@@ -12056,7 +12085,7 @@
|
||||
break;
|
||||
case "specialmovement":
|
||||
setAttrdb(isActive, debug, timer, value, attrdb, attrIDs, rowID, sourceAttr, attribute, setObj);
|
||||
setTotalMovement(debug, timer, value, attrdb, setObj, sourceAttr);
|
||||
setTotalMovement(debug, timer, value, attrdb, setObj);
|
||||
setActiveAttribute(isActive, debug, timer, value, rowID, attrdb, setObj, attribute, level);
|
||||
break;
|
||||
case "socialmastery":
|
||||
@@ -12602,27 +12631,22 @@
|
||||
}
|
||||
|
||||
function getAmmoMax(debug, timer, rank) {
|
||||
const result = rank == 4 ? 0 : 6 / rank;
|
||||
const result =
|
||||
rank == 4 ? 0 :
|
||||
rank == 3 ? 1 :
|
||||
6 / rank;
|
||||
clog(debug, timer, 'result =', result, 'getAmmoMax()');
|
||||
return result;
|
||||
}
|
||||
|
||||
function setWeaponReload(debug, timer, attrdb, value, setObj) {
|
||||
const rowID = value.active_weapon;
|
||||
//const weapon = _.find(attrdb.weapon, w => {
|
||||
// if (w.source == rowID) return true;
|
||||
//});
|
||||
//const customization = _.find(weapon.customizations, c => {
|
||||
// if (c.name == 'ammo') return true;
|
||||
//});
|
||||
//const ammo = getAmmoMax(debug, timer, customization.rank);
|
||||
const capacity = parseInt(value[`repeating_attr_${rowID}_capacity`]);
|
||||
let ammostate = parseInt(value.weapon_ammo_reloads);
|
||||
let capacitystate = parseInt(value.weapon_ammo_capacity);
|
||||
const reloadammo = ammo => ammo > 0 ? ammostate -= 1 : ammostate;
|
||||
const reloadcapacity = ammo => ammo > 0 ? capacitystate = capacity : capacitystate;
|
||||
setObj.weapon_ammo_reloads = reloadammo(ammostate);
|
||||
setObj.weapon_ammo_capacity = reloadcapacity(ammostate);
|
||||
const reloadcapacity = ammostate > 0 ? capacity : 0;
|
||||
const reloadammo = ammostate > 0 ? ammostate -= 1 : 0;
|
||||
writeValues(debug, timer, value, 'weapon_ammo_reloads', reloadammo, setObj);
|
||||
writeValues(debug, timer, value, 'weapon_ammo_capacity', reloadcapacity, setObj);
|
||||
clog(debug, timer, 'reloads =', setObj.weapon_ammo_reloads, 'setWeaponReload()');
|
||||
clog(debug, timer, 'capacity =', setObj.weapon_ammo_capacity);
|
||||
}
|
||||
@@ -12647,15 +12671,15 @@
|
||||
const capacity = isNaN(parseInt(value[`repeating_attr_${rowID}_capacitystate`])) ?
|
||||
0 :
|
||||
parseInt(value[`repeating_attr_${rowID}_capacitystate`]);
|
||||
setObj.weapon_ammo_reloads = ammo;
|
||||
setObj.weapon_ammo_capacity = capacity;
|
||||
writeValues(debug, timer, value, 'weapon_ammo_reloads', ammo, setObj);
|
||||
writeValues(debug, timer, value, 'weapon_ammo_capacity', capacity, setObj);
|
||||
clog(debug, timer, 'ammo =', ammo, 'setWeaponAmmo()');
|
||||
clog(debug, timer, 'capacity =', capacity);
|
||||
} else {//weapon unarmed, save ammo state
|
||||
const ammostate = parseInt(value.weapon_ammo_reloads);
|
||||
const capacitystate = parseInt(value.weapon_ammo_capacity);
|
||||
setObj[`repeating_attr_${rowID}_ammostate`] = ammostate;
|
||||
setObj[`repeating_attr_${rowID}_capacitystate`] = capacitystate;
|
||||
writeValues(debug, timer, value, `repeating_attr_${rowID}_ammostate`, ammostate, setObj);
|
||||
writeValues(debug, timer, value, `repeating_attr_${rowID}_capacitystate`, capacitystate, setObj);
|
||||
clog(debug, timer, 'ammostate =', ammostate, 'setWeaponAmmo()');
|
||||
clog(debug, timer, 'capacitystate =', capacitystate);
|
||||
}
|
||||
@@ -13514,20 +13538,28 @@
|
||||
});
|
||||
}
|
||||
|
||||
function recordAmmoState(debug, timer, value, setObj) {
|
||||
writeValues(debug, timer, value, `repeating_attr_${value.active_weapon}_ammostate`, value.weapon_ammo_reloads, setObj);
|
||||
writeValues(debug, timer, value, `repeating_attr_${value.active_weapon}_capacitystate`, value.weapon_ammo_capacity, setObj);
|
||||
}
|
||||
|
||||
function disableActiveWeapon(debug, timer, value, rowID, setObj) {
|
||||
const attribute = value[`repeating_attr_${rowID}_attribute`];
|
||||
if (attribute !== 'weapon') return;
|
||||
const activeweapon = value.active_weapon;
|
||||
recordAmmoState(debug, timer, value, setObj);
|
||||
setObj.weapon_range = 0;
|
||||
setObj.weapon_ammo_autofire = 0;
|
||||
setObj.weapon_ammo = 0;
|
||||
setObj.weapon_autofire = 0;
|
||||
const state = parseInt(setObj[`repeating_attr_${rowID}_activate`]) ||
|
||||
parseInt(value[`repeating_attr_${rowID}_activate`]);
|
||||
const activeweapon = value.active_weapon;
|
||||
clog(debug, timer, 'state =', state, 'disableActiveWeapon()');
|
||||
clog(debug, timer, 'activeweapon =', activeweapon);
|
||||
if (!state) return;
|
||||
if (activeweapon == rowID) {
|
||||
setObj.active_weapon = '';
|
||||
}
|
||||
clog(debug, timer, 'state =', state, 'disableActiveWeapon()');
|
||||
clog(debug, timer, 'activeweapon =', activeweapon);
|
||||
}
|
||||
|
||||
function setButtonState(debug, timer, value, source, rowID, sourceAttr, setObj) {
|
||||
@@ -13620,9 +13652,10 @@
|
||||
let result = [];
|
||||
_.each(stats, (stat) => {
|
||||
const lowerstat = stat.toLowerCase();
|
||||
result[result.length] = (sourceAttr == lowerstat) ?
|
||||
parseInt(setObj[`${skill}${lowerstat}state`]) || 0 :
|
||||
parseInt(value[`${skill}${lowerstat}state`]) || 0;
|
||||
result[result.length] =
|
||||
isNaN(parseInt(setObj[`${skill}${lowerstat}state`])) ?
|
||||
parseInt(value[`${skill}${lowerstat}state`]) || 0 :
|
||||
parseInt(setObj[`${skill}${lowerstat}state`]) || 0;
|
||||
});
|
||||
clog(debug, timer, 'stats:', stats, 'getStatStateArray()]');
|
||||
clog(debug, timer, 'result =', result);
|
||||
@@ -13683,6 +13716,7 @@
|
||||
|
||||
function setSkillRoll(debug, timer, value, source, rowID, sourceAttr, level, setObj, type) {
|
||||
clog(debug, timer, 'level =', level, 'setSkillRoll(TEST)');
|
||||
clog(debug, timer, 'source =', source);
|
||||
const base = getStatRollBase(debug, timer, value, sourceAttr, setObj, type, source);
|
||||
const roll = getRollString(debug, timer, 'rolls', 'skillroll', 'Skill Roll', base + level);
|
||||
setObj[`repeating_skill_${rowID}_skillrollvalue`] = roll;
|
||||
@@ -13710,16 +13744,18 @@
|
||||
clog(debug, timer, `value[${eventInfo.sourceAttribute}] =`, value[eventInfo.sourceAttribute]);
|
||||
}
|
||||
|
||||
function updateSkillRolls(debug, timer, value, source, skillIDs, sourceAttr, setObj) {
|
||||
function updateSkillRolls(debug, timer, value, skillIDs, sourceAttr, setObj) {
|
||||
clog(debug, timer, 'sourceAttr =', sourceAttr, 'updateSkillRolls(TEST)');
|
||||
const type = getStatType(value);
|
||||
_.each(skillIDs, id => {
|
||||
const level = parseInt(value[`repeating_skill_${id}_level`]) || 0;
|
||||
const source = `repeating_skill_${id}`;
|
||||
const level = parseInt(value[`${source}_level`]) || 0;
|
||||
setSkillRoll(debug, timer, value, source, id, sourceAttr, level, setObj, type);
|
||||
})
|
||||
}
|
||||
|
||||
function recordSheetChanges(eventInfo, value, setObj) {
|
||||
const sheet_change_array = ['show_debug_messages'];
|
||||
const sheet_change_array = ['show_debug_messages','weapon_ammo_reloads','weapon_ammo_capacity'];
|
||||
const recordChange = sheet_change_array.indexOf(eventInfo.sourceAttribute) !== -1 ?
|
||||
true : false;
|
||||
if (recordChange) {
|
||||
@@ -13839,7 +13875,7 @@
|
||||
const type = getStatType(value);
|
||||
_.each(statarray,stat=>{
|
||||
//setObj[`repeating_skill_${skillID}_${stat}state`] = 1;
|
||||
writeValues(debug, timer, value, `repeating_skill_${skillID}_${stat}state`, 1 ,setObj);
|
||||
writeValues(debug, timer, value, `repeating_skill_${skillID}_${stat}state`, 1 , setObj);
|
||||
});
|
||||
const stats = type.major==1 ? statmajor: statallaspect;
|
||||
const sum = _.chain(stats)
|
||||
@@ -13858,6 +13894,12 @@
|
||||
clog(debug, timer, "specializations =", specializations);
|
||||
clog(debug, timer, "statallaspect =", statallaspect);
|
||||
clog(debug, timer, "statmajor =", statmajor);
|
||||
const skill_attributes = ['group','name','skillspecilizations','majorstats','minorstats','stat','skillrollvalue'];
|
||||
const skill_attributes_values = [group, name, specializations, type.major, type.minor, getSkillStatsDisplay(stats), roll];
|
||||
_.each(skill_attributes, (a,i) => {
|
||||
writeValues(debug, timer, value, `repeating_skill_${skillID}_${a}`, skill_attributes_values[i], setObj);
|
||||
});
|
||||
/*
|
||||
setObj[`repeating_skill_${skillID}_group`] = group;
|
||||
setObj[`repeating_skill_${skillID}_name`] = name;
|
||||
setObj[`repeating_skill_${skillID}_costperlevel`] = cost;
|
||||
@@ -13866,8 +13908,8 @@
|
||||
setObj[`repeating_skill_${skillID}_minorstats`] = type.minor;
|
||||
setObj[`repeating_skill_${skillID}_stat`] = getSkillStatsDisplay(stats);
|
||||
setObj[`repeating_skill_${skillID}_skillrollvalue`] = roll;
|
||||
setObj.skillmanagement = 0;
|
||||
const id = skillID.toLowerCase();
|
||||
|
||||
|
||||
value[`repeating_skill_${id}_group`] = group;
|
||||
value[`repeating_skill_${id}_name`] = name;
|
||||
value[`repeating_skill_${id}_costperlevel`] = cost;
|
||||
@@ -13876,7 +13918,10 @@
|
||||
value[`repeating_skill_${id}_minorstats`] = type.minor;
|
||||
value[`repeating_skill_${id}_stat`] = getSkillStatsDisplay(stats);
|
||||
value[`repeating_skill_${id}_skillrollvalue`] = roll;
|
||||
value.skillIDs = value.skillIDs.push(id);
|
||||
*/
|
||||
//const id = skillID.toLowerCase();
|
||||
value.skillIDs = value.skillIDs.push(skillID.toLowerCase());
|
||||
setObj.skillmanagement = 0;
|
||||
}
|
||||
|
||||
function buildSkillTemplateValuesArray(skilltemplateIDs){
|
||||
@@ -13931,6 +13976,8 @@
|
||||
|
||||
function registerEvents() {
|
||||
const eventsToRegister = [
|
||||
"weapon_ammo_reloads",
|
||||
"weapon_ammo_capacity",
|
||||
"static_options_selection_gamegenre",
|
||||
"show_debug_messages",
|
||||
"static_weapon_autofire_selection",
|
||||
@@ -14272,14 +14319,15 @@
|
||||
const isActive = setButtonState(debug, timer, value, source, rowID, sourceAttr, setObj);
|
||||
const handsource = getHandSource(debug, timer, extraarmIDs, value[`repeating_attr_${rowID}_source`]);
|
||||
const handstate = handsource !== false ? parseInt(value[`${handsource}_state`]) : false;
|
||||
setAttrEffects(debug, timer, isActive, value, attrdb, extraarmIDs, attrIDs, sectionName, rowID, sourceAttr, setObj);
|
||||
setAttrEffects(debug, timer, isActive, value, attrdb, extraarmIDs, attrIDs, skillIDs, sectionName, rowID, sourceAttr, setObj);
|
||||
//setPoolCostIfGroupIsFlux(debug, timer, attrIDs, value, rowID, setObj);
|
||||
setAttrGroupPoolSpentByActivation(debug, timer, isActive, attrIDs, value, rowID, setObj);
|
||||
//setPoolCostIfGroupIsVariation(debug, timer, isActive, attrIDs, value, rowID, setObj);
|
||||
disableActiveWeapon(debug, timer, value, rowID, setObj);
|
||||
if (handstate) {
|
||||
setWeaponAmmo(debug, timer, attrdb, value, handsource, setObj);
|
||||
}
|
||||
disableActiveWeapon(debug, timer, value, rowID, setObj);
|
||||
|
||||
setGroupDefectPointsOnActivation(debug, timer, attrIDs, attrdb, value, sectionName, rowID, setObj);
|
||||
break;
|
||||
case `lock`:
|
||||
@@ -14331,7 +14379,8 @@
|
||||
case 'statselection':
|
||||
case 'option':
|
||||
const state = parseInt(value[`${source}_${sourceAttr}`]) > 0 ? 0: 1;
|
||||
setObj[`${source}_${sourceAttr}`] = state;
|
||||
//setObj[`${source}_${sourceAttr}`] = state;
|
||||
writeValues(debug, timer, value, `${source}_${sourceAttr}`, state, setObj);
|
||||
break;
|
||||
default:
|
||||
setSkillStatButtonState(debug, timer, value, match, sourceAttr, setObj);
|
||||
@@ -14412,9 +14461,9 @@
|
||||
setDerivedValue(debug, timer, attrdb, value, setObj, 'energy');
|
||||
setDerivedValue(debug, timer, attrdb, value, setObj, 'sanity');
|
||||
setDerivedValue(debug, timer, attrdb, value, setObj, 'social');
|
||||
setTotalShock(debug, timer, attrdb, setObj, sourceAttr);
|
||||
setTotalMovement(debug, timer, value, attrdb, setObj, sourceAttr);
|
||||
updateSkillRolls(debug, timer, value, source, skillIDs, sourceAttr, setObj);
|
||||
setTotalShock(debug, timer, value, attrdb, setObj);
|
||||
setTotalMovement(debug, timer, value, attrdb, setObj);
|
||||
updateSkillRolls(debug, timer, value, skillIDs, sourceAttr, setObj);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user