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); }
|
||||
|
||||
// NOTE: DO NOT REORDER FOR PERFORMANCE REASONS
|
||||
for (const node of item_nodes) { node.mark_dirty(); }
|
||||
for (const node of item_nodes) { node.update(); }
|
||||
for (const node of item_nodes) { calcSchedule(node, 10); }
|
||||
return this.compute_func(input_map);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -942,6 +941,7 @@ let item_nodes = [];
|
|||
let powder_nodes = [];
|
||||
let spelldmg_nodes = [];
|
||||
let edit_input_nodes = [];
|
||||
let skp_inputs = [];
|
||||
|
||||
function builder_graph_init() {
|
||||
// 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.link_to(build_node);
|
||||
|
||||
let skp_inputs = [];
|
||||
for (const skp of skp_order) {
|
||||
const elem = document.getElementById(skp+'-skp');
|
||||
const node = new SumNumberInputNode('builder-'+skp+'-input', elem);
|
||||
|
|
|
@ -51,7 +51,6 @@ function displaySetBonuses(parent_id,build) {
|
|||
}
|
||||
mock_item.set("powders", []);
|
||||
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);
|
||||
|
||||
// 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;
|
||||
let critChance = skillPointsToPercentage(total_skillpoints[1]);
|
||||
let save_damages = [];
|
||||
|
@ -41,8 +41,7 @@ function optimizeStrDex() {
|
|||
if (part.type === "damage") {
|
||||
let _results = calculateSpellDamage(stats, part.conversion,
|
||||
stats.get("sdRaw"), stats.get("sdPct"),
|
||||
part.multiplier / 100, player_build.weapon, total_skillpoints,
|
||||
player_build.damageMultiplier, player_build.externalStats);
|
||||
part.multiplier / 100, player_build.weapon.statMap, total_skillpoints, 1);
|
||||
let totalDamNormal = _results[0];
|
||||
let totalDamCrit = _results[1];
|
||||
let results = _results[2];
|
||||
|
@ -75,27 +74,16 @@ function optimizeStrDex() {
|
|||
|
||||
str_bonus -= 1;
|
||||
dex_bonus += 1;
|
||||
|
||||
}
|
||||
// TODO: reduce duplicated code, @calculateBuild
|
||||
let skillpoints = player_build.total_skillpoints;
|
||||
let delta_total = 0;
|
||||
console.log(best_skillpoints);
|
||||
|
||||
// TODO do not merge for performance reasons
|
||||
for (let i in skp_order) {
|
||||
let manual_assigned = best_skillpoints[i];
|
||||
let delta = manual_assigned - skillpoints[i];
|
||||
skillpoints[i] = manual_assigned;
|
||||
player_build.base_skillpoints[i] += delta;
|
||||
delta_total += delta;
|
||||
skp_inputs[i].input_field.value = best_skillpoints[i];
|
||||
skp_inputs[i].mark_dirty();
|
||||
}
|
||||
player_build.assigned_skillpoints += delta_total;
|
||||
|
||||
try {
|
||||
calculateBuildStats();
|
||||
if (player_build.errored)
|
||||
throw new ListError(player_build.errors);
|
||||
}
|
||||
catch (error) {
|
||||
handleBuilderError(error);
|
||||
for (let i in skp_order) {
|
||||
skp_inputs[i].update();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue