-
Notifications
You must be signed in to change notification settings - Fork 89
/
burst.go
89 lines (80 loc) · 2.45 KB
/
burst.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
82
83
84
85
86
87
88
89
package kaveh
import (
"github.com/genshinsim/gcsim/internal/frames"
"github.com/genshinsim/gcsim/pkg/core/action"
"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/player/character"
"github.com/genshinsim/gcsim/pkg/modifier"
)
var burstFrames []int
const (
burstHitmark = 36
burstDuration = 720
burstKey = "kaveh-q"
burstDmgBonusKey = "kaveh-q-dmg-bonus"
)
func init() {
burstFrames = frames.InitAbilSlice(49)
burstFrames[action.ActionAttack] = 48
burstFrames[action.ActionDash] = 44
burstFrames[action.ActionJump] = 44
burstFrames[action.ActionWalk] = 48
burstFrames[action.ActionSwap] = 42
}
func (c *char) Burst(p map[string]int) action.ActionInfo {
c.a4Stacks = 0
ai := combat.AttackInfo{
ActorIndex: c.Index,
Abil: "Painted Dome (Q)",
AttackTag: attacks.AttackTagElementalBurst,
ICDTag: attacks.ICDTagNone,
ICDGroup: attacks.ICDGroupDefault,
StrikeType: attacks.StrikeTypeDefault,
Element: attributes.Dendro,
Durability: 50,
Mult: burst[c.TalentLvlBurst()],
}
ap := combat.NewCircleHitOnTarget(c.Core.Combat.Player(), nil, 5)
c.Core.QueueAttack(ai, ap, burstHitmark, burstHitmark)
c.SetCD(action.ActionBurst, 1200)
c.ConsumeEnergy(3)
c.Core.Tasks.Add(func() {
c.ruptureDendroCores(ap)
c.AddStatus(burstKey, burstDuration, true)
c.a4()
if c.Base.Cons >= 2 {
c.c2()
}
for _, char := range c.Core.Player.Chars() {
char.AddReactBonusMod(character.ReactBonusMod{
Base: modifier.NewBaseWithHitlag(burstDmgBonusKey, burstDuration),
Amount: func(ai combat.AttackInfo) (float64, bool) {
if ai.AttackTag == attacks.AttackTagBloom {
return burstDmgBonus[c.TalentLvlBurst()], false
}
return 0, false
},
})
}
}, burstHitmark)
return action.ActionInfo{
Frames: frames.NewAbilFunc(burstFrames),
AnimationLength: burstFrames[action.InvalidAction],
CanQueueAfter: burstFrames[action.ActionSwap], // earliest cancel
State: action.BurstState,
}
}
func (c *char) addBurstExitHandler() {
c.Core.Events.Subscribe(event.OnCharacterSwap, func(_ ...interface{}) bool {
c.DeleteStatus(burstKey)
c.DeleteStatus(a4Key)
c.DeleteStatus(c2Key)
for _, char := range c.Core.Player.Chars() {
char.DeleteStatus(burstDmgBonusKey)
}
return false
}, "kaveh-exit")
}