Code cleaning
This commit is contained in:
@@ -1986,7 +1986,7 @@
|
||||
"npc", "AC", "innate_ac", "dexterity_mod",
|
||||
];
|
||||
getAttrs(sourceAttrs, v => {
|
||||
if (v.npc == "1") return;
|
||||
if (v.npc === "1") return;
|
||||
const baseAC = Math.max(
|
||||
parseInt(v.innate_ac) || 0,
|
||||
...idArray.filter(id => v[`repeating_armor_${id}_armor_active`] === "1")
|
||||
@@ -2088,7 +2088,7 @@
|
||||
};
|
||||
|
||||
const calculateNextLevelXP = () => {
|
||||
var xp = [0, 3, 6, 12, 18, 27, 39, 54, 72, 93];
|
||||
const xp = [0, 3, 6, 12, 18, 27, 39, 54, 72, 93];
|
||||
getAttrs(["level", "setting_xp_scheme"], v => {
|
||||
if (v.setting_xp_scheme === "xp") {
|
||||
if (v.level < 10) {
|
||||
@@ -2367,13 +2367,12 @@
|
||||
const setting = idArray.reduce((m, id) => {
|
||||
if (v.npc_roll_full_attack === "1") {
|
||||
const num = parseInt(v[`repeating_npc-attacks_${id}_attack_number`]) || 1;
|
||||
const macro = [2, 3, 4, 5, 6, 7, 8].map(n => {
|
||||
m[`repeating_npc-attacks_${id}_attack_extra_macro`] = [2, 3, 4, 5, 6, 7, 8].map(n => {
|
||||
if (n <= num)
|
||||
return `{{attack${n}=[[1d20 + @{attack_ab} @{attack_burst} @{modifier_query}]]}} ` +
|
||||
`{{damage${n}=[[@{attack_damage} @{attack_burst}]]}} `;
|
||||
else return "";
|
||||
}).join("");
|
||||
m[`repeating_npc-attacks_${id}_attack_extra_macro`] = macro;
|
||||
} else {
|
||||
m[`repeating_npc-attacks_${id}_attack_extra_macro`] = "";
|
||||
}
|
||||
@@ -2468,7 +2467,7 @@
|
||||
...techniqueIDs.map(id => `repeating_techniques_${id}_technique_name`),
|
||||
];
|
||||
getAttrs(sourceAttrs, v => {
|
||||
if (v.setting_super_type == "magic" || v.setting_super_type == "neither") return;
|
||||
if (v.setting_super_type === "magic" || v.setting_super_type === "neither") return;
|
||||
const macro_psionics = `${[
|
||||
...skills.psionic.filter(skill => v[`skill_${skill}`] !== "-1").map(skillToMacro(v)),
|
||||
...skillIDs.filter(id => v[`repeating_psychic-skills_${id}_skill`] !== "-1")
|
||||
@@ -2494,7 +2493,7 @@
|
||||
...spellIDs.map(id => `repeating_spells_${id}_spell_name`),
|
||||
];
|
||||
getAttrs(sourceAttrs, v => {
|
||||
if (v.setting_super_type == "psionics" || v.setting_super_type == "neither") return;
|
||||
if (v.setting_super_type === "psionics" || v.setting_super_type === "neither") return;
|
||||
const macro_magic = `${[
|
||||
...(v.skill_magic2_name ? ["magic", "magic2"] : ["magic"]).map(skillToMacro(v)),
|
||||
...skillIDs.map(idToSkillMacro(v, "magic-skills"))
|
||||
@@ -2539,7 +2538,7 @@
|
||||
const macro_npc_attacks = idArray.map((id, index) => {
|
||||
const title = v[`repeating_npc-attacks_${id}_attack_name`] +
|
||||
` ${sign(v[`repeating_npc-attacks_${id}_attack_ab`])}` +
|
||||
((v[`repeating_npc-attacks_${id}_attack_number`] != "1") ?
|
||||
((v[`repeating_npc-attacks_${id}_attack_number`] !== "1") ?
|
||||
` (${v[`repeating_npc-attacks_${id}_attack_number`]} attacks)` : "");
|
||||
return buildLink(title, `repeating_npc-attacks_${id}_attack`, index + 1 === idArray.length);
|
||||
}).join(" ");
|
||||
@@ -2729,8 +2728,7 @@
|
||||
data.weapon_ab ? `, ${translate("ATTACK_BONUS_SHORT")} +${data.weapon_ab}` : ""}${
|
||||
data.weapon_range ? `, ${translate("RANGE")} ${data.weapon_range}` : ""}${
|
||||
data.weapon_ammo ? `, ${translate("AMMO")} ${data.weapon_ammo}` : ""}${
|
||||
data.weapon_shock ? `, ${data.weapon_shock_damage} ${translate("SHOCK_DAMAGE_AGAINST_AC_LEQ")} ${data.weapon_shock_ac}` : ""}${
|
||||
", +"}${getNamedAttrMod(data.weapon_attribute_mod)}${
|
||||
data.weapon_shock ? `, ${data.weapon_shock_damage} ${translate("SHOCK_DAMAGE_AGAINST_AC_LEQ")} ${data.weapon_shock_ac}` : ""}, +${getNamedAttrMod(data.weapon_attribute_mod)}${
|
||||
data.weapon_encumbrance ? `, ${translate("ENCUMBRANCE_SHORT")} ${data.weapon_encumbrance}` : ""}.`;
|
||||
}
|
||||
if (sName === "armor") {
|
||||
@@ -2745,7 +2743,7 @@
|
||||
else return `${translate("LEVEL")}-${data.level}.`;
|
||||
}
|
||||
if (sName === "gear") {
|
||||
if (data.gear_bundled == "on") {
|
||||
if (data.gear_bundled === "on") {
|
||||
return `${translate("ENCUMBRANCE_SHORT")} ${data.gear_encumbrance}#.`;
|
||||
}
|
||||
return `${translate("ENCUMBRANCE_SHORT")} ${data.gear_encumbrance}.`;
|
||||
@@ -2971,7 +2969,7 @@
|
||||
const prefix = `repeating_drones_drone_fitting_${num}`;
|
||||
getAttrs([`${prefix}_desc`, `${prefix}_name`], v => {
|
||||
const fittingName = (v[`${prefix}_name`] || "").toLowerCase().trim().replace(/ /g, "_");
|
||||
if (v[`${prefix}_desc`] == "" && autofillData.droneFittings.includes(fittingName)) {
|
||||
if (v[`${prefix}_desc`] === "" && autofillData.droneFittings.includes(fittingName)) {
|
||||
setAttrs({
|
||||
[`${prefix}_desc`]: translate(`${fittingName.toUpperCase()}_DESC`)
|
||||
});
|
||||
@@ -3035,7 +3033,7 @@
|
||||
* set ammo and shock checkboxes to reasonable values
|
||||
* convert old format for gear readied/stowed
|
||||
**/
|
||||
if (major == 2 && minor < 1) {
|
||||
if (major === 2 && minor < 1) {
|
||||
const upgradeFunction = _.after(4, () => {
|
||||
// recalculate these things just to be sure, in case the v1.6.2 update
|
||||
// missed them.
|
||||
@@ -3108,7 +3106,7 @@
|
||||
* convert single armor line to repeating armor
|
||||
* Change @{attribute_query_none} to @{attribute_query}
|
||||
**/
|
||||
else if (major == 2 && minor < 2) {
|
||||
else if (major === 2 && minor < 2) {
|
||||
const upgradeFunction = _.after(2, () => {
|
||||
calculateStrDexMod();
|
||||
calculateEffort();
|
||||
@@ -3157,7 +3155,7 @@
|
||||
/** v2.3.1
|
||||
* Regenerate drone and weapon ABs
|
||||
**/
|
||||
else if (major == 2 && (minor < 3 || (minor == 3 && patch == 0))) {
|
||||
else if (major === 2 && (minor < 3 || (minor === 3 && patch === 0))) {
|
||||
const upgradeFunction = _.after(1, () => {
|
||||
upgradeSheet("2.3.1");
|
||||
});
|
||||
@@ -3169,14 +3167,14 @@
|
||||
/** v2.4.3
|
||||
* Regenerate Cyberware strain because it was bugged
|
||||
**/
|
||||
else if (major == 2 && (minor < 4 || (minor == 4 && patch < 3))) {
|
||||
else if (major === 2 && (minor < 4 || (minor === 4 && patch < 3))) {
|
||||
calculateCyberwareStrain();
|
||||
upgradeSheet("2.4.3");
|
||||
}
|
||||
/** v2.4.7
|
||||
* Move attr to attr_base, and recalculate attr
|
||||
**/
|
||||
else if (major == 2 && minor == 4 && patch < 7) {
|
||||
else if (major === 2 && minor === 4 && patch < 7) {
|
||||
attributes.forEach(attr => {
|
||||
getAttrs([attr, `${attr}_base`], v => {
|
||||
mySetAttrs({[`${attr}_base`]: parseInt(v[`${attr}`] || 10)}, v, null, () => {
|
||||
|
||||
Reference in New Issue
Block a user