Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #enemy
- res = 10
- defense = 0.5
- #weapon
- class Weapon:
- def __init__(self, name, b_atk, ctr, cdm, atk_p, em, dmg, em_to_atk, songs):
- self.name = name
- self.b_atk = b_atk
- self.ctr = ctr
- self.cdm = cdm
- self.atk_p = atk_p
- self.em = em
- self.dmg = dmg
- self.em_to_atk = em_to_atk
- self.songs = songs
- #weapons
- ThrillingTalesofDragonSlayers = Weapon("Thrilling Tales of Dragon Slayers R5", 401.29, 0, 0, 0, 0, 0, 0, [])
- MagicGuide = Weapon("Magic Guide R5", 354.38, 0, 0, 0, 187.44, 24, 0, [])
- TwinNephrite = Weapon("Twin Nephrite R5", 448.22, 15.62, 0, 20, 0, 0, 0, [])
- FavoniusCodex = Weapon("Favonius Codex", 509.61, 0, 0, 0, 0, 0, 0, [])
- TheWidsithRecitative = Weapon("The Widsith - Recitative", 509.61, 0, 55.13, 20, 0, 0, 0, [])
- TheWidsithAria = Weapon("The Widsith - Aria", 509.61, 0, 55.13, 0, 0, 16, 0, [])
- TheWidsithInterlude = Weapon("The Widsith - Interlude", 509.61, 0, 55.13, 0, 80, 0, 0, [])
- TheWidsith = Weapon("The Widsith", 509.61, 0, 55.13, 0, 0, 0, 0, [TheWidsithRecitative,TheWidsithAria,TheWidsithInterlude])
- TheWidsithRecitativeR5 = Weapon("The Widsith R5 - Recitative", 509.61, 0, 55.13, 40, 0, 0, 0, [])
- TheWidsithAriaR5 = Weapon("The Widsith R5 - Aria", 509.61, 0, 55.13, 0, 0, 32, 0, [])
- TheWidsithInterludeR5 = Weapon("The Widsith R5 - Interlude", 509.61, 0, 55.13, 0, 160, 0, 0, [])
- TheWidsithR5 = Weapon("The Widsith R5", 509.61, 0, 55.13, 0, 0, 0, 0, [TheWidsithRecitativeR5,TheWidsithAriaR5,TheWidsithInterludeR5])
- SacrificialFragments = Weapon("Sacrificial Fragments", 454.36, 0, 0, 0, 220.51, 0, 0, [])
- SolarPearl = Weapon("Solar Pearl", 509.61, 27.56, 0, 0, 0, 10, 0, [])
- SolarPearlR5 = Weapon("Solar Pearl R5", 509.61, 27.56, 0, 0, 0, 20, 0, [])
- MappaMare = Weapon("Mappa Mare", 564.78, 0, 0, 0, 110.26, 8, 0, [])
- MappaMareR5 = Weapon("Mappa Mare R5", 564.78, 0, 0, 0, 110.26, 16, 0, [])
- BlackcliffAgate = Weapon("Blackcliff Agate", 509.61, 0, 55.13, 0, 0, 0, 0, [])
- HakushinRing = Weapon("Hakushin Ring", 564.78, 0, 0, 0, 0, 5, 0, [])
- HakushinRingR5 = Weapon("Hakushin Ring R5", 564.78, 0, 0, 0, 0, 10, 0, [])
- OathswornsEye = Weapon("Oathsworn’s Eye R5", 564.78, 0, 0, 27.56, 0, 0, 0, [])
- WanderingEvenstar = Weapon("Wandering Evenstar", 509.61, 0, 0, 0, 165.38, 0, 24, [])
- WanderingEvenstarR5 = Weapon("Wandering Evenstar R5", 509.61, 0, 0, 0, 165.38, 0, 48, [])
- FruitofFulfillment = Weapon("Fruit of Fulfillment", 509.61, 0, 0, -25, 120, 0, 0, [])
- FruitofFulfillmentR5 = Weapon("Fruit of Fulfillment R5", 509.61, 0, 0, -25, 180, 0, 0, [])
- SkywardAtlas = Weapon("Skyward Atlas", 674.33, 0, 0, 33.08, 0, 12, 0, [])
- SkywardAtlasR5 = Weapon("Skyward Atlas R5", 674.33, 0, 0, 33.08, 0, 24, 0, [])
- LostPrayertotheSacredWinds = Weapon("Lost Prayer to the Sacred Winds", 608.07, 33.08, 0, 0, 0, 0, 0, [])
- KagurasVerity = Weapon("Kagura’s Verity", 608.07, 0, 66.15, 0, 0, 48, 0, [])
- KagurasVerityR5 = Weapon("Kagura’s Verity R5", 608.07, 0, 66.15, 0, 0, 96, 0, [])
- AThousandFloatingDreams = Weapon("A Thousand Floating Dreams - No dendro", 541.83, 0, 0, 0, 264.61, 30, 0, [])
- AThousandFloatingDreamsDendro = Weapon("A Thousand Floating Dreams - One dendro", 541.83, 0, 0, 0, 296.61, 20, 0, [])
- AThousandFloatingDreamsR5 = Weapon("A Thousand Floating Dreams R5 - No dendro", 541.83, 0, 0, 0, 264.61, 78, 0, [])
- AThousandFloatingDreamsDendroR5 = Weapon("A Thousand Floating Dreams R5 - One dendro", 541.83, 0, 0, 0, 328.61, 20, 0, [])
- #books = [ThrillingTalesofDragonSlayers,MagicGuide,TwinNephrite,TheWidsith,TheWidsithR5,SacrificialFragments,SolarPearl,SolarPearlR5,MappaMare,MappaMareR5,BlackcliffAgate,HakushinRing,HakushinRingR5,OathswornsEye,WanderingEvenstar,WanderingEvenstarR5,FruitofFulfillment,FruitofFulfillmentR5,SkywardAtlas,SkywardAtlasR5,LostPrayertotheSacredWinds,KagurasVerity,KagurasVerityR5,AThousandFloatingDreams,AThousandFloatingDreamsR5]
- books = [MagicGuide,TheWidsith,TheWidsithR5,SacrificialFragments,SolarPearl,SolarPearlR5,MappaMare,MappaMareR5,BlackcliffAgate,HakushinRing,HakushinRingR5,OathswornsEye,WanderingEvenstar,WanderingEvenstarR5,FruitofFulfillment,FruitofFulfillmentR5,SkywardAtlas,SkywardAtlasR5,LostPrayertotheSacredWinds,KagurasVerity,KagurasVerityR5,AThousandFloatingDreams,AThousandFloatingDreamsR5]
- #substats
- start_rolls = 3
- max_rolls_p_art = 4
- atk_p_roll = 5
- ctr_roll = 3.3
- cdm_roll = 6.6
- em_roll = 20
- #max_rolls_p_art = 5
- #atk_p_roll = 5.8
- #ctr_roll = 3.9
- #cdm_roll = 7.8
- #em_roll = 23
- #stats
- class Stats:
- def __init__(self, first, name, atk_p, ctr, cdm, em, dmg, sands, cup, cap):
- self.name = name
- self.atk_p = atk_p
- self.ctr = ctr
- self.cdm = cdm
- self.f_atk = 311
- self.em = em
- self.ctr = ctr
- self.cdm = cdm
- self.dmg = dmg
- self.sand = sands
- self.cup = cup
- self.cap = cap
- if first and start_rolls > 0:
- self.atk_p += max(0, min(start_rolls, 2 + sands[0] + cup[0] + cap[0])) * atk_p_roll
- self.ctr += max(0, min(start_rolls, 2 + sands[1] + cup[1] + cap[1])) * ctr_roll
- self.cdm += max(0, min(start_rolls, 2 + sands[2] + cup[2] + cap[2])) * cdm_roll
- self.em += max(0, min(start_rolls, 2 + sands[3] + cup[3] + cap[3])) * em_roll
- #AtkElCtr = Stats(True, "ATK%/Elemental/Crit Rate", 46.6, 31.1, 0, 0, 46.6, [0,1,1,1], [1,1,1,1], [1,0,1,1])
- #AtkElCdm = Stats(True, "ATK%/Elemental/Crit DMG", 46.6, 0, 62.2, 0, 46.6, [0,1,1,1], [1,1,1,1], [1,1,0,1])
- EmElCtr = Stats(True, "EM/Elemental/Crit Rate", 0, 31.1, 0, 187, 46.6, [1,1,1,0], [1,1,1,1], [1,0,1,1])
- EmElCdm = Stats(True, "EM/Elemental/Crit DMG", 0, 0, 62.2, 187, 46.6, [1,1,1,0], [1,1,1,1], [1,1,0,1])
- EmElCrt = Stats(True, "EM/Elemental/Crit", 0, 15.55, 31.1, 187, 46.6, [1,1,1,0], [1,1,1,1], [1,1,1,1])
- EmEmCtr = Stats(True, "EM/EM/Crit Rate", 0, 31.1, 0, 374, 0, [1,1,1,0], [1,1,1,0], [1,0,1,1])
- EmEmCdm = Stats(True, "EM/EM/Crit DMG", 0, 0, 62.2, 374, 0, [1,1,1,0], [1,1,1,0], [1,1,0,1])
- EmEmCrt = Stats(True, "EM/EM/Crit", 0, 15.55, 31.1, 374, 0, [1,1,1,0], [1,1,1,0], [1,1,1,1])
- #AtkElEm = Stats(True, "ATK%/Elemental/EM", 46.6, 0, 0, 187, 46.6, [0,1,1,1], [1,1,1,1], [1,1,1,0])
- EmElEm = Stats(True, "EM/Elemental/EM", 0, 0, 0, 374, 46.6, [1,1,1,0], [1,1,1,1], [1,1,1,0])
- EmEmEm = Stats(True, "EM/EM/EM", 0, 0, 0, 561, 0, [1,1,1,0], [1,1,1,1], [1,1,1,0])
- stats = [EmElCrt, EmEmCrt, EmElEm, EmEmEm]
- #buffs
- class Buff:
- def __init__(self, name, atk_p, em, dmg, res):
- self.name = name
- self.atk_p = atk_p
- self.em = em
- self.dmg = dmg
- self.res = res
- ToM = Buff("ToM", 20, 0, 0, 0)
- Zhongli = Buff("Zhongli", 0, 0, 0, -20)
- Instructor = Buff("Instructor", 0, 120, 0, 0)
- DeepwoodMemoriesBuff = Buff("Deepwood memories", 0, 0, 0, -30)
- #set
- class Set:
- def __init__(self, name, atk_p, em, dmg):
- self.name = name
- self.atk_p = atk_p
- self.f_atk = 311
- self.em = em
- self.dmg = dmg
- Thundersoother = Set("Thundersoother", 0, 0, 35)
- DeepwoodMemories = Set("Deepwood Memories", 0, 0, 15)
- GildedDreamsDendro = Set("Gilded Dreams, One dendro", 14, 180, 0)
- GildedDreams = Set("Gilded Dreams, No dendro", 0, 230, 0)
- ElAtk = Set("El/Atk% 2-piece", 18, 0, 15)
- AtkAtk = Set("Atk%/Atk% 2-piece", 36, 0, 0)
- ElEm = Set("El/EM 2-piece", 0, 80, 15)
- EmAtk = Set("EM/Atk% 2-piece", 18, 80, 0)
- EmEm = Set("EM/EM 2-piece", 0, 160, 0)
- sets = [Thundersoother,DeepwoodMemories,GildedDreams]
- #character
- class Character:
- def __init__(self, name, b_atk, ctr, cdm, dmg, em):
- self.name = name
- self.b_atk = b_atk
- self.dmg = dmg
- self.ctr = ctr
- self.cdm = cdm
- self.em = em
- Nahida = Character("Nahida", 298.97, 5, 50, 0, 115.2)
- #C4
- #Nahida.em += 160
- #calculation
- class Result:
- def __init__(self, weapon, artSet, stat, atk, em, ctr, cdm, dmg, dps, av, crit):
- self.weapon = weapon
- self.artSet = artSet
- self.stats = [stat.name]
- self.atk = atk
- self.em = em
- self.ctr = ctr
- self.cdm = cdm
- self.dmg = dmg
- self.dps = [dps]
- self.av = av
- self.crit = crit
- self.second = ""
- self.difference = 0.001
- pyro = 0
- pyro_bonus = [0, 20.02, 30.1]
- electro = 2
- interval = 1.9
- electro_reduction = [0, 0.3, 0.45]
- interval -= electro_reduction[electro]
- icd = 2.5
- #icd = 0
- icd = max(icd, interval)
- def Spread(em):
- bonus = 5 * em / (em + 1200)
- return 1663.88 * (1 + bonus)
- def evaluate(character, weapon, artSet, stats, buffs):
- stat = Stats(False, stats.name, stats.atk_p, stats.ctr, stats.cdm, stats.em, stats.dmg, stats.sand, stats.cup, stats.cap)
- for i in range(max_rolls_p_art):
- artifact(stat.cap, character, weapon, artSet, stat, buffs)
- artifact(stat.sand, character, weapon, artSet, stat, buffs)
- artifact(stat.cup, character, weapon, artSet, stat, buffs)
- artifact([1,1,1,1], character, weapon, artSet, stat, buffs)
- artifact([1,1,1,1], character, weapon, artSet, stat, buffs)
- result = calculate(character, weapon, artSet, stat, buffs)
- if len(weapon.songs) > 0:
- dps = 0
- av = 0
- for song in range(0, len(weapon.songs)):
- newResult = calculate(character, weapon.songs[song], artSet, stat, buffs)
- dps += newResult.dps[0]
- av += newResult.av
- result.crit = max(result.crit, newResult.crit)
- result.dps = [dps / len(weapon.songs)]
- result.av = av / len(weapon.songs)
- return result
- def artifact(weights, character, weapon, artSet, stat, buffs):
- stat.atk_p += atk_p_roll * weights[0]
- dmg1 = test(character, weapon, artSet, stat, buffs)
- stat.atk_p -= atk_p_roll * weights[0]
- stat.ctr += ctr_roll * weights[1]
- dmg2 = test(character, weapon, artSet, stat, buffs)
- stat.ctr -= ctr_roll * weights[1]
- stat.cdm += cdm_roll * weights[2]
- dmg3 = test(character, weapon, artSet, stat, buffs)
- stat.cdm -= cdm_roll * weights[2]
- stat.em += em_roll * weights[3]
- dmg4 = test(character, weapon, artSet, stat, buffs)
- stat.em -= em_roll * weights[3]
- top = max(dmg1, dmg2, dmg3, dmg4)
- if top == dmg1:
- print("Rolled Atk%!")
- stat.atk_p += atk_p_roll * weights[0]
- elif top == dmg2:
- #print("Rolled Crit Rate!")
- stat.ctr += ctr_roll * weights[1]
- elif top == dmg3:
- #print("Rolled Crit DMG!")
- stat.cdm += cdm_roll * weights[2]
- elif top == dmg4:
- #print("Rolled EM!")
- stat.em += em_roll * weights[3]
- def test(character, weapon, artSet, stat, buffs):
- if len(weapon.songs) <= 0:
- return calculate(character, weapon, artSet, stat, buffs).dps
- else:
- dps = 0
- for song in range(0, len(weapon.songs)):
- dps += calculate(character, weapon.songs[song], artSet, stat, buffs).dps[0]
- return dps / len(weapon.songs)
- def calculate(character, weapon, artSet, stat, buffs):
- em = character.em + weapon.em + stat.em + artSet.em
- bonus_dmg = character.dmg + weapon.dmg + stat.dmg + artSet.dmg + pyro_bonus[pyro]
- atk_p = weapon.atk_p + stat.atk_p + artSet.atk_p
- f_atk = stat.f_atk
- ctr = character.ctr + weapon.ctr + stat.ctr
- cdm = character.cdm + weapon.cdm + stat.cdm
- global res
- resistance = res
- for i in range(0, len(buffs)):
- atk_p += buffs[i].atk_p
- em += buffs[i].em
- bonus_dmg += buffs[i].dmg
- resistance += buffs[i].res
- if resistance < 0:
- resistance /= 2
- bonus_bonus_dmg = min(80, max(0, (round(em) - 200) * 0.1))
- bonus_dmg += bonus_bonus_dmg
- bonus_ctr = min(24, max(0, (round(em) - 200) * 0.03))
- ctr += bonus_ctr
- ctr = min(ctr, 100)
- atk = (character.b_atk + weapon.b_atk) * (1 + atk_p / 100) + f_atk
- atk += em * weapon.em_to_atk / 100
- damage = 185.76 / 100 * atk + 371.52 / 100 * em
- damage *= defense
- damage *= 1 + bonus_dmg / 100
- damage /= 1 + resistance / 100
- spread = Spread(em) * defense
- spread *= 1 + bonus_dmg / 100
- spread /= 1 + resistance / 100
- crit = damage + spread
- crit *= 1 + cdm / 100
- damage *= 1 + ctr / 100 * cdm / 100
- spread *= 1 + ctr / 100 * cdm / 100
- av = damage + spread
- dps = damage / interval + spread / icd
- return Result(weapon, artSet, stat, atk, em, ctr, cdm, bonus_dmg, dps, av, crit)
- def printResult(result):
- print("======================================================================")
- print(result.weapon.name)
- print("Best set: " + result.artSet.name)
- if not result.second == "":
- print("Second best: " + result.second1)
- print("Difference: " + str(round(result.difference1 * 100 - 100, 2)) + "%")
- if len(result.dps) == 1:
- print("Best main stat: " + result.stats[0])
- else:
- print("Main stats ranking:")
- for i in range(len(result.stats)):
- print(result.stats[i] + " - dps: " + str(round(result.dps[i], 2)))
- print()
- print("Best stats for this weapon:")
- print("Atk: " + str(round(result.atk, 2)))
- print("EM: " + str(round(result.em, 2)))
- print("Crit Rate: " + str(round(result.ctr, 2)))
- print("Crit DMG: " + str(round(result.cdm, 2)))
- print("Total DMG bonus: " + str(round(result.dmg, 2)))
- print()
- print("Best DPS: " + str(round(result.dps[0], 2)))
- print("Best Avg spread hit: " + str(round(result.av, 2)))
- print("Biggest crit hit: " + str(round(result.crit, 2)))
- print()
- def testWeapons(weapons, artSets, stats, buffs):
- for i in range(0, len(weapons)):
- result = testSets(weapons[i], artSets, stats, buffs)
- printResult(result)
- def testSets(weapon, artSets, stats, buffs):
- result = testStats(weapon, artSets[0], stats, buffs)
- if len(artSets) <= 1:
- return result
- for i in range(1, len(artSets)):
- newResult = testStats(weapon, artSets[i], stats, buffs)
- if newResult.dps > result.dps:
- newResult.second = result.artSet.name
- newResult.difference = newResult.dps / result.dps
- result = newResult
- else:
- gain = newResult.dps[0] / result.dps[0]
- if gain > 1 / result.difference:
- result.second = newResult.stat.name
- result.difference = 1 / gain
- return result
- def testStats(weapon, artSet, stats, buffs):
- result = evaluate(Nahida, weapon, artSet, stats[0], buffs)
- if len(stats) <= 1:
- return result
- for i in range(1, len(stats)):
- newResult = evaluate(Nahida, weapon, artSet, stats[i], buffs)
- if newResult.dps[0] > result.dps[0]:
- newResult.dps += result.dps
- newResult.stats += result.stats
- result = newResult
- else:
- for x in range(0, len(result.stats)):
- if newResult.dps[0] > result.dps[x]:
- result.dps.insert(x, newResult.dps[0])
- result.stats.insert(x, newResult.stats[0])
- break
- if x == len(result.stats) - 1:
- result.dps.append(newResult.dps[0])
- result.stats.append(newResult.stats[0])
- return result
- print("Weapon comparison:")
- testWeapons(books, [GildedDreams], stats, [DeepwoodMemoriesBuff])
- if True:
- print("######################################################################")
- print("Artifact set comparison with Magic Guide:")
- print()
- printResult(testStats(MagicGuide, GildedDreams, stats, [DeepwoodMemoriesBuff]))
- printResult(testStats(MagicGuide, Thundersoother, stats, [DeepwoodMemoriesBuff]))
- printResult(testStats(MagicGuide, GildedDreams, stats, []))
- printResult(testStats(MagicGuide, DeepwoodMemories, stats, [DeepwoodMemoriesBuff]))
- if True:
- print("######################################################################")
- print("Artifact set comparison with A Thousand Floating Dreams - No dendro teammate:")
- print()
- printResult(testStats(AThousandFloatingDreams, GildedDreams, stats, [DeepwoodMemoriesBuff]))
- printResult(testStats(AThousandFloatingDreams, Thundersoother, stats, [DeepwoodMemoriesBuff]))
- printResult(testStats(AThousandFloatingDreams, GildedDreams, stats, []))
- printResult(testStats(AThousandFloatingDreams, DeepwoodMemories, stats, [DeepwoodMemoriesBuff]))
Advertisement
Add Comment
Please, Sign In to add comment