dependencies in atree tooltips
This commit is contained in:
parent
f99e813348
commit
4aee8f2d31
1 changed files with 17 additions and 0 deletions
17
js/atree.js
17
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 += " <span class = 'mc-gray'>Required Ability:</span> " + 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"], {});
|
||||
|
|
Loading…
Add table
Reference in a new issue