Merge pull request #167 from hppeng-wynn/atree_reachable_fix

Fix reachable check to use currently reachable set instead of atree selection state
This commit is contained in:
hppeng-wynn 2022-07-25 00:20:21 -07:00 committed by GitHub
commit dcdf281612
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -310,7 +310,7 @@ function abil_can_activate(atree_node, atree_state, reachable, archetype_count,
}
let failed_deps = [];
for (const dep_id of ability.dependencies) {
if (!atree_state.get(dep_id).active) { failed_deps.push(dep_id) }
if (!reachable.has(dep_id)) { failed_deps.push(dep_id) }
}
if (failed_deps.length > 0) {
const dep_strings = failed_deps.map(i => '"' + atree_state.get(i).ability.display_name + '"');
@ -318,7 +318,7 @@ function abil_can_activate(atree_node, atree_state, reachable, archetype_count,
}
let blocking_ids = [];
for (const blocker_id of ability.blockers) {
if (atree_state.get(blocker_id).active) { blocking_ids.push(blocker_id); }
if (reachable.has(blocker_id)) { blocking_ids.push(blocker_id); }
}
if (blocking_ids.length > 0) {
const blockers_strings = blocking_ids.map(i => '"' + atree_state.get(i).ability.display_name + '"');