More misc fixes

Make builder not barf with classes without atree (to reduce confusion)
Skillpoint %effect changes (def/agi, ehp calc)
This commit is contained in:
hppeng 2022-07-05 00:51:02 -07:00
parent 6980005924
commit 98d2486ceb
4 changed files with 14 additions and 21 deletions

View file

@ -1275,20 +1275,7 @@
</div> </div>
<div id="all-spells-display" class="row row-cols-1 gy-3 text-center scaled-font pe-0"> <div id="all-spells-display" class="row row-cols-1 gy-3 text-center scaled-font pe-0">
<div class = "col pe-0"> <div class = "col pe-0">
<div class = "col spell-display spell-expand dark-5 rounded dark-shadow pt-2 border border-dark" id="spell0-infoAvg">spell1</div> <div class = "col spell-display spell-expand dark-5 rounded dark-shadow pt-2 border border-dark" id="spell0-infoAvg">Input a weapon to see abilities!</div>
<div class = "col spell-display dark-5 rounded dark-shadow py-2" id = "spell0-info" style="display: none;">Spell 1</div>
</div>
<div class = "col pe-0">
<div class = "col spell-display spell-expand dark-5 rounded dark-shadow pt-2 border border-dark" id="spell1-infoAvg">spell2</div>
<div class = "col spell-display dark-5 rounded dark-shadow py-2" id = "spell1-info" style="display: none;">Spell 2</div>
</div>
<div class = "col pe-0">
<div class = "col spell-display spell-expand dark-5 rounded dark-shadow pt-2 border border-dark" id="spell2-infoAvg">spell3</div>
<div class = "col spell-display dark-5 rounded dark-shadow py-2" id = "spell2-info" style="display: none;">Spell 3</div>
</div>
<div class = "col pe-0">
<div class = "col spell-display spell-expand dark-5 rounded dark-shadow pt-2 border border-dark" id="spell3-infoAvg">spell4</div>
<div class = "col spell-display dark-5 rounded dark-shadow py-2" id = "spell3-info" style="display: none;">Spell 4</div>
</div> </div>
</div> </div>
<div class = "col"> <div class = "col">

View file

