MaxShein

Wanderer script

Nov 14th, 2022 (edited)
814
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 26.06 KB | None | 0 0
  1. #enemy
  2. res = 10
  3. level = 90
  4. enemy_level = 90
  5. reduction = 0
  6.  
  7. defense = (level + 100) / ((1 - reduction) * (enemy_level + 100) + level + 100)
  8.  
  9. #weapon
  10. class Weapon:
  11.     def __init__(self, name, b_atk, ctr, cdm, atk_p, em, dmg, normal_dmg, charged_dmg, skill_dmg, burst_dmg, atk_spd, em_to_atk, songs):
  12.         self.name = name
  13.         self.b_atk = b_atk
  14.         self.ctr = ctr
  15.         self.cdm = cdm
  16.         self.atk_p = atk_p
  17.         self.em = em
  18.         self.dmg = dmg
  19.         self.normal_dmg = normal_dmg
  20.         self.charged_dmg = charged_dmg
  21.         self.skill_dmg = skill_dmg
  22.         self.burst_dmg = burst_dmg
  23.         self.atk_spd = atk_spd
  24.         self.em_to_atk = em_to_atk
  25.         self.songs = songs
  26.  
  27. #weapons
  28. TheWidsithRecitative = Weapon("The Widsith - Recitative", 509.61, 0, 55.13, 20, 0, 0, 0, 0, 0, 0, 0, 0, [])
  29. TheWidsithAria = Weapon("The Widsith - Aria", 509.61, 0, 55.13, 0, 0, 16, 0, 0, 0, 0, 0, 0, [])
  30. TheWidsithInterlude = Weapon("The Widsith - Interlude", 509.61, 0, 55.13, 0, 80, 0, 0, 0, 0, 0, 0, 0, [])
  31. TheWidsith = Weapon("The Widsith", 509.61, 0, 55.13, 0, 0, 0, 0, 0, 0, 0, 0, 0, [TheWidsithRecitative,TheWidsithAria,TheWidsithInterlude])
  32. TheWidsithRecitativeR5 = Weapon("The Widsith R5 - Recitative", 509.61, 0, 55.13, 40, 0, 0, 0, 0, 0, 0, 0, 0, [])
  33. TheWidsithAriaR5 = Weapon("The Widsith R5 - Aria", 509.61, 0, 55.13, 0, 0, 32, 0, 0, 0, 0, 0, 0, [])
  34. TheWidsithInterludeR5 = Weapon("The Widsith R5 - Interlude", 509.61, 0, 55.13, 0, 160, 0, 0, 0, 0, 0, 0, 0, [])
  35. TheWidsithR5 = Weapon("The Widsith R5", 509.61, 0, 55.13, 0, 0, 0, 0, 0, 0, 0, 0, 0, [TheWidsithRecitativeR5,TheWidsithAriaR5,TheWidsithInterludeR5])
  36. SacrificialFragments = Weapon("Sacrificial Fragments", 454.36, 0, 0, 0, 220.51, 0, 0, 0, 0, 0, 0, 0, [])
  37. SolarPearl = Weapon("Solar Pearl", 509.61, 27.56, 0, 0, 0, 0, 20, 0, 20, 20, 0, 0, [])
  38. SolarPearlR5 = Weapon("Solar Pearl R5", 509.61, 27.56, 0, 0, 0, 0, 40, 0, 40, 40, 0, 0, [])
  39. MappaMare = Weapon("Mappa Mare", 564.78, 0, 0, 0, 110.26, 16, 0, 0, 0, 0, 0, 0, [])
  40. MappaMareR5 = Weapon("Mappa Mare R5", 564.78, 0, 0, 0, 110.26, 32, 0, 0, 0, 0, 0, 0, [])
  41. BlackcliffAgate = Weapon("Blackcliff Agate", 509.61, 0, 55.13, 0, 0, 0, 0, 0, 0, 0, 0, 0, [])
  42. BlackcliffAgateMax = Weapon("Blackcliff Agate - Max stacks", 509.61, 0, 55.13, 36, 0, 0, 0, 0, 0, 0, 0, 0, [])
  43. BlackcliffAgateMaxR5 = Weapon("Blackcliff Agate R5 - Max stacks", 509.61, 0, 55.13, 72, 0, 0, 0, 0, 0, 0, 0, 0, [])
  44. HakushinRing = Weapon("Hakushin Ring", 564.78, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, [])
  45. HakushinRingR5 = Weapon("Hakushin Ring R5", 564.78, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, [])
  46. OathswornsEye = Weapon("Oathsworn’s Eye R5", 564.78, 0, 0, 27.56, 0, 0, 0, 0, 0, 0, 0, 0, [])
  47. WanderingEvenstar = Weapon("Wandering Evenstar", 509.61, 0, 0, 0, 165.38, 0, 0, 0, 0, 0, 0, 24, [])
  48. WanderingEvenstarR5 = Weapon("Wandering Evenstar R5", 509.61, 0, 0, 0, 165.38, 0, 0, 0, 0, 0, 0, 48, [])
  49. DodocoTales = Weapon("Dodoco Tales R5", 454.36, 0, 0, 71.13, 0, 0, 0, 32, 0, 0, 0, 0, [])
  50. SkywardAtlas = Weapon("Skyward Atlas", 674.33, 0, 0, 33.08, 0, 12, 0, 0, 0, 0, 0, 0, [])
  51. SkywardAtlasR5 = Weapon("Skyward Atlas R5", 674.33, 0, 0, 33.08, 0, 24, 0, 0, 0, 0, 0, 0, [])
  52. LostPrayertotheSacredWinds = Weapon("Lost Prayer to the Sacred Winds", 608.07, 33.08, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, [])
  53. LostPrayertotheSacredWindsR5 = Weapon("Lost Prayer to the Sacred Winds R5", 608.07, 33.08, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, [])
  54. MemoryofDustNo = Weapon("Memory of Dust - No stacks", 608.07, 0, 0, 49.62, 0, 0, 0, 0, 0, 0, 0, 0, [])
  55. MemoryofDust = Weapon("Memory of Dust - 5 stacks + shield", 608.07, 0, 0, 89.62, 0, 0, 0, 0, 0, 0, 0, 0, [])
  56. MemoryofDustR5 = Weapon("Memory of Dust R5 - 5 stacks + shield", 608.07, 0, 0, 129.62, 0, 0, 0, 0, 0, 0, 0, 0, [])
  57. KagurasVerityNo = Weapon("Kagura’s Verity - No stacks", 608.07, 0, 66.15, 0, 0, 0, 0, 0, 0, 0, 0, 0, [])
  58. KagurasVerity = Weapon("Kagura’s Verity - all stacks", 608.07, 0, 66.15, 0, 0, 12, 0, 0, 36, 0, 0, 0, [])
  59. KagurasVerityR5 = Weapon("Kagura’s Verity R5 - all stacks", 608.07, 0, 66.15, 0, 0, 24, 0, 0, 72, 0, 0, 0, [])
  60. AThousandFloatingDreams = Weapon("A Thousand Floating Dreams - No same elements", 541.83, 0, 0, 0, 264.61, 30, 0, 0, 0, 0, 0, 0, [])
  61. AThousandFloatingDreamsSame = Weapon("A Thousand Floating Dreams - One same element", 541.83, 0, 0, 0, 296.61, 20, 0, 0, 0, 0, 0, 0, [])
  62. AThousandFloatingDreamsR5 = Weapon("A Thousand Floating Dreams R5 - No same elements", 541.83, 0, 0, 0, 264.61, 78, 0, 0, 0, 0, 0, 0, [])
  63. AThousandFloatingDreamsSameR5 = Weapon("A Thousand Floating Dreams R5 - One same element", 541.83, 0, 0, 0, 328.61, 52, 0, 0, 0, 0, 0, 0, [])
  64. TullaytullahsRemembrance = Weapon("Tullaytullah's Remembrance", 674.33, 0, 44.1, 0, 0, 0, 42, 0, 0, 0, 10, 0, [])
  65. TullaytullahsRemembranceR5 = Weapon("Tullaytullah's Remembrance R5", 674.33, 0, 44.1, 0, 0, 84, 0, 0, 0, 0, 20, 0, [])
  66.  
  67. books = [TheWidsith,TheWidsithR5,SacrificialFragments,SolarPearl,SolarPearlR5,MappaMare,MappaMareR5,BlackcliffAgate,BlackcliffAgateMax,BlackcliffAgateMaxR5,HakushinRing,HakushinRingR5,OathswornsEye,WanderingEvenstar,WanderingEvenstarR5,DodocoTales,SkywardAtlas,SkywardAtlasR5,LostPrayertotheSacredWinds,LostPrayertotheSacredWindsR5,MemoryofDustNo,MemoryofDust,MemoryofDustR5,KagurasVerityNo,KagurasVerity,KagurasVerityR5,AThousandFloatingDreams,AThousandFloatingDreamsSame,AThousandFloatingDreamsR5,AThousandFloatingDreamsSameR5,TullaytullahsRemembrance,TullaytullahsRemembranceR5]
  68.  
  69. #substats
  70. start_rolls = 3
  71. max_rolls_p_art = 4
  72. atk_p_roll = 5
  73. ctr_roll = 3.3
  74. cdm_roll = 6.6
  75. em_roll = 20
  76. #max_rolls_p_art = 5
  77. #atk_p_roll = 5.8
  78. #ctr_roll = 3.9
  79. #cdm_roll = 7.8
  80. #em_roll = 23
  81.  
  82. #stats
  83. class Stats:
  84.     def __init__(self, first, name, atk_p, ctr, cdm, em, dmg, sands, cup, cap):
  85.         self.name = name
  86.         self.atk_p = atk_p
  87.         self.ctr = ctr
  88.         self.cdm = cdm
  89.         self.f_atk = 311
  90.         self.em = em
  91.         self.ctr = ctr
  92.         self.cdm = cdm
  93.         self.dmg = dmg
  94.         self.sand = sands
  95.         self.cup = cup
  96.         self.cap = cap
  97.         if first and start_rolls > 0:
  98.             self.atk_p += max(0, min(start_rolls, 2 + sands[0] + cup[0] + cap[0])) * atk_p_roll
  99.             self.ctr += max(0, min(start_rolls, 2 + sands[1] + cup[1] + cap[1])) * ctr_roll
  100.             self.cdm += max(0, min(start_rolls, 2 + sands[2] + cup[2] + cap[2])) * cdm_roll
  101.             self.em += max(0, min(start_rolls, 2 + sands[3] + cup[3] + cap[3])) * em_roll
  102.            
  103. 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])
  104. 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])
  105. AtkElCrt = Stats(True, "ATK%/Elemental/Crit", 46.6, 15.55, 31.1, 0, 46.6, [0,1,1,1], [1,1,1,1], [1,1,1,1])
  106.  
  107. 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])
  108. 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])
  109. 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])
  110.  
  111. AtkEmCtr = Stats(True, "ATK%/EM/Crit Rate", 46.6, 31.1, 0, 187, 0, [0,1,1,1], [1,1,1,0], [1,0,1,1])
  112. AtkEmCdm = Stats(True, "ATK%/EM/Crit DMG", 46.6, 0, 62.2, 187, 0, [0,1,1,1], [1,1,1,0], [1,1,0,1])
  113. AtkEmCrt = Stats(True, "ATK%/EM/Crit", 46.6, 15.55, 31.1, 187, 0, [0,1,1,1], [1,1,1,0], [1,1,1,1])
  114.  
  115. AtkAtkCtr = Stats(True, "ATK%/ATK%/Crit Rate", 93.2, 31.1, 0, 0, 0, [0,1,1,1], [0,1,1,1], [1,0,1,1])
  116. AtkAtkCdm = Stats(True, "ATK%/ATK%/Crit DMG", 93.2, 0, 62.2, 0, 0, [0,1,1,1], [0,1,1,1], [1,1,0,1])
  117. AtkAtkCrt = Stats(True, "ATK%/ATK%/Crit", 93.2, 15.55, 31.1, 0, 0, [0,1,1,1], [0,1,1,1], [1,1,1,1])
  118. stats = [AtkElCrt,EmElCrt,AtkEmCrt,AtkAtkCrt]
  119. #stats = [AtkElCtr,AtkElCdm,AtkAtkCtr,AtkAtkCdm]
  120. #stats = [Stats(True, "EM/EM/EM", 0, 0, 0, 561, 0, [1,1,1,0], [1,1,1,0], [1,1,1,0])]
  121.  
  122. #buffs
  123. class Buff:
  124.     def __init__(self, name, atk_p, em, dmg, res):
  125.         self.name = name
  126.         self.atk_p = atk_p
  127.         self.em = em
  128.         self.dmg = dmg
  129.         self.res = res
  130.  
  131. ToM = Buff("ToM", 20, 0, 0, 0)
  132. Zhongli = Buff("Zhongli", 0, 0, 0, -20)
  133. Instructor = Buff("Instructor", 0, 120, 0, 0)
  134. Faruzan = Buff("Faruzan", 0, 0, 50.37, -40)
  135. Diona = Buff("Diona", 0, 200, 0, 0)
  136. Noblesse = Buff("Noblesse", 20, 0, 0, 0)
  137.  
  138. #set
  139. class Set:
  140.     def __init__(self, name, atk_p, em, dmg, normal_dmg, charged_dmg, atk_spd):
  141.         self.name = name
  142.         self.atk_p = atk_p
  143.         self.f_atk = 311
  144.         self.em = em
  145.         self.dmg = dmg
  146.         self.normal_dmg = normal_dmg
  147.         self.charged_dmg = charged_dmg
  148.         self.atk_spd = atk_spd
  149.  
  150. HeartofDepth = Set("Heart of Depth", 0, 0, 0, 30, 30, 0)
  151. ShimenawasReminiscence = Set("Shimenawa’s Reminiscence", 18, 0, 0, 50, 50, 0)
  152. EchoesofanOffering = Set("Echoes of an Offering", 18, 0, 0, 0, 0, 0)
  153. #OldDesertPavilionChronicle = Set("Desert Pavilion Chronicle", 0, 0, 15, 30, 0, 10)
  154. DesertPavilionChronicle = Set("Desert Pavilion Chronicle", 0, 0, 15, 40, 0, 10)
  155. Thundersoother = Set("Thundersoother", 0, 0, 35, 0, 0, 0)
  156. GildedDreamsSame = Set("Gilded Dreams, One same element", 14, 180, 0, 0, 0, 0)
  157. GildedDreams = Set("Gilded Dreams, No same elements", 0, 230, 0, 0, 0, 0)
  158. ViridescentVenerer = Set("Viridescent Venerer", 0, 78, 5, 0, 0, 0)
  159. ElAtk = Set("El/Atk% 2-piece", 18, 0, 15, 0, 0, 0)
  160. AtkAtk = Set("Atk%/Atk% 2-piece", 36, 0, 0, 0, 0, 0)
  161. ElEm = Set("El/EM 2-piece", 0, 80, 15, 0, 0, 0)
  162. EmAtk = Set("EM/Atk% 2-piece", 18, 80, 0, 0, 0, 0)
  163. EmEm = Set("EM/EM 2-piece", 0, 160, 0, 0, 0, 0)
  164. sets = [HeartofDepth,ShimenawasReminiscence,EchoesofanOffering,DesertPavilionChronicle,Thundersoother,GildedDreamsSame,ViridescentVenerer]
  165. sets = [EchoesofanOffering,DesertPavilionChronicle]
  166. #sets = [GildedDreams,ViridescentVenerer]
  167.  
  168. #character
  169. class Character:
  170.     def __init__(self, name, b_atk, ctr, cdm, atk_p):
  171.         self.name = name
  172.         self.b_atk = b_atk
  173.         self.atk_p = atk_p
  174.         self.ctr = ctr
  175.         self.cdm = cdm
  176.  
  177. Wanderer = Character("Wanderer", 327.67, 24.2, 50, 0)
  178.  
  179. #Bonuses
  180. burst_dmg_bonus = 0
  181. old_normal_dmg_bonus = 68
  182. old_charged_dmg_bonus = 54.4
  183. normal_scaling_bonus = 153.7
  184. charged_scaling_bonus = 143
  185. C6 = False
  186.  
  187. old = [157.72, 137.55, 102.58, 102.58, 35, 0, 237.74, 171.36, 264.96, 40, 0, 0]
  188. scaling = [130.8, 123.6, 90.4, 90.4, 35, 0, 237.7, 171.4, 265, 40, 0, 0]
  189.  
  190. types = ["Normal", "Normal", "Normal", "Normal", "None", "Swirl", "Charged", "Skill", "Burst", "Normal", "Faruzan normal", "Faruzan none"]
  191.  
  192. #combo
  193. import random
  194. atk_spd_bonus = 0
  195. E_time = 9
  196. N_cancle = [False, False, False, False]
  197. N_times = [0.4875, 0.4875, 0, 1.17]
  198. A4_initial = 16
  199. a4_increase = 12
  200.  
  201. #hits
  202. hits = [[],[],[],[],[]]
  203. hits[0] = [6.0, 6.0, 6.0, 6.0, 0, 9.0, 1, 1, 5, 0, 18.0, 0]
  204. hits[1] = [7.0, 6.0, 6.0, 6.0, 0, 9.0, 1, 1, 5, 0, 19.0, 0]
  205. hits[2] = [7.0, 7.0, 7.0, 7.0, 0, 10.0, 1, 1, 5, 0, 21.0, 0]
  206. hits[3] = [8.0, 8.0, 7.0, 7.0, 0, 11.0, 1, 1, 5, 0, 8.0, 0]
  207. hits[4] = [8.0, 8.0, 8.0, 8.0, 0, 12.0, 1, 1, 5, 0, 8.0, 0]
  208. hits_A4 = [[],[],[],[],[]]
  209. hits_A4[0] = [7.020439000627398, 6.687644000580881, 3.6722580001593963, 3.6722580001593963, 12.06154400027032, 14.418990998197085, 1, 1, 5, 0, 10.259165999073558, 2.627877000013415]
  210. hits_A4[1] = [7.9316500007547655, 7.306129000667331, 3.7572460001712757, 3.7572460001712757, 13.053432000408964, 14.83579399816392, 1, 1, 5, 0, 11.068102998468149, 2.8701020000472726]
  211. hits_A4[2] = [8.106480000684629, 8.004960000760606, 4.234097000237929, 4.234097000237929, 14.790132000651717, 16.185478997901967, 1, 1, 5, 0, 11.703012997992982, 3.2379200000986854]
  212. hits_A4[3] = [8.65426100027467, 8.654244000274682, 4.320009000249938, 4.320009000249938, 15.142060000700909, 16.78571999800034, 1, 1, 5, 0, 8.65426100027467, 0]
  213. hits_A4[4] = [9.031096999992645, 9.001047000015134, 4.747087000309634, 4.747087000309634, 16.98534000095856, 18.335448998383036, 1, 1, 5, 0, 9.031096999992645, 0]
  214.  
  215. def Combo(samples, atk_spd, do_A4):
  216.     #print("Combo, atk speed: " + str(atk_spd))
  217.     counts = [0, 0, 0, 0, 0, 0, 1, 1, 5, 0, 0, 0]
  218.        
  219.     for i in range(0, samples):
  220.         time = E_time
  221.         n = 0
  222.         A4 = False
  223.         A4_chance = A4_initial
  224.         icd = 0
  225.         icd_c = 0
  226.         faruzan = 0
  227.        
  228.         while time > 0:
  229.             if A4 and N_cancle[n] and do_A4:
  230.                 #print("D")
  231.                 time -= 0.5
  232.                 icd -= 0.5
  233.                 if faruzan <= 0:
  234.                     counts[11] += 1 / samples
  235.                     faruzan = 0.8
  236.                 if faruzan > 0:
  237.                     faruzan -= 0.5
  238.                 counts[4] += 4 / samples
  239.                 counts[5] += 2 / samples
  240.                 A4 = False
  241.                 n = 0
  242.            
  243.             else:
  244.                 counts[n] += 1 / samples
  245.                 if C6:
  246.                     counts[9] += 1 / samples  
  247.                 time -= N_times[n] / atk_spd
  248.  
  249.                 if icd <= 0:
  250.                     icd = 2.5
  251.                     icd_c = -1
  252.                     counts[5] += 1 / samples
  253.                 if icd > 0:
  254.                     icd -= N_times[n] / atk_spd
  255.                     icd_c += 1
  256.                     if C6:
  257.                         icd_c += 1
  258.                    
  259.                     while icd_c >= 3:
  260.                         counts[5] += 1 / samples
  261.                         icd_c -= 3
  262.  
  263.                 if faruzan >= 0.8:
  264.                     counts[10] += 1 / samples
  265.                 if faruzan <= 0:
  266.                     counts[10] += 1 / samples
  267.                     faruzan = 0.8
  268.                 if faruzan > 0:
  269.                     faruzan -= N_times[n] / atk_spd
  270.                
  271.                 n += 1
  272.                 #print("N" + str(n))
  273.                 n %= 4
  274.                
  275.                 if not A4 and N_times[n] > 0:
  276.                     if random.random() * 100 <= A4_chance:
  277.                         A4 = True
  278.                         A4_chance = A4_initial
  279.                     else:
  280.                         A4_chance += a4_increase
  281.     #counts = [round(counts[0], 5), round(counts[1], 5), round(counts[2], 5), round(counts[3], 5), round(counts[4], 5), round(counts[5], 5), round(counts[6], 6), 1, 1, 5]
  282.     #counts[5] = 0
  283.     return counts
  284.        
  285. #print(Combo(1, 1.3))
  286. #c = Combo(100000, 1.2)
  287. #s = scaling
  288. #n = c[0] * s[0] + c[1] * s[1] + c[2] * s[2] + c[3] * s[3]
  289. #n *= 3.0367
  290. #n += c[4] * s[4]
  291. #print(n)
  292.  
  293. #calculation
  294. class Result:
  295.     def __init__(self, weapon, artSet, stat, atk, em, ctr, cdm, total, A4):
  296.         self.weapon = weapon
  297.         self.artSet = artSet
  298.         self.stats = [stat.name]
  299.         self.atk = atk
  300.         self.em = em
  301.         self.ctr = ctr
  302.         self.cdm = cdm
  303.         self.total = [total]
  304.         self.second = ""
  305.         self.difference = 2
  306.         self.A4 = A4
  307.  
  308. def Swirl(em):
  309.     bonus = 16 * em / (em + 2000)
  310.     return 868.11 * (1 + bonus)
  311.  
  312. def evaluate(character, weapon, artSet, stats, buffs):
  313.     stat = Stats(False, stats.name, stats.atk_p, stats.ctr, stats.cdm, stats.em, stats.dmg, stats.sand, stats.cup, stats.cap)
  314.     for i in range(max_rolls_p_art):
  315.         artifact(stat.cap, character,  weapon, artSet, stat, buffs)
  316.         artifact(stat.sand, character,  weapon, artSet, stat, buffs)
  317.         artifact(stat.cup, character,  weapon, artSet, stat, buffs)
  318.         artifact([1,1,1,1], character,  weapon, artSet, stat, buffs)
  319.         artifact([1,1,1,1], character,  weapon, artSet, stat, buffs)
  320.     result = calculate(character, weapon, artSet, stat, buffs)
  321.     if len(weapon.songs) > 0:
  322.         total = 0
  323.         for song in range(0, len(weapon.songs)):
  324.             newResult = calculate(character, weapon.songs[song], artSet, stat, buffs)
  325.             total += newResult.total[0]
  326.         result.total = [total / len(weapon.songs)]
  327.     return result
  328.  
  329. def artifact(weights, character, weapon, artSet, stat, buffs):
  330.     stat.atk_p += atk_p_roll * weights[0]
  331.     dmg1 = test(character, weapon, artSet, stat, buffs)
  332.     stat.atk_p -= atk_p_roll * weights[0]
  333.     stat.ctr += ctr_roll * weights[1]
  334.     dmg2 = test(character, weapon, artSet, stat, buffs)
  335.     stat.ctr -= ctr_roll * weights[1]
  336.     stat.cdm += cdm_roll * weights[2]
  337.     dmg3 = test(character, weapon, artSet, stat, buffs)
  338.     stat.cdm -= cdm_roll * weights[2]
  339.     stat.em += em_roll * weights[3]
  340.     dmg4 = test(character, weapon, artSet, stat, buffs)
  341.     stat.em -= em_roll * weights[3]
  342.  
  343.     top = max(dmg1, dmg2, dmg3, dmg4)
  344.     if top == dmg1:
  345.         #print("Rolled Atk%!")
  346.         stat.atk_p += atk_p_roll * weights[0]
  347.     elif top == dmg2:
  348.         #print("Rolled Crit Rate!")
  349.         stat.ctr += ctr_roll * weights[1]
  350.     elif top == dmg3:
  351.         #print("Rolled Crit DMG!")
  352.         stat.cdm += cdm_roll * weights[2]
  353.     elif top == dmg4:
  354.         #print("Rolled EM!")
  355.         stat.em += em_roll * weights[3]
  356.  
  357. def test(character, weapon, artSet, stat, buffs):
  358.     if len(weapon.songs) <= 0:
  359.         return calculate(character, weapon, artSet, stat, buffs).total
  360.     else:
  361.         dps = 0
  362.         for song in range(0, len(weapon.songs)):
  363.             dps += calculate(character, weapon.songs[song], artSet, stat, buffs).total[0]
  364.         return dps / len(weapon.songs)
  365.  
  366. def calculate(character, weapon, artSet, stat, buffs):
  367.     em = weapon.em + stat.em + artSet.em
  368.     bonus_dmg = weapon.dmg + stat.dmg + artSet.dmg
  369.     atk_p = weapon.atk_p + stat.atk_p + artSet.atk_p + character.atk_p
  370.     f_atk = stat.f_atk
  371.     ctr = character.ctr + weapon.ctr + stat.ctr
  372.     cdm = character.cdm + weapon.cdm + stat.cdm
  373.    
  374.     global res
  375.     resistance = res
  376.  
  377.     for i in range(0, len(buffs)):
  378.         atk_p += buffs[i].atk_p
  379.         em += buffs[i].em
  380.         bonus_dmg += buffs[i].dmg
  381.         resistance += buffs[i].res
  382.     if resistance < 0:
  383.         resistance /= 2
  384.        
  385.     ctr = min(ctr, 100)
  386.    
  387.     atk = (character.b_atk + weapon.b_atk) * (1 + atk_p / 100) + f_atk
  388.     atk += em * weapon.em_to_atk / 100
  389.     atk_spd = weapon.atk_spd + artSet.atk_spd + atk_spd_bonus
  390.  
  391.     total = 0
  392.     swirl = 0
  393.     combo = hits[int(atk_spd / 10)]
  394.     for i in range(0, len(combo)):
  395.         dmg = 100 + bonus_dmg
  396.         flat = 0
  397.         s = scaling[i] / 100
  398.         if types[i] == "Normal":
  399.             #dmg += weapon.normal_dmg + artSet.normal_dmg + old_normal_dmg_bonus
  400.             dmg += weapon.normal_dmg + artSet.normal_dmg
  401.             s *= normal_scaling_bonus / 100
  402.             if artSet.name == "Echoes of an Offering":
  403.                 s += 0.35
  404.         elif types[i] == "Skill":
  405.             dmg += weapon.skill_dmg
  406.         elif types[i] == "Charged":
  407.             #dmg += weapon.charged_dmg + artSet.charged_dmg + charged_dmg_bonus
  408.             dmg += weapon.charged_dmg + artSet.charged_dmg
  409.             s *= charged_scaling_bonus / 100
  410.             flat += faruzan_flat
  411.         elif types[i] == "Burst":
  412.             dmg += weapon.burst_dmg + burst_dmg_bonus
  413.             flat += faruzan_flat
  414.         elif types[i] == "Swirl":
  415.             swirl += Swirl(em) * combo[i] * 2
  416.             continue
  417.         elif types[i] == "Faruzan normal":
  418.             #dmg += weapon.normal_dmg + artSet.normal_dmg + old_normal_dmg_bonus
  419.             dmg += weapon.normal_dmg + artSet.normal_dmg
  420.             flat += faruzan_flat
  421.         elif types[i] == "Faruzan none":
  422.             flat += faruzan_flat
  423.  
  424.         add = (atk * s + flat) * dmg / 100
  425.         if(add > 0):
  426.             total += add * combo[i]
  427.     total *= 1 + ctr / 100 * cdm / 100
  428.     total /= 2
  429.     total *= 1 - resistance / 100
  430.    
  431.     if artSet.name == "Viridescent Venerer":
  432.         swirl /= 0.85
  433.     total += swirl
  434.  
  435.     old = total
  436.     total = 0
  437.     swirl = 0
  438.     if A4:
  439.         combo = hits_A4[int(atk_spd / 10)]
  440.     for i in range(0, len(combo)):
  441.         dmg = 100 + bonus_dmg
  442.         flat = 0
  443.         s = scaling[i] / 100
  444.         if types[i] == "Normal":
  445.             #dmg += weapon.normal_dmg + artSet.normal_dmg + old_normal_dmg_bonus
  446.             dmg += weapon.normal_dmg + artSet.normal_dmg
  447.             s *= normal_scaling_bonus / 100
  448.             if artSet.name == "Echoes of an Offering":
  449.                 s += 0.35
  450.         elif types[i] == "Skill":
  451.             dmg += weapon.skill_dmg
  452.         elif types[i] == "Charged":
  453.             #dmg += weapon.charged_dmg + artSet.charged_dmg + charged_dmg_bonus
  454.             dmg += weapon.charged_dmg + artSet.charged_dmg
  455.             s *= charged_scaling_bonus / 100
  456.             flat += faruzan_flat
  457.         elif types[i] == "Burst":
  458.             dmg += weapon.burst_dmg + burst_dmg_bonus
  459.             flat += faruzan_flat
  460.         elif types[i] == "Swirl":
  461.             swirl += Swirl(em) * combo[i] * 2
  462.             continue
  463.         elif types[i] == "Faruzan normal":
  464.             #dmg += weapon.normal_dmg + artSet.normal_dmg + old_normal_dmg_bonus
  465.             dmg += weapon.normal_dmg + artSet.normal_dmg
  466.             flat += faruzan_flat
  467.         elif types[i] == "Faruzan none":
  468.             flat += faruzan_flat
  469.  
  470.         add = (atk * s + flat) * dmg / 100
  471.         if(add > 0):
  472.             total += add * combo[i]
  473.     total *= 1 + ctr / 100 * cdm / 100
  474.     total /= 2
  475.     total *= 1 - resistance / 100
  476.    
  477.     if artSet.name == "Viridescent Venerer":
  478.         swirl /= 0.85
  479.     total += swirl
  480.  
  481.     used_A4 = (total > old)
  482.     total = max(total, old)
  483.  
  484.     return Result(weapon, artSet, stat, atk, em, ctr, cdm, total, used_A4)
  485.  
  486. def printResult(result):
  487.     print("======================================================================")
  488.     print(result.weapon.name)
  489.     print()
  490.     if not result.second == "":
  491.         print("Best set: " + result.artSet.name)
  492.         print("Second best: " + result.second)
  493.         print("Difference: " + str(round(result.difference * 100 - 100, 2)) + "%")
  494.     else:
  495.         print("Artifact set: " + result.artSet.name)
  496.     print()
  497.     if len(result.total) == 1:
  498.         print("Main stats: " + result.stats[0])
  499.     else:
  500.         print("Main stats ranking:")
  501.         for i in range(len(result.stats)):
  502.             print(result.stats[i] + " - dps: " + str(round(result.total[i], 2)))
  503.     print()
  504.     print("Best stats for this weapon:")
  505.     print("Atk: " + str(round(result.atk, 2)))
  506.     print("EM: " + str(round(result.em, 2)))
  507.     print("Crit Rate: " + str(round(result.ctr, 2)))
  508.     print("Crit DMG: " + str(round(result.cdm, 2)))
  509.     print()
  510.     print("Best total DMG: " + str(round(result.total[0], 2)))
  511.     print("Used his A4: " + str(result.A4))
  512.     print()
  513.  
  514. def testWeapons(weapons, artSets, stats, buffs):
  515.     results = []
  516.     for i in range(0, len(weapons)):
  517.         results.append(testSets(weapons[i], artSets, stats, buffs))
  518.     if sort:
  519.         results.sort(key=lambda x: x.total[0], reverse=True)
  520.     for results in results:
  521.         printResult(results)
  522.        
  523. def testSets(weapon, artSets, stats, buffs):
  524.     result = testStats(weapon, artSets[0], stats, buffs)
  525.     if len(artSets) <= 1:
  526.         return result
  527.     for i in range(1, len(artSets)):
  528.         newResult = testStats(weapon, artSets[i], stats, buffs)
  529.         if newResult.total > result.total:
  530.             newResult.second = result.artSet.name
  531.             newResult.difference = newResult.total[0] / result.total[0]
  532.             result = newResult
  533.         else:
  534.             gain = result.total[0] / newResult.total[0]
  535.             if gain < result.difference:
  536.                 result.second = newResult.artSet.name
  537.                 result.difference = gain
  538.     return result
  539.  
  540. def testStats(weapon, artSet, stats, buffs):
  541.     result = evaluate(Wanderer, weapon, artSet, stats[0], buffs)
  542.     if len(stats) <= 1:
  543.         return result
  544.     for i in range(1, len(stats)):
  545.         newResult = evaluate(Wanderer, weapon, artSet, stats[i], buffs)
  546.         if newResult.total[0] > result.total[0]:
  547.             newResult.total += result.total
  548.             newResult.stats += result.stats
  549.             result = newResult
  550.         else:
  551.             for x in range(0, len(result.stats)):
  552.                 if newResult.total[0] > result.total[x]:
  553.                     result.total.insert(x, newResult.total[0])
  554.                     result.stats.insert(x, newResult.stats[0])
  555.                     break
  556.                 if x == len(result.stats) - 1:
  557.                     result.total.append(newResult.total[0])
  558.                     result.stats.append(newResult.stats[0])
  559.     return result
  560.  
  561. #A1
  562.  
  563. #pyro
  564. Wanderer.atk_p += 30
  565.  
  566. #cryo
  567. Wanderer.ctr += 20
  568.  
  569. #hydro
  570. E_time += 2
  571.  
  572. #charge before_E
  573. charged_dmg_bonus = 0
  574. E_time += 1
  575.  
  576. #enable A4
  577. A4 = True
  578. N_cancle = [False, False, True, False]
  579.  
  580. #C1
  581. #atk_spd_bonus = 10
  582. #scaling[4] += 25
  583.  
  584. #C2
  585. #burst_dmg_bonus += 200
  586. #E_time -= 0.5
  587.  
  588. #C3
  589. #scaling[8] = 312.8
  590.  
  591. #C5
  592. #scaling[7] = 202.3
  593. #old_normal_dmg_bonus = 77.75
  594. #old_charged_dmg_bonus = 62.2
  595. #normal_scaling_bonus = 161.4
  596. #charged_scaling_bonus = 149.1
  597.  
  598. #C6
  599. #C6 = True
  600. #E_time += 2
  601.  
  602. #hits[0] = [7.0, 7.0, 6.0, 6.0, 0, 20.0, 1, 1, 5, 26.0, 19.0, 0]
  603. #hits[1] = [7.0, 7.0, 7.0, 7.0, 0, 19.0, 1, 1, 5, 28.0, 21.0, 0]
  604. #hits[2] = [8.0, 8.0, 8.0, 8.0, 0, 22.0, 1, 1, 5, 32.0, 24.0, 0]
  605. #hits[3] = [9.0, 8.0, 8.0, 8.0, 0, 25.0, 1, 1, 5, 33.0, 9.0, 0]
  606. #hits[4] = [9.0, 9.0, 9.0, 9.0, 0, 27.0, 1, 1, 5, 36.0, 9.0, 0]
  607. #hits_A4[1] = [8.6544870002745, 8.105421000685421, 4.24554800023953, 4.24554800023953, 15.037560000686302, 25.191859001367995, 1, 1, 5, 25.25100400428674, 12.013336997760735, 3.300324000107408]
  608. #hits_A4[2] = [9.031295999992496, 8.994642000019928, 4.650986000296201, 4.650986000296201, 16.015208000822955, 27.067030002332892, 1, 1, 5, 27.32791000642171, 12.873292997117144, 3.486290000133402]
  609. #hits_A4[3] = [9.897850999343966, 9.321999999774933, 4.771906000313103, 4.771906000313103, 17.037132000965798, 28.42796400296172, 1, 1, 5, 28.763663007897602, 9.897850999343966, 0]
  610. #hits_A4[4] = [10.126148999173108, 10.008512999261146, 5.249168000379814, 5.249168000379814, 19.003728001240685, 30.527797003780254, 1, 1, 5, 30.632998009819197, 10.126148999173108, 0]
  611.  
  612. #Faruzan
  613. #old_faruzan_flat = 761.25 * 0.459
  614. faruzan_flat = 761.25 * 0.32
  615. Wanderer.cdm = 40
  616.  
  617. sort = True
  618. print("Weapon comparison:")
  619. testWeapons(books, sets, stats, [Faruzan,Noblesse])
  620. #testWeapons([TullaytullahsRemembrance], [DesertPavilionChronicle], [AtkElCtr], [Faruzan,Noblesse])
  621. #testWeapons([SolarPearlR5], [DesertPavilionChronicle], [AtkElCtr], [Faruzan,Noblesse])
Advertisement
Add Comment
Please, Sign In to add comment