-
Notifications
You must be signed in to change notification settings - Fork 88
/
charge.go
69 lines (60 loc) · 1.82 KB
/
charge.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
package kokomi
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"
)
var chargeFrames []int
// hitmark frame, includes CA windup
const chargeHitmark = 48
func init() {
chargeFrames = frames.InitAbilSlice(76)
chargeFrames[action.ActionAttack] = 62
chargeFrames[action.ActionCharge] = 62
chargeFrames[action.ActionSkill] = 62
chargeFrames[action.ActionBurst] = 62
chargeFrames[action.ActionDash] = chargeHitmark
chargeFrames[action.ActionJump] = chargeHitmark
chargeFrames[action.ActionSwap] = 62
}
// Standard charge attack
// CA has no travel time
func (c *char) ChargeAttack(p map[string]int) action.ActionInfo {
ai := combat.AttackInfo{
ActorIndex: c.Index,
Abil: "Charge",
AttackTag: attacks.AttackTagExtra,
ICDTag: attacks.ICDTagNone,
ICDGroup: attacks.ICDGroupDefault,
StrikeType: attacks.StrikeTypeDefault,
Element: attributes.Hydro,
Durability: 25,
Mult: charge[c.TalentLvlAttack()],
}
ai.FlatDmg = c.burstDmgBonus(ai.AttackTag)
// skip CA windup if we're in NA animation
windup := 0
if c.Core.Player.CurrentState() == action.NormalAttackState {
windup = 14
}
radius := 3.5
if c.Core.Status.Duration(burstKey) > 0 {
radius = 4
}
c.Core.QueueAttack(
ai,
combat.NewCircleHitOnTarget(c.Core.Combat.PrimaryTarget(), nil, radius),
chargeHitmark-windup,
chargeHitmark-windup,
c.makeBurstHealCB(),
c.makeC4CB(),
)
return action.ActionInfo{
Frames: func(next action.Action) int { return chargeFrames[next] - windup },
AnimationLength: chargeFrames[action.InvalidAction] - windup,
CanQueueAfter: chargeHitmark - windup,
State: action.ChargeAttackState,
}
}