lots of updates

This commit is contained in:
Frederik Palmø 2022-04-05 21:55:34 +02:00
parent 5c105f1791
commit 3900057c68
4 changed files with 449 additions and 303 deletions

View File

@ -20,17 +20,65 @@ INFUSIONS = [
"Occult ", "Occult ",
] ]
helmets = [] WEAPON_CATEGORIES = {
chestpieces = [] 1: "dagger",
gauntlets = [] 2: "straight-sword",
leggings = [] 3: "greatsword",
talismans = [] 4: "colossal-sword",
classes = [] 5: "thrusting-sword",
weapons = [] 6: "heavy-thrusting-sword",
infusions = [] 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(): 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 # armors
with open("input/EquipParamProtector.csv") as af: with open("input/EquipParamProtector.csv") as af:
rows = list(csv.DictReader(af, delimiter=";")) rows = list(csv.DictReader(af, delimiter=";"))
@ -44,6 +92,7 @@ def main():
open("input/EquipParamAccessory.csv") as tf, open("input/EquipParamAccessory.csv") as tf,
open("input/SpEffectParam.csv") as ef, open("input/SpEffectParam.csv") as ef,
): ):
effects = list(csv.DictReader(ef, delimiter=";")) effects = list(csv.DictReader(ef, delimiter=";"))
rows = list(csv.DictReader(tf, delimiter=";")) rows = list(csv.DictReader(tf, delimiter=";"))
@ -52,26 +101,68 @@ def main():
process_talisman(talisman, effects) process_talisman(talisman, effects)
# classes # classes
with open("input/CharaInitParam.csv", "r") as cf: classes = [
rows = list(csv.DictReader(cf, delimiter=";")) {
rows = [row for row in rows if 3000 <= int(row["Row ID"]) <= 3009] "id": "vagabond",
"name": "Vagabond",
for row in rows: "level": 9,
c = {} "stats": [15, 10, 11, 14, 13, 9, 9, 7],
c["id"] = to_kebab(row["Row Name"][8:]) },
c["name"] = row["Row Name"][8:] {
c["level"] = int(row["Level"]) "id": "warrior",
c["stats"] = [ "name": "Warrior",
int(row["Vigor"]), "level": 8,
int(row["Attunement"]), "stats": [11, 12, 11, 10, 16, 10, 8, 9],
int(row["Endurance"]), },
int(row["Strength"]), {
int(row["Dexterity"]), "id": "hero",
int(row["Intelligence"]), "name": "Hero",
int(row["Faith"]), "level": 7,
int(row["Arcane"]), "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],
},
] ]
classes.append(c)
# weapons # weapons
with ( with (
@ -79,6 +170,7 @@ def main():
open("input/EquipParamWeapon.csv") as wf, open("input/EquipParamWeapon.csv") as wf,
open("input/CalcCorrectGraph.csv") as cf, open("input/CalcCorrectGraph.csv") as cf,
): ):
rows = list(csv.DictReader(wf, delimiter=";")) rows = list(csv.DictReader(wf, delimiter=";"))
rows = [row for row in rows if 1000000 <= int(row["Row ID"]) <= 44010000] 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} masks = {row["Row ID"]: row for row in masks}
softcaps = list(csv.DictReader(cf, delimiter=";")) 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: for row in rows:
if not ignored(row): if not ignored(row):
process_weapon(row, masks, softcaps) process_weapon(row, masks, softcaps)
process_damage(softcaps)
# infusions # infusions
with open("input/ReinforceParamWeapon.csv") as inf: with open("input/ReinforceParamWeapon.csv") as inf:
rows = list(csv.DictReader(inf, delimiter=";")) rows = list(csv.DictReader(inf, delimiter=";"))
@ -99,30 +195,94 @@ def main():
extract_infusions(rows) extract_infusions(rows)
# add missing items # add missing items
for h in MISSING["helmets"]: helmets.update(MISSING["helmets"])
helmets.append(h) chestpieces.update(MISSING["chestpieces"])
for c in MISSING["chestpieces"]: gauntlets.update(MISSING["gauntlets"])
chestpieces.append(c) leggings.update(MISSING["leggings"])
for g in MISSING["gauntlets"]:
gauntlets.append(g)
for l in MISSING["leggings"]:
leggings.append(l)
# sort all files # sort all files
helmets.sort(key=lambda item: item["id"]) helmets = dict(sorted(helmets.items(), key=lambda item: item[0]))
chestpieces.sort(key=lambda item: item["id"]) chestpieces = dict(sorted(chestpieces.items(), key=lambda item: item[0]))
gauntlets.sort(key=lambda item: item["id"]) gauntlets = dict(sorted(gauntlets.items(), key=lambda item: item[0]))
leggings.sort(key=lambda item: item["id"]) leggings = dict(sorted(leggings.items(), key=lambda item: item[0]))
classes.sort(key=lambda item: item["id"], reverse=True) classes = sorted(classes, key=lambda item: item["level"])
weapons.sort(key=lambda item: item["id"]) weapons = dict(sorted(weapons.items(), key=lambda item: item[0]))
# add none cases (no helmet etc.) # add none cases (no helmet etc.)
helmets.insert(0, {"id": "no-helmet", "name": "None"}) helmets = {
chestpieces.insert(0, {"id": "no-chestpiece", "name": "None"}) "no-helmet": {
gauntlets.insert(0, {"id": "no-gauntlets", "name": "None"}) "id": "no-helmet",
leggings.insert(0, {"id": "no-leggings", "name": "None"}) "name": "No helmet",
talismans.insert(0, {"id": "no-talisman", "name": "None"}) "defenses": [0, 0, 0, 0, 0, 0, 0, 0],
weapons.insert(0, {"id": "no-weapon", "name": "None"}) "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 # save to files
with ( with (
@ -134,6 +294,7 @@ def main():
open("output/classes.json", "w") as scf, open("output/classes.json", "w") as scf,
open("output/weapons.json", "w") as wf, open("output/weapons.json", "w") as wf,
open("output/infusions.json", "w") as inf, open("output/infusions.json", "w") as inf,
open("output/damage.json", "w") as df,
): ):
json.dump(helmets, hf) json.dump(helmets, hf)
json.dump(chestpieces, cf) json.dump(chestpieces, cf)
@ -143,6 +304,7 @@ def main():
json.dump(classes, scf) json.dump(classes, scf)
json.dump(weapons, wf) json.dump(weapons, wf)
json.dump(infusions, inf) json.dump(infusions, inf)
json.dump(calculations, df)
# format output files with prettier # format output files with prettier
if os.system("prettier output --write --tab-width 4") != 0: if os.system("prettier output --write --tab-width 4") != 0:
@ -170,11 +332,12 @@ def to_kebab(name):
def process_armor_piece(row): def process_armor_piece(row):
item = {} item = {}
item["id"] = to_kebab(row["Row Name"]) id = to_kebab(row["Row Name"])
item["id"] = id
item["name"] = row["Row Name"] item["name"] = row["Row Name"]
if item["id"] in HELMET_STATS: if id in HELMET_STATS:
item["stats"] = HELMET_STATS[item["id"]] item["stats"] = HELMET_STATS[id]
item["defenses"] = [ item["defenses"] = [
round((1.0 - float(row["Absorption - Physical"])) * 100.0, 2), 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) item["weight"] = round(float(row["Weight"]), 2)
if row["Is Head Equipment"] == "True": if row["Is Head Equipment"] == "True":
helmets.append(item) helmets[id] = item
elif row["Is Body Equipment"] == "True": elif row["Is Body Equipment"] == "True":
chestpieces.append(item) chestpieces[id] = item
elif row["Is Arm Equipment"] == "True": elif row["Is Arm Equipment"] == "True":
gauntlets.append(item) gauntlets[id] = item
elif row["Is Leg Equipment"] == "True": elif row["Is Leg Equipment"] == "True":
leggings.append(item) leggings[id] = item
def process_talisman(row, effects): def process_talisman(row, effects):
item = {} item = {}
item["id"] = to_kebab(row["Row Name"]) id = to_kebab(row["Row Name"])
item["id"] = id
item["name"] = row["Row Name"] item["name"] = row["Row Name"]
item["weight"] = row["Weight"] item["weight"] = row["Weight"]
@ -240,16 +404,18 @@ def process_talisman(row, effects):
if all(mult == 1.0 for mult in item["multipliers"]): if all(mult == 1.0 for mult in item["multipliers"]):
item.pop("multipliers") item.pop("multipliers")
talismans.append(item) talismans[id] = item
def split_weapon_name(name): def split_weapon_name(name):
infusion = "standard" infusion = "standard"
for other in INFUSIONS: 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 ", "") name = name.replace("Bloody ", "")
infusion = "blood" 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 infusion = other
name = name.replace(infusion, "") name = name.replace(infusion, "")
@ -332,137 +498,18 @@ def process_weapon(row, masks, caps):
row["Correction Type: Holy"], row["Correction Type: Holy"],
] ]
softcaps = [ if id in weapons:
[ # physical weapon = weapons[id]
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:
weapon["infusions"][infusion] = { weapon["infusions"][infusion] = {
"damage": damage, "damage": damage,
"upgrade": scaling, "upgrade": scaling,
"masks": weapon_masks, "masks": weapon_masks,
"caps": softcaps, "corrections": corrections,
"growth": growth,
"adjustments": adjustments,
} }
return
else: else:
weapon = {}
weapon["id"] = id weapon["id"] = id
weapon["name"] = name weapon["name"] = name
@ -474,22 +521,22 @@ def process_weapon(row, masks, caps):
int(row["Requirement: ARC"]), int(row["Requirement: ARC"]),
] ]
if row["Enables Sorcery"] == "True": weapon["category"] = WEAPON_CATEGORIES[int(row["Row ID"]) // 1000000]
weapon["sorcery-catalyst"] = True
if row["Enables Incantations"] == "True": if int(row["Reinforcement Material Set ID"]) == 2200:
weapon["incantation-catalyst"] = True weapon["unique"] = True
else:
weapon["unique"] = False
weapon["infusions"] = {} weapon["infusions"] = {}
weapon["infusions"][infusion] = { weapon["infusions"][infusion] = {
"damage": damage, "damage": damage,
"scaling": scaling, "scaling": scaling,
"masks": weapon_masks, "masks": weapon_masks,
"caps": softcaps, "corrections": corrections,
"growth": growth,
"adjustments": adjustments,
} }
weapons.append(weapon) weapons[id] = weapon
def regression(xs, ys): def regression(xs, ys):
@ -507,7 +554,9 @@ def regression(xs, ys):
def extract_infusions(rows): def extract_infusions(rows):
for i, ty in enumerate(INFUSIONS): for i, ty in enumerate(INFUSIONS):
infusion = {} infusion = {}
infusion["id"] = to_kebab(ty) id = to_kebab(ty)
infusion["id"] = id
infusion["name"] = ty.strip() infusion["name"] = ty.strip()
relevant = [row for row in rows[0 + i + i * 25 : 26 + i + i * 25]] relevant = [row for row in rows[0 + i + i * 25 : 26 + i + i * 25]]
@ -570,10 +619,131 @@ def extract_infusions(rows):
arc_growth, 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() main()

View File

@ -23,8 +23,8 @@ IGNORED = [
"ragged-armor-altered", "ragged-armor-altered",
"ragged-gloves", "ragged-gloves",
"ragged-loincloth", "ragged-loincloth",
"deathbed-smalls" "deathbed-smalls",
# these items are wrong in the param file # these items are wrong in the param files
"ash-of-war-scarab", "ash-of-war-scarab",
"sanguine-noble-hood", "sanguine-noble-hood",
"sanguine-noble-robe", "sanguine-noble-robe",
@ -32,98 +32,106 @@ IGNORED = [
"sanguine-noble-trousers", "sanguine-noble-trousers",
"fias-robe", "fias-robe",
"fias-robe-altered", "fias-robe-altered",
"deathbed-dress",
"rotten-duelist-greaves",
] ]
# these items are either missing or wrong in the param files # these items are either missing or wrong in the param files
MISSING = { MISSING = {
"helmets": [ "helmets": {
{ "ash-of-war-scarab": {
"id": "ash-of-war-scarab",
"name": "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], "defenses": [-5.8, -5.6, -5.8, -5.8, -4.9, -4.9, -4.9, -5.1],
"resistances": [42, 22, 27, 26], "resistances": [42, 22, 27, 26],
"poise": 2, "poise": 2,
"weight": 5.1, "weight": 5.1,
}, },
{ "godskin-noble-hood": {
"id": "godskin-noble-hood",
"name": "Godskin Noble Hood", "name": "Godskin Noble Hood",
"defenses": [1.4, 2.8, 1.8, 1.4, 4.5, 4, 4.2, 4.8], "defenses": [1.4, 2.8, 1.8, 1.4, 4.5, 4, 4.2, 4.8],
"resistances": [16, 10, 27, 29], "resistances": [16, 10, 27, 29],
"poise": 1, "poise": 1,
"weight": 1.7, "weight": 1.7,
}, },
{ "sanguine-noble-hood": {
"id": "sanguine-noble-hood",
"name": "Sanguine Noble Hood", "name": "Sanguine Noble Hood",
"defenses": [1.4, 0.9, 0.9, 0.9, 4.6, 3.8, 4.5, 4.6], "defenses": [1.4, 0.9, 0.9, 0.9, 4.6, 3.8, 4.5, 4.6],
"resistances": [18, 5, 29, 27], "resistances": [18, 5, 29, 27],
"poise": 0, "poise": 0,
"weight": 1.4, "weight": 1.4,
}, },
], },
"chestpieces": [ "chestpieces": {
{ "godskin-noble-robe": {
"id": "godskin-noble-robe",
"name": "Godskin Noble Robe", "name": "Godskin Noble Robe",
"defenses": [6.1, 9.5, 6.7, 6.1, 13, 12.4, 12.6, 14.1], "defenses": [6.1, 9.5, 6.7, 6.1, 13, 12.4, 12.6, 14.1],
"resistances": [46, 25, 76, 83], "resistances": [46, 25, 76, 83],
"poise": 5, "poise": 5,
"weight": 6.3, "weight": 6.3,
}, },
{ "sanguine-noble-robe": {
"id": "sanguine-noble-robe",
"name": "Sanguine Noble Robe", "name": "Sanguine Noble Robe",
"defenses": [6.1, 5.3, 5.3, 5.3, 13.3, 11.9, 13.0, 13.5], "defenses": [6.1, 5.3, 5.3, 5.3, 13.3, 11.9, 13.0, 13.5],
"resistances": [50, 21, 83, 76], "resistances": [50, 21, 83, 76],
"poise": 2, "poise": 2,
"weight": 5.1, "weight": 5.1,
}, },
{ "fias-robe": {
"id": "fias-robe",
"name": "Fia's Robe", "name": "Fia's Robe",
"defenses": [5.3, 6.1, 5.3, 5.3, 12.6, 12.4, 12.6, 13], "defenses": [5.3, 6.1, 5.3, 5.3, 12.6, 12.4, 12.6, 13],
"resistances": [46, 21, 76, 108], "resistances": [46, 21, 76, 108],
"poise": 2, "poise": 2,
"weight": 5.1, "weight": 5.1,
}, },
{ "fias-robe": {
"id": "fias-robe",
"name": "Fia's Robe", "name": "Fia's Robe",
"defenses": [5.3, 6.1, 5.3, 5.3, 12.6, 12.4, 12.6, 13.0], "defenses": [5.3, 6.1, 5.3, 5.3, 12.6, 12.4, 12.6, 13.0],
"resistances": [46, 21, 76, 108], "resistances": [46, 21, 76, 108],
"poise": 2, "poise": 2,
"weight": 5.1, "weight": 5.1,
}, },
{ "fias-robe-altered": {
"id": "fias-robe-altered",
"name": "Fia's Robe (Altered)", "name": "Fia's Robe (Altered)",
"defenses": [2.7, 4.2, 2.7, 2.7, 11.9, 11.4, 11.9, 12.6], "defenses": [2.7, 4.2, 2.7, 2.7, 11.9, 11.4, 11.9, 12.6],
"resistances": [34, 10, 57, 93], "resistances": [34, 10, 57, 93],
"poise": 0, "poise": 0,
"weight": 3.2, "weight": 3.2,
}, },
], "deathbed-dress": {
"gauntlets": [ "id": "deathbed-dress",
{ "name": "Deathbed Dress",
"id": "godskin-noble-bracelets", "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", "name": "Godskin Noble Bracelets",
"defenses": [1.3, 2.1, 1.5, 1.3, 3.2, 2.9, 3.1, 3.4], "defenses": [1.3, 2.1, 1.5, 1.3, 3.2, 2.9, 3.1, 3.4],
"resistances": [14, 8, 24, 25], "resistances": [14, 8, 24, 25],
"poise": 1, "poise": 1,
"weight": 1.7, "weight": 1.7,
}, },
], },
"leggings": [ "leggings": {
{ "godskin-noble-trousers": {
"id": "godskin-noble-trousers",
"name": "Godskin Noble Trousers", "name": "Godskin Noble Trousers",
"defenses": [2.3, 4.5, 3, 2.3, 7.2, 6.5, 6.8, 7.7], "defenses": [2.3, 4.5, 3, 2.3, 7.2, 6.5, 6.8, 7.7],
"resistances": [24, 14, 39, 41], "resistances": [24, 14, 39, 41],
"poise": 1, "poise": 1,
"weight": 2.5, "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 # 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], "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",
]

Binary file not shown.

View File

@ -1,97 +1,60 @@
const fs = require("fs");
const sum = (a, b) => a + b; const sum = (a, b) => a + b;
let item = { let weapons = JSON.parse(fs.readFileSync("./output/weapons.json"));
"id": "longsword", let corrections = JSON.parse(fs.readFileSync("./output/damage.json"));
"name": "Longsword", let infusions = JSON.parse(fs.readFileSync("./output/infusions.json"));
"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 weapon = weapons.find(item => item.id == "longsword");
let infusion = infusions.find(inf => inf.id == "standard");
let stats = [20, 10, 10, 10, 10] let stats = [20, 10, 10, 10, 10]
function damage(item, infusion, stats, upgrade) { 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((amount, ty) => {
let extras = bases.map((dmgTypeAmount, i) => { let calc = corrections.find(c => c.id == itemInfusion.corrections[ty]);
let scalings = itemData.scaling.map(itemScaling => { let correction = modifiers(calc, stats, itemInfusion.masks[ty]);
return (itemScaling * infusion.scaling[i] + itemScaling * infusion.scaling[i] * infusion.growth[i] * upgrade); 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); return extras.reduce(sum);
}); });
console.log(statModifiers); console.log("base dmg: " + bases);
console.log(bases); console.log("extra dmg: " + extras)
console.log(extras)
return Math.floor(bases.reduce(sum) + extras.reduce(sum)); return Math.floor(bases.reduce(sum) + extras.reduce(sum));
} }
function modifiers(infusion, stats) { function modifiers(calc, stats, masks) {
return infusion.masks.map(m => { return stats.map((stat, ty) => {
return stats.map((stat, i) => { let mask = masks[ty];
let capIndex = infusion.caps[i].findIndex(cap => cap >= stat) - 1; if (mask == 0) {
let cap = infusion.caps[i][capIndex]; return 0.0;
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 capIndex = calc.softcaps[ty].findIndex(cap => cap >= stat) - 1;
let adjust = infusion.adjustments[i][capIndex]; 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) { if (Math.sign(adjust) != -1) {
return m[i] * (growth + growthDelta * ((stat - cap) / capDelta) ** adjust); return growth + growthDelta * ((stat - cap) / capDelta) ** adjust;
} else { } else {
return m[i] * (growth + growthDelta * (1 - (1 - ((stat - cap) / capDelta)) ** Math.abs(adjust))); return growth + growthDelta * (1 - (1 - ((stat - cap) / capDelta)) ** Math.abs(adjust));
} }
}) })
});
} }
for (u = 0; u < 26; u++) { for (u = 0; u < 26; u++) {
console.log("+" + u + ": " + damage(item, infusion, stats, u)) console.log("+" + 25 + ": " + damage(weapon, infusion, stats, 25))
} }