From 24de737a4bfe633873c8dc8e9bf4176c77f22930 Mon Sep 17 00:00:00 2001 From: ferricles Date: Fri, 8 Jan 2021 09:30:36 -0800 Subject: [PATCH] tried minor fixes, now website doens't update to newer code --- build.js | 2 +- display.js | 12 +++++++++- test.js | 68 +++++++++++++----------------------------------------- 3 files changed, 28 insertions(+), 54 deletions(-) diff --git a/build.js b/build.js index cead73c..21cb383 100644 --- a/build.js +++ b/build.js @@ -139,7 +139,7 @@ class Build{ getMeleeStats(){ const stats = this.statMap; - // Array of neutral + ewtf damages. Each entry is a pair (min, max). + // Array of neutral + ewtfa damages. Each entry is a pair (min, max). let damages = []; for (const damage_string of stats.get("damageRaw")) { const damage_vals = damage_string.split("-").map(Number); diff --git a/display.js b/display.js index ed3cade..d7f5f13 100644 --- a/display.js +++ b/display.js @@ -38,7 +38,17 @@ function expandItem(item){ expandedItem.set("maxRolls",maxRolls); return expandedItem; } - +/*An independent helper function that rounds a rolled ID to the nearest integer OR brings the roll away from 0. +* @param id +*/ +function idRound(id){ + rounded = Math.round(id); + if(rounded == 0){ + return 1; + }else{ + return rounded; + } +} function displayExpandedItem(item, parent_id){ // Commands to "script" the creation of nice formatting. // #commands create a new element. diff --git a/test.js b/test.js index 043d724..8016f7d 100644 --- a/test.js +++ b/test.js @@ -288,13 +288,12 @@ function calculateBuild(){ setText("int-skp-base", "Original Value: " + skillpoints[2]); setText("def-skp-base", "Original Value: " + skillpoints[3]); setText("agi-skp-base", "Original Value: " + skillpoints[4]); - console.log(skillpoints); - - setHTML("str-skp-pct", skillPointsToPercentage(skillpoints[0])*100 ); - setHTML("dex-skp-pct", skillPointsToPercentage(skillpoints[1])*100 ); - setHTML("int-skp-pct", skillPointsToPercentage(skillpoints[2])*100 ); - setHTML("def-skp-pct", skillPointsToPercentage(skillpoints[3])*100 ); - setHTML("agi-skp-pct", skillPointsToPercentage(skillpoints[4])*100 ); + console.log("????"); + setHTML("str-skp-pct", (skillPointsToPercentage(skillpoints[0])*100).toFixed(1).concat("% more damage dealt.")); + setHTML("dex-skp-pct", (skillPointsToPercentage(skillpoints[1])*100).toFixed(1).concat("% chance to crit.")); + setHTML("int-skp-pct", (skillPointsToPercentage(skillpoints[2])*100).toFixed(1).concat("% spell cost reduction.")); + setHTML("def-skp-pct", (skillPointsToPercentage(skillpoints[3])*100).toFixed(1).concat("% less damage taken.")); + setHTML("agi-skp-pct", (skillPointsToPercentage(skillpoints[4])*100).toFixed(1).concat("% chance to dodge.")); setText("summary-box", "Summary: Assigned "+player_build.assigned_skillpoints+" skillpoints."); @@ -313,44 +312,19 @@ function calculateBuild(){ meleeSummary = meleeSummary.concat("

Melee Stats

"); meleeSummary = meleeSummary.concat("

Average DPS: ",Math.round(meleeStats[10]),"



"); meleeSummary = meleeSummary.concat("Non-Crit Stats:
"); - if(meleeStats[0][0] > 0){ - meleeSummary = meleeSummary.concat("Neutral Damage: ",meleeStats[0][0]," -> ",meleeStats[0][1],"
"); - } - if(meleeStats[1][0] > 0){ - meleeSummary = meleeSummary.concat("Earth Damage: ",meleeStats[1][0]," -> ",meleeStats[1][1],"
"); - } - if(meleeStats[2][0] > 0){ - meleeSummary = meleeSummary.concat("Thunder Damage: ",meleeStats[2][0]," -> ",meleeStats[2][1],"
"); - } - if(meleeStats[3][0] > 0){ - meleeSummary = meleeSummary.concat("Water Damage: ",meleeStats[3][0]," -> ",meleeStats[3][1],"
"); - } - if(meleeStats[4][0] > 0){ - meleeSummary = meleeSummary.concat("Fire Damage: ",meleeStats[4][0]," -> ",meleeStats[4][1],"
"); - } - if(meleeStats[5][0] > 0){ - meleeSummary = meleeSummary.concat("Air Damage: ",meleeStats[5][0]," -> ",meleeStats[5][1],"
"); + let damagePrefixes = ["Neutral Damage: ","Earth Damage: ","Thunder Damage: ","Water Damage: ","Fire Damage: ","Air Damage: "]; + for (const i in meleeStats){ + if(meleeStats[i][0] > 0){ + meleeSummary = meleeSummary.concat(damagePrefixes[i],meleeStats[i][0]," -> ",meleeStats[i][1],"
"); + } } meleeSummary = meleeSummary.concat("
Total Damage: ",meleeStats[6][0]," -> ",meleeStats[6][1],"
"); meleeSummary = meleeSummary.concat("Normal DPS: ",Math.round(meleeStats[8]),"

"); meleeSummary = meleeSummary.concat("Crit Stats:
"); - if(meleeStats[0][2] > 0){ - meleeSummary = meleeSummary.concat("Neutral Damage: ",meleeStats[0][2]," -> ",meleeStats[0][3],"
"); - } - if(meleeStats[1][2] > 0){ - meleeSummary = meleeSummary.concat("Earth Damage: ",meleeStats[1][2]," -> ",meleeStats[1][3],"
"); - } - if(meleeStats[2][2] > 0){ - meleeSummary = meleeSummary.concat("Thunder Damage: ",meleeStats[2][2]," -> ",meleeStats[2][3],"
"); - } - if(meleeStats[3][2] > 0){ - meleeSummary = meleeSummary.concat("Water Damage: ",meleeStats[3][2]," -> ",meleeStats[3][3],"
"); - } - if(meleeStats[4][2] > 0){ - meleeSummary = meleeSummary.concat("Fire Damage: ",meleeStats[4][2]," -> ",meleeStats[4][3],"
"); - } - if(meleeStats[5][2] > 0){ - meleeSummary = meleeSummary.concat("Air Damage: ",meleeStats[5][2]," -> ",meleeStats[5][3],"
"); + for (const i in meleeStats){ + if(meleeStats[i][2] > 0){ + meleeSummary = meleeSummary.concat(damagePrefixes[i],meleeStats[i][2]," -> ",meleeStats[i][3],"
"); + } } meleeSummary = meleeSummary.concat("
Total Damage: ",meleeStats[7][0]," -> ",meleeStats[7][1],"
"); meleeSummary = meleeSummary.concat("Crit DPS: ",Math.round(meleeStats[9]),"

"); @@ -358,17 +332,7 @@ function calculateBuild(){ location.hash = encodeBuild(); } -/*An independent helper function that rounds a rolled ID to the nearest integer OR brings the roll away from 0. -* @param id -*/ -function idRound(id){ - rounded = Math.round(id); - if(rounded == 0){ - return 1; - }else{ - return rounded; - } -} +