Fix tome damage calculation...

This commit is contained in:
hppeng 2022-06-26 04:08:54 -07:00
parent b9e04c4c9f
commit aa9041bd01
6 changed files with 30 additions and 24 deletions

View file

@ -153,7 +153,7 @@ class Build{
*/ */
initBuildStats(){ 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 = [ let must_ids = [
"eMdPct","eMdRaw","eSdPct","eSdRaw","eDamPct","eDamRaw","eDamAddMin","eDamAddMax", "eMdPct","eMdRaw","eSdPct","eSdRaw","eDamPct","eDamRaw","eDamAddMin","eDamAddMax",
@ -188,9 +188,10 @@ class Build{
} }
statMap.set(id,(statMap.get(id) || 0)+value); statMap.set(id,(statMap.get(id) || 0)+value);
} }
console.log(item_stats);
for (const staticID of staticIDs) { for (const staticID of staticIDs) {
if (item_stats.get(staticID)) { if (item_stats.get(staticID)) {
if (staticID === "dmgMobs") { if (staticID == "damMobs") {
statMap.set('damageMultiplier', statMap.get('damageMultiplier') * item_stats.get(staticID)); statMap.set('damageMultiplier', statMap.get('damageMultiplier') * item_stats.get(staticID));
} }
else if (staticID === "defMobs") { else if (staticID === "defMobs") {

View file

@ -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. /*"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 "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" ] 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 //File reading for ID translations for JSON purposes
let reversetranslations = new Map(); 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"]]); 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) { for (const [k, v] of translations) {
reversetranslations.set(v, k); reversetranslations.set(v, k);
} }
@ -115,6 +116,8 @@ let nonRolledIDs = [
"reqs", "reqs",
"nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_",
"majorIds", "majorIds",
"damMobs",
"defMobs",
// wynn2 damages. // wynn2 damages.
"eDamAddMin","eDamAddMax", "eDamAddMin","eDamAddMax",
"tDamAddMin","tDamAddMax", "tDamAddMin","tDamAddMax",

View file

@ -832,6 +832,7 @@ class AggregateStatsNode extends ComputeNode {
} }
} }
} }
console.log(output_stats);
return output_stats; return output_stats;
} }
} }

View file

@ -101,7 +101,8 @@ function calculateSpellDamage(stats, weapon, conversions, use_spell_damage, igno
let total_max = 0; let total_max = 0;
for (let i in damages) { for (let i in damages) {
let damage_prefix = damage_elements[i] + specific_boost_str; 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][0] *= Math.max(damageBoost, 0);
damages[i][1] *= Math.max(damageBoost, 0); damages[i][1] *= Math.max(damageBoost, 0);
// Collect total damage post %boost // Collect total damage post %boost

View file

@ -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 // @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.jsA
let tdb; let tdb;

View file

@ -290,7 +290,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 60, "lvl": 60,
"dmgMobs": 6, "damMobs": 6,
"fixID": false, "fixID": false,
"id": 20 "id": 20
}, },
@ -302,7 +302,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 7, "damMobs": 7,
"str": 3, "str": 3,
"fixID": false, "fixID": false,
"id": 21 "id": 21
@ -315,7 +315,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 8, "damMobs": 8,
"str": 3, "str": 3,
"fixID": false, "fixID": false,
"id": 22 "id": 22
@ -328,7 +328,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 7, "damMobs": 7,
"dex": 3, "dex": 3,
"fixID": false, "fixID": false,
"id": 23 "id": 23
@ -341,7 +341,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 8, "damMobs": 8,
"dex": 3, "dex": 3,
"fixID": false, "fixID": false,
"id": 24 "id": 24
@ -354,7 +354,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 7, "damMobs": 7,
"int": 3, "int": 3,
"fixID": false, "fixID": false,
"id": 25 "id": 25
@ -367,7 +367,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 8, "damMobs": 8,
"int": 3, "int": 3,
"fixID": false, "fixID": false,
"id": 26 "id": 26
@ -380,7 +380,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 7, "damMobs": 7,
"def": 3, "def": 3,
"fixID": false, "fixID": false,
"id": 27 "id": 27
@ -393,7 +393,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 8, "damMobs": 8,
"def": 3, "def": 3,
"fixID": false, "fixID": false,
"id": 28 "id": 28
@ -406,7 +406,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 7, "damMobs": 7,
"agi": 3, "agi": 3,
"fixID": false, "fixID": false,
"id": 29 "id": 29
@ -419,7 +419,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 8, "damMobs": 8,
"agi": 3, "agi": 3,
"fixID": false, "fixID": false,
"id": 30 "id": 30
@ -432,7 +432,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 7, "damMobs": 7,
"str": 1, "str": 1,
"dex": 1, "dex": 1,
"int": 1, "int": 1,
@ -449,7 +449,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 8, "damMobs": 8,
"str": 1, "str": 1,
"dex": 1, "dex": 1,
"int": 1, "int": 1,
@ -466,7 +466,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 12, "damMobs": 12,
"eDamPct": 7, "eDamPct": 7,
"fixID": false, "fixID": false,
"id": 33 "id": 33
@ -479,7 +479,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 12, "damMobs": 12,
"tDamPct": 7, "tDamPct": 7,
"fixID": false, "fixID": false,
"id": 34 "id": 34
@ -492,7 +492,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 12, "damMobs": 12,
"wDamPct": 7, "wDamPct": 7,
"fixID": false, "fixID": false,
"id": 35 "id": 35
@ -505,7 +505,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 12, "damMobs": 12,
"fDamPct": 7, "fDamPct": 7,
"fixID": false, "fixID": false,
"id": 36 "id": 36
@ -518,7 +518,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 12, "damMobs": 12,
"aDamPct": 7, "aDamPct": 7,
"fixID": false, "fixID": false,
"id": 37 "id": 37
@ -531,7 +531,7 @@
"drop": "never", "drop": "never",
"restrict": "Soulbound Item", "restrict": "Soulbound Item",
"lvl": 80, "lvl": 80,
"dmgMobs": 12, "damMobs": 12,
"eDamPct": 6, "eDamPct": 6,
"tDamPct": 6, "tDamPct": 6,
"wDamPct": 6, "wDamPct": 6,