Skip to content

Commit

Permalink
fix yaoyao radishes dealing dmg to active character (genshinsim#1995)
Browse files Browse the repository at this point in the history
  • Loading branch information
k0l11 authored Feb 10, 2024
1 parent 9b50dbe commit ffa4576
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 42 deletions.
7 changes: 3 additions & 4 deletions internal/characters/yaoyao/asc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/genshinsim/gcsim/pkg/core/combat"
"github.com/genshinsim/gcsim/pkg/core/glog"
"github.com/genshinsim/gcsim/pkg/core/player"
"github.com/genshinsim/gcsim/pkg/core/targets"
)

const a4Status = "yaoyao-a4"
Expand All @@ -33,7 +32,6 @@ func (c *char) a1Throw() {
target := enemy.Pos()

radishExplodeAoE := combat.NewCircleHitOnTarget(target, nil, radishRad)
radishExplodeAoE.SkipTargets[targets.TargettablePlayer] = false

c.QueueCharTask(func() {
var hi player.HealInfo
Expand All @@ -50,12 +48,13 @@ func (c *char) a1Throw() {
hi = c.getSkillHealInfo(&snap)
}

delay := 1
c.Core.Tasks.Add(c.heal(radishExplodeAoE, hi), delay)
c.Core.QueueAttackWithSnap(
ai,
snap,
radishExplodeAoE,
1,
c.makeHealCB(radishExplodeAoE, hi),
delay,
c.makeC2CB(),
)
}, travelDelay-1)
Expand Down
30 changes: 9 additions & 21 deletions internal/characters/yaoyao/cons.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ import (
"github.com/genshinsim/gcsim/pkg/modifier"
)

const c1ICDkey = "yaoyao-c1-stam-icd"
const c2ICDkey = "yaoyao-c2-icd"
const c6MegaRadishRad = 4.0
const (
c1ICDkey = "yaoyao-c1-stam-icd"
c2ICDkey = "yaoyao-c2-icd"
c6MegaRadishRad = 4.0
c6HealMsg = "Radish C6"
)

func (c *char) c1() {
m := make([]float64, attributes.EndStatType)
Expand Down Expand Up @@ -85,27 +88,12 @@ func (yg *yuegui) c6(target geometry.Point) {
}
hi := player.HealInfo{
Caller: yg.c.Index,
Message: "Radish C6",
Message: c6HealMsg,
Src: yg.c.MaxHP() * 0.075,
Bonus: yg.c.Stat(attributes.Heal),
}

c6MegaRadishAoE := combat.NewCircleHitOnTarget(target, nil, c6MegaRadishRad)
c6MegaRadishAoE.SkipTargets[targets.TargettablePlayer] = false
done := false
heal := func(a combat.AttackCB) {
if a.Target.Type() != targets.TargettableEnemy && a.Target.Type() != targets.TargettablePlayer {
return
}

if done {
return
}
if yg.Core.Combat.Player().IsWithinArea(c6MegaRadishAoE) {
hi.Target = yg.Core.Player.Active()
yg.c.Core.Player.Heal(hi)
done = true
}
}
yg.Core.QueueAttackWithSnap(ai, yg.snap, c6MegaRadishAoE, c6TravelDelay, heal)
yg.Core.Tasks.Add(yg.c.heal(c6MegaRadishAoE, hi), c6TravelDelay)
yg.Core.QueueAttackWithSnap(ai, yg.snap, c6MegaRadishAoE, c6TravelDelay)
}
4 changes: 4 additions & 0 deletions internal/characters/yaoyao/radish.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import "github.com/genshinsim/gcsim/pkg/core/player"

func (c *char) radishHeal(hi player.HealInfo) {
c.Core.Player.Heal(hi)
// c1 and a4 should not proc on c6 radish
if hi.Message == c6HealMsg {
return
}
if c.Base.Cons >= 1 {
c.c1()
}
Expand Down
26 changes: 9 additions & 17 deletions internal/characters/yaoyao/yuegui.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,15 @@ func (c *char) newYueguiJump() {
c.numYueguiJumping += 1
}

func (c *char) makeHealCB(area combat.AttackPattern, hi player.HealInfo) func(combat.AttackCB) {
done := false
return func(a combat.AttackCB) {
if a.Target.Type() != targets.TargettableEnemy && a.Target.Type() != targets.TargettablePlayer {
return
}

if done {
func (c *char) heal(area combat.AttackPattern, hi player.HealInfo) func() {
return func() {
if !c.Core.Combat.Player().IsWithinArea(area) {
return
}
if c.Core.Combat.Player().IsWithinArea(area) {
if hi.Target != -1 {
hi.Target = c.Core.Player.Active()
}
c.radishHeal(hi)
done = true
if hi.Target != -1 {
hi.Target = c.Core.Player.Active()
}
c.radishHeal(hi)
}
}

Expand Down Expand Up @@ -142,16 +134,16 @@ func (yg *yuegui) throw() {
target = yg.Core.Combat.Player().Pos()
}
radishExplodeAoE := combat.NewCircleHitOnTarget(target, nil, radishRad)
radishExplodeAoE.SkipTargets[targets.TargettablePlayer] = false
yg.c.QueueCharTask(func() {
ai, hi := yg.getInfos()

delay := 1
yg.Core.Tasks.Add(yg.c.heal(radishExplodeAoE, hi), delay)
yg.Core.QueueAttackWithSnap(
ai,
yg.snap,
radishExplodeAoE,
1,
yg.c.makeHealCB(radishExplodeAoE, hi),
delay,
yg.makeParticleCB(),
yg.c.makeC2CB(),
)
Expand Down

0 comments on commit ffa4576

Please sign in to comment.