Skip to content

Commit

Permalink
Merge pull request #805 from skippi/yoimiya-fix
Browse files Browse the repository at this point in the history
fix yoimiya normal attack icd
  • Loading branch information
srliao authored Aug 18, 2022
2 parents 2cf6cbf + 48570c1 commit 3bc10bf
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 22 deletions.
13 changes: 7 additions & 6 deletions internal/characters/yoimiya/asc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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")
}
Expand Down
23 changes: 15 additions & 8 deletions internal/characters/yoimiya/attack.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 {
Expand All @@ -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),
Expand All @@ -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()
Expand Down
14 changes: 7 additions & 7 deletions internal/characters/yoimiya/skill.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import (

var skillFrames []int

const skillStart = 11
const (
skillKey = "yoimiyaskill"
skillStart = 11
)

func init() {
skillFrames = frames.InitAbilSlice(34)
Expand All @@ -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
}

Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion internal/characters/yoimiya/yoimiya.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit 3bc10bf

Please sign in to comment.