Misc bugfix (#245)

* Atree bugs fix

Fix phantom ray damage
Fix more focus II connection

* Fix item display bugs

missing some damages
effectiveness typo

* Fix builder bugs

damage calc didn't account for rDamPct
morph- shortcut broke

* Fix fatal typo

remove extra console log

Co-authored-by: hppeng <hppeng>
This commit is contained in:
hppeng-wynn 2023-01-03 01:21:45 +00:00 committed by GitHub
parent cc7e5b6818
commit f90794070a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 59 additions and 34 deletions

View file

@ -2334,7 +2334,8 @@ const atrees = {
"base_abil": "Focus", "base_abil": "Focus",
"parents": [ "parents": [
"Cheaper Arrow Bomb II", "Cheaper Arrow Bomb II",
"Grape Bomb" "Grape Bomb",
"Minefield"
], ],
"dependencies": [ "dependencies": [
"Focus" "Focus"
@ -2549,7 +2550,7 @@ const atrees = {
"name": "Total Damage", "name": "Total Damage",
"type": "total", "type": "total",
"hits": { "hits": {
"Single Arrow": 16 "Single Arrow": 12
} }
} }
] ]

View file

@ -89,13 +89,12 @@ function resetFields(){
} }
} }
for (const elem of skp_order) { 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").value = 0;
document.getElementById(elem + "_boost_armor").style.background = `linear-gradient(to right, #AAAAAA, #AAAAAA 0%, #AAAAAA 100%)`; 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`; 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, armor_powder_node]); const nodes_to_reset = equip_inputs.concat(powder_nodes).concat(edit_input_nodes).concat([powder_special_input, boosts_node, armor_powder_node]);
for (const node of nodes_to_reset) { for (const node of nodes_to_reset) {
node.mark_dirty(); node.mark_dirty();
} }
@ -368,7 +367,7 @@ async function init() {
console.log(e); console.log(e);
} }
builder_graph_init(save_skp); builder_graph_init(save_skp);
for (const item_node of item_nodes) { for (const item_node of item_final_nodes) {
if (item_node.get_value() === null) { if (item_node.get_value() === null) {
// likely DB load failure... // likely DB load failure...
if (confirm('One or more items failed to load correctly. This could be due to a corrupted build link, or (more likely) a database load failure. Would you like to reload?')) { if (confirm('One or more items failed to load correctly. This could be due to a corrupted build link, or (more likely) a database load failure. Would you like to reload?')) {

View file

@ -183,7 +183,7 @@ class ItemInputNode extends InputNode {
for (const [i, x] of zip2(equipment_inputs, replace_items)) { setValue(i, x); } for (const [i, x] of zip2(equipment_inputs, replace_items)) { setValue(i, x); }
for (const node of item_nodes) { for (const node of equip_inputs) {
if (node !== this) { if (node !== this) {
// save a tiny bit of compute // save a tiny bit of compute
calcSchedule(node, 10); calcSchedule(node, 10);
@ -1034,8 +1034,7 @@ class SumNumberInputNode extends InputNode {
} }
} }
let item_nodes = []; let item_final_nodes = [];
let item_nodes_map = new Map();
let powder_nodes = []; let powder_nodes = [];
let edit_input_nodes = []; let edit_input_nodes = [];
let skp_inputs = []; let skp_inputs = [];
@ -1079,8 +1078,7 @@ function builder_graph_init(save_skp) {
.link_to(powder_node, 'powdering').link_to(item_input, 'item'); .link_to(powder_node, 'powdering').link_to(item_input, 'item');
item_input = item_powdering; item_input = item_powdering;
} }
item_nodes.push(item_input); item_final_nodes.push(item_input);
item_nodes_map.set(eq, item_input);
new ItemInputDisplayNode(eq+'-input-display', eq, item_image).link_to(item_input); new ItemInputDisplayNode(eq+'-input-display', eq, item_image).link_to(item_input);
new ItemDisplayNode(eq+'-item-display', display_elem).link_to(item_input); new ItemDisplayNode(eq+'-item-display', display_elem).link_to(item_input);
//new PrintNode(eq+'-debug').link_to(item_input); //new PrintNode(eq+'-debug').link_to(item_input);
@ -1094,7 +1092,7 @@ function builder_graph_init(save_skp) {
let item_input = new ItemInputNode(eq+'-input', input_field, none_item); let item_input = new ItemInputNode(eq+'-input', input_field, none_item);
equip_inputs.push(item_input); equip_inputs.push(item_input);
item_nodes.push(item_input); item_final_nodes.push(item_input);
new ItemInputDisplayNode(eq+'-input-display', eq, item_image).link_to(item_input); new ItemInputDisplayNode(eq+'-input-display', eq, item_image).link_to(item_input);
build_node.link_to(item_input, eq); build_node.link_to(item_input, eq);
} }
@ -1102,7 +1100,7 @@ function builder_graph_init(save_skp) {
// weapon image changer node. // weapon image changer node.
let weapon_image = document.getElementById("weapon-img"); let weapon_image = document.getElementById("weapon-img");
let weapon_dps = document.getElementById("weapon-dps"); let weapon_dps = document.getElementById("weapon-dps");
new WeaponInputDisplayNode('weapon-type', weapon_image, weapon_dps).link_to(item_nodes[8]); new WeaponInputDisplayNode('weapon-type', weapon_image, weapon_dps).link_to(item_final_nodes[8]);
// linking to atree verification // linking to atree verification
atree_validate.link_to(level_input, 'level'); atree_validate.link_to(level_input, 'level');

View file

@ -190,7 +190,6 @@ let graph_live_update = false;
* @param node : ComputeNode to schedule an update for. * @param node : ComputeNode to schedule an update for.
*/ */
function calcSchedule(node, timeout) { function calcSchedule(node, timeout) {
if (!graph_live_update) return;
if (node.update_task !== null) { if (node.update_task !== null) {
clearTimeout(node.update_task); clearTimeout(node.update_task);
} }
@ -227,8 +226,8 @@ class InputNode extends ValueCheckComputeNode {
constructor(name, input_field) { constructor(name, input_field) {
super(name); super(name);
this.input_field = input_field; this.input_field = input_field;
this.input_field.addEventListener("input", () => calcSchedule(this, 500)); this.input_field.addEventListener("input", () => { if (graph_live_update) calcSchedule(this, 500) } );
this.input_field.addEventListener("change", () => calcSchedule(this, 5)); this.input_field.addEventListener("change", () => { if (graph_live_update) calcSchedule(this, 5) } );
//calcSchedule(this); Manually fire first update for better control //calcSchedule(this); Manually fire first update for better control
} }

View file

@ -134,7 +134,7 @@ function calculateSpellDamage(stats, weapon, _conversions, use_spell_damage, ign
let damageBoost = 1 + skill_boost[i] + static_boost let damageBoost = 1 + skill_boost[i] + static_boost
+ ((stats.get(damage_specific) + stats.get(damage_elements[i]+'DamPct')) /100); + ((stats.get(damage_specific) + stats.get(damage_elements[i]+'DamPct')) /100);
if (i > 0) { if (i > 0) {
damageBoost += stats.get('r'+specific_boost_str+'Pct') / 100; damageBoost += (stats.get('r'+specific_boost_str+'Pct') + stats.get('rDamPct')) / 100;
} }
damages[i][0] *= Math.max(damageBoost, 0); damages[i][0] *= Math.max(damageBoost, 0);
damages[i][1] *= Math.max(damageBoost, 0); damages[i][1] *= Math.max(damageBoost, 0);

View file

@ -35,13 +35,14 @@ let idPrefixes = {"displayName": "",
"str":"Strength: ", "str":"Strength: ",
"dex":"Dexterity: ", "dex":"Dexterity: ",
"int":"Intelligence: ", "int":"Intelligence: ",
"def":"Defense: ","agi":"Agility: ", "def":"Defense: ",
"agi":"Agility: ",
"hpBonus":"Health Bonus: ", "hpBonus":"Health Bonus: ",
"hprRaw":"Health Regen Raw: ", "hprRaw":"Raw Health Regen: ",
"hprPct":"Health Regen %: ", "hprPct":"Health Regen %: ",
"sdRaw":"Raw Spell Damage: ", "sdRaw":"Raw Spell Damage: ",
"rSdRaw":"Elem. Spell Damage Raw: ", "rSdRaw":"Raw Elem. Spell Damage: ",
"nSdRaw":"Neut. Spell Damage Raw: ", "nSdRaw":"Raw Neut. Spell Damage: ",
"eSdRaw":"Raw Earth Spell Damage: ", "eSdRaw":"Raw Earth Spell Damage: ",
"tSdRaw":"Raw Thunder Spell Damage: ", "tSdRaw":"Raw Thunder Spell Damage: ",
"wSdRaw":"Raw Water Spell Damage: ", "wSdRaw":"Raw Water Spell Damage: ",
@ -56,8 +57,8 @@ let idPrefixes = {"displayName": "",
"fSdPct":"% Fire Spell Damage: ", "fSdPct":"% Fire Spell Damage: ",
"aSdPct":"% Air Spell Damage: ", "aSdPct":"% Air Spell Damage: ",
"mdRaw":"Raw Melee Damage: ", "mdRaw":"Raw Melee Damage: ",
"rMdRaw":"Elem. Melee Damage Raw: ", "rMdRaw":"Raw Elem. Melee Damage: ",
"nMdRaw":"Neut. Melee Damage Raw: ", "nMdRaw":"Raw Neut. Melee Damage: ",
"eMdRaw":"Raw Earth Melee Damage: ", "eMdRaw":"Raw Earth Melee Damage: ",
"tMdRaw":"Raw Thunder Melee Damage: ", "tMdRaw":"Raw Thunder Melee Damage: ",
"wMdRaw":"Raw Water Melee Damage: ", "wMdRaw":"Raw Water Melee Damage: ",
@ -71,6 +72,22 @@ let idPrefixes = {"displayName": "",
"wMdPct":"% Water Melee Damage: ", "wMdPct":"% Water Melee Damage: ",
"fMdPct":"% Fire Melee Damage: ", "fMdPct":"% Fire Melee Damage: ",
"aMdPct":"% Air Melee Damage: ", "aMdPct":"% Air Melee Damage: ",
"damRaw":"Raw Damage: ",
"rDamRaw":"Raw Elemental Damage: ",
"nDamRaw":"Raw Neutral Damage: ",
"eDamRaw":"Raw Earth Damage: ",
"tDamRaw":"Raw Thunder Damage: ",
"wDamRaw":"Raw Water Damage: ",
"fDamRaw":"Raw Fire Damage: ",
"aDamRaw":"Raw Air Damage: ",
"damPct":"Damage %: ",
"rDamPct":"Elemental Damage %: ",
"nDamPct":"Neutral Damage %: ",
"eDamPct":"Earth Damage %: ",
"tDamPct":"Thunder Damage %: ",
"wDamPct":"Water Damage %: ",
"fDamPct":"Fire Damage %: ",
"aDamPct":"Air Damage %: ",
"mr":"Mana Regen: ", "mr":"Mana Regen: ",
"ms":"Mana Steal: ", "ms":"Mana Steal: ",
"ref":"Reflection: ", "ref":"Reflection: ",
@ -80,11 +97,6 @@ let idPrefixes = {"displayName": "",
"expd":"Exploding: ", "expd":"Exploding: ",
"spd":"Walk Speed Bonus: ", "spd":"Walk Speed Bonus: ",
"atkTier":"Attack Speed Bonus: ", "atkTier":"Attack Speed Bonus: ",
"eDamPct":"Earth Damage %: ",
"tDamPct":"Thunder Damage %: ",
"wDamPct":"Water Damage %: ",
"fDamPct":"Fire Damage %: ",
"aDamPct":"Air Damage %: ",
"eDefPct":"Earth Defense %: ", "eDefPct":"Earth Defense %: ",
"tDefPct":"Thunder Defense %: ", "tDefPct":"Thunder Defense %: ",
"wDefPct":"Water Defense %: ", "wDefPct":"Water Defense %: ",
@ -175,6 +187,22 @@ let idSuffixes = {"displayName": "",
"wMdPct":"%", "wMdPct":"%",
"fMdPct":"%", "fMdPct":"%",
"aMdPct":"%", "aMdPct":"%",
"damRaw":"",
"rDamRaw":"",
"nDamRaw":"",
"eDamRaw":"",
"tDamRaw":"",
"wDamRaw":"",
"fDamRaw":"",
"aDamRaw":"",
"damPct":"%",
"rDamPct":"%",
"nDamPct":"%",
"eDamPct":"%",
"tDamPct":"%",
"wDamPct":"%",
"fDamPct":"%",
"aDamPct":"%",
"mr":"/5s", "mr":"/5s",
"ms":"/3s", "ms":"/3s",
"ref":"%", "ref":"%",
@ -184,11 +212,6 @@ let idSuffixes = {"displayName": "",
"expd":"%", "expd":"%",
"spd":"%", "spd":"%",
"atkTier":" tier", "atkTier":" tier",
"eDamPct":"%",
"tDamPct":"%",
"wDamPct":"%",
"fDamPct":"%",
"aDamPct":"%",
"eDefPct":"%", "eDefPct":"%",
"tDefPct":"%", "tDefPct":"%",
"wDefPct":"%", "wDefPct":"%",
@ -245,10 +268,10 @@ let itemIDPrefixes = {
//Used for ingredient posMods IDs //Used for ingredient posMods IDs
let posModPrefixes = { let posModPrefixes = {
"left":"Effectiveness Left: ", "left":"Effectiveness Left: ",
"right":"EFfectiveness Right: ", "right":"Effectiveness Right: ",
"above":"Effectiveness Above: ", "above":"Effectiveness Above: ",
"under":"Effectiveness Under: ", "under":"Effectiveness Under: ",
"touching":"EFfectiveness Touching: ", "touching":"Effectiveness Touching: ",
"notTouching":"Effectiveness Not Touching: " "notTouching":"Effectiveness Not Touching: "
} }
let posModSuffixes = { let posModSuffixes = {
@ -292,11 +315,14 @@ let build_detailed_display_commands = [
"sdPct", "nSdPct", "rSdPct", "sdPct", "nSdPct", "rSdPct",
"mdRaw", "nMdRaw", "rMdRaw", "mdRaw", "nMdRaw", "rMdRaw",
"mdPct", "nMdPct", "rMdPct", "mdPct", "nMdPct", "rMdPct",
"damRaw", "nDamRaw", "rDamRaw",
"damPct", "nDamPct", "rDamPct",
"!elemental", "!elemental",
"fSdRaw", "wSdRaw", "aSdRaw", "tSdRaw", "eSdRaw", "fSdRaw", "wSdRaw", "aSdRaw", "tSdRaw", "eSdRaw",
"fSdPct", "wSdPct", "aSdPct", "tSdPct", "eSdPct", "fSdPct", "wSdPct", "aSdPct", "tSdPct", "eSdPct",
"fMdRaw", "wMdRaw", "aMdRaw", "tMdRaw", "eMdRaw", "fMdRaw", "wMdRaw", "aMdRaw", "tMdRaw", "eMdRaw",
"fMdPct", "wMdPct", "aMdPct", "tMdPct", "eMdPct", "fMdPct", "wMdPct", "aMdPct", "tMdPct", "eMdPct",
"fDamRaw", "wDamRaw", "aDamRaw", "tDamRaw", "eDamRaw",
"fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct",
"!elemental", "!elemental",
"spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4",
@ -373,6 +399,8 @@ let sq2_item_display_commands = [
"sdPct", "nSdPct", "eSdPct", "tSdPct", "wSdPct", "fSdPct", "aSdPct", "rSdPct", "sdPct", "nSdPct", "eSdPct", "tSdPct", "wSdPct", "fSdPct", "aSdPct", "rSdPct",
"mdRaw", "nMdRaw", "eMdRaw", "tMdRaw", "wMdRaw", "fMdRaw", "aMdRaw", "rMdRaw", "mdRaw", "nMdRaw", "eMdRaw", "tMdRaw", "wMdRaw", "fMdRaw", "aMdRaw", "rMdRaw",
"mdPct", "nMdPct", "eMdPct", "tMdPct", "wMdPct", "fMdPct", "aMdPct", "rMdPct", "mdPct", "nMdPct", "eMdPct", "tMdPct", "wMdPct", "fMdPct", "aMdPct", "rMdPct",
"damRaw", "nDamRaw", "eDamRaw", "tDamRaw", "wDamRaw", "fDamRaw", "aDamRaw", "rDamRaw",
"damPct", "nDamPct", "eDamPct", "tDamPct", "wDamPct", "fDamPct", "aDamPct", "rDamPct",
"mr", "ms", "mr", "ms",
"ref", "thorns", "ref", "thorns",
"ls", "ls",