Merge pull request #116 from hppeng-wynn/atree-validation-hotfix
Fix bug that would count abilities' AP cost and archetype even if it was not "added" to AT
This commit is contained in:
commit
6cb003f9bd
1 changed files with 3 additions and 17 deletions
20
js/atree.js
20
js/atree.js
|
@ -402,6 +402,7 @@ const atree_validate = new (class extends ComputeNode {
|
||||||
const [success, hard_error, reason] = abil_can_activate(node, atree_state, reachable, archetype_count, 9999);
|
const [success, hard_error, reason] = abil_can_activate(node, atree_state, reachable, archetype_count, 9999);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
_add.push([node, reason, hard_error]);
|
_add.push([node, reason, hard_error]);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if ('archetype' in ability && ability.archetype !== "") {
|
if ('archetype' in ability && ability.archetype !== "") {
|
||||||
let val = 1;
|
let val = 1;
|
||||||
|
@ -1099,7 +1100,7 @@ function resolve_connector(atree_connectors_map, pos, new_connector) {
|
||||||
function set_connector_type(connector_info) { // left right up down
|
function set_connector_type(connector_info) { // left right up down
|
||||||
const connections = connector_info.connections;
|
const connections = connector_info.connections;
|
||||||
const connector_elem = connector_info.connector;
|
const connector_elem = connector_info.connector;
|
||||||
let connector_dict = {
|
const connector_dict = {
|
||||||
"1100": {type: "line", rotate: 90},
|
"1100": {type: "line", rotate: 90},
|
||||||
"1010": {type: "angle", rotate: 0},
|
"1010": {type: "angle", rotate: 0},
|
||||||
"1001": {type: "angle", rotate: 270},
|
"1001": {type: "angle", rotate: 270},
|
||||||
|
@ -1115,7 +1116,7 @@ function set_connector_type(connector_info) { // left right up down
|
||||||
|
|
||||||
let lookup_str = "";
|
let lookup_str = "";
|
||||||
for (let i of connections) {
|
for (let i of connections) {
|
||||||
if (i != 0) {
|
if (i) {
|
||||||
lookup_str += 1;
|
lookup_str += 1;
|
||||||
} else {
|
} else {
|
||||||
lookup_str += 0;
|
lookup_str += 0;
|
||||||
|
@ -1171,21 +1172,6 @@ function atree_set_state(node_wrapper, new_state) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// refresh all connector to default state, then try to calculate the connector for all node
|
|
||||||
function atree_update_connector() {
|
|
||||||
atree_connectors_map.forEach((v) => {
|
|
||||||
if (v.length != 0) {
|
|
||||||
let connector_elem = document.createElement("img");
|
|
||||||
connector_elem.style = "width: 100%; height: 100%;";
|
|
||||||
connector_elem.src = '../media/atree/connect_' + v[0].type + '.png'
|
|
||||||
v[0].replaceChildren(connector_elem);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
atree_map.forEach((v) => {
|
|
||||||
atree_compute_highlight(v);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function atree_set_edge(atree_connectors_map, parent, child, state) {
|
function atree_set_edge(atree_connectors_map, parent, child, state) {
|
||||||
const connectors = child.connectors.get(parent);
|
const connectors = child.connectors.get(parent);
|
||||||
const parent_row = parent.ability.display.row;
|
const parent_row = parent.ability.display.row;
|
||||||
|
|
Loading…
Reference in a new issue