From aa9041bd010a11cad7bc2a3d1e0006a7f0e9b654 Mon Sep 17 00:00:00 2001 From: hppeng Date: Sun, 26 Jun 2022 04:08:54 -0700 Subject: [PATCH] Fix tome damage calculation... --- js/build.js | 5 +++-- js/build_utils.js | 5 ++++- js/builder_graph.js | 1 + js/damage_calc.js | 3 ++- js/load_tome.js | 2 +- tomes.json | 38 +++++++++++++++++++------------------- 6 files changed, 30 insertions(+), 24 deletions(-) diff --git a/js/build.js b/js/build.js index fc57316..ff14bee 100644 --- a/js/build.js +++ b/js/build.js @@ -153,7 +153,7 @@ class Build{ */ initBuildStats(){ - let staticIDs = ["hp", "eDef", "tDef", "wDef", "fDef", "aDef", "str", "dex", "int", "def", "agi", "dmgMobs", "defMobs"]; + let staticIDs = ["hp", "eDef", "tDef", "wDef", "fDef", "aDef", "str", "dex", "int", "def", "agi", "damMobs", "defMobs"]; let must_ids = [ "eMdPct","eMdRaw","eSdPct","eSdRaw","eDamPct","eDamRaw","eDamAddMin","eDamAddMax", @@ -188,9 +188,10 @@ class Build{ } statMap.set(id,(statMap.get(id) || 0)+value); } + console.log(item_stats); for (const staticID of staticIDs) { if (item_stats.get(staticID)) { - if (staticID === "dmgMobs") { + if (staticID == "damMobs") { statMap.set('damageMultiplier', statMap.get('damageMultiplier') * item_stats.get(staticID)); } else if (staticID === "defMobs") { diff --git a/js/build_utils.js b/js/build_utils.js index 58e863d..17dfd4e 100644 --- a/js/build_utils.js +++ b/js/build_utils.js @@ -78,12 +78,13 @@ let item_fields = [ "name", "displayName", "lore", "color", "tier", "set", "slot /*"mdPct","mdRaw","sdPct","sdRaw",*/"damPct","damRaw","damAddMin","damAddMax", // These are the old ids. Become proportional. "rMdPct","rMdRaw","rSdPct",/*"rSdRaw",*/"rDamPct","rDamRaw","rDamAddMin","rDamAddMax" // rainbow (the "element" of all minus neutral). rSdRaw is rainraw ]; +// Extra fake IDs (reserved for use in spell damage calculation) : damageMultiplier, defMultiplier, poisonPct, activeMajorIDs let str_item_fields = [ "name", "displayName", "lore", "color", "tier", "set", "type", "material", "drop", "quest", "restrict", "category", "atkSpd" ] //File reading for ID translations for JSON purposes let reversetranslations = new Map(); let translations = new Map([["name", "name"], ["displayName", "displayName"], ["tier", "tier"], ["set", "set"], ["sockets", "slots"], ["type", "type"], ["dropType", "drop"], ["quest", "quest"], ["restrictions", "restrict"], ["damage", "nDam"], ["fireDamage", "fDam"], ["waterDamage", "wDam"], ["airDamage", "aDam"], ["thunderDamage", "tDam"], ["earthDamage", "eDam"], ["attackSpeed", "atkSpd"], ["health", "hp"], ["fireDefense", "fDef"], ["waterDefense", "wDef"], ["airDefense", "aDef"], ["thunderDefense", "tDef"], ["earthDefense", "eDef"], ["level", "lvl"], ["classRequirement", "classReq"], ["strength", "strReq"], ["dexterity", "dexReq"], ["intelligence", "intReq"], ["agility", "agiReq"], ["defense", "defReq"], ["healthRegen", "hprPct"], ["manaRegen", "mr"], ["spellDamage", "sdPct"], ["damageBonus", "mdPct"], ["lifeSteal", "ls"], ["manaSteal", "ms"], ["xpBonus", "xpb"], ["lootBonus", "lb"], ["reflection", "ref"], ["strengthPoints", "str"], ["dexterityPoints", "dex"], ["intelligencePoints", "int"], ["agilityPoints", "agi"], ["defensePoints", "def"], ["thorns", "thorns"], ["exploding", "expd"], ["speed", "spd"], ["attackSpeedBonus", "atkTier"], ["poison", "poison"], ["healthBonus", "hpBonus"], ["soulPoints", "spRegen"], ["emeraldStealing", "eSteal"], ["healthRegenRaw", "hprRaw"], ["spellDamageRaw", "sdRaw"], ["damageBonusRaw", "mdRaw"], ["bonusFireDamage", "fDamPct"], ["bonusWaterDamage", "wDamPct"], ["bonusAirDamage", "aDamPct"], ["bonusThunderDamage", "tDamPct"], ["bonusEarthDamage", "eDamPct"], ["bonusFireDefense", "fDefPct"], ["bonusWaterDefense", "wDefPct"], ["bonusAirDefense", "aDefPct"], ["bonusThunderDefense", "tDefPct"], ["bonusEarthDefense", "eDefPct"], ["type", "type"], ["identified", "fixID"], ["skin", "skin"], ["category", "category"], ["spellCostPct1", "spPct1"], ["spellCostRaw1", "spRaw1"], ["spellCostPct2", "spPct2"], ["spellCostRaw2", "spRaw2"], ["spellCostPct3", "spPct3"], ["spellCostRaw3", "spRaw3"], ["spellCostPct4", "spPct4"], ["spellCostRaw4", "spRaw4"], ["rainbowSpellDamageRaw", "rSdRaw"], ["sprint", "sprint"], ["sprintRegen", "sprintReg"], ["jumpHeight", "jh"], ["lootQuality", "lq"], ["gatherXpBonus", "gXp"], ["gatherSpeed", "gSpd"]]); -//does not include dmgMobs (wep tomes) and defMobs (armor tomes) +//does not include damMobs (wep tomes) and defMobs (armor tomes) for (const [k, v] of translations) { reversetranslations.set(v, k); } @@ -115,6 +116,8 @@ let nonRolledIDs = [ "reqs", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_", "majorIds", + "damMobs", + "defMobs", // wynn2 damages. "eDamAddMin","eDamAddMax", "tDamAddMin","tDamAddMax", diff --git a/js/builder_graph.js b/js/builder_graph.js index f079f40..b18204b 100644 --- a/js/builder_graph.js +++ b/js/builder_graph.js @@ -832,6 +832,7 @@ class AggregateStatsNode extends ComputeNode { } } } + console.log(output_stats); return output_stats; } } diff --git a/js/damage_calc.js b/js/damage_calc.js index e3b2f14..a2ad42d 100644 --- a/js/damage_calc.js +++ b/js/damage_calc.js @@ -101,7 +101,8 @@ function calculateSpellDamage(stats, weapon, conversions, use_spell_damage, igno let total_max = 0; for (let i in damages) { let damage_prefix = damage_elements[i] + specific_boost_str; - let damageBoost = 1 + skill_boost[i] + static_boost + (stats.get(damage_prefix+'Pct')/100); + let damageBoost = 1 + skill_boost[i] + static_boost + + ((stats.get(damage_prefix+'Pct') + stats.get(damage_elements[i]+'DamPct')) /100); damages[i][0] *= Math.max(damageBoost, 0); damages[i][1] *= Math.max(damageBoost, 0); // Collect total damage post %boost diff --git a/js/load_tome.js b/js/load_tome.js index 7b75451..6cde49d 100644 --- a/js/load_tome.js +++ b/js/load_tome.js @@ -1,4 +1,4 @@ -const TOME_DB_VERSION = 2; +const TOME_DB_VERSION = 3; // @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.jsA let tdb; diff --git a/tomes.json b/tomes.json index 0b4c213..dc60657 100644 --- a/tomes.json +++ b/tomes.json @@ -290,7 +290,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 60, - "dmgMobs": 6, + "damMobs": 6, "fixID": false, "id": 20 }, @@ -302,7 +302,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 7, + "damMobs": 7, "str": 3, "fixID": false, "id": 21 @@ -315,7 +315,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 8, + "damMobs": 8, "str": 3, "fixID": false, "id": 22 @@ -328,7 +328,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 7, + "damMobs": 7, "dex": 3, "fixID": false, "id": 23 @@ -341,7 +341,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 8, + "damMobs": 8, "dex": 3, "fixID": false, "id": 24 @@ -354,7 +354,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 7, + "damMobs": 7, "int": 3, "fixID": false, "id": 25 @@ -367,7 +367,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 8, + "damMobs": 8, "int": 3, "fixID": false, "id": 26 @@ -380,7 +380,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 7, + "damMobs": 7, "def": 3, "fixID": false, "id": 27 @@ -393,7 +393,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 8, + "damMobs": 8, "def": 3, "fixID": false, "id": 28 @@ -406,7 +406,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 7, + "damMobs": 7, "agi": 3, "fixID": false, "id": 29 @@ -419,7 +419,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 8, + "damMobs": 8, "agi": 3, "fixID": false, "id": 30 @@ -432,7 +432,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 7, + "damMobs": 7, "str": 1, "dex": 1, "int": 1, @@ -449,7 +449,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 8, + "damMobs": 8, "str": 1, "dex": 1, "int": 1, @@ -466,7 +466,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 12, + "damMobs": 12, "eDamPct": 7, "fixID": false, "id": 33 @@ -479,7 +479,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 12, + "damMobs": 12, "tDamPct": 7, "fixID": false, "id": 34 @@ -492,7 +492,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 12, + "damMobs": 12, "wDamPct": 7, "fixID": false, "id": 35 @@ -505,7 +505,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 12, + "damMobs": 12, "fDamPct": 7, "fixID": false, "id": 36 @@ -518,7 +518,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 12, + "damMobs": 12, "aDamPct": 7, "fixID": false, "id": 37 @@ -531,7 +531,7 @@ "drop": "never", "restrict": "Soulbound Item", "lvl": 80, - "dmgMobs": 12, + "damMobs": 12, "eDamPct": 6, "tDamPct": 6, "wDamPct": 6,