Merge pull request #159 from fin444/atree

dependencies in atree tooltips
This commit is contained in:
hppeng-wynn 2022-07-21 21:55:35 -07:00 committed by GitHub
commit 2824a971f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,18 @@ function generateTooltip(UI_elem, node_elem, ability, atree_map) {
container.appendChild(archReq);
}
// dependencies
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"], {});