-
Notifications
You must be signed in to change notification settings - Fork 10
/
TheoryCraftClassicEngine.lua
1840 lines (1757 loc) · 84.6 KB
/
TheoryCraftClassicEngine.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
local _, class = UnitClass("player")
local returndata = {}
local summeddata = {}
local function findpattern(text, pattern, start)
if (text and pattern and (string.find(text, pattern, start))) then
return string.sub(text, string.find(text, pattern, start))
else
return ""
end
end
local function round(arg1, decplaces)
if (decplaces == nil) then decplaces = 0 end
if arg1 == nil then arg1 = 0 end
return string.format ("%."..decplaces.."f", arg1)
end
local function TheoryCraft_AddData(arg1, data, summeddata)
if data == nil then return end
summeddata["tmpincrease"] = summeddata["tmpincrease"] + (data[arg1.."modifier"] or 0)
summeddata["tmpincreaseupfront"] = summeddata["tmpincreaseupfront"] + (data[arg1.."UpFrontmodifier"] or 0)
if summeddata["baseincrease"] ~= 0 then
summeddata["baseincrease"] = summeddata["baseincrease"] * ((data[arg1.."baseincrease"] or 0)+1)
else
summeddata["baseincrease"] = summeddata["baseincrease"] + (data[arg1.."baseincrease"] or 0)
end
if summeddata["baseincreaseupfront"] ~= 0 then
summeddata["baseincreaseupfront"] = summeddata["baseincreaseupfront"] * ((data[arg1.."UpFrontbaseincrease"] or 0)+1)
else
summeddata["baseincreaseupfront"] = summeddata["baseincreaseupfront"] + (data[arg1.."UpFrontbaseincrease"] or 0)
end
summeddata["talentmod"] = summeddata["talentmod"] + (data[arg1.."talentmod"] or 0)
summeddata["talentmodupfront"] = summeddata["talentmodupfront"] + (data[arg1.."UpFronttalentmod"] or 0)
if (summeddata["doshatter"] ~= 0) then
summeddata["critchance"] = summeddata["critchance"] + (data[arg1.."shatter"] or 0)
end
summeddata["illum"] = summeddata["illum"] + (data[arg1.."illum"] or 0)
summeddata["plusdam"] = summeddata["plusdam"] + (data[arg1] or 0)
summeddata["manacostmod"] = summeddata["manacostmod"] + (data[arg1.."manacost"] or 0)
summeddata["critchance"] = summeddata["critchance"] + (data[arg1.."critchance"] or 0)
summeddata["critbonus"] = summeddata["critbonus"] + (data[arg1.."critbonus"] or 0)
summeddata["ignitemodifier"] = summeddata["ignitemodifier"] + (data[arg1.."ignitemodifier"] or 0)
summeddata["sepignite"] = summeddata["sepignite"] + (data[arg1.."sepignite"] or 0)
summeddata["hitbonus"] = summeddata["hitbonus"] - (data[arg1.."hitchance"] or 0)
summeddata["casttime"] = summeddata["casttime"] + (data[arg1.."casttime"] or 0)
summeddata["regencasttime"] = summeddata["regencasttime"] + (data[arg1.."casttime"] or 0)
summeddata["penetration"] = summeddata["penetration"] + (data[arg1.."penetration"] or 0)
summeddata["grace"] = summeddata["grace"] + (data[arg1.."grace"] or 0)
summeddata["threat"] = summeddata["threat"] + (data[arg1.."threat"] or 0)
if data[arg1.."Netherwind"] == 1 then
summeddata["netherwind"] = 1
end
end
local function TheoryCraft_DoSchool(arg1, summeddata)
if TheoryCraft_Data.Testing then
TheoryCraft_AddData(arg1, TheoryCraft_Data.TalentsTest, summeddata)
else
TheoryCraft_AddData(arg1, TheoryCraft_Data.Talents, summeddata)
end
TheoryCraft_AddData(arg1, TheoryCraft_Data.BaseData, summeddata)
TheoryCraft_AddData(arg1, TheoryCraft_Data.Stats, summeddata)
TheoryCraft_AddData(arg1, TheoryCraft_Data.PlayerBuffs, summeddata)
TheoryCraft_AddData(arg1, TheoryCraft_Data.TargetBuffs, summeddata)
TheoryCraft_AddData(arg1, TheoryCraft_Data.EquipEffects, summeddata)
TheoryCraft_AddData(arg1, TheoryCraft_Data.Target, summeddata)
end
local function SummateData(name, schools)
TheoryCraft_DeleteTable(summeddata)
summeddata["doshatter"] = (TheoryCraft_Data.TargetBuffs["doshatter"] or 0)
summeddata["tmpincrease"] = 0
summeddata["tmpincreaseupfront"] = 0
summeddata["baseincrease"] = 0
summeddata["baseincreaseupfront"] = 0
summeddata["talentmod"] = 0
summeddata["talentmodupfront"] = 0
summeddata["critchance"] = (TheoryCraft_Data.Stats["critchance"] or 0)
summeddata["illum"] = 0
summeddata["plusdam"] = 0
summeddata["manacostmod"] = 1
summeddata["critbonus"] = 0
summeddata["ignitemodifier"] = 0
summeddata["sepignite"] = 0
summeddata["hitbonus"] = 0
summeddata["casttime"] = 0
summeddata["regencasttime"] = 0
summeddata["penetration"] = 0
summeddata["grace"] = 0
summeddata["netherwind"] = 0
summeddata["threat"] = 0
for k, v in pairs (schools) do
TheoryCraft_DoSchool(v, summeddata)
end
TheoryCraft_DoSchool(name, summeddata)
end
local function getcooldown(frame)
index = 1
local rtext = getglobal(frame:GetName().."TextRight"..index):GetText()
local cooldown = 1.5
while (rtext) do
if (getglobal(frame:GetName().."TextRight"..index):IsVisible()) then
if (strfind(rtext, "%d+.%d+"..TheoryCraft_Locale.Cooldown)) then
cooldown = findpattern(rtext, "%d+.%d+");
elseif (strfind(rtext, "%d+"..TheoryCraft_Locale.Cooldown)) then
cooldown = findpattern(rtext, "%d+");
end
end
index = index + 1;
rtext = getglobal(frame:GetName().."TextRight"..index):GetText()
end
return cooldown
end
local function getlifetap(returndata)
local i2 = 1
local spellname = 1
local spellrank = 1
local quit = 0
local found = 0
while (spellname) do
spellname, spellrank = GetSpellBookItemName(i2,BOOKTYPE_SPELL)
spellrank = tonumber(findpattern(spellrank, "%d+"))
if (spellname == TheoryCraft_Locale.lifetap) then
found = 1
elseif (found == 1) then
TCTooltip:SetOwner(UIParent,"ANCHOR_NONE")
TCTooltip:SetSpellBookItem(i2-1,BOOKTYPE_SPELL)
if (TCTooltip:NumLines() > 0) then
local description = getglobal("TCTooltipTextLeft"..TCTooltip:NumLines()):GetText()
returndata["lifetapHealth"] = findpattern(description, "%d+ health")
returndata["lifetapMana"] = findpattern(description, "%d+ mana")
if returndata["lifetapHealth"] then
returndata["lifetapHealth"] = tonumber(findpattern(returndata["lifetapHealth"], "%d+"))
end
if returndata["lifetapMana"] then
returndata["lifetapMana"] = tonumber(findpattern(returndata["lifetapMana"], "%d+"))
end
end
return
end
i2 = i2 + 1
end
end
function TheoryCraft_GetStat(statname)
if TheoryCraft_Data.testing then
return (TheoryCraft_Data.BaseData[statname] or 0)+
(TheoryCraft_Data.TalentsTest[statname] or 0)+
(TheoryCraft_Data.Stats[statname] or 0)+
(TheoryCraft_Data.PlayerBuffs[statname] or 0)+
(TheoryCraft_Data.TargetBuffs[statname] or 0)+
(TheoryCraft_Data.EquipEffects[statname] or 0)+
(TheoryCraft_Data.Target[statname] or 0)
else
return (TheoryCraft_Data.BaseData[statname] or 0)+
(TheoryCraft_Data.Talents[statname] or 0)+
(TheoryCraft_Data.Stats[statname] or 0)+
(TheoryCraft_Data.PlayerBuffs[statname] or 0)+
(TheoryCraft_Data.TargetBuffs[statname] or 0)+
(TheoryCraft_Data.EquipEffects[statname] or 0)+
(TheoryCraft_Data.Target[statname] or 0)
end
end
local function agipercrit()
if TheoryCraft_agipercrit then
return TheoryCraft_agipercrit
else
return TheoryCraft_CritChance[class][1]
end
end
function TheoryCraft_intpercrit()
local critdivider
local agipercrit = agipercrit()
if agipercrit == TheoryCraft_CritChance[class][1] then
critdivider = UnitLevel("player")/60*TheoryCraft_CritChance[class][2]
if (critdivider < 5) then
critdivider = 5
end
else
critdivider = agipercrit/TheoryCraft_CritChance[class][1]*TheoryCraft_CritChance[class][2]
end
return critdivider
end
--- Returns the cast time from the spell tooltip ---
local function getcasttime(frame)
index = 1;
local ltext = getglobal(frame:GetName().."TextLeft"..index):GetText()
local castTime = 0
while (ltext) do
ltext = string.gsub(ltext, ",", ".")
if (strfind(ltext, "%d+.%d+"..TheoryCraft_Locale.SecCast)) then
castTime = findpattern(findpattern(ltext, "%d+.%d+"..TheoryCraft_Locale.SecCast), "%d+.%d+")
elseif (strfind(ltext, "%d+"..TheoryCraft_Locale.SecCast)) then
castTime = findpattern(findpattern(ltext, "%d+"..TheoryCraft_Locale.SecCast), "%d+")
end
index = index + 1
ltext = getglobal(frame:GetName().."TextLeft"..index):GetText()
end
castTime = tonumber(castTime)
return castTime
end
--- Returns the dot duration from the spell tooltip ---
local function TheoryCraft_getDotDuration(description)
local i = 1
local _, found
while TheoryCraft_DotDurations[i] do
if (strfind(description, TheoryCraft_DotDurations[i].text)) then
if TheoryCraft_DotDurations[i].amount == "n" then
_, _, found = strfind(description, TheoryCraft_DotDurations[i].text)
return found
else
return TheoryCraft_DotDurations[i].amount
end
end
i = i + 1
end
return 1
end
local function getmanacost(frame)
index = 1
local ltext = getglobal(frame:GetName().."TextLeft"..index):GetText()
local manaCost = 0
while (ltext) do
if (strfind(ltext, TheoryCraft_Locale.Mana)) then
manaCost = findpattern(ltext, "%d+")
end
index = index + 1;
ltext = getglobal(frame:GetName().."TextLeft"..index):GetText()
end
manaCost = tonumber(manaCost)
if manaCost then
return manaCost
else
return 0
end
end
local function TheoryCraft_GetRangedSpeed()
TheoryCraftTooltip:SetOwner(UIParent,"ANCHOR_NONE")
TheoryCraftTooltip:SetInventoryItem ("player", GetInventorySlotInfo("RangedSlot"))
local index = 1
ltext = getglobal(TheoryCraftTooltip:GetName().."TextLeft"..index)
rtext = getglobal(TheoryCraftTooltip:GetName().."TextRight"..index)
if ltext then
ltext = ltext:GetText()
end
if rtext then
if not (getglobal(TheoryCraftTooltip:GetName().."TextRight"..index):IsVisible()) then
rtext = nil
else
rtext = rtext:GetText()
end
end
while (ltext ~= nil) do
if (rtext) then
for k, v in pairs(TheoryCraft_EquipEveryRight) do
if (v.slot == nil) or (v.slot == "Ranged") then
_, start, found = strfind(rtext, v.text)
if found then
if v.amount then
TheoryCraftTooltip:ClearLines()
return v.amount
else
TheoryCraftTooltip:ClearLines()
return found
end
end
end
end
end
index = index + 1;
ltext = getglobal(TheoryCraftTooltip:GetName().."TextLeft"..index)
rtext = getglobal(TheoryCraftTooltip:GetName().."TextRight"..index)
if ltext then
ltext = ltext:GetText()
end
if rtext then
if not (getglobal(TheoryCraftTooltip:GetName().."TextRight"..index):IsVisible()) then
rtext = nil
else
rtext = rtext:GetText()
end
end
end
TheoryCraftTooltip:ClearLines()
return 2.8
end
local function GetCritChance(critreport)
local critChance, iCritInfo, critNum
local remove = 0
local id = 1
local attackSpell = GetSpellBookItemName(id,BOOKTYPE_SPELL)
if (attackSpell ~= TheoryCraft_Locale.Attack) then
name, texture, offset, numSpells = GetSpellTabInfo(1)
for i=1, numSpells do
if (GetSpellBookItemName(i,BOOKTYPE_SPELL) == TheoryCraft_Locale.Attack) then
id = i
end
end
end
if GetSpellBookItemName(id,BOOKTYPE_SPELL) ~= TheoryCraft_Locale.Attack then
return 0
end
TheoryCraftTooltip:SetOwner(UIParent,"ANCHOR_NONE")
TheoryCraftTooltip:SetSpellBookItem(id, BOOKTYPE_SPELL)
local spellName = TheoryCraftTooltipTextLeft2:GetText()
if not spellName then return 0 end
iCritInfo = string.find(spellName, "%s")
critNum = string.sub(spellName,0,(iCritInfo -2))
critChance = string.gsub(critNum, ",", ".")
critChance = tonumber(critChance)
if critreport == nil then critreport = 0 end
if (critChance) and (critChance ~= critreport) then
local doweaponskill = true
if class == "DRUID" then
local _, _, active = GetShapeshiftFormInfo(1)
if active then doweaponskill = nil end
local _, _, active = GetShapeshiftFormInfo(3)
if active then doweaponskill = nil end
end
if doweaponskill then
TheoryCraftTooltip:SetOwner(UIParent,"ANCHOR_NONE")
TheoryCraftTooltip:SetInventoryItem ("player", GetInventorySlotInfo("MainHandSlot"))
local i, i2 = 1
local ltext = getglobal(TheoryCraftTooltip:GetName().."TextLeft"..i):GetText()
local rtext = getglobal(TheoryCraftTooltip:GetName().."TextRight"..i):GetText()
local skill = TheoryCraft_WeaponSkillOther
local english = "Unarmed"
while ltext do
ltext = getglobal(TheoryCraftTooltip:GetName().."TextLeft"..i):GetText()
rtext = getglobal(TheoryCraftTooltip:GetName().."TextRight"..i):GetText()
if (rtext) and (getglobal(TheoryCraftTooltip:GetName().."TextRight"..i):IsVisible()) then
i2 = 1
while TheoryCraft_WeaponSkills[i2] do
if (((TheoryCraft_WeaponSkills[i2].ltext) and (TheoryCraft_WeaponSkills[i2].ltext == ltext)) or (TheoryCraft_WeaponSkills[i2].ltext == nil)) and (TheoryCraft_WeaponSkills[i2].text == rtext) then
skill = TheoryCraft_WeaponSkills[i2].skill
english = TheoryCraft_WeaponSkills[i2].english
break
end
i2 = i2 + 1
end
end
if skill ~= TheoryCraft_WeaponSkillOther then
break
end
i = i + 1
end
local i = 1
local skillTitle, header, isExpanded, skillRank
while GetSkillLineInfo(i) do
skillTitle, header, isExpanded, skillRank = GetSkillLineInfo(i)
if (skillTitle == skill) then
critChance = critChance + (UnitLevel("player")*5 - skillRank)*0.04
break
end
i = i + 1
end
-- remove weapon specs
critChance = critChance - TheoryCraft_GetStat(english.."specreal")
end
critChance = critChance - (TheoryCraft_GetStat("CritChangeTalents") or 0)
if doweaponskill == nil then
critChance = critChance - (TheoryCraft_Data.Talents["Formcritchancereal"] or 0)
remove = -1*(TheoryCraft_Data.Talents["Formcritchancereal"] or 0)
end
local critchance2 = critChance-TheoryCraft_GetStat("CritReport")
if doweaponskill == nil then
critChance = critChance + (TheoryCraft_Data.Talents["Formcritchance"] or 0)
end
if class == "WARRIOR" then
local _, _, active = GetShapeshiftFormInfo(3)
if active then
critchance2 = critchance2 - 3
remove = -3
end
end
if UnitLevel("player") == 60 then
if (class == "DRUID") then
if doweaponskill == nil then
remove = -1*(TheoryCraft_Data.Talents["Formcritchance"] or 0)
end
end
TheoryCraft_agipercrit = TheoryCraft_CritChance[class][1]
else
if (TheoryCraft_Data["outfit"] == nil) or (TheoryCraft_Data["outfit"] == 1) then
local _, agi = UnitStat("player", 2)
TheoryCraft_agipercrit = agi/(critchance2-TheoryCraft_CritChance[class][3])
end
end
return (critChance or 0), remove
else
return 0, remove
end
end
function TheoryCraft_LoadStats(talents)
if talents == nil then talents = TheoryCraft_Data.Talents end
TheoryCraft_DeleteTable(TheoryCraft_Data.Stats)
local remove
TheoryCraft_Data.Stats["meleecritchance"], remove = GetCritChance()
TheoryCraft_Data.Stats["Rangedhastebonus"] = UnitRangedDamage("player")/TheoryCraft_GetRangedSpeed()
local outfit = (TheoryCraft_Data["outfit"] or 1)
if outfit == -1 then
outfit = 1
end
local _, tmp = UnitStat("player", 1)
TheoryCraft_Data.Stats["strength"] = tmp
_, tmp = UnitStat("player", 2)
TheoryCraft_Data.Stats["agility"] = tmp
_, tmp = UnitStat("player", 3)
TheoryCraft_Data.Stats["stamina"] = tmp
_, tmp = UnitStat("player", 4)
TheoryCraft_Data.Stats["intellect"] = tmp
_, tmp = UnitStat("player", 5)
TheoryCraft_Data.Stats["spirit"] = tmp
TheoryCraft_Data.Stats["agipercrit"] = agipercrit()
local _, catform, bearform
if class == "DRUID" then
_, _, bearform = GetShapeshiftFormInfo(1)
_, _, catform = GetShapeshiftFormInfo(3)
TheoryCraft_Data.Stats["agilityapranged"] = 2
TheoryCraft_Data.Stats["strengthapmelee"] = 2
if catform then
TheoryCraft_Data.Stats["agilityapmelee"] = 1
else
TheoryCraft_Data.Stats["agilityapmelee"] = 0
end
elseif (class == "WARRIOR") or (class == "PALADIN") or (class == "SHAMAN") then
TheoryCraft_Data.Stats["agilityapranged"] = 2
TheoryCraft_Data.Stats["strengthapmelee"] = 2
TheoryCraft_Data.Stats["agilityapmelee"] = 0
elseif (class == "ROGUE") or (class == "HUNTER") then
TheoryCraft_Data.Stats["agilityapranged"] = 2
TheoryCraft_Data.Stats["strengthapmelee"] = 1
TheoryCraft_Data.Stats["agilityapmelee"] = 1
else
TheoryCraft_Data.Stats["agilityapranged"] = 0
TheoryCraft_Data.Stats["strengthapmelee"] = 1
TheoryCraft_Data.Stats["agilityapmelee"] = 0
end
local base, pos, neg = UnitAttackPower("player")
TheoryCraft_Data.Stats["attackpower"] = base+pos+neg-TheoryCraft_Data.Stats["strengthapmelee"]*TheoryCraft_Data.Stats["strength"]-TheoryCraft_Data.Stats["agilityapmelee"]*TheoryCraft_Data.Stats["agility"]+(talents["AttackPowerTalents"] or 0)
base, pos, neg = UnitRangedAttackPower("player")
TheoryCraft_Data.Stats["rangedattackpower"] = (TheoryCraft_Data.TargetBuffs["huntersmark"] or 0)+base+pos+neg-TheoryCraft_Data.Stats["agilityapranged"]*TheoryCraft_Data.Stats["agility"]
TheoryCraft_Data.Stats["totalmana"] = UnitPowerMax("player")/talents["manamultiplierreal"]
TheoryCraft_Data.Stats["totalhealth"] = UnitHealthMax("player")/talents["healthmultiplierreal"]
TheoryCraft_Data.Stats["meleecritchance"] = TheoryCraft_Data.Stats["meleecritchance"]-TheoryCraft_Data.Stats["agility"]/TheoryCraft_Data.Stats["agipercrit"]
TheoryCraft_Data.Stats["totalhealth"] = TheoryCraft_Data.Stats["totalhealth"] - TheoryCraft_Data.Stats["stamina"]*10
TheoryCraft_Data.Stats["totalmana"] = TheoryCraft_Data.Stats["totalmana"] - TheoryCraft_Data.Stats["intellect"]*15
TheoryCraft_Data.Stats["strength"] = TheoryCraft_Data.Stats["strength"]/talents["strmultiplierreal"]
TheoryCraft_Data.Stats["agility"] = TheoryCraft_Data.Stats["agility"]/talents["agimultiplierreal"]
TheoryCraft_Data.Stats["stamina"] = TheoryCraft_Data.Stats["stamina"]/talents["stammultiplierreal"]
TheoryCraft_Data.Stats["intellect"] = TheoryCraft_Data.Stats["intellect"]/talents["intmultiplierreal"]
TheoryCraft_Data.Stats["spirit"] = TheoryCraft_Data.Stats["spirit"]/talents["spiritmultiplierreal"]
TheoryCraft_Data.Stats["formattackpower"] = 0
if (TheoryCraft_Outfits[outfit].meleecritchance) then TheoryCraft_Data.Stats["meleecritchance"] = TheoryCraft_Data.Stats["meleecritchance"]+TheoryCraft_Outfits[outfit].meleecritchance end
if (TheoryCraft_Outfits[outfit].rangedattackpower) then TheoryCraft_Data.Stats["rangedattackpower"] = TheoryCraft_Data.Stats["rangedattackpower"]+TheoryCraft_Outfits[outfit].rangedattackpower end
if (TheoryCraft_Outfits[outfit].attackpower) then TheoryCraft_Data.Stats["attackpower"] = TheoryCraft_Data.Stats["attackpower"]+TheoryCraft_Outfits[outfit].attackpower end
if (TheoryCraft_Outfits[outfit].formattackpower) then TheoryCraft_Data.Stats["formattackpower"] = TheoryCraft_Data.Stats["formattackpower"]+TheoryCraft_Outfits[outfit].formattackpower end
if (TheoryCraft_Outfits[outfit].strength) then TheoryCraft_Data.Stats["strength"] = TheoryCraft_Data.Stats["strength"]+TheoryCraft_Outfits[outfit].strength end
if (TheoryCraft_Outfits[outfit].agility) then TheoryCraft_Data.Stats["agility"] = TheoryCraft_Data.Stats["agility"]+TheoryCraft_Outfits[outfit].agility end
if (TheoryCraft_Outfits[outfit].stamina) then TheoryCraft_Data.Stats["stamina"] = TheoryCraft_Data.Stats["stamina"]+TheoryCraft_Outfits[outfit].stamina end
if (TheoryCraft_Outfits[outfit].intellect) then TheoryCraft_Data.Stats["intellect"] = TheoryCraft_Data.Stats["intellect"]+TheoryCraft_Outfits[outfit].intellect end
if (TheoryCraft_Outfits[outfit].spirit) then TheoryCraft_Data.Stats["spirit"] = TheoryCraft_Data.Stats["spirit"]+TheoryCraft_Outfits[outfit].spirit end
if (TheoryCraft_Outfits[outfit].totalmana) then TheoryCraft_Data.Stats["totalmana"] = TheoryCraft_Data.Stats["totalmana"]+TheoryCraft_Outfits[outfit].totalmana end
if (TheoryCraft_Outfits[outfit].totalhealth) then TheoryCraft_Data.Stats["totalhealth"] = TheoryCraft_Data.Stats["totalhealth"]+TheoryCraft_Outfits[outfit].totalhealth end
local i = 1
TheoryCraft_Data.DequippedSets = {}
while (TheoryCraft_Outfits[outfit].destat[i]) do
TheoryCraft_Data.Stats = TheoryCraft_DequipEffect(TheoryCraft_Outfits[outfit].destat[i], TheoryCraft_Data.Stats, TheoryCraft_Data.DequippedSets)
i = i + 1
end
local returndata
for k,count in pairs(TheoryCraft_Data.DequippedSets) do
if TheoryCraft_SetBonuses[k] then
for k,v in pairs(TheoryCraft_SetBonuses[k]) do
if (v["pieces"] <= count) then
returndata = {}
returndata = TheoryCraft_DequipLine(v["text"], returndata)
for k,v in pairs(returndata) do
TheoryCraft_Data.Stats[k] = (TheoryCraft_Data.Stats[k] or 0) + v
end
returndata = {}
returndata = TheoryCraft_DequipSpecial(v["text"], returndata)
for k,v in pairs(returndata) do
TheoryCraft_Data.Stats[k] = (TheoryCraft_Data.Stats[k] or 0) + v
end
end
end
end
end
if catform or bearform then TheoryCraft_Data.Stats["attackpower"] = TheoryCraft_Data.Stats["attackpower"] + TheoryCraft_Data.Stats["formattackpower"] end
TheoryCraft_Data.Stats["strength"] = math.floor(TheoryCraft_Data.Stats["strength"] * talents["strmultiplier"])
TheoryCraft_Data.Stats["agility"] = math.floor(TheoryCraft_Data.Stats["agility"] * talents["agimultiplier"])
TheoryCraft_Data.Stats["rangedattackpower"] = math.floor(TheoryCraft_Data.Stats["rangedattackpower"]+TheoryCraft_Data.Stats["agilityapranged"]*TheoryCraft_Data.Stats["agility"])
TheoryCraft_Data.Stats["attackpower"] = math.floor(TheoryCraft_Data.Stats["attackpower"]+TheoryCraft_Data.Stats["strengthapmelee"]*TheoryCraft_Data.Stats["strength"]+TheoryCraft_Data.Stats["agilityapmelee"]*TheoryCraft_Data.Stats["agility"])
TheoryCraft_Data.Stats["intellect"] = math.floor(TheoryCraft_Data.Stats["intellect"] * talents["intmultiplier"])
TheoryCraft_Data.Stats["stamina"] = math.floor(TheoryCraft_Data.Stats["stamina"] * talents["stammultiplier"])
TheoryCraft_Data.Stats["spirit"] = math.floor(TheoryCraft_Data.Stats["spirit"] * talents["spiritmultiplier"])
TheoryCraft_Data.Stats["totalhealth"] = (TheoryCraft_Data.Stats["totalhealth"] + TheoryCraft_Data.Stats["stamina"]*10)*talents["healthmultiplier"]
TheoryCraft_Data.Stats["totalmana"] = (TheoryCraft_Data.Stats["totalmana"] + TheoryCraft_Data.Stats["intellect"]*15)*talents["manamultiplier"]
TheoryCraft_Data.Stats["meleecritchance"] = TheoryCraft_Data.Stats["meleecritchance"]+TheoryCraft_Data.Stats["agility"]/TheoryCraft_Data.Stats["agipercrit"]
TheoryCraft_Data.Stats["rangedcritchance"] = TheoryCraft_Data.Stats["meleecritchance"]+(talents["Huntercritchance"] or 0)
TheoryCraft_Data.Stats["critchance"] = TheoryCraft_Data.Stats["intellect"]/TheoryCraft_intpercrit()+TheoryCraft_CritChance[class][4]
if class == "MAGE" then
TheoryCraft_Data.Stats["regenfromspirit"] = TheoryCraft_Data.Stats["spirit"]/8+6.25
elseif class == "PRIEST" then
TheoryCraft_Data.Stats["regenfromspirit"] = TheoryCraft_Data.Stats["spirit"]/8+6.25
elseif class == "WARLOCK" then
TheoryCraft_Data.Stats["regenfromspirit"] = TheoryCraft_Data.Stats["spirit"]/10+7.5
elseif class == "DRUID" then
TheoryCraft_Data.Stats["regenfromspirit"] = TheoryCraft_Data.Stats["spirit"]/10+7.5
elseif class == "SHAMAN" then
TheoryCraft_Data.Stats["regenfromspirit"] = TheoryCraft_Data.Stats["spirit"]/10+8.5
elseif class == "HUNTER" then
TheoryCraft_Data.Stats["regenfromspirit"] = TheoryCraft_Data.Stats["spirit"]/10+7.5
elseif class == "PALADIN" then
TheoryCraft_Data.Stats["regenfromspirit"] = TheoryCraft_Data.Stats["spirit"]/10+7.5
elseif class == "ROGUE" then
TheoryCraft_Data.Stats["regenfromspirit"] = 0
elseif class == "WARRIOR" then
TheoryCraft_Data.Stats["regenfromspirit"] = 0
end
TheoryCraft_Data.Stats["meleecritchancereal"] = TheoryCraft_Data.Stats["meleecritchance"]+(remove or 0)
if (TheoryCraft_Data.EquipEffects["FistEquipped"] or 0) >= 1 then
TheoryCraft_Data.Stats["meleecritchance"] = TheoryCraft_Data.Stats["meleecritchance"]+TheoryCraft_GetStat("Fistspec")
end
if (TheoryCraft_Data.EquipEffects["DaggerEquipped"] or 0) >= 1 then
TheoryCraft_Data.Stats["meleecritchance"] = TheoryCraft_Data.Stats["meleecritchance"]+TheoryCraft_GetStat("Daggerspec")
end
if (TheoryCraft_Data.EquipEffects["AxeEquipped"] or 0) >= 1 then
TheoryCraft_Data.Stats["meleecritchance"] = TheoryCraft_Data.Stats["meleecritchance"]+TheoryCraft_GetStat("Axespec")
end
if (TheoryCraft_Data.EquipEffects["PolearmEquipped"] or 0) >= 1 then
TheoryCraft_Data.Stats["meleecritchance"] = TheoryCraft_Data.Stats["meleecritchance"]+TheoryCraft_GetStat("Polearmspec")
end
local meleeapmult = TheoryCraft_GetStat("MeleeAPMult")
if meleeapmult > 3 then
TheoryCraft_Data.Stats["Meleemodifier"] = (talents["Twohandmodifier"] or 0)+(talents["Twohandtalentmod"] or 0)
elseif meleeapmult > 1 then
TheoryCraft_Data.Stats["Meleemodifier"] = (talents["Onehandmodifier"] or 0)+(talents["Onehandtalentmod"] or 0)
end
local manaregen = TheoryCraft_GetStat("manaperfive")/5
manaregen = manaregen+TheoryCraft_Data.Stats["totalmana"]*TheoryCraft_GetStat("FelEnergy")/4
TheoryCraft_Data.Stats["regen"] = manaregen+TheoryCraft_Data.Stats["regenfromspirit"]
TheoryCraft_Data.Stats["icregen"] = manaregen+(TheoryCraft_Data.Stats["regenfromspirit"])*TheoryCraft_GetStat("ICPercent")
if (class == "MAGE") then
TheoryCraft_Data.Stats["maxtotalmana"] = TheoryCraft_Data.Stats["totalmana"]+TheoryCraft_Data.Stats["regenfromspirit"]*15*8+1100+manaregen*8
end
if (class == "WARLOCK") then
getlifetap(TheoryCraft_Data.Stats)
end
TheoryCraft_Data.Stats["All"] = math.floor(TheoryCraft_Data.Stats["spirit"]*(talents["Allspiritual"] or 0))
TheoryCraft_Data.Stats["BlockValue"] = TheoryCraft_GetStat("BlockValueReport")+(TheoryCraft_Data.Stats["strength"]/20) - 1
end
local function AddProcs(casttime, returndata, spelldata)
TheoryCraft_Data.Procs = {}
if TheoryCraft_Settings["procs"] == nil then return end
if (spelldata == nil) or (spelldata.Schools == nil) then return end
if TheoryCraft_Data.EquipEffects["procs"] then
local i = 1
local amount, procduration
while TheoryCraft_Data.EquipEffects["procs"][i] do
amount = TheoryCraft_Data.EquipEffects["procs"][i].amount
if TheoryCraft_Data.EquipEffects["procs"][i].exact then
procduration = 1 - (1 - TheoryCraft_Data.EquipEffects["procs"][i].proc)^math.floor(TheoryCraft_Data.EquipEffects["procs"][i].duration/casttime)
else
procduration = 1 - (1 - TheoryCraft_Data.EquipEffects["procs"][i].proc)^(TheoryCraft_Data.EquipEffects["procs"][i].duration/casttime)
end
TheoryCraft_Data.Procs[TheoryCraft_Data.EquipEffects["procs"][i].type] = (TheoryCraft_Data.Procs[TheoryCraft_Data.EquipEffects["procs"][i].type] or 0)+amount*procduration
i = i + 1
end
i = 1
while (spelldata.Schools[i]) do
TheoryCraft_AddData(spelldata.Schools[i], TheoryCraft_Data.Procs, returndata)
i = i+1
end
if TheoryCraft_Data.Procs["ICPercent"] then
TheoryCraft_Data.Stats["icregen"] = TheoryCraft_GetStat("manaperfive")/5+(TheoryCraft_Data.Stats["regenfromspirit"])*(TheoryCraft_GetStat("ICPercent")+TheoryCraft_Data.Procs["ICPercent"])
end
end
end
local function CleanUp(spelldata, returndata)
if spelldata.percent == 0 then
returndata["plusdam"] = nil
returndata["damfinal"] = nil
returndata["damcoef"] = nil
end
if spelldata.ismelee then
returndata["manacost"] = nil
returndata["plusdam"] = nil
end
if spelldata.isheal then
returndata["penetration"] = nil
end
if spelldata.armor then
returndata["plusdam"] = nil
returndata["penetration"] = nil
end
if spelldata.dodps == nil then
returndata["hps"] = nil
returndata["withhothps"] = nil
returndata["hpsdam"] = nil
returndata["hpsdampercent"] = nil
returndata["dps"] = nil
returndata["withdotdps"] = nil
returndata["dpsdam"] = nil
returndata["dpsdampercent"] = nil
end
if (spelldata.usemelee) or (spelldata.petspell) then
returndata["nextpendam"] = nil
returndata["nextpen"] = nil
returndata["penetration"] = nil
end
if spelldata.petspell then
returndata["damcoef"] = nil
returndata["dpsdam"] = nil
returndata["dpsdampercent"] = nil
returndata["plusdam"] = nil
returndata["dameff"] = nil
returndata["damfinal"] = nil
returndata["lifetapdps"] = nil
returndata["lifetapdpm"] = nil
returndata["nextagidps"] = nil
returndata["nexthitdps"] = nil
returndata["nextcritdps"] = nil
returndata["nextstrdpsequive"] = nil
returndata["nextagidpsequive"] = nil
returndata["nexthitdpsequive"] = nil
returndata["nextcritdpsequive"] = nil
returndata["nextagidam"] = nil
returndata["nextpendam"] = nil
returndata["nexthitdam"] = nil
returndata["nextcritdam"] = nil
returndata["nextstrdamequive"] = nil
returndata["nextagidamequive"] = nil
returndata["nextpendamequive"] = nil
returndata["nexthitdamequive"] = nil
returndata["nextcritdamequive"] = nil
returndata["regendam"] = nil
returndata["icregendam"] = nil
returndata["nextcritheal"] = nil
returndata["nextcrithealequive"] = nil
returndata["hpsdam"] = nil
returndata["hpsdampercent"] = nil
returndata["regenheal"] = nil
returndata["icregenheal"] = nil
end
if (spelldata.dontdpsafterresists) then
returndata["nexthitdam"] = nil
end
if (spelldata.cancrit == nil) then
returndata["nextcritdam"] = nil
returndata["nextcritdamequive"] = nil
returndata["nextcritdps"] = nil
returndata["nextcritdpsequive"] = nil
returndata["critchance"] = nil
returndata["critdmgchance"] = nil
returndata["crithealchance"] = nil
returndata["critdmgmin"] = nil
returndata["critdmgmax"] = nil
returndata["critdmgminminusignite"] = nil
returndata["critdmgmaxminusignite"] = nil
returndata["crithealmin"] = nil
returndata["crithealmax"] = nil
end
end
local function GenerateTooltip(frame, returndata, spelldata, spellrank)
returndata["RangedAPMult"] = 2.8
if (frame == nil) or (frame:NumLines() == 0) then
CleanUp(spelldata, returndata)
return
end
if spelldata.evocation then
CleanUp(spelldata, returndata)
returndata["evocation"] = TheoryCraft_GetStat("maxtotalmana")-TheoryCraft_GetStat("totalmana")-1100
return
end
if (spelldata.isranged) then
if TheoryCraft_Data.EquipEffects["RangedSpeed"] == nil then
CleanUp(spelldata, returndata)
return
end
end
if (spelldata.isseal) then
if TheoryCraft_Data.EquipEffects["MainSpeed"] == nil then
CleanUp(spelldata, returndata)
return
end
end
if (spelldata.id == "Backstab") then
if TheoryCraft_GetStat("DaggerEquipped") == 0 then
CleanUp(spelldata, returndata)
return
end
end
if (spelldata.ismelee) then
if TheoryCraft_Data.EquipEffects["MainSpeed"] == nil then
CleanUp(spelldata, returndata)
return
end
local i = 1
returndata["critchance"] = TheoryCraft_Data.Stats["meleecritchance"]+TheoryCraft_GetStat(spelldata.id.."critchance")
while spelldata.Schools[i] do
returndata["critchance"] = returndata["critchance"]+TheoryCraft_GetStat(spelldata.Schools[i].."critchance")
i = i + 1
end
end
if (spelldata.bearform) then
local _, _, active = GetShapeshiftFormInfo(1)
if active == nil then
CleanUp(spelldata, returndata)
return
end
end
if (spelldata.catform) then
local _, _, active = GetShapeshiftFormInfo(3)
if active == nil then
CleanUp(spelldata, returndata)
return
end
end
if (spelldata.usemelee) then
returndata["critchance"] = (TheoryCraft_Data.Stats["meleecritchance"] or 0)+TheoryCraft_GetStat("Holycritchance")
returndata["critbonus"] = 1
end
if (spelldata.isranged) or ((class == "HUNTER") and (spelldata.ismelee == nil)) then
returndata["critchance"] = TheoryCraft_Data.Stats["rangedcritchance"]
end
returndata["description"] = getglobal(frame:GetName().."TextLeft"..frame:NumLines()):GetText()
returndata["casttime"] = getcasttime(frame)+(returndata["casttime"] or 0)
returndata["manacost"] = getmanacost(frame)
if not (spelldata.shoot or spelldata.ismelee or spelldata.isranged) then
returndata["basemanacost"] = returndata["manacost"]
end
if returndata["casttime"] < 1.5 then
returndata["casttime"] = 1.5
end
returndata["regencasttime"] = returndata["casttime"]
if (spelldata.casttime) then
returndata["casttime"] = spelldata.casttime
end
AddProcs(returndata["casttime"], returndata, spelldata)
if (spelldata.regencasttime) then
returndata["regencasttime"] = spelldata.regencasttime
end
if (returndata["netherwind"] == 1) and (TheoryCraft_Settings["procs"]) then
if (returndata["casttime"] > 1.5) then returndata["casttime"] = (returndata["casttime"]-1.5)*0.9+1.5 end
if (returndata["regencasttime"] > 1.5) then returndata["regencasttime"] = (returndata["regencasttime"]-1.5)*0.9+1.5 end
end
local spelllevel = 60
local levelpercent = 1
returndata["manamultiplier"] = spelldata.manamultiplier
if (spelldata["level"..spellrank]) then spelllevel = spelldata["level"..spellrank] end
if (spelldata["level"..spellrank.."per"]) then levelpercent = spelldata["level"..spellrank.."per"] end
if (spelldata["level"..spellrank.."manamult"]) then returndata["manamultiplier"] = spelldata["level"..spellrank.."manamult"] end
if (spelldata["level"..spellrank.."ct"]) then
returndata["casttime"] = spelldata["level"..spellrank.."ct"]
returndata["regencasttime"] = spelldata["level"..spellrank.."ct"]
end
if (spelllevel < 20) then
levelpercent = levelpercent*(0.0375*spelllevel+0.25)
end
returndata["dotduration"] = TheoryCraft_getDotDuration(returndata["description"])
returndata["basedotduration"] = spelldata.basedotduration
if (spelldata.ismelee == nil) and (spelldata.isranged == nil) then
if (spelldata.isheal == nil) and (spelldata.talentsbeforegear == nil) then
returndata["damcoef"] = spelldata.percent*returndata["tmpincrease"]*returndata["tmpincreaseupfront"]*levelpercent
else
returndata["damcoef"] = spelldata.percent*levelpercent
end
if (spelldata.righteousness) then
if (TheoryCraft_Data.EquipEffects["MeleeAPMult"] >= 3) then
returndata["damcoef"] = spelldata.percent2*returndata["tmpincrease"]*levelpercent
end
end
if (spelldata.hasdot == 1) then
returndata["damcoef2"] = spelldata.percentdot
returndata["plusdam2"] = math.floor(returndata["plusdam"] * returndata["damcoef2"] * levelpercent)
end
if (newcasttime) and (spelldata.isdot) then
returndata["damcoef"] = returndata["damcoef"]*newcasttime/returndata["basedotduration"]
returndata["casttime"] = newcasttime
end
returndata["damfinal"] = returndata["plusdam"] * returndata["damcoef"]
end
if returndata["critchance"] > 100 then
returndata["critchance"] = 100
end
returndata["critbonus"] = returndata["critbonus"]+returndata["sepignite"]*(returndata["baseincrease"]+returndata["ignitemodifier"]-1)
returndata["sepignite"] = returndata["sepignite"]*returndata["baseincrease"]
returndata["talentbaseincrease"] = (1/returndata["tmpincrease"])*(returndata["talentmod"]+returndata["tmpincrease"])
returndata["talentbaseincreaseupfront"] = (1/returndata["tmpincreaseupfront"])*(returndata["talentmodupfront"]+returndata["tmpincreaseupfront"])
if (spelldata.talentsbeforegear == nil) and (returndata["damcoef"]) then
returndata["damcoef"] = returndata["damcoef"]*returndata["talentbaseincrease"]*returndata["talentbaseincreaseupfront"]
end
if class == "DRUID" then
local _, bearform, catform
_, _, bearform = GetShapeshiftFormInfo(1)
_, _, catform = GetShapeshiftFormInfo(3)
if catform then
TheoryCraft_Data.EquipEffects["MeleeAPMult"] = 1
TheoryCraft_Data.EquipEffects["MainSpeed"] = 1
elseif bearform then
TheoryCraft_Data.EquipEffects["MeleeAPMult"] = 2.5
TheoryCraft_Data.EquipEffects["MainSpeed"] = 2.5
end
if (bearform) or (catform) then
local lowDmg, hiDmg, offlowDmg, offhiDmg, posBuff, negBuff, percentmod = UnitDamage("player")
local base, pos, neg = UnitAttackPower("player")
base = (base+pos+neg)/14*TheoryCraft_Data.EquipEffects["MeleeAPMult"]
TheoryCraft_Data.EquipEffects["MeleeMin"] = lowDmg-base
TheoryCraft_Data.EquipEffects["MeleeMax"] = hiDmg-lowDmg+TheoryCraft_Data.EquipEffects["MeleeMin"]
end
end
TheoryCraft_getMinMax(spelldata, returndata, frame)
if spelldata.cancrit then
if spelldata.drain then
returndata["critdmgchance"] = returndata["critchance"]
returndata["crithealchance"] = returndata["critchance"]
elseif spelldata.isheal then
returndata["crithealchance"] = returndata["critchance"]
else
returndata["critdmgchance"] = returndata["critchance"]
end
end
if spelldata.isheal == nil then
returndata["manacost"] = returndata["manacost"]-returndata["manacost"]*(TheoryCraft_Data.Talents["clearcast"] or 0)
end
if (returndata["manamultiplier"]) then
returndata["manacost"] = returndata["manacost"]*returndata["manamultiplier"]
end
returndata["manacost"] = returndata["manacost"]-TheoryCraft_Data.Stats["icregen"]*returndata["regencasttime"]
returndata["manacost"] = returndata["manacost"]*returndata["manacostmod"]
if (returndata["crithealchance"]) and (returndata["crithealchance"] > 100) then
returndata["crithealchance"] = 100
end
if (returndata["critdmgchance"]) and (returndata["critdmgchance"] > 100) then
returndata["critdmgchance"] = 100
end
if spelldata.dontusemelee then
returndata["critbonus"] = 0.5
end
if (spelldata.isseal) or (spelldata.ismelee) or (spelldata.isranged) then
if (returndata["mindamage"] and returndata["maxdamage"] and (spelldata.isseal == nil)) and (spelldata.block == nil) then
returndata["critdmgmin"] = returndata["mindamage"]*(returndata["critbonus"]+1)
returndata["critdmgmax"] = returndata["maxdamage"]*(returndata["critbonus"]+1)
returndata["averagedamnocrit"] = (returndata["maxdamage"]+returndata["mindamage"])/2
returndata["averagecritdam"] = returndata["averagedamnocrit"]*returndata["critbonus"]
returndata["averagedam"] = returndata["averagedamnocrit"]+returndata["averagecritdam"]*returndata["critdmgchance"]/100
returndata["nextagidam"] = 10*TheoryCraft_Data.Talents["agimultiplier"]
if spelldata.ismelee then
if spelldata.nextattack then
local attackpower = 10*TheoryCraft_Data.Talents["agimultiplier"]*TheoryCraft_Data.Stats["agilityapmelee"]
local addeddamage = attackpower*(TheoryCraft_Data.EquipEffects["MainSpeed"])*returndata["backstabmult"]*returndata["baseincrease"]*TheoryCraft_GetStat("Meleemodifier")/14
local addedcritpercent = 10*TheoryCraft_Data.Talents["agimultiplier"]/TheoryCraft_Data.Stats["agipercrit"]/100
returndata["nextagidam"] = addedcritpercent*returndata["averagecritdam"]+addeddamage*(addedcritpercent+returndata["critdmgchance"]/100)*returndata["critbonus"]+addeddamage
returndata["damworth"] = (1+(returndata["critchance"]/100)*returndata["critbonus"])*(TheoryCraft_Data.EquipEffects["MainSpeed"])/14*returndata["backstabmult"]*returndata["baseincrease"]*TheoryCraft_GetStat("Meleemodifier")
elseif returndata["bloodthirstmult"] then
local attackpower = 10*TheoryCraft_Data.Talents["agimultiplier"]*TheoryCraft_Data.Stats["agilityapmelee"]
local addeddamage = attackpower*returndata["bloodthirstmult"]*returndata["backstabmult"]*returndata["baseincrease"]*TheoryCraft_GetStat("Meleemodifier")/14
local addedcritpercent = 10*TheoryCraft_Data.Talents["agimultiplier"]/TheoryCraft_Data.Stats["agipercrit"]/100
returndata["nextagidam"] = addedcritpercent*returndata["averagecritdam"]+addeddamage*(addedcritpercent+returndata["critdmgchance"]/100)*returndata["critbonus"]+addeddamage
returndata["damworth"] = (1+(returndata["critchance"]/100)*returndata["critbonus"])*returndata["bloodthirstmult"]*returndata["backstabmult"]*returndata["baseincrease"]*TheoryCraft_GetStat("Meleemodifier")
else
local attackpower = 10*TheoryCraft_Data.Talents["agimultiplier"]*TheoryCraft_Data.Stats["agilityapmelee"]
local addeddamage = attackpower*TheoryCraft_Data.EquipEffects["MeleeAPMult"]*returndata["backstabmult"]*returndata["baseincrease"]*TheoryCraft_GetStat("Meleemodifier")/14
local addedcritpercent = 10*TheoryCraft_Data.Talents["agimultiplier"]/TheoryCraft_Data.Stats["agipercrit"]/100
returndata["nextagidam"] = addedcritpercent*returndata["averagecritdam"]+addeddamage*(addedcritpercent+returndata["critdmgchance"]/100)*returndata["critbonus"]+addeddamage
returndata["damworth"] = (1+(returndata["critchance"]/100)*returndata["critbonus"])*TheoryCraft_Data.EquipEffects["MeleeAPMult"]/14*returndata["backstabmult"]*returndata["baseincrease"]*TheoryCraft_GetStat("Meleemodifier")
end
returndata["nextstrdam"] = 10*TheoryCraft_Data.Talents["strmultiplier"]*TheoryCraft_Data.Stats["strengthapmelee"]*returndata["damworth"]
else
local attackpower = 10*TheoryCraft_Data.Talents["agimultiplier"]*TheoryCraft_Data.Stats["agilityapranged"]
local addeddamage = attackpower*returndata["RangedAPMult"]*returndata["backstabmult"]*returndata["baseincrease"]*TheoryCraft_GetStat("Rangedmodifier")/14
local addedcritpercent = 10*TheoryCraft_Data.Talents["agimultiplier"]/TheoryCraft_Data.Stats["agipercrit"]/100
returndata["nextagidam"] = addedcritpercent*returndata["averagecritdam"]+addeddamage*(addedcritpercent+returndata["critdmgchance"]/100)*returndata["critbonus"]+addeddamage
returndata["damworth"] = (1+(returndata["critchance"]/100)*returndata["critbonus"])*returndata["RangedAPMult"]/14*returndata["backstabmult"]*returndata["baseincrease"]*TheoryCraft_GetStat("Rangedmodifier")
end
returndata["nextcritdam"] = returndata["averagecritdam"]/100
returndata["nexthitdam"] = returndata["averagedamnocrit"]/100
if (returndata["damworth"] ~= 0) then
if returndata["nextstrdam"] then
returndata["nextstrdamequive"] = returndata["nextstrdam"]/returndata["damworth"]
end
returndata["nexthitdamequive"] = returndata["nexthitdam"]/returndata["damworth"]
returndata["nextcritdamequive"] = returndata["nextcritdam"]/returndata["damworth"]
returndata["nextagidamequive"] = returndata["nextagidam"]/returndata["damworth"]
end
if (spelldata.isranged) and (spelldata.shoot == nil) then
if (spelldata.autoshot) then
returndata["dpm"] = returndata["msrotationlength"]*returndata["msrotationdps"]/returndata["manacost"]
returndata["maxoomdam"] = (TheoryCraft_Data.Stats["totalmana"]+TheoryCraft_GetStat("manarestore"))*returndata["dpm"]
returndata["maxoomdamtime"] = returndata["maxoomdam"]/returndata["dps"]
returndata["regendam"] = TheoryCraft_Data.Stats["regen"]*10*returndata["dpm"]
returndata["icregendam"] = TheoryCraft_Data.Stats["icregen"]*10*returndata["dpm"]
else
if TheoryCraft_Settings["dontcritdpm"] then
returndata["dpm"] = returndata["averagedamnocrit"]/returndata["manacost"]
else
returndata["dpm"] = returndata["averagedam"]/returndata["manacost"]
end
returndata["regendam"] = TheoryCraft_Data.Stats["regen"]*10*returndata["dpm"]
returndata["icregendam"] = TheoryCraft_Data.Stats["icregen"]*10*returndata["dpm"]
end
end
end
else
if class == "DRUID" then
if (spelldata.cancrit) and (returndata["grace"] ~= 0) and (not TheoryCraft_Settings["dontcrit"]) then
returndata["casttime"] = returndata["casttime"]-(returndata["critchance"]/100)*returndata["grace"]
if returndata["casttime"] < 1.5 then
returndata["casttime"] = 1.5
end
end
end
if (class == "MAGE") then
if (returndata["critdmgchance"]) and (not TheoryCraft_Settings["dontcrit"]) then
returndata["manacost"] = returndata["manacost"]-returndata["manacost"]*((returndata["critdmgchance"]/100)*returndata["illum"])
end
end
if returndata["mindamage"] then
if returndata["maxdamage"] == nil then
returndata["maxdamage"] = returndata["mindamage"]
end
returndata["critdmgmin"] = returndata["mindamage"]*(returndata["critbonus"]+1)
returndata["critdmgmax"] = returndata["maxdamage"]*(returndata["critbonus"]+1)
returndata["averagedamnocrit"] = (returndata["maxdamage"]+returndata["mindamage"])/2
returndata["averagedpsdamnocrit"] = returndata["damfinal"]
if spelldata.cancrit then
returndata["critdmgmin"] = returndata["mindamage"]*(returndata["critbonus"]+1)
returndata["critdmgmax"] = returndata["maxdamage"]*(returndata["critbonus"]+1)
if (returndata["sepignite"] ~= 0) then
returndata["critdmgminminusignite"] = ((returndata["critdmgmin"]/(returndata["critbonus"]+1))*(1+returndata["critbonus"]-returndata["sepignite"]))
returndata["critdmgmaxminusignite"] = ((returndata["critdmgmax"]/(returndata["critbonus"]+1))*(1+returndata["critbonus"]-returndata["sepignite"]))
end
if (TheoryCraft_Settings["rollignites"]) and (not spelldata.dontdomax) and (returndata["sepignite"] ~= 0) and (returndata["critdmgchance"] < 99) then
local ignitecritmin = returndata["critdmgmin"]-(returndata["critdmgmin"]/(returndata["critbonus"]+1))*(1+returndata["critbonus"]-returndata["sepignite"])
local ignitecritmax = returndata["critdmgmax"]-(returndata["critdmgmax"]/(returndata["critbonus"]+1))*(1+returndata["critbonus"]-returndata["sepignite"])
local igniteaverage = (ignitecritmax-ignitecritmin)/2+ignitecritmin
local noignitecritmin = returndata["critdmgmin"]-ignitecritmin-returndata["mindamage"]
local noignitecritmax = returndata["critdmgmax"]-ignitecritmax-returndata["maxdamage"]
local noigniteaverage = (noignitecritmin+noignitecritmax)/2
local rollchance = (returndata["critdmgchance"]/100)
local ignitelength = 4+rollchance*4+(rollchance^2)*4+(rollchance^3)*4+(rollchance^4)*4+(rollchance^5)*4+(rollchance^6)*4
returndata["averagecritdam"] = noigniteaverage+ignitelength*igniteaverage/4
rollchance = ((returndata["critdmgchance"]+1)/100)
local newignitelength = 4+rollchance*4+(rollchance^2)*4+(rollchance^3)*4+(rollchance^4)*4+(rollchance^5)*4+(rollchance^6)*4
-- Average Crit Damage
returndata["nextcritdam"] = noigniteaverage+newignitelength*igniteaverage/4
-- Damage from extra ignite length
returndata["nextcritdam"] = (returndata["nextcritdam"]+(newignitelength-ignitelength)*igniteaverage/4*returndata["critdmgchance"])/100
else
returndata["averagecritdam"] = returndata["averagedamnocrit"]*returndata["critbonus"]
returndata["nextcritdam"] = returndata["averagecritdam"]/100
end
returndata["damhitworth"] = returndata["damcoef"]
returndata["damcritworth"] = returndata["damcoef"]*(returndata["critbonus"]+1)
returndata["damworth"] = returndata["damcoef"]*(1+returndata["critdmgchance"]*returndata["critbonus"]/100)
returndata["averagedam"] = returndata["averagedamnocrit"]+returndata["averagecritdam"]*returndata["critdmgchance"]/100
returndata["nextcritdam"] = returndata["nextcritdam"] + returndata["averagedam"]*returndata["grace"]
returndata["nextcritdamequive"] = returndata["nextcritdam"]/returndata["damworth"]
else