From 4aee8f2d31f6f799d2b3990de018c0a764430ed5 Mon Sep 17 00:00:00 2001 From: fin444 Date: Thu, 21 Jul 2022 11:26:46 -0700 Subject: [PATCH 1/2] dependencies in atree tooltips --- js/atree.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/js/atree.js b/js/atree.js index 623aa29..1e9bd6b 100644 --- a/js/atree.js +++ b/js/atree.js @@ -1143,6 +1143,7 @@ function generateTooltip(UI_elem, node_elem, ability, atree_map) { let apUsed = 0; let maxAP = parseInt(document.getElementById("active_AP_cap").innerHTML); let archChosen = 0; + let satisfiedDependencies = []; let blockedBy = []; for (let [id, node_wrap] of atree_map.entries()) { if (!node_wrap.active || id == ability.id) { @@ -1152,6 +1153,9 @@ function generateTooltip(UI_elem, node_elem, ability, atree_map) { if (node_wrap.ability.archetype == ability.archetype) { archChosen++; } + if (ability.dependencies.includes(id)) { + satisfiedDependencies.push(id); + } if (ability.blockers.includes(id)) { blockedBy.push(node_wrap.ability.display_name); } @@ -1182,6 +1186,19 @@ function generateTooltip(UI_elem, node_elem, ability, atree_map) { container.appendChild(archReq); } + // dependencies + console.log(satisfiedDependencies) + for (let i = 0; i < ability.dependencies.length; i++) { + let dependency = make_elem("p", ["scaled-font-sm", "my-0", "mx-1"], {}); + if (satisfiedDependencies.includes(ability.dependencies[i])) { + dependency.innerHTML = reqYes; + } else { + dependency.innerHTML = reqNo; + } + dependency.innerHTML += " Required Ability: " + atree_map.get(ability.dependencies[i]).ability.display_name; + container.appendChild(dependency); + } + // blockers for (let i = 0; i < blockedBy.length; i++) { let blocker = make_elem("p", ["scaled-font-sm", "my-0", "mx-1"], {}); From 868e56b0ea6c89b7f53cb0f31493e628f851c373 Mon Sep 17 00:00:00 2001 From: fin444 Date: Thu, 21 Jul 2022 17:17:33 -0700 Subject: [PATCH 2/2] remove print statement --- js/atree.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/atree.js b/js/atree.js index 1e9bd6b..2b38f27 100644 --- a/js/atree.js +++ b/js/atree.js @@ -1187,7 +1187,6 @@ function generateTooltip(UI_elem, node_elem, ability, atree_map) { } // dependencies - console.log(satisfiedDependencies) for (let i = 0; i < ability.dependencies.length; i++) { let dependency = make_elem("p", ["scaled-font-sm", "my-0", "mx-1"], {}); if (satisfiedDependencies.includes(ability.dependencies[i])) {