diff --git a/js/build.js b/js/build.js index 1760004..987aac3 100644 --- a/js/build.js +++ b/js/build.js @@ -155,10 +155,12 @@ class Build{ */ initBuildStats(){ - let staticIDs = ["hp", "eDef", "tDef", "wDef", "fDef", "aDef", "str", "dex", "int", "def", "agi"]; + let staticIDs = ["hp", "eDef", "tDef", "wDef", "fDef", "aDef", "str", "dex", "int", "def", "agi", "dmgMobs", "defMobs"]; //Create a map of this build's stats let statMap = new Map(); + statMap.set("damageMultiplier", 1); + statMap.set("defMultiplier", 1); for (const staticID of staticIDs) { statMap.set(staticID, 0); @@ -176,7 +178,15 @@ class Build{ } for (const staticID of staticIDs) { if (item_stats.get(staticID)) { - statMap.set(staticID, statMap.get(staticID) + item_stats.get(staticID)); + if (staticID === "dmgMobs") { + statMap.set('damageMultiplier', statMap.get('damageMultiplier') * item_stats.get(staticID)); + } + else if (staticID === "defMobs") { + statMap.set('defMultiplier', statMap.get('defMultiplier') * item_stats.get(staticID)); + } + else { + statMap.set(staticID, statMap.get(staticID) + item_stats.get(staticID)); + } } } if (item_stats.get("majorIds")) { diff --git a/js/build_encode_decode.js b/js/build_encode_decode.js index 86aabd5..c12dae0 100644 --- a/js/build_encode_decode.js +++ b/js/build_encode_decode.js @@ -157,7 +157,7 @@ function encodeBuild(build, powders, skillpoints) { } else if (item.statMap.get("crafted")) { build_string += "CR-"+encodeCraft(item); } else if (item.statMap.get("category") === "tome") { - let tome_id = item.get("id"); + let tome_id = item.statMap.get("id"); if (tome_id <= 60) { // valid normal tome. ID 61-63 is for NONE tomes. build_version = Math.max(build_version, 6); diff --git a/js/builder.js b/js/builder.js index 34f7eab..cf997f3 100644 --- a/js/builder.js +++ b/js/builder.js @@ -95,8 +95,15 @@ function resetFields(){ elem.classList.remove("toggleOn"); } } + for (const elem of skp_order) { + console.log(document.getElementById(elem + "_boost_armor").value); + document.getElementById(elem + "_boost_armor").value = 0; + document.getElementById(elem + "_boost_armor_prev").value = 0; + document.getElementById(elem + "_boost_armor").style.background = `linear-gradient(to right, #AAAAAA, #AAAAAA 0%, #AAAAAA 100%)`; + document.getElementById(elem + "_boost_armor_label").textContent = `% ${damageClasses[skp_order.indexOf(elem)+1]} Damage Boost: 0`; + } - const nodes_to_reset = item_nodes.concat(powder_nodes).concat(edit_input_nodes).concat([powder_special_input, boosts_node]); + const nodes_to_reset = item_nodes.concat(powder_nodes).concat(edit_input_nodes).concat([powder_special_input, boosts_node, armor_powder_node]); for (const node of nodes_to_reset) { node.mark_dirty(); } @@ -317,6 +324,7 @@ function init_autocomplete() { if (event.detail.selection.value) { event.target.value = event.detail.selection.value; } + event.target.dispatchEvent(new Event('input')); }, }, } diff --git a/js/builder_graph.js b/js/builder_graph.js index ed0ac00..cfb8491 100644 --- a/js/builder_graph.js +++ b/js/builder_graph.js @@ -259,7 +259,10 @@ class ItemInputDisplayNode extends ComputeNode { // Doesn't exist for weapons. this.health_field.textContent = "0"; } - this.level_field.textContent = "0"; + if (this.level_field) { + // Doesn't exist for tomes. + this.level_field.textContent = "0"; + } if (!item) { this.input_field.classList.add("is-invalid"); return null; @@ -274,7 +277,10 @@ class ItemInputDisplayNode extends ComputeNode { // Doesn't exist for weapons. this.health_field.textContent = item.statMap.get('hp'); } - this.level_field.textContent = item.statMap.get('lvl'); + if (this.level_field) { + // Doesn't exist for tomes. + this.level_field.textContent = item.statMap.get('lvl'); + } this.image.classList.add(tier + "-shadow"); return null; } @@ -401,7 +407,14 @@ class BuildAssembleNode extends ComputeNode { input_map.get('ring1-input'), input_map.get('ring2-input'), input_map.get('bracelet-input'), - input_map.get('necklace-input') + input_map.get('necklace-input'), + input_map.get('weaponTome1-input'), + input_map.get('weaponTome2-input'), + input_map.get('armorTome1-input'), + input_map.get('armorTome2-input'), + input_map.get('armorTome3-input'), + input_map.get('armorTome4-input'), + input_map.get('guildTome1-input') ]; let weapon = input_map.get('weapon-input'); let level = input_map.get('level-input'); @@ -759,7 +772,7 @@ class DisplayBuildWarningsNode extends ComputeNode { } let baditem = document.createElement("p"); baditem.classList.add("nocolor"); baditem.classList.add("itemp"); - baditem.textContent = item.get("displayName") + " requires level " + item_lvl + " to use."; + baditem.textContent = item.statMap.get("displayName") + " requires level " + item_lvl + " to use."; lvlWarning.appendChild(baditem); } } @@ -791,7 +804,13 @@ class AggregateStatsNode extends ComputeNode { for (const [k, v] of input_map.entries()) { for (const [k2, v2] of v.entries()) { if (output_stats.has(k2)) { - output_stats.set(k2, v2 + output_stats.get(k2)); + // TODO: ugly AF + if (k2 === 'damageMultiplier' || k2 === 'defMultiplier') { + output_stats.set(k2, v2 * output_stats.get(k2)); + } + else { + output_stats.set(k2, v2 + output_stats.get(k2)); + } } else { output_stats.set(k2, v2); @@ -815,8 +834,6 @@ class AggregateEditableIDNode extends ComputeNode { const weapon = input_map.get('weapon'); input_map.delete('weapon'); const output_stats = new Map(build.statMap); - output_stats.set("damageMultiplier", 1); - output_stats.set("defMultiplier", 1); for (const [k, v] of input_map.entries()) { output_stats.set(k, v); } @@ -944,6 +961,15 @@ function builder_graph_init() { //new PrintNode(eq+'-debug').link_to(item_input); //document.querySelector("#"+eq+"-tooltip").setAttribute("onclick", "collapse_element('#"+ eq +"-tooltip');"); //toggle_plus_minus('" + eq + "-pm'); } + console.log(none_tomes); + for (const [eq, none_item] of zip2(tome_fields, [none_tomes[0], none_tomes[0], none_tomes[1], none_tomes[1], none_tomes[1], none_tomes[1], none_tomes[2]])) { + let input_field = document.getElementById(eq+"-choice"); + let item_image = document.getElementById(eq+"-img"); + + let item_input = new ItemInputNode(eq+'-input', input_field, none_item); + item_nodes.push(item_input); + new ItemInputDisplayNode(eq+'-input-display', eq, item_image).link_to(item_input); + } // weapon image changer node. let weapon_image = document.getElementById("weapon-img"); diff --git a/js/load_tome.js b/js/load_tome.js index e6fded5..3b44842 100644 --- a/js/load_tome.js +++ b/js/load_tome.js @@ -1,4 +1,4 @@ -const TOME_DB_VERSION = 1; +const TOME_DB_VERSION = 2; // @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.jsA let tdb; @@ -120,6 +120,11 @@ async function load_tome_init() { }); } +let none_tomes = [ + ["tome", "weaponTome", "No Weapon Tome"], + ["tome", "armorTome", "No Armor Tome"], + ["tome", "guildTome", "No Guild Tome"] +]; function init_tome_maps() { //warp tomeMap = new Map(); @@ -131,17 +136,12 @@ function init_tome_maps() { tomeLists.set(it, []); } - let noneTomes = [ - ["tome", "weaponTome", "No Weapon Tome"], - ["tome", "armorTome", "No Armor Tome"], - ["tome", "guildTome", "No Guild Tome"] - ]; for (let i = 0; i < 3; i++) { let tome = Object(); tome.slots = 0; - tome.category = noneTomes[i][0]; - tome.type = noneTomes[i][1]; - tome.name = noneTomes[i][2]; + tome.category = none_tomes[i][0]; + tome.type = none_tomes[i][1]; + tome.name = none_tomes[i][2]; tome.displayName = tome.name; tome.set = null; tome.quest = null; @@ -160,14 +160,14 @@ function init_tome_maps() { //dependency - load.js clean_item(tome); - noneTomes[i] = tome; + none_tomes[i] = tome; } - tomes = tomes.concat(noneTomes); + tomes = tomes.concat(none_tomes); for (const tome of tomes) { if (tome.remapID === undefined) { tomeLists.get(tome.type).push(tome.displayName); tomeMap.set(tome.displayName, tome); - if (noneTomes.includes(tome)) { + if (none_tomes.includes(tome)) { tomeIDMap.set(tome.id, ""); } else { diff --git a/tomes.json b/tomes.json index 913efa4..0b4c213 100644 --- a/tomes.json +++ b/tomes.json @@ -9,6 +9,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 60, + "defmobs": 3, "thorns": 6, "ref": 6, "hpBonus": 120, @@ -23,6 +24,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 100, + "defMobs": 5, "thorns": 8, "ref": 8, "fixID": false, @@ -36,6 +38,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 60, + "defMobs": 3, "exploding": 5, "mdPct": 5, "hpBonus": 120, @@ -50,6 +53,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 100, + "defMobs": 5, "thorns": 6, "reflection": 6, "fixID": false, @@ -63,6 +67,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 60, + "defMobs": 3, "sdPct": 5, "hpBonus": 120, "fixID": false, @@ -76,6 +81,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 100, + "defMobs": 5, "sdPct": 6, "fixID": false, "id": 5 @@ -88,6 +94,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 60, + "defMobs": 3, "hprRaw": 15, "hpBonus": 120, "fixID": false, @@ -101,6 +108,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 100, + "defMobs": 5, "hprRaw": 60, "fixID": false, "id": 7 @@ -113,6 +121,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 60, + "defMobs": 3, "ls": 25, "hpBonus": 120, "fixID": false, @@ -126,6 +135,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 100, + "defMobs": 5, "ls": 85, "fixID": false, "id": 9 @@ -138,6 +148,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 60, + "defMobs": 3, "lb": 5, "hpBonus": 120, "fixID": false, @@ -151,6 +162,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 100, + "defMobs": 5, "lb": 6, "fixID": false, "id": 11 @@ -163,6 +175,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 60, + "defMobs": 3, "spd": 5, "hpBonus": 120, "fixID": false, @@ -176,6 +189,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 100, + "defMobs": 5, "spd": 6, "fixID": false, "id": 13 @@ -188,6 +202,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 100, + "defMobs": 8, "eDefPct": 10, "hpBonus": 150, "fixID": false, @@ -201,6 +216,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 100, + "defMobs": 8, "tDefPct": 10, "hpBonus": 150, "fixID": false, @@ -214,6 +230,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 100, + "defMobs": 8, "wDefPct": 10, "hpBonus": 150, "fixID": false, @@ -227,6 +244,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 100, + "defMobs": 8, "fDefPct": 10, "hpBonus": 150, "fixID": false, @@ -240,6 +258,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 100, + "defMobs": 8, "aDefPct": 10, "hpBonus": 150, "fixID": false, @@ -253,6 +272,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 100, + "defMobs": 8, "eDefPct": 6, "tDefPct": 6, "wDefPct": 6,