-
Notifications
You must be signed in to change notification settings - Fork 36
/
apl_values_core.go
81 lines (72 loc) · 2.07 KB
/
apl_values_core.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
package core
import (
"fmt"
"time"
"github.com/wowsims/cata/sim/core/proto"
)
type APLValueDotIsActive struct {
DefaultAPLValueImpl
dot *Dot
}
func (rot *APLRotation) newValueDotIsActive(config *proto.APLValueDotIsActive) APLValue {
dot := rot.GetAPLDot(rot.GetTargetUnit(config.TargetUnit), config.SpellId)
if dot == nil {
return nil
}
return &APLValueDotIsActive{
dot: dot,
}
}
func (value *APLValueDotIsActive) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeBool
}
func (value *APLValueDotIsActive) GetBool(sim *Simulation) bool {
return value.dot.IsActive()
}
func (value *APLValueDotIsActive) String() string {
return fmt.Sprintf("Dot Is Active(%s)", value.dot.Spell.ActionID)
}
type APLValueDotRemainingTime struct {
DefaultAPLValueImpl
dot *Dot
}
func (rot *APLRotation) newValueDotRemainingTime(config *proto.APLValueDotRemainingTime) APLValue {
dot := rot.GetAPLDot(rot.GetTargetUnit(config.TargetUnit), config.SpellId)
if dot == nil {
return nil
}
return &APLValueDotRemainingTime{
dot: dot,
}
}
func (value *APLValueDotRemainingTime) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeDuration
}
func (value *APLValueDotRemainingTime) GetDuration(sim *Simulation) time.Duration {
return value.dot.RemainingDuration(sim)
}
func (value *APLValueDotRemainingTime) String() string {
return fmt.Sprintf("Dot Remaining Time(%s)", value.dot.Spell.ActionID)
}
type APLValueDotTickFrequency struct {
DefaultAPLValueImpl
dot *Dot
}
func (rot *APLRotation) newValueDotTickFrequency(config *proto.APLValueDotTickFrequency) APLValue {
dot := rot.GetAPLDot(rot.GetTargetUnit(config.TargetUnit), config.SpellId)
if dot == nil {
return nil
}
return &APLValueDotTickFrequency{
dot: dot,
}
}
func (value *APLValueDotTickFrequency) Type() proto.APLValueType {
return proto.APLValueType_ValueTypeDuration
}
func (value *APLValueDotTickFrequency) GetDuration(_ *Simulation) time.Duration {
return value.dot.tickPeriod
}
func (value *APLValueDotTickFrequency) String() string {
return fmt.Sprintf("Dot Tick Frequency(%s)", value.dot.tickPeriod)
}