Skip to content

Commit b25387b

Browse files
committed
Moved GetMoonsignLevel to player. Added util func to check if reaction is lunar
1 parent bd4c690 commit b25387b

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

internal/artifacts/silkenmoonsserenade/silkenmoonsserenade.go

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,14 @@ func (s *Set) Init() error {
5353
}
5454

5555
m2 := make([]float64, attributes.EndStatType)
56-
switch s.getMoonsignLevel() {
56+
switch s.core.Player.GetMoonsignLevel() {
5757
case 0:
5858
case 1:
5959
m2[attributes.EM] = 60
6060
default:
6161
m2[attributes.EM] = 120
6262
}
63+
6364
hook := func(args ...any) bool {
6465
if _, ok := args[0].(*enemy.Enemy); !ok {
6566
return false
@@ -96,10 +97,7 @@ func (s *Set) Init() error {
9697
char.AddReactBonusMod(character.ReactBonusMod{
9798
Base: modifier.NewBase(gleamingMoonDevotionReactKey, -1),
9899
Amount: func(ai info.AttackInfo) (float64, bool) {
99-
switch ai.AttackTag {
100-
case attacks.AttackTagDirectLunarCharged:
101-
case attacks.AttackTagReactionLunarCharge:
102-
default:
100+
if !attacks.AttackTagIsLunar(ai.AttackTag) {
103101
return 0, false
104102
}
105103

@@ -122,14 +120,6 @@ func (s *Set) Init() error {
122120
return nil
123121
}
124122

125-
func (s *Set) getMoonsignLevel() int {
126-
count := 0
127-
for _, c := range s.core.Player.Chars() {
128-
count += c.Moonsign
129-
}
130-
return count
131-
}
132-
133123
func NewSet(c *core.Core, char *character.CharWrapper, count int, param map[string]int) (info.Set, error) {
134124
s := Set{
135125
char: char,

pkg/core/attacks/attack.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,9 @@ const (
5858
AdditionalTagNightsoul
5959
AdditionalTagKinichCannon
6060
)
61+
62+
func AttackTagIsLunar(tag AttackTag) bool {
63+
isReaction := LunarReactionStartDelim < tag && tag < LunarReactionEndDelim
64+
isDirect := DirectLunarReactionStartDelim < tag && tag < DirectLunarReactionEndDelim
65+
return isReaction || isDirect
66+
}

pkg/core/player/player.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,3 +342,11 @@ func (h *Handler) Airborne() AirborneSource {
342342
const (
343343
XianyunAirborneBuff = "xianyun-airborne-buff"
344344
)
345+
346+
func (h *Handler) GetMoonsignLevel() int {
347+
count := 0
348+
for _, c := range h.Chars() {
349+
count += c.Moonsign
350+
}
351+
return count
352+
}

pkg/simulation/setup.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,7 @@ func setupAscendantGleam(core *core.Core) {
423423
c.AddReactBonusMod(character.ReactBonusMod{
424424
Base: modifier.NewBase("ascendant-gleam", 20*60),
425425
Amount: func(ai info.AttackInfo) (float64, bool) {
426-
lunarReact := (attacks.LunarReactionStartDelim < ai.AttackTag && ai.AttackTag < attacks.LunarReactionEndDelim)
427-
directLunar := (attacks.DirectLunarReactionStartDelim < ai.AttackTag && ai.AttackTag < attacks.DirectLunarReactionEndDelim)
428-
429-
if !lunarReact && !directLunar {
426+
if !attacks.AttackTagIsLunar(ai.AttackTag) {
430427
return 0, false
431428
}
432429
if core.Flags.LogDebug {

0 commit comments

Comments
 (0)