forked from genshinsim/gcsim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathburst.go
More file actions
207 lines (190 loc) · 5.37 KB
/
Copy pathburst.go
File metadata and controls
207 lines (190 loc) · 5.37 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
package lisa
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/geometry"
)
var burstFrames []int
const burstHitmark = 56
func init() {
burstFrames = frames.InitAbilSlice(88)
burstFrames[action.ActionAttack] = 86
burstFrames[action.ActionCharge] = 86
burstFrames[action.ActionSkill] = 87
burstFrames[action.ActionJump] = 57
burstFrames[action.ActionSwap] = 56
}
func (c *char) Burst(p map[string]int) (action.Info, error) {
// first zap has no icd and hits everyone
ai := combat.AttackInfo{
ActorIndex: c.Index,
Abil: "Lightning Rose (Initial)",
AttackTag: attacks.AttackTagElementalBurst,
ICDTag: attacks.ICDTagNone,
ICDGroup: attacks.ICDGroupDefault,
StrikeType: attacks.StrikeTypeDefault,
Element: attributes.Electro,
Durability: 0,
Mult: 0.1,
}
// based on discussion with nosi; turns out this does not apply def shred
c.Core.QueueAttack(ai, combat.NewCircleHitOnTarget(c.Core.Combat.Player(), nil, 7), burstHitmark, burstHitmark)
// duration is 15 seconds, tick every .5 sec
// 30 zaps once every 30 frame, starting at 119
ai = combat.AttackInfo{
ActorIndex: c.Index,
Abil: "Lightning Rose (Tick)",
AttackTag: attacks.AttackTagElementalBurst,
ICDTag: attacks.ICDTagElementalBurst,
ICDGroup: attacks.ICDGroupDefault,
StrikeType: attacks.StrikeTypeDefault,
Element: attributes.Electro,
Durability: 25,
Mult: burst[c.TalentLvlBurst()],
}
var snap combat.Snapshot
c.Core.Tasks.Add(func() {
snap = c.Snapshot(&ai)
}, burstHitmark-1)
firstTick := 119 // first tick at 119
burstArea := combat.NewCircleHitOnTarget(c.Core.Combat.Player(), nil, 7)
for i := 0; i < 15*60; i += 30 {
progress := i + firstTick
c.Core.Tasks.Add(func() {
// logic below c4 is fairly simple: 1 discharge to a random enemy in the area
if c.Base.Cons < 4 {
enemy := c.Core.Combat.RandomEnemyWithinArea(burstArea, nil)
if enemy == nil {
return
}
c.Core.QueueAttackWithSnap(
ai,
snap,
combat.NewCircleHitOnTarget(enemy, nil, 1),
0,
c.makeA4CB(),
)
return
}
// at C4 and above:
// - https://library.keqingmains.com/evidence/characters/electro/lisa#c4-plasma-eruption
// - spawn up to 3 attacks based on enemy + gadget count
// - priority: enemy > gadget
discharge := func(pos geometry.Point) {
c.Core.QueueAttackWithSnap(
ai,
snap,
combat.NewCircleHitOnTarget(pos, nil, 1),
0,
c.makeA4CB(),
)
}
dischargeCount := 0
dischargeLimit := 3
enemies := c.Core.Combat.RandomEnemiesWithinArea(burstArea, nil, dischargeLimit)
enemyCount := len(enemies)
var gadgets []combat.Gadget
if enemyCount < dischargeLimit {
gadgets = c.Core.Combat.RandomGadgetsWithinArea(burstArea, nil, dischargeLimit-enemyCount)
}
gadgetCount := len(gadgets)
totalEntities := enemyCount + gadgetCount
switch totalEntities {
case 0:
case 1:
dischargeCount = 1
case 2:
threshold := 0.15
if progress == firstTick {
// first arc: 60% chance 1, 40% chance 2
threshold = 0.6
}
// rest: 15% chance 1, 85% chance 2
if c.Core.Rand.Float64() < threshold {
dischargeCount = 1
} else {
dischargeCount = 2
}
default: // 3 or more entities
if progress == firstTick {
// first arc: 55% 1, 45% 2
if c.Core.Rand.Float64() < 0.55 {
dischargeCount = 1
} else {
dischargeCount = 2
}
c.previousDischargeCount = dischargeCount
if dischargeCount == 0 {
return
}
return
}
rand := c.Core.Rand.Float64()
switch c.previousDischargeCount {
case 1:
// after a 1: 20% 1, 50% 2, 30% 3
switch {
case rand < 0.2:
dischargeCount = 1
case rand < 0.7:
dischargeCount = 2
default:
dischargeCount = 3
}
case 2:
// after a 2: 25% 1, 50% 2, 25% 3
switch {
case rand < 0.25:
dischargeCount = 1
case rand < 0.75:
dischargeCount = 2
default:
dischargeCount = 3
}
case 3:
// after a 3: next is 50% 1, 50% 2, 0% 3
if rand < 0.5 {
dischargeCount = 1
} else {
dischargeCount = 2
}
}
}
c.previousDischargeCount = dischargeCount
if dischargeCount == 0 {
return
}
// target up to 3 enemies
for i := 0; i < dischargeCount; i++ {
if i < enemyCount {
discharge(enemies[i].Pos())
}
}
dischargeCount -= enemyCount
// if less than 3 enemies were targeted, then check for gadgets
for i := 0; i < dischargeCount; i++ {
if i < gadgetCount {
discharge(gadgets[i].Pos())
}
}
}, progress)
}
// add a status for this just in case someone cares
c.Core.Tasks.Add(func() {
c.Core.Status.Add("lisaburst", 119+900)
}, burstHitmark)
// burst cd starts 53 frames after executed
// energy usually consumed after 63 frames
c.ConsumeEnergy(63)
// c.CD[def.BurstCD] = c.Core.F + 1200
c.SetCDWithDelay(action.ActionBurst, 1200, 53)
return action.Info{
Frames: frames.NewAbilFunc(burstFrames),
AnimationLength: burstFrames[action.InvalidAction],
CanQueueAfter: burstFrames[action.ActionSwap], // earliest cancel
State: action.BurstState,
}, nil
}