From 7d25aa28e5706f1a6f92b39b6c97ce0033364e63 Mon Sep 17 00:00:00 2001 From: b Date: Sat, 30 Jan 2021 06:03:40 -0600 Subject: [PATCH] Implement major IDs --- build.js | 7 +++++++ builder.js | 2 +- damage_calc.js | 41 +++++++++++++++++++++++++++++++---------- display.js | 18 ++++++++++++++++-- 4 files changed, 55 insertions(+), 13 deletions(-) diff --git a/build.js b/build.js index daf1887..b6b0e54 100644 --- a/build.js +++ b/build.js @@ -444,6 +444,7 @@ class Build{ } statMap.set("hp", levelToHPBase(this.level)); + let major_ids = new Set(); for (const item of this.items){ for (let [id, value] of item.get("maxRolls")) { statMap.set(id,(statMap.get(id) || 0)+value); @@ -453,7 +454,13 @@ class Build{ statMap.set(staticID, statMap.get(staticID) + item.get(staticID)); } } + if (item.get("majorIds")) { + for (const majorID of item.get("majorIds")) { + major_ids.add(majorID); + } + } } + statMap.set("activeMajorIDs", major_ids); for (const [setName, count] of this.activeSetCounts) { const bonus = sets[setName].bonuses[count-1]; for (const id in bonus) { diff --git a/builder.js b/builder.js index a40d17c..9bc6862 100644 --- a/builder.js +++ b/builder.js @@ -3,7 +3,7 @@ const url_tag = location.hash.slice(1); console.log(url_base); console.log(url_tag); -const BUILD_VERSION = "6.9.21"; +const BUILD_VERSION = "6.9.22"; function setTitle() { let text; diff --git a/damage_calc.js b/damage_calc.js index c131ef7..7805d82 100644 --- a/damage_calc.js +++ b/damage_calc.js @@ -131,7 +131,10 @@ const spell_table = { { title: "Heal", cost: 6, parts: [ { subtitle: "First Pulse", type: "heal", strength: 0.12 }, { subtitle: "Second and Third Pulses", type: "heal", strength: 0.06 }, - { subtitle: "Total Heal", type: "heal", strength: 0.24, summary: true } + { subtitle: "Total Heal", type: "heal", strength: 0.24, summary: true }, + { subtitle: "First Pulse (Ally)", type: "heal", strength: 0.20 }, + { subtitle: "Second and Third Pulses (Ally)", type: "heal", strength: 0.1 }, + { subtitle: "Total Heal (Ally)", type: "heal", strength: 0.4 } ] }, { title: "Teleport", cost: 4, parts: [ { subtitle: "Total Damage", type: "damage", multiplier: 100, conversion: [60, 0, 40, 0, 0, 0], summary: true }, @@ -150,9 +153,15 @@ const spell_table = { { subtitle: "Explosion Damage", type: "damage", multiplier: 130, conversion: [100, 0, 0, 0, 0, 0]}, { subtitle: "Total Damage", type: "total", factors: [1, 1], summary: true }, ] }, - { title: "Charge", cost: 4, parts: [ - { subtitle: "Total Damage", type: "damage", multiplier: 150, conversion: [60, 0, 0, 0, 40, 0], summary: true }, - ] }, + { title: "Charge", cost: 4, variants: { + DEFAULT: [ + { subtitle: "Total Damage", type: "damage", multiplier: 150, conversion: [60, 0, 0, 0, 40, 0], summary: true } + ], + RALLY: [ + { subtitle: "Self Heal", type: "heal", strength: 0.1, summary: true }, + { subtitle: "Ally Heal", type: "heal", strength: 0.15 } + ] + } }, { title: "Uppercut", cost: 9, parts: [ { subtitle: "First Damage", type: "damage", multiplier: 300, conversion: [70, 20, 10, 0, 0, 0] }, { subtitle: "Fireworks Damage", type: "damage", multiplier: 50, conversion: [60, 0, 40, 0, 0, 0] }, @@ -165,10 +174,16 @@ const spell_table = { ] }, ], "bow": [ - { title: "Arrow Storm", cost: 6, parts: [ + { title: "Arrow Storm", cost: 6, variants: { + DEFAULT: [ { subtitle: "Total Damage", type: "damage", multiplier: 600, conversion: [60, 0, 25, 0, 15, 0], summary: true }, - { subtitle: "Per Arrow", type: "damage", multiplier: 10, conversion: [60, 0, 25, 0, 15, 0]}, - ] }, + { subtitle: "Per Arrow (60)", type: "damage", multiplier: 10, conversion: [60, 0, 25, 0, 15, 0]} + ], + HAWKEYE: [ + { subtitle: "Total Damage (Hawkeye)", type: "damage", multiplier: 400, conversion: [60, 0, 25, 0, 15, 0], summary: true }, + { subtitle: "Per Arrow (5)", type: "damage", multiplier: 80, conversion: [60, 0, 25, 0, 15, 0]} + ], + } }, { title: "Escape", cost: 3, parts: [ { subtitle: "Landing Damage", type: "damage", multiplier: 100, conversion: [50, 0, 0, 0, 0, 50], summary: true }, ] }, @@ -192,10 +207,16 @@ const spell_table = { { subtitle: "Fatality", type: "damage", multiplier: 120, conversion: [20, 0, 30, 50, 0, 0] }, { subtitle: "Total Damage", type: "total", factors: [10, 1], summary: true }, ] }, - { title: "Smoke Bomb", cost: 8, parts: [ - { subtitle: "Tick Damage", type: "damage", multiplier: 60, conversion: [45, 25, 0, 0, 0, 30] }, + { title: "Smoke Bomb", cost: 8, variants: { + DEFAULT: [ + { subtitle: "Tick Damage (10 max)", type: "damage", multiplier: 60, conversion: [45, 25, 0, 0, 0, 30] }, { subtitle: "Total Damage", type: "damage", multiplier: 600, conversion: [45, 25, 0, 0, 0, 30], summary: true }, - ] }, + ], + CHERRY_BOMBS: [ + { subtitle: "Total Damage (Cherry Bombs)", type: "damage", multiplier: 330, conversion: [45, 25, 0, 0, 0, 30], summary: true }, + { subtitle: "Per Bomb", type: "damage", multiplier: 110, conversion: [45, 25, 0, 0, 0, 30] } + ] + } }, ], "relik": [ { title: "Totem", cost: 4, parts: [ diff --git a/display.js b/display.js index ac8f547..8254bd3 100644 --- a/display.js +++ b/display.js @@ -1,4 +1,4 @@ -let nonRolledIDs = ["name", "displayName", "tier", "set", "slots", "type", "material", "drop", "quest", "restrict", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq","str", "dex", "int", "agi", "def", "fixID", "category", "id", "skillpoints", "reqs", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_"]; +let nonRolledIDs = ["name", "displayName", "tier", "set", "slots", "type", "material", "drop", "quest", "restrict", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq","str", "dex", "int", "agi", "def", "fixID", "category", "id", "skillpoints", "reqs", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_", "majorIds"]; let rolledIDs = ["hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "expd", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd"]; let reversedIDs = [ "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4" ]; let colorMap = new Map( @@ -1824,7 +1824,21 @@ function displaySpellDamage(parent_elem, overallparent_elem, build, spell, spell part_divavg.classList.add("nomargin"); overallparent_elem.append(part_divavg); - for (const part of spell.parts) { + let spell_parts; + if (spell.parts) { + spell_parts = spell.parts; + } + else { + spell_parts = spell.variants.DEFAULT; + for (const majorID of stats.get("activeMajorIDs")) { + if (majorID in spell.variants) { + spell_parts = spell.variants[majorID]; + break; + } + } + } + + for (const part of spell_parts) { parent_elem.append(document.createElement("br")); let part_div = document.createElement("p"); parent_elem.append(part_div);