-
Notifications
You must be signed in to change notification settings - Fork 89
/
cons.go
55 lines (52 loc) · 1.47 KB
/
cons.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
package yanfei
import (
"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/player/character"
"github.com/genshinsim/gcsim/pkg/core/player/shield"
"github.com/genshinsim/gcsim/pkg/enemy"
"github.com/genshinsim/gcsim/pkg/modifier"
)
// Hook for C2:
// Increases Yan Fei's Charged Attack CRIT Rate by 20% against enemies below 50% HP.
func (c *char) c2() {
if c.Core.Combat.DamageMode {
m := make([]float64, attributes.EndStatType)
c.AddAttackMod(character.AttackMod{
Base: modifier.NewBase("yanfei-c2", -1),
Amount: func(atk *combat.AttackEvent, t combat.Target) ([]float64, bool) {
if atk.Info.AttackTag != attacks.AttackTagExtra {
return nil, false
}
x, ok := t.(*enemy.Enemy)
if !ok {
return nil, false
}
if x.HP()/x.MaxHP() >= .5 {
return nil, false
}
m[attributes.CR] = 0.20
return m, true
},
})
}
}
// Handles C4 shield creation
// When Done Deal is used:
// Creates a shield that absorbs up to 45% of Yan Fei's Max HP for 15s
// This shield absorbs Pyro DMG 250% more effectively
func (c *char) c4() {
if c.Base.Cons < 4 {
return
}
c.Core.Player.Shields.Add(&shield.Tmpl{
ActorIndex: c.Index,
Src: c.Core.F,
ShieldType: shield.ShieldYanfeiC4,
Name: "Yanfei C4",
HP: c.MaxHP() * .45,
Ele: attributes.Pyro,
Expires: c.Core.F + 15*60,
})
}