@ -141,7 +141,7 @@ const atree_node = new (class extends ComputeNode {
const [player_class] = input_map.values(); // Extract values, pattern match it into size one list and bind to first element const [player_class] = input_map.values(); // Extract values, pattern match it into size one list and bind to first element
const atree_raw = atrees[player_class]; const atree_raw = atrees[player_class];
if (!atree_raw) return null; if (!atree_raw) return [];
let atree_map = new Map(); let atree_map = new Map();
let atree_head; let atree_head;
@ -308,6 +308,8 @@ const atree_validate = new (class extends ComputeNode {
const atree_state = input_map.get('atree-state'); const atree_state = input_map.get('atree-state');
const atree_order = input_map.get('atree'); const atree_order = input_map.get('atree');
if (atree_order.length == 0) { return [0, ['no atree data']]; }
let errors = []; let errors = [];
let reachable = new Map(); let reachable = new Map();
atree_dfs_mark(atree_order[0], atree_state, reachable); atree_dfs_mark(atree_order[0], atree_state, reachable);
@ -473,7 +475,7 @@ const atree_collect_spells = new (class extends ComputeNode {
case 'add_spell_prop': { case 'add_spell_prop': {
const { base_spell, target_part = null, cost = 0, behavior = 'merge'} = effect; const { base_spell, target_part = null, cost = 0, behavior = 'merge'} = effect;
if (base_spell !== base_spell_id) { continue; } // TODO: redundant? if we assume abils only affect one spell if (base_spell !== base_spell_id) { continue; } // TODO: redundant? if we assume abils only affect one spell
ret_spell.cost += cost; if ('cost' in ret_spell) { ret_spell.cost += cost; }
if (target_part === null) { if (target_part === null) {
continue; continue;

View file

@ -200,7 +200,7 @@ function encodeBuild(build, powders, skillpoints, atree, atree_state) {
} }
build_string += tome_string; build_string += tome_string;
if (atree_state.get(atree[0].ability.id).active) { if (atree.length > 0 && atree_state.get(atree[0].ability.id).active) {
build_version = Math.max(build_version, 7); build_version = Math.max(build_version, 7);
const bitvec = encode_atree(atree, atree_state); const bitvec = encode_atree(atree, atree_state);
build_string += bitvec.toB64(); build_string += bitvec.toB64();

View file

@ -502,8 +502,8 @@ class SpellSelectNode extends ComputeNode {
*/ */
function getDefenseStats(stats) { function getDefenseStats(stats) {
let defenseStats = []; let defenseStats = [];
let def_pct = skillPointsToPercentage(stats.get('def')); let def_pct = skillPointsToPercentage(stats.get('def')) * 0.867; // lol
let agi_pct = skillPointsToPercentage(stats.get('agi')); let agi_pct = skillPointsToPercentage(stats.get('agi')) * 0.951; // lol2
//total hp //total hp
let totalHp = stats.get("hp") + stats.get("hpBonus"); let totalHp = stats.get("hp") + stats.get("hpBonus");
if (totalHp < 5) totalHp = 5; if (totalHp < 5) totalHp = 5;
@ -511,7 +511,10 @@ function getDefenseStats(stats) {
//EHP //EHP
let ehp = [totalHp, totalHp]; let ehp = [totalHp, totalHp];
let defMult = (2 - stats.get("classDef")) * stats.get("defMultiplier"); let defMult = (2 - stats.get("classDef")) * stats.get("defMultiplier");
ehp[0] /= (1-def_pct)*(1-agi_pct)*defMult; // newehp = oldehp / [0.1 * A(x) + (1 - A(x)) * (1 - D(x))]
ehp[0] = ehp[0] / (0.1*agi_pct + (1-agi_pct) * (1-def_pct));
ehp[0] /= defMult;
// ehp[0] /= (1-def_pct)*(1-agi_pct)*defMult;
ehp[1] /= (1-def_pct)*defMult; ehp[1] /= (1-def_pct)*defMult;
defenseStats.push(ehp); defenseStats.push(ehp);
//HPR //HPR
@ -763,6 +766,7 @@ class DisplayBuildWarningsNode extends ComputeNode {
]; ];
let skp_effects = ["% more damage dealt.","% chance to crit.","% spell cost reduction.","% less damage taken.","% chance to dodge."]; let skp_effects = ["% more damage dealt.","% chance to crit.","% spell cost reduction.","% less damage taken.","% chance to dodge."];
let total_assigned = 0; let total_assigned = 0;
const mults = [1, 1, 0.5, 0.867, 0.951];
for (let i in skp_order){ //big bren for (let i in skp_order){ //big bren
const assigned = skillpoints[i] - base_totals[i] + min_assigned[i] const assigned = skillpoints[i] - base_totals[i] + min_assigned[i]
setText(skp_order[i] + "-skp-base", "Original: " + base_totals[i]); setText(skp_order[i] + "-skp-base", "Original: " + base_totals[i]);
@ -770,7 +774,7 @@ class DisplayBuildWarningsNode extends ComputeNode {
setValue(skp_order[i] + "-skp", skillpoints[i]); setValue(skp_order[i] + "-skp", skillpoints[i]);
let linebreak = document.createElement("br"); let linebreak = document.createElement("br");
linebreak.classList.add("itemp"); linebreak.classList.add("itemp");
setText(skp_order[i] + "-skp-pct", (skillPointsToPercentage(skillpoints[i])*100).toFixed(1).concat(skp_effects[i])); setText(skp_order[i] + "-skp-pct", (skillPointsToPercentage(skillpoints[i])*100*mults[i]).toFixed(1).concat(skp_effects[i]));
document.getElementById(skp_order[i]+"-warnings").textContent = '' document.getElementById(skp_order[i]+"-warnings").textContent = ''
if (assigned > 100) { if (assigned > 100) {
let skp_warning = document.createElement("p"); let skp_warning = document.createElement("p");