Skip to content

Commit 5bb8963

Browse files
authored
Fix mona c2 not having a delay (#2549)
1 parent 64d5907 commit 5bb8963

File tree

3 files changed

+45
-30
lines changed

3 files changed

+45
-30
lines changed

internal/characters/mona/attack.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ func (c *char) Attack(p map[string]int) (action.Info, error) {
5757
),
5858
attackHitmarks[c.NormalCounter],
5959
attackHitmarks[c.NormalCounter],
60-
c.c2,
6160
)
6261

6362
defer c.AdvanceNormalIndex()

internal/characters/mona/cons.go

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ import (
1616
)
1717

1818
const (
19-
c4key = "mona-c4"
20-
c6Key = "mona-c6"
19+
c2icdkey = "mona-c2-icd"
20+
c4key = "mona-c4"
21+
c6Key = "mona-c6"
2122
)
2223

2324
// C1:
@@ -78,34 +79,49 @@ func (c *char) c1() {
7879
// C2:
7980
// When a Normal Attack hits, there is a 20% chance that it will be automatically followed by a Charged Attack.
8081
// This effect can only occur once every 5s.
81-
func (c *char) c2(a info.AttackCB) {
82-
trg := a.Target
82+
func (c *char) c2() {
8383
if c.Base.Cons < 2 {
8484
return
8585
}
86-
if a.Target.Type() != info.TargettableEnemy {
87-
return
88-
}
89-
if c.Core.Rand.Float64() > .2 {
90-
return
91-
}
92-
if c.c2icd > c.Core.F {
93-
return
94-
}
95-
c.c2icd = c.Core.F + 300 // every 5 seconds
96-
ai := info.AttackInfo{
97-
ActorIndex: c.Index(),
98-
Abil: "Charge Attack",
99-
AttackTag: attacks.AttackTagExtra,
100-
ICDTag: attacks.ICDTagNone,
101-
ICDGroup: attacks.ICDGroupDefault,
102-
StrikeType: attacks.StrikeTypeDefault,
103-
Element: attributes.Hydro,
104-
Durability: 25,
105-
Mult: charge[c.TalentLvlAttack()],
106-
}
86+
c.Core.Events.Subscribe(event.OnEnemyDamage, func(args ...any) bool {
87+
trg, ok := args[0].(*enemy.Enemy)
88+
if !ok {
89+
return false
90+
}
10791

108-
c.Core.QueueAttack(ai, combat.NewCircleHitOnTarget(trg, nil, 3), 0, 0)
92+
atk := args[1].(*info.AttackEvent)
93+
if atk.Info.ActorIndex != c.Index() {
94+
return false
95+
}
96+
if atk.Info.AttackTag != attacks.AttackTagNormal {
97+
return false
98+
}
99+
100+
if c.Core.Rand.Float64() > .2 {
101+
return false
102+
}
103+
if c.StatusIsActive(c2icdkey) {
104+
return false
105+
}
106+
c.AddStatus(c2icdkey, 5*60, true)
107+
108+
c.QueueCharTask(func() {
109+
ai := info.AttackInfo{
110+
ActorIndex: c.Index(),
111+
Abil: "Charge Attack",
112+
AttackTag: attacks.AttackTagExtra,
113+
ICDTag: attacks.ICDTagNone,
114+
ICDGroup: attacks.ICDGroupDefault,
115+
StrikeType: attacks.StrikeTypeDefault,
116+
Element: attributes.Hydro,
117+
Durability: 25,
118+
Mult: charge[c.TalentLvlAttack()],
119+
}
120+
c.Core.QueueAttack(ai, combat.NewCircleHitOnTarget(trg, nil, 3), 0, 0)
121+
}, .7*60)
122+
123+
return false
124+
}, "mona-c2-followup")
109125
}
110126

111127
// C4:

internal/characters/mona/mona.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ func init() {
2020
type char struct {
2121
*tmpl.Character
2222
a4Stats []float64
23-
c2icd int
2423
c6Src int
2524
c6Stacks int
2625
}
@@ -34,8 +33,6 @@ func NewChar(s *core.Core, w *character.CharWrapper, _ info.CharacterProfile) er
3433
c.BurstCon = 3
3534
c.SkillCon = 5
3635

37-
c.c2icd = -1
38-
3936
w.Character = &c
4037

4138
return nil
@@ -48,6 +45,9 @@ func (c *char) Init() error {
4845
if c.Base.Cons >= 1 {
4946
c.c1()
5047
}
48+
if c.Base.Cons >= 2 {
49+
c.c2()
50+
}
5151
if c.Base.Cons >= 4 {
5252
c.c4()
5353
}

0 commit comments

Comments
 (0)