Fix More Focus base_abil, display sliders
This commit is contained in:
parent
4a1939b5a1
commit
cdaff5fce9
4 changed files with 67 additions and 39 deletions
96
js/atree.js
96
js/atree.js
|
@ -174,6 +174,30 @@ const atree_node = new (class extends ComputeNode {
|
|||
}
|
||||
})();
|
||||
|
||||
/**
|
||||
* Create a reverse topological sort of the tree in the result list.
|
||||
*
|
||||
* https://en.wikipedia.org/wiki/Topological_sorting
|
||||
* @param tree: Root of tree to sort
|
||||
* @param res: Result list (reverse topological order)
|
||||
* @param mark_state: Bookkeeping. Call with empty Map()
|
||||
*/
|
||||
function topological_sort_tree(tree, res, mark_state) {
|
||||
const state = mark_state.get(tree);
|
||||
if (state === undefined) {
|
||||
// unmarked.
|
||||
mark_state.set(tree, false); // temporary mark
|
||||
for (const child of tree.children) {
|
||||
topological_sort_tree(child, res, mark_state);
|
||||
}
|
||||
mark_state.set(tree, true); // permanent mark
|
||||
res.push(tree);
|
||||
}
|
||||
// these cases are not needed. Case 1 does nothing, case 2 should never happen.
|
||||
// else if (state === true) { return; } // permanent mark.
|
||||
// else if (state === false) { throw "not a DAG"; } // temporary mark.
|
||||
}
|
||||
|
||||
/**
|
||||
* Display ability tree from topologically sorted list.
|
||||
*
|
||||
|
@ -216,30 +240,6 @@ const atree_state_node = new (class extends ComputeNode {
|
|||
}
|
||||
})().link_to(atree_render, 'atree-render');
|
||||
|
||||
/**
|
||||
* Create a reverse topological sort of the tree in the result list.
|
||||
*
|
||||
* https://en.wikipedia.org/wiki/Topological_sorting
|
||||
* @param tree: Root of tree to sort
|
||||
* @param res: Result list (reverse topological order)
|
||||
* @param mark_state: Bookkeeping. Call with empty Map()
|
||||
*/
|
||||
function topological_sort_tree(tree, res, mark_state) {
|
||||
const state = mark_state.get(tree);
|
||||
if (state === undefined) {
|
||||
// unmarked.
|
||||
mark_state.set(tree, false); // temporary mark
|
||||
for (const child of tree.children) {
|
||||
topological_sort_tree(child, res, mark_state);
|
||||
}
|
||||
mark_state.set(tree, true); // permanent mark
|
||||
res.push(tree);
|
||||
}
|
||||
// these cases are not needed. Case 1 does nothing, case 2 should never happen.
|
||||
// else if (state === true) { return; } // permanent mark.
|
||||
// else if (state === false) { throw "not a DAG"; } // temporary mark.
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect abilities and condense them into a list of "final abils".
|
||||
* This is just for rendering purposes, and for collecting things that modify spells into one chunk.
|
||||
|
@ -575,22 +575,48 @@ const atree_make_interactives = new (class extends ComputeNode {
|
|||
const merged_abils = input_map.get('atree-merged');
|
||||
const atree_order = input_map.get('atree-order');
|
||||
const atree_html = input_map.get('atree-elements');
|
||||
|
||||
const ret_states = [];
|
||||
|
||||
/**
|
||||
* slider_info {
|
||||
* label_name: str,
|
||||
* max: int,
|
||||
* step: int,
|
||||
* id: str,
|
||||
* abil: atree_node
|
||||
* }
|
||||
*/
|
||||
// Map<str, slider_info>
|
||||
const slider_map = new Map();
|
||||
|
||||
// first, pull out all the sliders.
|
||||
for (const [abil_id, abil] of merged_abils.entries()) {
|
||||
for (const [abil_id, ability] of merged_abils.entries()) {
|
||||
for (const effect of ability.effects) {
|
||||
if (effect['type'] === "stat_scaling" && effect['slider'] === true) {
|
||||
const { slider_name, slider_behavior = 'merge', slider_max, slider_step } = effect;
|
||||
if (slider_map.has(slider_name)) {
|
||||
const slider_info = slider_map.get(slider_name);
|
||||
slider_info.max += slider_max;
|
||||
}
|
||||
else if (slider_behavior === 'merge') {
|
||||
slider_map.set(slider_name, {
|
||||
label_name: slider_name,
|
||||
max: slider_max,
|
||||
step: slider_step,
|
||||
id: "ability-slider"+ability.id,
|
||||
//color: effect['slider_color'] TODO: add colors to json
|
||||
abil: ability
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// next, render the sliders onto the abilities.
|
||||
for (const [slider_name, slider_info] of slider_map.entries()) {
|
||||
let slider_container = gen_slider_labeled(slider_info);
|
||||
atree_html.get(slider_info.abil.id).appendChild(slider_container);
|
||||
}
|
||||
//add in slider(s)
|
||||
// for (const effect of ability.effects) {
|
||||
// if (effect['type'] === "stat_scaling" && effect['slider'] === true) {
|
||||
// let slider_container = gen_slider_labeled(effect['slider_name'], [], effect['min'], effect['max'], effect['slider_step'], effect['default_val'], "ability-slider" + ability.id, effect['slider_color'], []);
|
||||
// active_tooltip.appendChild(slider_container);
|
||||
// }
|
||||
// }
|
||||
// active_tooltip.id = "atree-ab-" + ability.id;
|
||||
//
|
||||
// active_tooltip.appendChild(tooltip_cost.cloneNode(true));
|
||||
return ret_states;
|
||||
}
|
||||
})().link_to(atree_node, 'atree-order').link_to(atree_merge, 'atree-merged').link_to(atree_render_active, 'atree-elements');
|
||||
|
|
|
@ -1699,6 +1699,7 @@ const atrees = {
|
|||
"desc": "Add +2 max Focus",
|
||||
"archetype": "Sharpshooter",
|
||||
"archetype_req": 0,
|
||||
"base_abil": "Focus",
|
||||
"parents": ["Cheaper Arrow Storm", "Grappling Hook"],
|
||||
"dependencies": ["Focus"],
|
||||
"blockers": [],
|
||||
|
@ -1726,6 +1727,7 @@ const atrees = {
|
|||
"desc": "Add +2 max Focus",
|
||||
"archetype": "Sharpshooter",
|
||||
"archetype_req": 0,
|
||||
"base_abil": "Focus",
|
||||
"parents": ["Crepuscular Ray", "Snow Storm"],
|
||||
"dependencies": ["Focus"],
|
||||
"blockers": [],
|
||||
|
@ -2204,7 +2206,7 @@ const atrees = {
|
|||
|
||||
{
|
||||
"display_name": "Tougher Skin",
|
||||
"desc": "Harden your skin and become permanently +5% more resistant\nFor every 1% or 1 Raw Heath Regen you have from items, gain +10 Health (Max 100)",
|
||||
"desc": "Harden your skin and become permanently +5% more resistant. For every 1% or 1 Raw Heath Regen you have from items, gain +10 Health (Max 100)",
|
||||
"archetype": "Paladin",
|
||||
"archetype_req": 0,
|
||||
"parents": ["Charge"],
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -16,8 +16,8 @@ function skillPointsToPercentage(skp){
|
|||
}
|
||||
|
||||
// WYNN2: Skillpoint max scaling. Intel is cost reduction
|
||||
const skillpoint_final_mult = [1, 1, 0.5, 0.867, 0.951];
|
||||
// intel damage and water%
|
||||
const skillpoint_final_mult = [1, 1, 0.5/skillPointsToPercentage(150), 0.867, 0.951];
|
||||
// intel water%
|
||||
const skillpoint_damage_mult = [1, 1, 1, 0.867, 0.951];
|
||||
|
||||
/*Turns the input amount of levels into skillpoints available.
|
||||
|
|
Loading…
Add table
Reference in a new issue