From d28d125404751ba73750549bbf92d19682ba1e6c Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Mon, 14 Mar 2022 10:29:23 -0700 Subject: [PATCH 01/10] Refactored createSkill() Moving to writeValues() to likely resolve cache out of sync issues. POCed on createSkill() function. --- BESM4eExtras/BESM4eExtras.html | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index 621ea0c80b..9b896a761c 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -13858,6 +13858,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 +13872,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 +13882,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){ From d57a099410ec9ef375baa55853547f6b2f2b1ee0 Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Mon, 14 Mar 2022 13:14:57 -0700 Subject: [PATCH 02/10] Ammo/Capacity Fix Setting Ammo limiter to rank 3 will now give reloads of 1 instead of 2. Fixed ammo/capacity persistency with new caching system. --- BESM4eExtras/BESM4eExtras.html | 52 ++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index 9b896a761c..0363b5534b 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -12602,27 +12602,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 +12642,19 @@ 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; + //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; + //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 +13513,26 @@ }); } + 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 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) { @@ -13719,7 +13724,7 @@ } 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) { @@ -13940,6 +13945,8 @@ function registerEvents() { const eventsToRegister = [ + "weapon_ammo_reloads", + "weapon_ammo_capacity", "static_options_selection_gamegenre", "show_debug_messages", "static_weapon_autofire_selection", @@ -14285,10 +14292,11 @@ //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`: From 475dbfde5502282e79f41de3d56b3152166e9a33 Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Mon, 14 Mar 2022 13:57:18 -0700 Subject: [PATCH 03/10] Stat update fix Stat update is now reflected in skill rolls. --- BESM4eExtras/BESM4eExtras.html | 51 +++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index 0363b5534b..459425c605 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -8108,7 +8108,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 +8121,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 +8722,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 +8742,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 +8896,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; @@ -12056,7 +12060,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": @@ -12642,8 +12646,6 @@ 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()'); @@ -12651,8 +12653,6 @@ } 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()'); @@ -13625,9 +13625,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); @@ -13688,6 +13689,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; @@ -13715,10 +13717,12 @@ 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); }) } @@ -13844,7 +13848,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) @@ -14348,7 +14352,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); @@ -14429,9 +14434,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; From fc490e03d227e4673f9350b45452c32cd6206e40 Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Mon, 14 Mar 2022 14:05:40 -0700 Subject: [PATCH 04/10] Fixed default dynamic roll string New characters will now be able to roll 2d6 from roll menu (previously had no default value set). --- BESM4eExtras/BESM4eExtras.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index 459425c605..9c22c8bc96 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -938,7 +938,7 @@
-
+
From e53b739a9859da6d4ab4409a9150d95659b51bcd Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Mon, 14 Mar 2022 16:12:56 -0700 Subject: [PATCH 05/10] Fixed Augmented Stat Augmented stat now works! --- BESM4eExtras/BESM4eExtras.html | 73 ++++++++++++---------------------- 1 file changed, 26 insertions(+), 47 deletions(-) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index 9c22c8bc96..3cb7a49119 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -11079,39 +11079,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; @@ -11161,21 +11151,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; @@ -11965,7 +11941,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) { @@ -11982,7 +11958,8 @@ 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": @@ -13519,6 +13496,8 @@ } 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; @@ -14292,7 +14271,7 @@ 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); From 33a68ff07ae58015e6cd886e892157e203189c8b Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Mon, 14 Mar 2022 16:38:36 -0700 Subject: [PATCH 06/10] Fixed Mastery Updates Attack/Defense Mastery attributes will now be added/removed from ACV/DCV rolls, respectively. --- BESM4eExtras/BESM4eExtras.html | 1 + 1 file changed, 1 insertion(+) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index 3cb7a49119..975a83262b 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -11954,6 +11954,7 @@ 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": From 7a9d55d796f967910f215a1d0cdc019dd3b86a63 Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Mon, 14 Mar 2022 17:29:55 -0700 Subject: [PATCH 07/10] Fixed attribute settings Attributes now expose the correct settings available to them. --- BESM4eExtras/BESM4eExtras.html | 45 ++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index 975a83262b..c0c0fe0ecd 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -10913,6 +10913,35 @@ 'showweaponclass' ]; const settingsObj = { + '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':['showweaponclass'], + 'meleedefense':['showweaponclass'], + 'metamorphosis':['showvariablestat'], + 'mimic':['showattrsrc'], + 'nullify':['showattrsrc','showvariablestat'], + 'powerflux':['showvariablestat'], + 'powervariation':['showvariablestat'], + 'rangeddefense':['showdefenseclass'], + 'regeneration':['showcollectiontype'], + 'skill':['showskillgroup'], + 'supersense':['showsupersense'], + 'transmute':['showvariablestat'], + 'unaffected':['showunaffected','showattrsrc'], + 'weapon':['showdamagetype','showweaponclass'] + /* 'showcollectiontype':'absorption', 'showarmorlayer':'armor', 'showaugmentedstat':'augmented', @@ -10927,7 +10956,6 @@ 'showvariablestat':'features', 'showimmunityrole':'immunity', 'showvariablestat':'immutable', - 'showvariablestat':'immutable', 'showweaponclass':'meleeattack', 'showweaponclass':'meleedefense', 'showvariablestat':'metamorphosis', @@ -10945,13 +10973,26 @@ 'showattrsrc':'unaffected', 'showdamagetype':'weapon', 'showweaponclass':'weapon' + */ }; + const settings_array = settingsObj[attribute] || []; + const result = + _.map(settings, setting => { + clog(debug, timer, 'setting =', setting,'exposeAttrSettingsOnAttributeChange(TEST)'); + const set = settings_array.indexOf(setting) !== -1 ? 1 : 0; + clog(debug, timer, 'set =', set); + setObj[`${source}_${setting}`] = set; + return `${setting} = ${set}`; + }); + /* const result = _.map(settings, setting => { - const set = settingsObj[setting] === attribute ? 1 : 0; + const set = settingsObj[attribute] === setting ? 1 : 0; setObj[`${source}_${setting}`] = set; return `${setting} = ${set}`; }); + */ clog(debug, timer, 'result:', result,'exposeAttrSettingsOnAttributeChange()'); + clog(debug, timer, 'attribute =', attribute); } function exposeAttrSettingsOnCustomizationChange(debug, timer, eventInfo, source, customization, setObj) { From c9771a4427af4c2b9fe425c479d079364e6b1951 Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Mon, 14 Mar 2022 20:43:45 -0700 Subject: [PATCH 08/10] Cleanup Cleaned up some unnecessary code. --- BESM4eExtras/BESM4eExtras.html | 43 ---------------------------------- 1 file changed, 43 deletions(-) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index c0c0fe0ecd..f409836df5 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -10941,58 +10941,15 @@ 'transmute':['showvariablestat'], 'unaffected':['showunaffected','showattrsrc'], 'weapon':['showdamagetype','showweaponclass'] - /* - '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', - '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' - */ }; const settings_array = settingsObj[attribute] || []; const result = _.map(settings, setting => { - clog(debug, timer, 'setting =', setting,'exposeAttrSettingsOnAttributeChange(TEST)'); const set = settings_array.indexOf(setting) !== -1 ? 1 : 0; - clog(debug, timer, 'set =', set); setObj[`${source}_${setting}`] = set; return `${setting} = ${set}`; }); - /* - const result = _.map(settings, setting => { - const set = settingsObj[attribute] === setting ? 1 : 0; - setObj[`${source}_${setting}`] = set; - return `${setting} = ${set}`; - }); - */ clog(debug, timer, 'result:', result,'exposeAttrSettingsOnAttributeChange()'); - clog(debug, timer, 'attribute =', attribute); } function exposeAttrSettingsOnCustomizationChange(debug, timer, eventInfo, source, customization, setObj) { From 892f003e46338188f0c5314df632e6d930c2c22e Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Mon, 14 Mar 2022 20:51:08 -0700 Subject: [PATCH 09/10] Fixed weapon classes Added support for respective melee/ranged weapon class attributes --- BESM4eExtras/BESM4eExtras.html | 53 ++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index f409836df5..aa05505e14 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -3181,6 +3181,52 @@ +
+ +
+
+
+

+ Weapon Class + +

+
+
+
+ +
+ +
+
+
+

+ Weapon Class + +

+
+
+
+
@@ -10904,6 +10950,8 @@ 'showenemy', 'showextraarms', 'showimmunityrole', + 'showmeleeclass', + 'showrangedclass', 'showseeinto', 'showskillgroup', 'showsupersense', @@ -10927,13 +10975,14 @@ 'features':['showvariablestat'], 'immunity':['showimmunityrole'], 'immutable':['showvariablestat'], - 'meleeattack':['showweaponclass'], - 'meleedefense':['showweaponclass'], + 'meleeattack':['showmeleeclass'], + 'meleedefense':['showmeleeclass'], 'metamorphosis':['showvariablestat'], 'mimic':['showattrsrc'], 'nullify':['showattrsrc','showvariablestat'], 'powerflux':['showvariablestat'], 'powervariation':['showvariablestat'], + 'rangedattack':['showrangedclass'], 'rangeddefense':['showdefenseclass'], 'regeneration':['showcollectiontype'], 'skill':['showskillgroup'], From 5e355ff481019e9d747a67449d7f4161aecd192c Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Thu, 17 Mar 2022 12:20:46 -0700 Subject: [PATCH 10/10] Incremented Version --- BESM4eExtras/BESM4eExtras.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index aa05505e14..0b8a4701be 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -30,7 +30,7 @@

Sheet Options

Sheet Version - +

Sheet Type