-
Notifications
You must be signed in to change notification settings - Fork 32
/
divine_favor.go
65 lines (58 loc) · 1.65 KB
/
divine_favor.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
package paladin
import (
"time"
"github.com/wowsims/sod/sim/core"
)
func (paladin *Paladin) registerDivineFavor() {
if !paladin.Talents.DivineFavor {
return
}
var affectedSpells []*core.Spell
paladin.OnSpellRegistered(func(spell *core.Spell) {
if spell.SpellCode == SpellCode_PaladinHolyShock {
affectedSpells = append(affectedSpells, spell)
}
})
cd := core.Cooldown{
Timer: paladin.NewTimer(),
Duration: time.Minute * 2,
}
aura := paladin.RegisterAura(core.Aura{
Label: "Divine Favor",
ActionID: core.ActionID{SpellID: 20216},
Duration: core.NeverExpires,
OnGain: func(aura *core.Aura, sim *core.Simulation) {
core.Each(affectedSpells, func(spell *core.Spell) {
spell.BonusCritRating += core.SpellCritRatingPerCritChance * 100
})
},
OnExpire: func(aura *core.Aura, sim *core.Simulation) {
core.Each(affectedSpells, func(spell *core.Spell) {
spell.BonusCritRating -= core.SpellCritRatingPerCritChance * 100
})
},
OnSpellHitDealt: func(aura *core.Aura, sim *core.Simulation, spell *core.Spell, result *core.SpellResult) {
if spell.SpellCode != SpellCode_PaladinHolyShock {
return
}
// Remove the buff and put skill on CD
aura.Deactivate(sim)
cd.Set(sim.CurrentTime + cd.Duration)
paladin.UpdateMajorCooldowns()
},
})
divineFavor := paladin.RegisterSpell(core.SpellConfig{
ActionID: aura.ActionID,
Flags: core.SpellFlagNoOnCastComplete,
Cast: core.CastConfig{
CD: cd,
},
ApplyEffects: func(sim *core.Simulation, _ *core.Unit, _ *core.Spell) {
aura.Activate(sim)
},
})
paladin.AddMajorCooldown(core.MajorCooldown{
Spell: divineFavor,
Type: core.CooldownTypeDPS,
})
}