untested fix for custom crafted break and custom crafteds not calculating damage properly

This commit is contained in:
ferricles 2021-04-29 20:10:29 -07:00
parent 574baf6595
commit 5f2d35eb8a
4 changed files with 11 additions and 7 deletions

View file

@ -1,11 +1,12 @@
const ci_save_order = ["name", "lore", "tier", "set", "slots", "type", "material", "drop", "quest", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq","str", "dex", "int", "agi", "def", "id", "skillpoints", "reqs", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_", "majorIds", "hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "expd", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd","durability","duration","charges"]; const ci_save_order = ["name", "lore", "tier", "set", "slots", "type", "material", "drop", "quest", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq","str", "dex", "int", "agi", "def", "id", "skillpoints", "reqs", "majorIds", "hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "expd", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd","durability","duration","charges"];
const nonRolled_strings = ["name","lore", "tier","set","type","material","drop","quest","majorIds","classReq","atkSpd","displayName", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_", "durability", "duration"]; const nonRolled_strings = ["name","lore", "tier","set","type","material","drop","quest","majorIds","classReq","atkSpd","displayName", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "durability", "duration"];
//omitted restrict - it's always "Custom Item" //omitted restrict - it's always "Custom Item"
//omitted displayName - either it's the same as name (repetitive) or it's "Custom Item" //omitted displayName - either it's the same as name (repetitive) or it's "Custom Item"
//omitted category - can always get this from type //omitted category - can always get this from type
//omitted fixId - we will denote this early in the string. //omitted fixId - we will denote this early in the string.
//omitted "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_" - will be calculated on display
function getCustomFromHash(hash) { function getCustomFromHash(hash) {
let name = hash.slice(); let name = hash.slice();

View file

@ -250,7 +250,7 @@ function encodeCustom(custom, verbose) {
} }
} }
} else { } else {
let damages = ["nDam", "eDam", "tDam", "wDam", "fDam", "aDam","nDam_", "eDam_", "tDam_", "wDam_", "fDam_", "aDam_"]; let damages = ["nDam", "eDam", "tDam", "wDam", "fDam", "aDam"]; //"nDam_", "eDam_", "tDam_", "wDam_", "fDam_", "aDam_"
let val = custom.get(id); let val = custom.get(id);
if (typeof(val) === "string" && val !== "") { if (typeof(val) === "string" && val !== "") {
@ -305,7 +305,6 @@ function decodeCustom(custom_url_tag) {
while (tag !== "") { while (tag !== "") {
let id = ci_save_order[Base64.toInt(tag.slice(0,2))]; let id = ci_save_order[Base64.toInt(tag.slice(0,2))];
let len = Base64.toInt(tag.slice(2,4)); let len = Base64.toInt(tag.slice(2,4));
console.log(id);
if (rolledIDs.includes(id)) { if (rolledIDs.includes(id)) {
let sign = parseInt(tag.slice(4,5),10); let sign = parseInt(tag.slice(4,5),10);
let minRoll = Base64.toInt(tag.slice(5,5+len)); let minRoll = Base64.toInt(tag.slice(5,5+len));

View file

@ -52,9 +52,12 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
damageBases[element+1] += diff + Math.floor( (powder.min + powder.max) / 2 ); damageBases[element+1] += diff + Math.floor( (powder.min + powder.max) / 2 );
} }
//update all damages //update all damages
for (let i = 0; i < damages.length; i++) { if(!weapon.get("custom")) {
damages[i] = [Math.floor(damageBases[i] * 0.9), Math.floor(damageBases[i] * 1.1)]; for (let i = 0; i < damages.length; i++) {
damages[i] = [Math.floor(damageBases[i] * 0.9), Math.floor(damageBases[i] * 1.1)];
}
} }
neutralRemainingRaw = damages[0].slice(); neutralRemainingRaw = damages[0].slice();
neutralBase = damages[0].slice(); neutralBase = damages[0].slice();
} }

View file

@ -461,6 +461,7 @@ function displayExpandedItem(item, parent_id){
stats.set("damageBases", [item.get("nDamBaseHigh"),item.get("eDamBaseHigh"),item.get("tDamBaseHigh"),item.get("wDamBaseHigh"),item.get("fDamBaseHigh"),item.get("aDamBaseHigh")]); stats.set("damageBases", [item.get("nDamBaseHigh"),item.get("eDamBaseHigh"),item.get("tDamBaseHigh"),item.get("wDamBaseHigh"),item.get("fDamBaseHigh"),item.get("aDamBaseHigh")]);
let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], 0, 0, 0, item, [0, 0, 0, 0, 0], 1, undefined); let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], 0, 0, 0, item, [0, 0, 0, 0, 0], 1, undefined);
let damages = results[2]; let damages = results[2];
console.log(damages);
let total_damage_min = 0; let total_damage_min = 0;
let total_damage_max = 0; let total_damage_max = 0;
@ -893,7 +894,7 @@ function displayExpandedItem(item, parent_id){
let base_dps_min = total_damages[0] * damage_mult; let base_dps_min = total_damages[0] * damage_mult;
let base_dps_max = total_damages[1] * damage_mult; let base_dps_max = total_damages[1] * damage_mult;
base_dps_elem.textContent = "Base DPS: "+base_dps_min+"\u279c"+base_dps_max; base_dps_elem.textContent = "Base DPS: "+base_dps_min.toFixed(3)+"\u279c"+base_dps_max.toFixed(3);
} }
else { else {
base_dps_elem.textContent = "Base DPS: "+(total_damages * damage_mult); base_dps_elem.textContent = "Base DPS: "+(total_damages * damage_mult);