paritybit.ca

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 7d6fe3eb2faa932c47e39cce4be8b9479d0edbdd
parent dd043e05b7ec2c5e7debfa959424228843b7a3db
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Thu,  2 Jan 2020 03:03:00 -0500

Update BL3DPSCalc with new algorithm until old calculations can be fine-tuned

Diffstat:
Mbuild/borderlands.css | 4++++
Mpages/projects/borderlands-3-dps-calculator.md | 9++-------
Mpublic/js/borderlands-3-dps-calculator.js | 37+++++--------------------------------
3 files changed, 11 insertions(+), 39 deletions(-)

diff --git a/build/borderlands.css b/build/borderlands.css @@ -6,6 +6,10 @@ select { width: 106px; } +table { + display: inline-block; +} + .td-label { text-align: right; padding-right: 10px; diff --git a/pages/projects/borderlands-3-dps-calculator.md b/pages/projects/borderlands-3-dps-calculator.md @@ -19,11 +19,8 @@ Use this utility to calculate the DPS of weapons in Borderlands 3. <form> <table id="form-table"> <tbody> - <tr> - <td class="td-label">Damage: </td><td><input id="dmg" type="number" min="0" placeholder="0" value="0"></td> - <td class="td-label"> x </td><td><input id="dmg-mult" type="number" min="1" placeholder="1" value="1"></td> - </tr> - <tr><td class="td-label">Accuracy (%): </td><td><input id="acc" type="number" max="100" min="0" placeholder="0-100"></td></tr> + <tr><td class="td-label">Damage: </td><td><input id="dmg" type="number" min="0" placeholder="0" value="0"></td></tr> + <tr><td class="td-label">Projectiles Fired: </td><td><input id="dmg-mult" type="number" min="1" placeholder="1" value="1"></td></tr> <tr><td class="td-label">Reload Time (s): </td><td><input id="rload" type="number" min="0" placeholder="0"></td></tr> <tr><td class="td-label">Fire Rate (shots/s): </td><td><input id="frate" type="number" min="0" placeholder="0"></td></tr> <tr><td class="td-label">Magazine Size: </td><td><input id="mag" type="number" min="0" placeholder="0"></td></tr> @@ -36,8 +33,6 @@ Use this utility to calculate the DPS of weapons in Borderlands 3. <option value="Cryo">Cryo</option> <option value="Rad">Rad</option> </select></td></tr> - <tr><td class="td-label">Elemental Effect Damage: </td><td><input id="e-dmg" type="number" min="0" placeholder="0"></td></tr> - <tr><td class="td-label">Elemental Effect Chance (%): </td><td><input id="e-chance" type="number" max="100" min="0" placeholder="0-100"></td></tr> <tr><td class="td-label">True Vault Hunter Mode: </td><td id="checkbox-cell"><input id="tvhm" type="checkbox"></td></tr> </tbody> </table> diff --git a/public/js/borderlands-3-dps-calculator.js b/public/js/borderlands-3-dps-calculator.js @@ -69,7 +69,7 @@ const mults_g = { * gun properties (except "elmnt" and "tvhm") */ const properties_g = [ - "dmg","dmg-mult","acc","rload","frate","mag","ammo","e-dmg","e-chance" + "dmg","dmg-mult","rload","frate","mag","ammo" ]; /* @@ -92,42 +92,15 @@ const properties_g = [ function calculateDPS(gun, effectDuration) { let dps = []; - gun.dmg *= gun["dmg-mult"]; - gun.mag /= gun["ammo"]; - gun.dmg += gun["e-dmg"] * gun["e-chance"] * effectDuration; - gun.acc = ((gun.acc/100) * 0.2) + 0.8; - gun.frate = gun.mag / (((gun.mag - 1) / gun.frate) + gun.rload); - for (let i = 0; i < 3; i++) { dps[i] = mults_g[gun.elmnt][gun.tvhm][i]; - dps[i] *= gun.dmg * gun.acc * gun.frate; + dps[i] *= (gun["dmg"] * gun["dmg-mult"] * (gun["mag"] / gun ["ammo"])) / + (gun["rload"] + (gun["mag"] / gun["ammo"]) / gun["frate"]); } return dps; } -//elemental duration values: 5 secs for fire/acid, 8 for radiation, 2 for shock -function computeEffectDuration(gun) { - let effectDuration = 0; - switch(gun.elmnt) { - case "Fire": - effectDuration = 5; - break; - case "Acid": - effectDuration = 5; - break; - case "Rad": - effectDuration = 8; - break; - case "Shock": - effectDuration = 2; - break; - default: - break; - } - return effectDuration; -} - function gamerMoment() { let gun = {}; @@ -137,14 +110,14 @@ function gamerMoment() { for (let str of properties_g) { gun[str] = parseFloat(document.getElementById(str).value); + if (! gun[str]) + gun[str] = 0; } e = document.getElementById("elmnt"); gun["elmnt"] = e.options[e.selectedIndex].value; gun["tvhm"] = document.getElementById("tvhm").checked ? 1 : 0; - effectDuration = computeEffectDuration(gun); - dpsResult = calculateDPS(gun, effectDuration); document.getElementById("flesh").innerHTML = dpsResult[0].toFixed(2);