-
Notifications
You must be signed in to change notification settings - Fork 89
/
catch.go
43 lines (36 loc) · 1.17 KB
/
catch.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
package catch
import (
"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/keys"
"github.com/genshinsim/gcsim/pkg/core/player/character"
"github.com/genshinsim/gcsim/pkg/core/player/weapon"
"github.com/genshinsim/gcsim/pkg/modifier"
)
func init() {
core.RegisterWeaponFunc(keys.TheCatch, NewWeapon)
}
type Weapon struct {
Index int
}
func (w *Weapon) SetIndex(idx int) { w.Index = idx }
func (w *Weapon) Init() error { return nil }
func NewWeapon(c *core.Core, char *character.CharWrapper, p weapon.WeaponProfile) (weapon.Weapon, error) {
w := &Weapon{}
r := p.Refine
val := make([]float64, attributes.EndStatType)
val[attributes.DmgP] = 0.12 + 0.04*float64(r)
val[attributes.CR] = 0.045 + 0.015*float64(r)
char.AddAttackMod(character.AttackMod{
Base: modifier.NewBase("the-catch", -1),
Amount: func(atk *combat.AttackEvent, t combat.Target) ([]float64, bool) {
if atk.Info.AttackTag == attacks.AttackTagElementalBurst {
return val, true
}
return nil, false
},
})
return w, nil
}