forked from genshinsim/gcsim
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeepwood.go
More file actions
76 lines (65 loc) · 2.22 KB
/
Copy pathdeepwood.go
File metadata and controls
76 lines (65 loc) · 2.22 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package deepwood
import (
"fmt"
"github.com/genshinsim/gcsim/pkg/core"
"github.com/genshinsim/gcsim/pkg/core/attacks"
"github.com/genshinsim/gcsim/pkg/core/attributes"
"github.com/genshinsim/gcsim/pkg/core/combat"
"github.com/genshinsim/gcsim/pkg/core/event"
"github.com/genshinsim/gcsim/pkg/core/glog"
"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/enemy"
"github.com/genshinsim/gcsim/pkg/modifier"
)
func init() {
core.RegisterSetFunc(keys.DeepwoodMemories, 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 }
// 2-Piece Bonus: Dendro DMG Bonus +15%.
// 4-Piece Bonus: After Elemental Skills or Bursts hit opponents, the targets’ Dendro RES will be decreased by 30% for 8s.
// This effect can be triggered even if the equipping character is not on the field.
func NewSet(c *core.Core, char *character.CharWrapper, count int, param map[string]int) (info.Set, error) {
s := Set{Count: count}
if count >= 2 {
m := make([]float64, attributes.EndStatType)
m[attributes.DendroP] = 0.15
char.AddStatMod(character.StatMod{
Base: modifier.NewBase("dm-2pc", -1),
AffectedStat: attributes.DendroP,
Amount: func() ([]float64, bool) {
return m, true
},
})
}
if count >= 4 {
c.Events.Subscribe(event.OnEnemyDamage, func(args ...interface{}) bool {
atk := args[1].(*info.AttackEvent)
t, ok := args[0].(*enemy.Enemy)
if !ok {
return false
}
if atk.Info.ActorIndex != char.Index {
return false
}
if atk.Info.AttackTag != attacks.AttackTagElementalArt && atk.Info.AttackTag != attacks.AttackTagElementalArtHold && atk.Info.AttackTag != attacks.AttackTagElementalBurst {
return false
}
t.AddResistMod(combat.ResistMod{
Base: modifier.NewBaseWithHitlag("dm-4pc", 8*60),
Ele: attributes.Dendro,
Value: -0.3,
})
c.Log.NewEvent("dm 4pc proc", glog.LogArtifactEvent, char.Index).Write("char", char.Index)
return false
}, fmt.Sprintf("dm-4pc-%v", char.Base.Key.String()))
}
return &s, nil
}