forked from genshinsim/gcsim
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathberserker.go
More file actions
56 lines (49 loc) · 1.43 KB
/
Copy pathberserker.go
File metadata and controls
56 lines (49 loc) · 1.43 KB
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
package berserker
import (
"github.com/genshinsim/gcsim/pkg/core"
"github.com/genshinsim/gcsim/pkg/core/attributes"
"github.com/genshinsim/gcsim/pkg/core/info"
"github.com/genshinsim/gcsim/pkg/core/keys"
"github.com/genshinsim/gcsim/pkg/core/player/character"
"github.com/genshinsim/gcsim/pkg/modifier"
)
func init() {
core.RegisterSetFunc(keys.Berserker, NewSet)
}
type Set struct {
Index int
Count int
}
func (s *Set) SetIndex(idx int) { s.Index = idx }
func (s *Set) GetCount() int { return s.Count }
func (s *Set) Init() error { return nil }
func NewSet(c *core.Core, char *character.CharWrapper, count int, param map[string]int) (info.Set, error) {
s := Set{Count: count}
// 2 Piece: CRIT Rate +12%
if count >= 2 {
m := make([]float64, attributes.EndStatType)
m[attributes.CR] = 0.12
char.AddStatMod(character.StatMod{
Base: modifier.NewBase("berserker-2pc", -1),
AffectedStat: attributes.CR,
Amount: func() ([]float64, bool) {
return m, true
},
})
}
// 4 Piece: When HP is below 70%, CRIT Rate increases by an additional 24%.
if count >= 4 {
m := make([]float64, attributes.EndStatType)
m[attributes.CR] = 0.24
char.AddAttackMod(character.AttackMod{
Base: modifier.NewBase("berserker-4pc", -1),
Amount: func(atk *info.AttackEvent, t info.Target) ([]float64, bool) {
if char.CurrentHPRatio() > 0.7 {
return nil, false
}
return m, true
},
})
}
return &s, nil
}