Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix klee A1 and CA snapshot #2269

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions internal/characters/klee/asc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,32 @@ package klee

import (
"github.com/genshinsim/gcsim/pkg/core/combat"
"github.com/genshinsim/gcsim/pkg/core/glog"
"github.com/genshinsim/gcsim/pkg/core/targets"
)

const (
a1IcdKey = "a1-icd"
a1SparkKey = "a1-spark"
)

// When Jumpy Dumpty and Normal Attacks deal DMG, Klee has a 50% chance to obtain an Explosive Spark.
// This Explosive Spark is consumed by the next Charged Attack, which costs no Stamina and deals 50% increased DMG.
func (c *char) makeA1CB() combat.AttackCBFunc {
if c.Base.Ascension < 1 {
return nil
}
return func(a combat.AttackCB) {
if c.Core.F < c.sparkICD {
if c.StatusIsActive(a1IcdKey) {
return
}
if c.Core.Rand.Float64() < 0.5 {
return
}
c.AddStatus(a1IcdKey, 60*5, true)

c.sparkICD = c.Core.F + 60*4
c.Core.Status.Add("kleespark", 60*30)
c.Core.Log.NewEvent("klee gained spark", glog.LogCharacterEvent, c.Index).
Write("icd", c.sparkICD)
if !c.StatusIsActive(a1SparkKey) {
c.AddStatus(a1SparkKey, 60*30, true)
}
}
}

Expand Down
45 changes: 25 additions & 20 deletions internal/characters/klee/charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
"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/glog"
)

var chargeFrames []int

const (
chargeHitmark = 76
chargeHitmark = 76
chargeSnapshot = 29 + 32
)

func init() {
Expand Down Expand Up @@ -44,28 +44,33 @@ func (c *char) ChargeAttack(p map[string]int) (action.Info, error) {
Durability: 25,
Mult: charge[c.TalentLvlAttack()],
}
// stam is calculated before this func is called so it's safe to
// set spark to 0 here
snap := c.Snapshot(&ai)
if c.Core.Status.Duration("kleespark") > 0 {
snap.Stats[attributes.DmgP] += .50
c.Core.Status.Delete("kleespark")
c.Core.Log.NewEvent("klee consumed spark", glog.LogCharacterEvent, c.Index).
Write("icd", c.sparkICD)
}

windup := 0
if (c.Core.Player.CurrentState() == action.NormalAttackState && (c.NormalCounter == 1 || c.NormalCounter == 2)) ||
c.Core.Player.CurrentState() == action.SkillState {
switch c.Core.Player.CurrentState() {
case action.NormalAttackState:
if c.NormalCounter == 1 || c.NormalCounter == 2 {
windup = 14
}
case action.SkillState:
windup = 14
}
c.Core.QueueAttackWithSnap(
ai,
snap,
combat.NewCircleHit(c.Core.Combat.Player(), c.Core.Combat.PrimaryTarget(), nil, 3),
chargeHitmark-windup+travel,
c.makeA4CB(),
)

c.Core.Tasks.Add(func() {
// apply and clear spark
snap := c.Snapshot(&ai)
if c.StatusIsActive(a1SparkKey) {
snap.Stats[attributes.DmgP] += .50
c.DeleteStatus(a1SparkKey)
}

c.Core.QueueAttackWithSnap(
ai,
snap,
combat.NewCircleHit(c.Core.Combat.Player(), c.Core.Combat.PrimaryTarget(), nil, 3),
(chargeHitmark-chargeSnapshot)+travel,
c.makeA4CB(),
)
}, chargeSnapshot-windup)

c.c1(chargeHitmark - windup + travel)

Expand Down
5 changes: 1 addition & 4 deletions internal/characters/klee/klee.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ func init() {
type char struct {
*tmpl.Character
c1Chance float64
sparkICD int
}

func NewChar(s *core.Core, w *character.CharWrapper, _ info.CharacterProfile) error {
Expand All @@ -28,8 +27,6 @@ func NewChar(s *core.Core, w *character.CharWrapper, _ info.CharacterProfile) er
c.SkillCon = 3
c.BurstCon = 5

c.sparkICD = -1

c.SetNumCharges(action.ActionSkill, 2)

w.Character = &c
Expand All @@ -44,7 +41,7 @@ func (c *char) Init() error {

func (c *char) ActionStam(a action.Action, p map[string]int) float64 {
if a == action.ActionCharge {
if c.Core.Status.Duration("kleespark") > 0 {
if c.StatusIsActive(a1SparkKey) {
return 0
}
return 50
Expand Down
Loading