From 3900057c68bf4a094b49f2be041b932b903a71dd Mon Sep 17 00:00:00 2001 From: vodofrede Date: Tue, 5 Apr 2022 21:55:34 +0200 Subject: [PATCH] lots of updates --- convert_params.py | 564 ++++++++++++++++++++++++++++++---------------- corrections.py | 75 +++--- output.txt | Bin 29118 -> 0 bytes sandbox.js | 113 ++++------ 4 files changed, 449 insertions(+), 303 deletions(-) delete mode 100644 output.txt diff --git a/convert_params.py b/convert_params.py index 2a9fca2..e2c367c 100644 --- a/convert_params.py +++ b/convert_params.py @@ -20,17 +20,65 @@ INFUSIONS = [ "Occult ", ] -helmets = [] -chestpieces = [] -gauntlets = [] -leggings = [] -talismans = [] -classes = [] -weapons = [] -infusions = [] +WEAPON_CATEGORIES = { + 1: "dagger", + 2: "straight-sword", + 3: "greatsword", + 4: "colossal-sword", + 5: "thrusting-sword", + 6: "heavy-thrusting-sword", + 7: "curved-sword", + 8: "curved-greatsword", + 9: "katana", + 10: "twinblade", + 11: "hammer", + 12: "great-hammer", + 13: "flail", + 14: "axe", + 15: "greataxe", + 16: "spear", + 17: "great-spear", + 18: "halberd", + 19: "scythe", + 20: "whip", + 21: "fist", + 22: "claw", + 23: "colossal-weapon", + 24: "torch", + 30: "small-shield", + 31: "medium-shield", + 32: "greatshield", + 33: "glintstone-staff", + 34: "sacred-seal", + 40: "light-bow", + 41: "bow", + 42: "greatbow", + 43: "crossbow", + 44: "ballista", +} def main(): + + global helmets + helmets = {} + global chestpieces + chestpieces = {} + global gauntlets + gauntlets = {} + global leggings + leggings = {} + global talismans + talismans = {} + global classes + classes = {} + global weapons + weapons = {} + global infusions + infusions = {} + global calculations + calculations = {} + # armors with open("input/EquipParamProtector.csv") as af: rows = list(csv.DictReader(af, delimiter=";")) @@ -44,6 +92,7 @@ def main(): open("input/EquipParamAccessory.csv") as tf, open("input/SpEffectParam.csv") as ef, ): + effects = list(csv.DictReader(ef, delimiter=";")) rows = list(csv.DictReader(tf, delimiter=";")) @@ -52,26 +101,68 @@ def main(): process_talisman(talisman, effects) # classes - with open("input/CharaInitParam.csv", "r") as cf: - rows = list(csv.DictReader(cf, delimiter=";")) - rows = [row for row in rows if 3000 <= int(row["Row ID"]) <= 3009] - - for row in rows: - c = {} - c["id"] = to_kebab(row["Row Name"][8:]) - c["name"] = row["Row Name"][8:] - c["level"] = int(row["Level"]) - c["stats"] = [ - int(row["Vigor"]), - int(row["Attunement"]), - int(row["Endurance"]), - int(row["Strength"]), - int(row["Dexterity"]), - int(row["Intelligence"]), - int(row["Faith"]), - int(row["Arcane"]), - ] - classes.append(c) + classes = [ + { + "id": "vagabond", + "name": "Vagabond", + "level": 9, + "stats": [15, 10, 11, 14, 13, 9, 9, 7], + }, + { + "id": "warrior", + "name": "Warrior", + "level": 8, + "stats": [11, 12, 11, 10, 16, 10, 8, 9], + }, + { + "id": "hero", + "name": "Hero", + "level": 7, + "stats": [14, 9, 12, 16, 9, 7, 8, 11], + }, + { + "id": "bandit", + "name": "Bandit", + "level": 5, + "stats": [10, 11, 10, 9, 13, 9, 8, 14], + }, + { + "id": "astrologer", + "name": "Astrologer", + "level": 6, + "stats": [9, 15, 9, 8, 12, 16, 7, 9], + }, + { + "id": "prophet", + "name": "Prophet", + "level": 7, + "stats": [10, 14, 8, 11, 10, 7, 16, 10], + }, + { + "id": "samurai", + "name": "Samurai", + "level": 9, + "stats": [12, 11, 13, 12, 15, 9, 8, 8], + }, + { + "id": "prisoner", + "name": "Prisoner", + "level": 9, + "stats": [11, 12, 11, 11, 14, 14, 6, 9], + }, + { + "id": "confessor", + "name": "Confessor", + "level": 10, + "stats": [10, 13, 10, 12, 12, 9, 14, 9], + }, + { + "id": "wretch", + "name": "Wretch", + "level": 1, + "stats": [10, 10, 10, 10, 10, 10, 10, 10], + }, + ] # weapons with ( @@ -79,6 +170,7 @@ def main(): open("input/EquipParamWeapon.csv") as wf, open("input/CalcCorrectGraph.csv") as cf, ): + rows = list(csv.DictReader(wf, delimiter=";")) rows = [row for row in rows if 1000000 <= int(row["Row ID"]) <= 44010000] @@ -86,12 +178,16 @@ def main(): masks = {row["Row ID"]: row for row in masks} softcaps = list(csv.DictReader(cf, delimiter=";")) - softcaps = {row["Row ID"]: row for row in softcaps} + softcaps = { + row["Row ID"]: row for row in softcaps if 0 <= int(row["Row ID"]) <= 16 + } for row in rows: if not ignored(row): process_weapon(row, masks, softcaps) + process_damage(softcaps) + # infusions with open("input/ReinforceParamWeapon.csv") as inf: rows = list(csv.DictReader(inf, delimiter=";")) @@ -99,30 +195,94 @@ def main(): extract_infusions(rows) # add missing items - for h in MISSING["helmets"]: - helmets.append(h) - for c in MISSING["chestpieces"]: - chestpieces.append(c) - for g in MISSING["gauntlets"]: - gauntlets.append(g) - for l in MISSING["leggings"]: - leggings.append(l) + helmets.update(MISSING["helmets"]) + chestpieces.update(MISSING["chestpieces"]) + gauntlets.update(MISSING["gauntlets"]) + leggings.update(MISSING["leggings"]) # sort all files - helmets.sort(key=lambda item: item["id"]) - chestpieces.sort(key=lambda item: item["id"]) - gauntlets.sort(key=lambda item: item["id"]) - leggings.sort(key=lambda item: item["id"]) - classes.sort(key=lambda item: item["id"], reverse=True) - weapons.sort(key=lambda item: item["id"]) + helmets = dict(sorted(helmets.items(), key=lambda item: item[0])) + chestpieces = dict(sorted(chestpieces.items(), key=lambda item: item[0])) + gauntlets = dict(sorted(gauntlets.items(), key=lambda item: item[0])) + leggings = dict(sorted(leggings.items(), key=lambda item: item[0])) + classes = sorted(classes, key=lambda item: item["level"]) + weapons = dict(sorted(weapons.items(), key=lambda item: item[0])) # add none cases (no helmet etc.) - helmets.insert(0, {"id": "no-helmet", "name": "None"}) - chestpieces.insert(0, {"id": "no-chestpiece", "name": "None"}) - gauntlets.insert(0, {"id": "no-gauntlets", "name": "None"}) - leggings.insert(0, {"id": "no-leggings", "name": "None"}) - talismans.insert(0, {"id": "no-talisman", "name": "None"}) - weapons.insert(0, {"id": "no-weapon", "name": "None"}) + helmets = { + "no-helmet": { + "id": "no-helmet", + "name": "No helmet", + "defenses": [0, 0, 0, 0, 0, 0, 0, 0], + "resistances": [0, 0, 0, 0], + "poise": 0, + "weight": 0, + }, + **helmets, + } + chestpieces = { + "no-chestpiece": { + "id": "no-chestpieces", + "name": "No chestpiece", + "defenses": [0, 0, 0, 0, 0, 0, 0, 0], + "resistances": [0, 0, 0, 0], + "poise": 0, + "weight": 0, + }, + **chestpieces, + } + gauntlets = { + "no-gauntlets": { + "id": "no-gauntlets", + "name": "No gauntlets", + "defenses": [0, 0, 0, 0, 0, 0, 0, 0], + "resistances": [0, 0, 0, 0], + "poise": 0, + "weight": 0, + }, + **gauntlets, + } + leggings = { + "no-leggings": { + "id": "no-leggings", + "name": "No leggings", + "defenses": [0, 0, 0, 0, 0, 0, 0, 0], + "resistances": [0, 0, 0, 0], + "poise": 0, + "weight": 0, + }, + **leggings, + } + talismans = { + "no-talisman": { + "id": "no-talismans", + "name": "No talisman", + }, + **talismans, + } + weapons = { + "no-weapon": { + "id": "unarmed", + "name": "Unarmed", + "requirements": [0, 0, 0, 0, 0], + "unique": False, + "infusions": { + "standard": { + "damage": [20, 0, 0, 0, 0], + "scaling": [0.5, 0.5, 0.0, 0.0, 0.0], + "masks": [ + [1, 1, 0, 0, 0], + [0, 0, 1, 0, 0], + [0, 0, 0, 1, 0], + [0, 1, 0, 0, 0], + [0, 0, 0, 1, 0], + ], + "corrections": ["0", "0", "0", "0", "0"], + } + }, + }, + **weapons, + } # save to files with ( @@ -134,6 +294,7 @@ def main(): open("output/classes.json", "w") as scf, open("output/weapons.json", "w") as wf, open("output/infusions.json", "w") as inf, + open("output/damage.json", "w") as df, ): json.dump(helmets, hf) json.dump(chestpieces, cf) @@ -143,6 +304,7 @@ def main(): json.dump(classes, scf) json.dump(weapons, wf) json.dump(infusions, inf) + json.dump(calculations, df) # format output files with prettier if os.system("prettier output --write --tab-width 4") != 0: @@ -170,11 +332,12 @@ def to_kebab(name): def process_armor_piece(row): item = {} - item["id"] = to_kebab(row["Row Name"]) + id = to_kebab(row["Row Name"]) + item["id"] = id item["name"] = row["Row Name"] - if item["id"] in HELMET_STATS: - item["stats"] = HELMET_STATS[item["id"]] + if id in HELMET_STATS: + item["stats"] = HELMET_STATS[id] item["defenses"] = [ round((1.0 - float(row["Absorption - Physical"])) * 100.0, 2), @@ -198,19 +361,20 @@ def process_armor_piece(row): item["weight"] = round(float(row["Weight"]), 2) if row["Is Head Equipment"] == "True": - helmets.append(item) + helmets[id] = item elif row["Is Body Equipment"] == "True": - chestpieces.append(item) + chestpieces[id] = item elif row["Is Arm Equipment"] == "True": - gauntlets.append(item) + gauntlets[id] = item elif row["Is Leg Equipment"] == "True": - leggings.append(item) + leggings[id] = item def process_talisman(row, effects): item = {} - item["id"] = to_kebab(row["Row Name"]) + id = to_kebab(row["Row Name"]) + item["id"] = id item["name"] = row["Row Name"] item["weight"] = row["Weight"] @@ -240,16 +404,18 @@ def process_talisman(row, effects): if all(mult == 1.0 for mult in item["multipliers"]): item.pop("multipliers") - talismans.append(item) + talismans[id] = item def split_weapon_name(name): infusion = "standard" for other in INFUSIONS: - if "Bloody" in name: + if "Bloody" in name and not to_kebab(name) in IGNORED_WEAPON_INFUSIONS: name = name.replace("Bloody ", "") infusion = "blood" - if other in name and not to_kebab(name) in IGNORED_WEAPON_INFUSIONS: + elif "celebrants-cleaver-blades" in to_kebab(name): + name = "Celebrant's Cleaver" + elif other in name and not to_kebab(name) in IGNORED_WEAPON_INFUSIONS: infusion = other name = name.replace(infusion, "") @@ -332,137 +498,18 @@ def process_weapon(row, masks, caps): row["Correction Type: Holy"], ] - softcaps = [ - [ # physical - int(caps[corrections[0]]["Stat Max 0"]), - int(caps[corrections[0]]["Stat Max 1"]), - int(caps[corrections[0]]["Stat Max 2"]), - int(caps[corrections[0]]["Stat Max 3"]), - int(caps[corrections[0]]["Stat Max 4"]), - ], - [ # magic - int(caps[corrections[1]]["Stat Max 0"]), - int(caps[corrections[1]]["Stat Max 1"]), - int(caps[corrections[1]]["Stat Max 2"]), - int(caps[corrections[1]]["Stat Max 3"]), - int(caps[corrections[1]]["Stat Max 4"]), - ], - [ # fire - int(caps[corrections[2]]["Stat Max 0"]), - int(caps[corrections[2]]["Stat Max 1"]), - int(caps[corrections[2]]["Stat Max 2"]), - int(caps[corrections[2]]["Stat Max 3"]), - int(caps[corrections[2]]["Stat Max 4"]), - ], - [ # lightning - int(caps[corrections[3]]["Stat Max 0"]), - int(caps[corrections[3]]["Stat Max 1"]), - int(caps[corrections[3]]["Stat Max 2"]), - int(caps[corrections[3]]["Stat Max 3"]), - int(caps[corrections[3]]["Stat Max 4"]), - ], - [ # holy - int(caps[corrections[4]]["Stat Max 0"]), - int(caps[corrections[4]]["Stat Max 1"]), - int(caps[corrections[4]]["Stat Max 2"]), - int(caps[corrections[4]]["Stat Max 3"]), - int(caps[corrections[4]]["Stat Max 4"]), - ], - ] - - growth = [ - [ - int(caps[corrections[0]]["Grow 0"]), - int(caps[corrections[0]]["Grow 1"]), - int(caps[corrections[0]]["Grow 2"]), - int(caps[corrections[0]]["Grow 3"]), - int(caps[corrections[0]]["Grow 4"]), - ], - [ - int(caps[corrections[1]]["Grow 0"]), - int(caps[corrections[1]]["Grow 1"]), - int(caps[corrections[1]]["Grow 2"]), - int(caps[corrections[1]]["Grow 3"]), - int(caps[corrections[1]]["Grow 4"]), - ], - [ - int(caps[corrections[2]]["Grow 0"]), - int(caps[corrections[2]]["Grow 1"]), - int(caps[corrections[2]]["Grow 2"]), - int(caps[corrections[2]]["Grow 3"]), - int(caps[corrections[2]]["Grow 4"]), - ], - [ - int(caps[corrections[3]]["Grow 0"]), - int(caps[corrections[3]]["Grow 1"]), - int(caps[corrections[3]]["Grow 2"]), - int(caps[corrections[3]]["Grow 3"]), - int(caps[corrections[3]]["Grow 4"]), - ], - [ - int(caps[corrections[4]]["Grow 0"]), - int(caps[corrections[4]]["Grow 1"]), - int(caps[corrections[4]]["Grow 2"]), - int(caps[corrections[4]]["Grow 3"]), - int(caps[corrections[4]]["Grow 4"]), - ], - ] - adjustments = [ - [ - float(caps[corrections[0]]["Adjustment Point - Grow 0"]), - float(caps[corrections[0]]["Adjustment Point - Grow 1"]), - float(caps[corrections[0]]["Adjustment Point - Grow 2"]), - float(caps[corrections[0]]["Adjustment Point - Grow 3"]), - float(caps[corrections[0]]["Adjustment Point - Grow 4"]), - ], - [ - float(caps[corrections[1]]["Adjustment Point - Grow 0"]), - float(caps[corrections[1]]["Adjustment Point - Grow 1"]), - float(caps[corrections[1]]["Adjustment Point - Grow 2"]), - float(caps[corrections[1]]["Adjustment Point - Grow 3"]), - float(caps[corrections[1]]["Adjustment Point - Grow 4"]), - ], - [ - float(caps[corrections[2]]["Adjustment Point - Grow 0"]), - float(caps[corrections[2]]["Adjustment Point - Grow 1"]), - float(caps[corrections[2]]["Adjustment Point - Grow 2"]), - float(caps[corrections[2]]["Adjustment Point - Grow 3"]), - float(caps[corrections[2]]["Adjustment Point - Grow 4"]), - ], - [ - float(caps[corrections[3]]["Adjustment Point - Grow 0"]), - float(caps[corrections[3]]["Adjustment Point - Grow 1"]), - float(caps[corrections[3]]["Adjustment Point - Grow 2"]), - float(caps[corrections[3]]["Adjustment Point - Grow 3"]), - float(caps[corrections[3]]["Adjustment Point - Grow 4"]), - ], - [ - float(caps[corrections[4]]["Adjustment Point - Grow 0"]), - float(caps[corrections[4]]["Adjustment Point - Grow 1"]), - float(caps[corrections[4]]["Adjustment Point - Grow 2"]), - float(caps[corrections[4]]["Adjustment Point - Grow 3"]), - float(caps[corrections[4]]["Adjustment Point - Grow 4"]), - ], - ] - - weapon = {} - found = False - for other in weapons: - if other["id"] == id: - found = True - weapon = other - break - - if found: + if id in weapons: + weapon = weapons[id] weapon["infusions"][infusion] = { "damage": damage, "upgrade": scaling, "masks": weapon_masks, - "caps": softcaps, - "growth": growth, - "adjustments": adjustments, + "corrections": corrections, } + return else: + weapon = {} + weapon["id"] = id weapon["name"] = name @@ -474,22 +521,22 @@ def process_weapon(row, masks, caps): int(row["Requirement: ARC"]), ] - if row["Enables Sorcery"] == "True": - weapon["sorcery-catalyst"] = True - if row["Enables Incantations"] == "True": - weapon["incantation-catalyst"] = True + weapon["category"] = WEAPON_CATEGORIES[int(row["Row ID"]) // 1000000] + + if int(row["Reinforcement Material Set ID"]) == 2200: + weapon["unique"] = True + else: + weapon["unique"] = False weapon["infusions"] = {} weapon["infusions"][infusion] = { "damage": damage, "scaling": scaling, "masks": weapon_masks, - "caps": softcaps, - "growth": growth, - "adjustments": adjustments, + "corrections": corrections, } - weapons.append(weapon) + weapons[id] = weapon def regression(xs, ys): @@ -507,7 +554,9 @@ def regression(xs, ys): def extract_infusions(rows): for i, ty in enumerate(INFUSIONS): infusion = {} - infusion["id"] = to_kebab(ty) + id = to_kebab(ty) + + infusion["id"] = id infusion["name"] = ty.strip() relevant = [row for row in rows[0 + i + i * 25 : 26 + i + i * 25]] @@ -570,10 +619,131 @@ def extract_infusions(rows): arc_growth, ] - infusions.append(infusion) + infusions[id] = infusion - # catalyst - infusion = {} + +def process_damage(caps): + for row in caps.values(): + calculation = {} + + id = row["Row ID"] + calculation["id"] = id + + calculation["softcaps"] = [ + [ # physical + int(row["Stat Max 0"]), + int(row["Stat Max 1"]), + int(row["Stat Max 2"]), + int(row["Stat Max 3"]), + int(row["Stat Max 4"]), + ], + [ # magic + int(row["Stat Max 0"]), + int(row["Stat Max 1"]), + int(row["Stat Max 2"]), + int(row["Stat Max 3"]), + int(row["Stat Max 4"]), + ], + [ # fire + int(row["Stat Max 0"]), + int(row["Stat Max 1"]), + int(row["Stat Max 2"]), + int(row["Stat Max 3"]), + int(row["Stat Max 4"]), + ], + [ # lightning + int(row["Stat Max 0"]), + int(row["Stat Max 1"]), + int(row["Stat Max 2"]), + int(row["Stat Max 3"]), + int(row["Stat Max 4"]), + ], + [ # holy + int(row["Stat Max 0"]), + int(row["Stat Max 1"]), + int(row["Stat Max 2"]), + int(row["Stat Max 3"]), + int(row["Stat Max 4"]), + ], + ] + + calculation["growth"] = [ + [ + int(row["Grow 0"]), + int(row["Grow 1"]), + int(row["Grow 2"]), + int(row["Grow 3"]), + int(row["Grow 4"]), + ], + [ + int(row["Grow 0"]), + int(row["Grow 1"]), + int(row["Grow 2"]), + int(row["Grow 3"]), + int(row["Grow 4"]), + ], + [ + int(row["Grow 0"]), + int(row["Grow 1"]), + int(row["Grow 2"]), + int(row["Grow 3"]), + int(row["Grow 4"]), + ], + [ + int(row["Grow 0"]), + int(row["Grow 1"]), + int(row["Grow 2"]), + int(row["Grow 3"]), + int(row["Grow 4"]), + ], + [ + int(row["Grow 0"]), + int(row["Grow 1"]), + int(row["Grow 2"]), + int(row["Grow 3"]), + int(row["Grow 4"]), + ], + ] + + calculation["adjustments"] = [ + [ + float(row["Adjustment Point - Grow 0"]), + float(row["Adjustment Point - Grow 1"]), + float(row["Adjustment Point - Grow 2"]), + float(row["Adjustment Point - Grow 3"]), + float(row["Adjustment Point - Grow 4"]), + ], + [ + float(row["Adjustment Point - Grow 0"]), + float(row["Adjustment Point - Grow 1"]), + float(row["Adjustment Point - Grow 2"]), + float(row["Adjustment Point - Grow 3"]), + float(row["Adjustment Point - Grow 4"]), + ], + [ + float(row["Adjustment Point - Grow 0"]), + float(row["Adjustment Point - Grow 1"]), + float(row["Adjustment Point - Grow 2"]), + float(row["Adjustment Point - Grow 3"]), + float(row["Adjustment Point - Grow 4"]), + ], + [ + float(row["Adjustment Point - Grow 0"]), + float(row["Adjustment Point - Grow 1"]), + float(row["Adjustment Point - Grow 2"]), + float(row["Adjustment Point - Grow 3"]), + float(row["Adjustment Point - Grow 4"]), + ], + [ + float(row["Adjustment Point - Grow 0"]), + float(row["Adjustment Point - Grow 1"]), + float(row["Adjustment Point - Grow 2"]), + float(row["Adjustment Point - Grow 3"]), + float(row["Adjustment Point - Grow 4"]), + ], + ] + + calculations[id] = calculation main() diff --git a/corrections.py b/corrections.py index e17c0c0..1eefa77 100644 --- a/corrections.py +++ b/corrections.py @@ -23,8 +23,8 @@ IGNORED = [ "ragged-armor-altered", "ragged-gloves", "ragged-loincloth", - "deathbed-smalls" - # these items are wrong in the param file + "deathbed-smalls", + # these items are wrong in the param files "ash-of-war-scarab", "sanguine-noble-hood", "sanguine-noble-robe", @@ -32,98 +32,106 @@ IGNORED = [ "sanguine-noble-trousers", "fias-robe", "fias-robe-altered", + "deathbed-dress", + "rotten-duelist-greaves", ] # these items are either missing or wrong in the param files MISSING = { - "helmets": [ - { - "id": "ash-of-war-scarab", + "helmets": { + "ash-of-war-scarab": { "name": "Ash-of-War Scarab", "defenses": [-5.8, -5.6, -5.8, -5.8, -4.9, -4.9, -4.9, -5.1], "resistances": [42, 22, 27, 26], "poise": 2, "weight": 5.1, }, - { - "id": "godskin-noble-hood", + "godskin-noble-hood": { "name": "Godskin Noble Hood", "defenses": [1.4, 2.8, 1.8, 1.4, 4.5, 4, 4.2, 4.8], "resistances": [16, 10, 27, 29], "poise": 1, "weight": 1.7, }, - { - "id": "sanguine-noble-hood", + "sanguine-noble-hood": { "name": "Sanguine Noble Hood", "defenses": [1.4, 0.9, 0.9, 0.9, 4.6, 3.8, 4.5, 4.6], "resistances": [18, 5, 29, 27], "poise": 0, "weight": 1.4, }, - ], - "chestpieces": [ - { - "id": "godskin-noble-robe", + }, + "chestpieces": { + "godskin-noble-robe": { "name": "Godskin Noble Robe", "defenses": [6.1, 9.5, 6.7, 6.1, 13, 12.4, 12.6, 14.1], "resistances": [46, 25, 76, 83], "poise": 5, "weight": 6.3, }, - { - "id": "sanguine-noble-robe", + "sanguine-noble-robe": { "name": "Sanguine Noble Robe", "defenses": [6.1, 5.3, 5.3, 5.3, 13.3, 11.9, 13.0, 13.5], "resistances": [50, 21, 83, 76], "poise": 2, "weight": 5.1, }, - { - "id": "fias-robe", + "fias-robe": { "name": "Fia's Robe", "defenses": [5.3, 6.1, 5.3, 5.3, 12.6, 12.4, 12.6, 13], "resistances": [46, 21, 76, 108], "poise": 2, "weight": 5.1, }, - { - "id": "fias-robe", + "fias-robe": { "name": "Fia's Robe", "defenses": [5.3, 6.1, 5.3, 5.3, 12.6, 12.4, 12.6, 13.0], "resistances": [46, 21, 76, 108], "poise": 2, "weight": 5.1, }, - { - "id": "fias-robe-altered", + "fias-robe-altered": { "name": "Fia's Robe (Altered)", "defenses": [2.7, 4.2, 2.7, 2.7, 11.9, 11.4, 11.9, 12.6], "resistances": [34, 10, 57, 93], "poise": 0, "weight": 3.2, }, - ], - "gauntlets": [ - { - "id": "godskin-noble-bracelets", + "deathbed-dress": { + "id": "deathbed-dress", + "name": "Deathbed Dress", + "defenses": [0.6, 2.7, 0.6, 0.6, 11.9, 11.4, 11.9, 12.4], + "resistances": [38, 11, 63, 107], + "poise": 1, + "weight": 3.2, + }, + }, + "gauntlets": { + "godskin-noble-bracelets": { "name": "Godskin Noble Bracelets", "defenses": [1.3, 2.1, 1.5, 1.3, 3.2, 2.9, 3.1, 3.4], "resistances": [14, 8, 24, 25], "poise": 1, "weight": 1.7, }, - ], - "leggings": [ - { - "id": "godskin-noble-trousers", + }, + "leggings": { + "godskin-noble-trousers": { "name": "Godskin Noble Trousers", "defenses": [2.3, 4.5, 3, 2.3, 7.2, 6.5, 6.8, 7.7], "resistances": [24, 14, 39, 41], "poise": 1, "weight": 2.5, }, - ], + "rotten-duelist-greaves": { + "id": "rotten-duelist-greaves", + "name": "Rotten Duelist Greaves", + "defenses": [7.4, 6.2, 7.7, 7.1, 6.2, 6.5, 5.8, 6.2], + "resistances": [35, 35, 15, 15], + "poise": 10, + "weight": 7.3, + }, + }, } # until i find where this is located in the param files, this is the workaround @@ -152,4 +160,9 @@ HELMET_STATS = { "witchs-glintstone-crown": [0, 0, 0, 0, 0, 3, 0, 3], } -IGNORED_WEAPON_INFUSIONS = ["heavy-crossbow"] +IGNORED_WEAPON_INFUSIONS = [ + "heavy-crossbow", + "bloody-helice", + "mohgwyns-sacred-spear", + "sacred-relic-sword", +] diff --git a/output.txt b/output.txt deleted file mode 100644 index 3355e2f5b004df282e495643574f4c34582cc3ad..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 29118 zcmeI5O>Wdc5QTdki95_b$nwv)ZF2}N5M_asAhBV`^?~;s!6G!#Kqxt(K3P5KjBJl$ zx4-Fn^{Vsj>rl2bYwOCSZ7D>*p{B?hJuABXeoXV-(sC_A)%U!uIAIm58?$v)A^zNzL>fF9}e0G*=?z?@v z-*b;OkJEl1U#(Y<5AW|i-lVJCYL>zkn9+O|4Ng( z&l6TX_pNORWz7Iha3*M*W{413)gOzMVX@37OVBT zwgB2d8>*Occ;{B>yq&x*$EdxoLWDNZ2HNDH&8Fww4wzWIcTiLYRiFw~$wC$T|EFMO z*YyQZ1*$-m3{-LU$g8I;zsVv+=aIZl3$%eY&?X0Mtc2JJbCl|f$M-qwUy)-X$Mkw~ zOkT;zbp!r(ZF^**^%-2g(1w-r?4$qx*JtpGFRmz9!&P5=zEB0KWTDEm*AAF2?KwRL7&Mnhw&QPu8M54CRzp)Nisz8+-RGBr4 zuuo=g))lzcAaZ2~M{3Xp+CZBuv~gv@60G`;cztz+p$b&VL6y2kMs~}zm6+)ND}V a + b; -let item = { - "id": "longsword", - "name": "Longsword", - "requirements": [10, 10, 0, 0, 0], - "infusions": { - "standard": { - "damage": [110, 0, 0, 0, 0], - "scaling": [0.5, 0.33, 0.0, 0.0, 0.0], - "masks": [ - [1, 1, 0, 0, 0], - [0, 0, 1, 0, 0], - [0, 0, 0, 1, 0], - [0, 1, 0, 0, 0], - [0, 0, 0, 1, 0] - ], - "caps": [ - [1, 18, 60, 80, 150], - [1, 18, 60, 80, 150], - [1, 18, 60, 80, 150], - [1, 18, 60, 80, 150], - [1, 18, 60, 80, 150] - ], - "growth": [ - [0, 25, 75, 90, 110], - [0, 25, 75, 90, 110], - [0, 25, 75, 90, 110], - [0, 25, 75, 90, 110], - [0, 25, 75, 90, 110] - ], - "adjustments": [ - [1.2, -1.2, 1.0, 1.0, 1.0], - [1.2, -1.2, 1.0, 1.0, 1.0], - [1.2, -1.2, 1.0, 1.0, 1.0], - [1.2, -1.2, 1.0, 1.0, 1.0], - [1.2, -1.2, 1.0, 1.0, 1.0] - ] - } - } -} - -let infusion = { - "id": "standard", - "name": "Standard", - "damage": [1.0, 1.0, 1.0, 1.0, 1.0], - "upgrade": [0.058, 0.058, 0.058, 0.058, 0.058], - "scaling": [1.0, 1.0, 1.0, 1.0, 1.0], - "growth": [0.02, 0.02, 0.03243, 0.03243, 0.03243] -} +let weapons = JSON.parse(fs.readFileSync("./output/weapons.json")); +let corrections = JSON.parse(fs.readFileSync("./output/damage.json")); +let infusions = JSON.parse(fs.readFileSync("./output/infusions.json")); +let weapon = weapons.find(item => item.id == "longsword"); +let infusion = infusions.find(inf => inf.id == "standard"); let stats = [20, 10, 10, 10, 10] function damage(item, infusion, stats, upgrade) { - let itemData = item.infusions[infusion.id]; + let itemInfusion = item.infusions[infusion.id]; - let bases = infusion.damage.map((ty, i) => itemData.damage[i] * (ty + infusion.upgrade[i] * upgrade)); + let bases = infusion.damage.map((amount, ty) => itemInfusion.damage[ty] * (amount + infusion.upgrade[ty] * upgrade)); - let statModifiers = modifiers(itemData, stats); - let extras = bases.map((dmgTypeAmount, i) => { - let scalings = itemData.scaling.map(itemScaling => { - return (itemScaling * infusion.scaling[i] + itemScaling * infusion.scaling[i] * infusion.growth[i] * upgrade); + let extras = bases.map((amount, ty) => { + let calc = corrections.find(c => c.id == itemInfusion.corrections[ty]); + let correction = modifiers(calc, stats, itemInfusion.masks[ty]); + console.log(correction); + let scalings = itemInfusion.scaling.map(itemScaling => { + return (itemScaling * infusion.scaling[ty] + itemScaling * infusion.scaling[ty] * infusion.growth[ty] * upgrade); }) - let extras = scalings.map((statScaling, j) => dmgTypeAmount * statScaling * statModifiers[i][j] / 100.0) + let extras = scalings.map((statScaling, j) => amount * statScaling * correction[j] / 100.0) return extras.reduce(sum); }); - console.log(statModifiers); - console.log(bases); - console.log(extras) + console.log("base dmg: " + bases); + console.log("extra dmg: " + extras) return Math.floor(bases.reduce(sum) + extras.reduce(sum)); } -function modifiers(infusion, stats) { - return infusion.masks.map(m => { - return stats.map((stat, i) => { - let capIndex = infusion.caps[i].findIndex(cap => cap >= stat) - 1; - let cap = infusion.caps[i][capIndex]; - let capDelta = (infusion.caps[i][capIndex + 1] || cap) - cap; - let growth = infusion.growth[i][capIndex]; - let growthDelta = (infusion.growth[i][capIndex + 1] || growth) - growth; - let adjust = infusion.adjustments[i][capIndex]; +function modifiers(calc, stats, masks) { + return stats.map((stat, ty) => { + let mask = masks[ty]; + if (mask == 0) { + return 0.0; + } - if (Math.sign(adjust) != -1) { - return m[i] * (growth + growthDelta * ((stat - cap) / capDelta) ** adjust); - } else { - return m[i] * (growth + growthDelta * (1 - (1 - ((stat - cap) / capDelta)) ** Math.abs(adjust))); - } - }) - }); + let capIndex = calc.softcaps[ty].findIndex(cap => cap >= stat) - 1; + let cap = calc.softcaps[ty][capIndex]; + let capDelta = (calc.softcaps[ty][capIndex + 1] || cap) - cap; + let growth = calc.growth[ty][capIndex]; + let growthDelta = (calc.growth[ty][capIndex + 1] || growth) - growth; + let adjust = calc.adjustments[ty][capIndex]; + + if (Math.sign(adjust) != -1) { + return growth + growthDelta * ((stat - cap) / capDelta) ** adjust; + } else { + return growth + growthDelta * (1 - (1 - ((stat - cap) / capDelta)) ** Math.abs(adjust)); + } + }) } for (u = 0; u < 26; u++) { - console.log("+" + u + ": " + damage(item, infusion, stats, u)) + console.log("+" + 25 + ": " + damage(weapon, infusion, stats, 25)) }