-
Notifications
You must be signed in to change notification settings - Fork 133
/
pestilence.go
154 lines (134 loc) · 4.98 KB
/
pestilence.go
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
package deathknight
import (
"github.com/wowsims/wotlk/sim/core"
"github.com/wowsims/wotlk/sim/core/proto"
)
var PestilenceActionID = core.ActionID{SpellID: 50842}
func (dk *Deathknight) registerPestilenceSpell() {
hasGlyphOfDisease := dk.HasMajorGlyph(proto.DeathknightMajorGlyph_GlyphOfDisease)
deathConvertChance := float64(dk.Talents.BloodOfTheNorth+dk.Talents.Reaping) / 3
dk.Pestilence = dk.RegisterSpell(core.SpellConfig{
ActionID: core.ActionID{SpellID: 50842},
Flags: core.SpellFlagAPL,
SpellSchool: core.SpellSchoolShadow,
ProcMask: core.ProcMaskSpellDamage,
RuneCost: core.RuneCostOptions{
BloodRuneCost: 1,
RunicPowerGain: 10,
Refundable: true,
},
Cast: core.CastConfig{
DefaultCast: core.Cast{
GCD: core.GCDDefault,
},
},
DamageMultiplier: 0,
ThreatMultiplier: 0,
ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
for _, aoeTarget := range sim.Encounter.TargetUnits {
// Zero damage spell with a Hit mechanic, thanks blizz!
result := spell.CalcAndDealDamage(sim, aoeTarget, 0, spell.OutcomeMagicHit)
if aoeTarget == target {
spell.SpendRefundableCostAndConvertBloodRune(sim, result, deathConvertChance)
}
if result.Landed() {
refreshCFEP := false
// Main target
if aoeTarget == target {
if hasGlyphOfDisease {
// Update expire instead of Apply to keep old snapshotted value
if dk.FrostFeverSpell.Dot(aoeTarget).IsActive() {
dk.FrostFeverSpell.Dot(aoeTarget).Rollover(sim)
if dk.Talents.IcyTalons > 0 {
dk.IcyTalonsAura.Activate(sim)
}
dk.FrostFeverDebuffAura.Get(aoeTarget).Activate(sim)
if dk.Talents.CryptFever > 0 {
refreshCFEP = true
}
}
if dk.BloodPlagueSpell.Dot(aoeTarget).IsActive() {
dk.BloodPlagueSpell.Dot(aoeTarget).Rollover(sim)
if dk.Talents.CryptFever > 0 {
refreshCFEP = true
}
}
}
} else {
// Apply diseases on every other target
if dk.FrostFeverSpell.Dot(target).IsActive() {
dk.FrostFeverExtended[aoeTarget.Index] = 0
dk.FrostFeverSpell.Dot(aoeTarget).Apply(sim)
if dk.Talents.CryptFever > 0 {
refreshCFEP = true
}
}
if dk.BloodPlagueSpell.Dot(target).IsActive() {
dk.BloodPlagueExtended[aoeTarget.Index] = 0
dk.BloodPlagueSpell.Dot(aoeTarget).Apply(sim)
if dk.Talents.CryptFever > 0 {
refreshCFEP = true
}
}
}
if refreshCFEP {
dk.EbonPlagueOrCryptFeverAura.Get(aoeTarget).Activate(sim)
}
}
}
},
})
}
func (dk *Deathknight) registerDrwPestilenceSpell() {
hasGlyphOfDisease := dk.HasMajorGlyph(proto.DeathknightMajorGlyph_GlyphOfDisease)
dk.RuneWeapon.Pestilence = dk.RuneWeapon.RegisterSpell(core.SpellConfig{
ActionID: PestilenceActionID,
SpellSchool: core.SpellSchoolShadow,
ProcMask: core.ProcMaskSpellDamage,
DamageMultiplier: 0,
ThreatMultiplier: 0,
ApplyEffects: func(sim *core.Simulation, target *core.Unit, spell *core.Spell) {
// DRW and Pestilence have a weird interaction where the drws Dots can be applied
// with the spread effect from pestilence if the target has the Dks dots up but it
// only works if there is a valid target for spread mechanic to happen (2+ mobs)
shouldApplyDrwDots := dk.Env.GetNumTargets() > 1 || dk.Inputs.DrwPestiApply
for _, aoeTarget := range sim.Encounter.TargetUnits {
// Zero damage spell with a Hit mechanic, thanks blizz!
result := spell.CalcAndDealDamage(sim, aoeTarget, 0, spell.OutcomeMagicHit)
if result.Landed() {
// Main target
if aoeTarget == target {
if hasGlyphOfDisease {
// Update expire instead of Apply to keep old snapshotted value
if dk.RuneWeapon.FrostFeverSpell.Dot(aoeTarget).IsActive() {
dk.RuneWeapon.FrostFeverSpell.Dot(aoeTarget).Rollover(sim)
} else if shouldApplyDrwDots && dk.FrostFeverSpell.Dot(aoeTarget).IsActive() {
dk.RuneWeapon.FrostFeverSpell.Dot(aoeTarget).Apply(sim)
}
if dk.RuneWeapon.BloodPlagueSpell.Dot(aoeTarget).IsActive() {
dk.RuneWeapon.BloodPlagueSpell.Dot(aoeTarget).Rollover(sim)
} else if shouldApplyDrwDots && dk.BloodPlagueSpell.Dot(aoeTarget).IsActive() {
dk.RuneWeapon.BloodPlagueSpell.Dot(aoeTarget).Apply(sim)
}
} else if shouldApplyDrwDots {
if dk.FrostFeverSpell.Dot(aoeTarget).IsActive() {
dk.RuneWeapon.FrostFeverSpell.Dot(aoeTarget).Apply(sim)
}
if dk.BloodPlagueSpell.Dot(aoeTarget).IsActive() {
dk.RuneWeapon.BloodPlagueSpell.Dot(aoeTarget).Apply(sim)
}
}
} else {
// Apply diseases on every other target
if dk.RuneWeapon.FrostFeverSpell.Dot(target).IsActive() {
dk.RuneWeapon.FrostFeverSpell.Dot(aoeTarget).Apply(sim)
}
if dk.RuneWeapon.BloodPlagueSpell.Dot(target).IsActive() {
dk.RuneWeapon.BloodPlagueSpell.Dot(aoeTarget).Apply(sim)
}
}
}
}
},
})
}