Merge pull request #77 from hppeng-wynn/atree-misc-patch

More misc fixes
This commit is contained in:
hppeng-wynn 2022-07-05 20:44:09 -07:00 committed by GitHub
commit 328760d65e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 30 additions and 31 deletions

View file

@ -1275,20 +1275,7 @@
</div>
<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 spell-display spell-expand dark-5 rounded dark-shadow pt-2 border border-dark" id="spell0-infoAvg">spell1</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 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>
</div>
<div class = "col">

View file

@ -16582,10 +16582,10 @@
"wDamPct": 50,
"type": "necklace",
"fixID": true,
"spPct1": 91,
"spPct2": 59,
"spPct3": 91,
"spPct4": 70,
"spPct1": 130,
"spPct2": 85,
"spPct3": 130,
"spPct4": 100,
"id": 3618
},
{

File diff suppressed because one or more lines are too long

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 atree_raw = atrees[player_class];
if (!atree_raw) return null;
if (!atree_raw) return [];
let atree_map = new Map();
let atree_head;
@ -308,6 +308,8 @@ const atree_validate = new (class extends ComputeNode {
const atree_state = input_map.get('atree-state');
const atree_order = input_map.get('atree');
if (atree_order.length == 0) { return [0, ['no atree data']]; }
let errors = [];
let reachable = new Map();
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': {
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
ret_spell.cost += cost;
if ('cost' in ret_spell) { ret_spell.cost += cost; }
if (target_part === null) {
continue;

View file

@ -200,7 +200,7 @@ function encodeBuild(build, powders, skillpoints, atree, atree_state) {
}
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);
const bitvec = encode_atree(atree, atree_state);
build_string += bitvec.toB64();

View file

@ -15,6 +15,11 @@ function skillPointsToPercentage(skp){
//return clamp((-0.0000000066695* Math.pow(Math.E, -0.00924033 * skp + 18.9) + 1.0771), 0.00, 0.808);
}
// 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_damage_mult = [1, 1, 1, 0.867, 0.951];
/*Turns the input amount of levels into skillpoints available.
*
* @param level - the integer level count to be converted

View file

@ -502,8 +502,8 @@ class SpellSelectNode extends ComputeNode {
*/
function getDefenseStats(stats) {
let defenseStats = [];
let def_pct = skillPointsToPercentage(stats.get('def'));
let agi_pct = skillPointsToPercentage(stats.get('agi'));
let def_pct = skillPointsToPercentage(stats.get('def')) * skillpoint_final_mult[3];
let agi_pct = skillPointsToPercentage(stats.get('agi')) * skillpoint_final_mult[4];
//total hp
let totalHp = stats.get("hp") + stats.get("hpBonus");
if (totalHp < 5) totalHp = 5;
@ -511,7 +511,10 @@ function getDefenseStats(stats) {
//EHP
let ehp = [totalHp, totalHp];
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;
defenseStats.push(ehp);
//HPR
@ -770,7 +773,7 @@ class DisplayBuildWarningsNode extends ComputeNode {
setValue(skp_order[i] + "-skp", skillpoints[i]);
let linebreak = document.createElement("br");
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*skillpoint_final_mult[i]).toFixed(1).concat(skp_effects[i]));
document.getElementById(skp_order[i]+"-warnings").textContent = ''
if (assigned > 100) {
let skp_warning = document.createElement("p");

View file

@ -66,6 +66,7 @@ function calculateSpellDamage(stats, weapon, conversions, use_spell_damage, igno
total_convert += conv_frac
}
}
total_convert += conversions[0]/100;
// Also theres prop and rainbow!!
const damage_elements = ['n'].concat(skp_elements); // netwfa
@ -94,8 +95,9 @@ function calculateSpellDamage(stats, weapon, conversions, use_spell_damage, igno
}
// 5.1: %boost application
let skill_boost = [0]; // no neutral skillpoint booster
for (const skp of skp_order) {
skill_boost.push(skillPointsToPercentage(stats.get(skp)));
for (let i in skp_order) {
const skp = skp_order[i];
skill_boost.push(skillPointsToPercentage(stats.get(skp)) * skillpoint_damage_mult[i]);
}
let static_boost = (stats.get(specific_boost_str.toLowerCase()+'Pct') + stats.get('damPct')) / 100;
@ -131,7 +133,7 @@ function calculateSpellDamage(stats, weapon, conversions, use_spell_damage, igno
let min_boost = raw_boost;
let max_boost = raw_boost;
if (total_max > 0) { // TODO: what about total negative all raw?
if (total_elem_min > 0) {
if (total_min > 0) {
min_boost += (damages_obj[0] / total_min) * prop_raw;
}
max_boost += (damages_obj[1] / total_max) * prop_raw;

View file

@ -1,4 +1,4 @@
const DB_VERSION = 91;
const DB_VERSION = 92;
// @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.jsA
let db;