diff --git a/internal/characters/yoimiya/asc.go b/internal/characters/yoimiya/asc.go index 541ee037c..09fb44a2d 100644 --- a/internal/characters/yoimiya/asc.go +++ b/internal/characters/yoimiya/asc.go @@ -8,16 +8,18 @@ import ( "github.com/genshinsim/gcsim/pkg/modifier" ) +const a1Key = "yoimiyaa1" + // During Niwabi Fire-Dance, shots from Yoimiya's Normal Attack will increase // her Pyro DMG Bonus by 2% on hit. This effect lasts for 3s and can have a // maximum of 10 stacks. func (c *char) a1() { - //TODO: change this to add mod on each hit instead + // TODO: change this to add mod on each hit instead c.AddStatMod(character.StatMod{ Base: modifier.NewBase("yoimiya-a1", -1), AffectedStat: attributes.PyroP, Amount: func() ([]float64, bool) { - if c.Core.Status.Duration("yoimiyaa1") > 0 { + if c.StatusIsActive(a1Key) { c.a1bonus[attributes.PyroP] = float64(c.a1stack) * 0.02 return c.a1bonus, true } @@ -31,18 +33,17 @@ func (c *char) a1() { if atk.Info.ActorIndex != c.Index { return false } - if c.Core.Status.Duration("yoimiyaskill") == 0 { + if !c.StatusIsActive(skillKey) { return false } if atk.Info.AttackTag != combat.AttackTagNormal { return false } - //here we can add stacks up to 10 + // here we can add stacks up to 10 if c.a1stack < 10 { c.a1stack++ } - c.Core.Status.Add("yoimiyaa1", 180) - // c.a1expiry = c.Core.F + 180 // 3 seconds + c.AddStatus(a1Key, 180, true) return false }, "yoimiya-a1") } diff --git a/internal/characters/yoimiya/attack.go b/internal/characters/yoimiya/attack.go index 2c5efb2cf..5f3a4ec7d 100644 --- a/internal/characters/yoimiya/attack.go +++ b/internal/characters/yoimiya/attack.go @@ -9,8 +9,10 @@ import ( "github.com/genshinsim/gcsim/pkg/core/combat" ) -var attackFrames [][]int -var attackHitmarks = [][]int{{15, 24}, {17}, {25}, {11, 26}, {17}} +var ( + attackFrames [][]int + attackHitmarks = [][]int{{15, 24}, {17}, {25}, {11, 26}, {17}} +) const normalHitNum = 5 @@ -45,13 +47,13 @@ func (c *char) Attack(p map[string]int) action.ActionInfo { } particleCB := func(combat.AttackCB) { - if c.Core.Status.Duration("yoimiyaskill") <= 0 { + if !c.StatusIsActive(skillKey) { return } if c.Core.F < c.lastPart { return } - c.lastPart = c.Core.F + 300 //every 5 second + c.lastPart = c.Core.F + 300 // every 5 second var count float64 = 2 if c.Core.Rand.Float64() < 0.5 { @@ -73,8 +75,8 @@ func (c *char) Attack(p map[string]int) action.ActionInfo { ) } - if c.Base.Cons >= 6 && c.Core.Status.Duration("yoimiyaskill") > 0 && c.Core.Rand.Float64() < 0.5 { - //trigger attack + if c.Base.Cons >= 6 && c.StatusIsActive(skillKey) && c.Core.Rand.Float64() < 0.5 { + // trigger attack ai := combat.AttackInfo{ ActorIndex: c.Index, Abil: fmt.Sprintf("Kindling (C6) - N%v", c.NormalCounter), @@ -85,8 +87,13 @@ func (c *char) Attack(p map[string]int) action.ActionInfo { Durability: 25, Mult: totalMV * 0.6, } - //TODO: frames? - c.Core.QueueAttack(ai, combat.NewCircleHit(c.Core.Combat.Player(), 0.1, false, combat.TargettableEnemy), 0, attackHitmarks[c.NormalCounter][0]+travel+5) + // TODO: frames? + c.Core.QueueAttack( + ai, + combat.NewCircleHit(c.Core.Combat.Player(), 0.1, false, combat.TargettableEnemy), + 0, + attackHitmarks[c.NormalCounter][0]+travel+5, + ) } defer c.AdvanceNormalIndex() diff --git a/internal/characters/yoimiya/skill.go b/internal/characters/yoimiya/skill.go index af575506e..09f37e613 100644 --- a/internal/characters/yoimiya/skill.go +++ b/internal/characters/yoimiya/skill.go @@ -8,7 +8,10 @@ import ( var skillFrames []int -const skillStart = 11 +const ( + skillKey = "yoimiyaskill" + skillStart = 11 +) func init() { skillFrames = frames.InitAbilSlice(34) @@ -20,9 +23,8 @@ func init() { } func (c *char) Skill(p map[string]int) action.ActionInfo { - - c.Core.Status.Add("yoimiyaskill", 600+skillStart) //activate for 10 - if c.Core.Status.Duration("yoimiyaa1") == 0 { + c.AddStatus(skillKey, 600+skillStart, true) // activate for 10 + if !c.StatusIsActive(a1Key) { c.a1stack = 0 } @@ -41,9 +43,7 @@ func (c *char) onExit() { prev := args[0].(int) next := args[1].(int) if prev == c.Index && next != c.Index { - if c.Core.Status.Duration("yoimiyaskill") > 0 { - c.Core.Status.Delete("yoimiyaskill") - } + c.DeleteStatus(skillKey) } return false }, "yoimiya-exit") diff --git a/internal/characters/yoimiya/yoimiya.go b/internal/characters/yoimiya/yoimiya.go index e44f43abc..049dedb3a 100644 --- a/internal/characters/yoimiya/yoimiya.go +++ b/internal/characters/yoimiya/yoimiya.go @@ -57,7 +57,7 @@ func (c *char) Snapshot(ai *combat.AttackInfo) combat.Snapshot { ds := c.Character.Snapshot(ai) //infusion to normal attack only - if c.Core.Status.Duration("yoimiyaskill") > 0 && ai.AttackTag == combat.AttackTagNormal { + if c.StatusIsActive(skillKey) && ai.AttackTag == combat.AttackTagNormal { ai.Element = attributes.Pyro ai.Mult = skill[c.TalentLvlSkill()] * ai.Mult c.Core.Log.NewEvent("skill mult applied", glog.LogCharacterEvent, c.Index).