HOTFIX: str/dex optimizer working now
This commit is contained in:
parent
ef5dd8f6c6
commit
5f9c0d5185
3 changed files with 12 additions and 26 deletions
|
@ -223,9 +223,8 @@ class ItemInputNode extends InputNode {
|
||||||
|
|
||||||
for (const [i, x] of zip2(equipment_inputs, replace_items)) { setValue(i, x); }
|
for (const [i, x] of zip2(equipment_inputs, replace_items)) { setValue(i, x); }
|
||||||
|
|
||||||
// NOTE: DO NOT REORDER FOR PERFORMANCE REASONS
|
for (const node of item_nodes) { calcSchedule(node, 10); }
|
||||||
for (const node of item_nodes) { node.mark_dirty(); }
|
return this.compute_func(input_map);
|
||||||
for (const node of item_nodes) { node.update(); }
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -942,6 +941,7 @@ let item_nodes = [];
|
||||||
let powder_nodes = [];
|
let powder_nodes = [];
|
||||||
let spelldmg_nodes = [];
|
let spelldmg_nodes = [];
|
||||||
let edit_input_nodes = [];
|
let edit_input_nodes = [];
|
||||||
|
let skp_inputs = [];
|
||||||
|
|
||||||
function builder_graph_init() {
|
function builder_graph_init() {
|
||||||
// Phase 1/2: Set up item input, propagate updates, etc.
|
// Phase 1/2: Set up item input, propagate updates, etc.
|
||||||
|
@ -1022,7 +1022,6 @@ function builder_graph_init() {
|
||||||
edit_id_output = new EditableIDSetterNode(edit_input_nodes); // Makes shallow copy of list.
|
edit_id_output = new EditableIDSetterNode(edit_input_nodes); // Makes shallow copy of list.
|
||||||
edit_id_output.link_to(build_node);
|
edit_id_output.link_to(build_node);
|
||||||
|
|
||||||
let skp_inputs = [];
|
|
||||||
for (const skp of skp_order) {
|
for (const skp of skp_order) {
|
||||||
const elem = document.getElementById(skp+'-skp');
|
const elem = document.getElementById(skp+'-skp');
|
||||||
const node = new SumNumberInputNode('builder-'+skp+'-input', elem);
|
const node = new SumNumberInputNode('builder-'+skp+'-input', elem);
|
||||||
|
|
|
@ -51,7 +51,6 @@ function displaySetBonuses(parent_id,build) {
|
||||||
}
|
}
|
||||||
mock_item.set("powders", []);
|
mock_item.set("powders", []);
|
||||||
displayExpandedItem(mock_item, set_elem.id);
|
displayExpandedItem(mock_item, set_elem.id);
|
||||||
console.log(mock_item);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ function optimizeStrDex() {
|
||||||
total_skillpoints[1] += Math.min(max_dex_boost, dex_bonus);
|
total_skillpoints[1] += Math.min(max_dex_boost, dex_bonus);
|
||||||
|
|
||||||
// Calculate total 3rd spell damage
|
// Calculate total 3rd spell damage
|
||||||
let spell = spell_table[player_build.weapon.get("type")][2];
|
let spell = spell_table[player_build.weapon.statMap.get("type")][2];
|
||||||
const stats = player_build.statMap;
|
const stats = player_build.statMap;
|
||||||
let critChance = skillPointsToPercentage(total_skillpoints[1]);
|
let critChance = skillPointsToPercentage(total_skillpoints[1]);
|
||||||
let save_damages = [];
|
let save_damages = [];
|
||||||
|
@ -41,8 +41,7 @@ function optimizeStrDex() {
|
||||||
if (part.type === "damage") {
|
if (part.type === "damage") {
|
||||||
let _results = calculateSpellDamage(stats, part.conversion,
|
let _results = calculateSpellDamage(stats, part.conversion,
|
||||||
stats.get("sdRaw"), stats.get("sdPct"),
|
stats.get("sdRaw"), stats.get("sdPct"),
|
||||||
part.multiplier / 100, player_build.weapon, total_skillpoints,
|
part.multiplier / 100, player_build.weapon.statMap, total_skillpoints, 1);
|
||||||
player_build.damageMultiplier, player_build.externalStats);
|
|
||||||
let totalDamNormal = _results[0];
|
let totalDamNormal = _results[0];
|
||||||
let totalDamCrit = _results[1];
|
let totalDamCrit = _results[1];
|
||||||
let results = _results[2];
|
let results = _results[2];
|
||||||
|
@ -75,27 +74,16 @@ function optimizeStrDex() {
|
||||||
|
|
||||||
str_bonus -= 1;
|
str_bonus -= 1;
|
||||||
dex_bonus += 1;
|
dex_bonus += 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
// TODO: reduce duplicated code, @calculateBuild
|
console.log(best_skillpoints);
|
||||||
let skillpoints = player_build.total_skillpoints;
|
|
||||||
let delta_total = 0;
|
// TODO do not merge for performance reasons
|
||||||
for (let i in skp_order) {
|
for (let i in skp_order) {
|
||||||
let manual_assigned = best_skillpoints[i];
|
skp_inputs[i].input_field.value = best_skillpoints[i];
|
||||||
let delta = manual_assigned - skillpoints[i];
|
skp_inputs[i].mark_dirty();
|
||||||
skillpoints[i] = manual_assigned;
|
|
||||||
player_build.base_skillpoints[i] += delta;
|
|
||||||
delta_total += delta;
|
|
||||||
}
|
}
|
||||||
player_build.assigned_skillpoints += delta_total;
|
for (let i in skp_order) {
|
||||||
|
skp_inputs[i].update();
|
||||||
try {
|
|
||||||
calculateBuildStats();
|
|
||||||
if (player_build.errored)
|
|
||||||
throw new ListError(player_build.errors);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
handleBuilderError(error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue