Skip to content

Commit

Permalink
fix swirl vape bug: (genshinsim#434)
Browse files Browse the repository at this point in the history
- add em to swirl attacks
- prevent 4vv from adding bonus in vape
  • Loading branch information
srliao committed Apr 3, 2022
1 parent 86cc444 commit bfdc55c
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 12 deletions.
5 changes: 4 additions & 1 deletion internal/artifacts/viridescent/viridescent.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ func New(c core.Character, s *core.Core, count int, params map[string]int) {
Key: "vv",
Expiry: -1,
Amount: func(ai core.AttackInfo) (float64, bool) {
//overload dmg can't melt or vape so it's fine
//check to make sure this is not an amped swirl
if ai.Amped {
return 0, false
}
switch ai.AttackTag {
case core.AttackTagSwirlCryo:
case core.AttackTagSwirlElectro:
Expand Down
4 changes: 3 additions & 1 deletion internal/reactable/electrocharged.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ func (r *Reactable) tryAddEC(a *core.AttackEvent) {
Element: core.Electro,
IgnoreDefPercent: 1,
}
atk.FlatDmg = 1.2 * r.calcReactionDmg(atk)
char := r.core.Chars[a.Info.ActorIndex]
em := char.Stat(core.EM)
atk.FlatDmg = 1.2 * r.calcReactionDmg(atk, em)
r.ecSnapshot = atk

//if this is a new ec then trigger tick immediately and queue up ticks
Expand Down
4 changes: 3 additions & 1 deletion internal/reactable/freeze.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ func (r *Reactable) ShatterCheck(a *core.AttackEvent) {
Element: core.Physical,
IgnoreDefPercent: 1,
}
ai.FlatDmg = 1.5 * r.calcReactionDmg(ai)
char := r.core.Chars[a.Info.ActorIndex]
em := char.Stat(core.EM)
ai.FlatDmg = 1.5 * r.calcReactionDmg(ai, em)
//shatter is a self attack
r.core.Combat.QueueAttack(
ai,
Expand Down
4 changes: 3 additions & 1 deletion internal/reactable/overload.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ func (r *Reactable) tryOverload(a *core.AttackEvent) {
Element: core.Pyro,
IgnoreDefPercent: 1,
}
atk.FlatDmg = 2 * r.calcReactionDmg(atk)
char := r.core.Chars[a.Info.ActorIndex]
em := char.Stat(core.EM)
atk.FlatDmg = 2 * r.calcReactionDmg(atk, em)
r.core.Combat.QueueAttack(atk, core.NewDefCircHit(3, true, core.TargettableEnemy), -1, 1)
}
3 changes: 1 addition & 2 deletions internal/reactable/reactable.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,8 @@ func (r *Reactable) tryRefill(ele core.EleType, dur *core.Durability) {
*dur = 0
}

func (r *Reactable) calcReactionDmg(atk core.AttackInfo) float64 {
func (r *Reactable) calcReactionDmg(atk core.AttackInfo, em float64) float64 {
char := r.core.Chars[atk.ActorIndex]
em := char.Stat(core.EM)
lvl := char.Level() - 1
if lvl > 89 {
lvl = 89
Expand Down
4 changes: 3 additions & 1 deletion internal/reactable/superconduct.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ func (r *Reactable) queueSuperconduct(a *core.AttackEvent) {
Element: core.Cryo,
IgnoreDefPercent: 1,
}
atk.FlatDmg = 0.5 * r.calcReactionDmg(atk)
char := r.core.Chars[a.Info.ActorIndex]
em := char.Stat(core.EM)
atk.FlatDmg = 0.5 * r.calcReactionDmg(atk, em)
r.core.Combat.QueueAttack(atk, core.NewDefCircHit(3, true, core.TargettableEnemy), -1, 1, superconductPhysShred)
}

Expand Down
17 changes: 12 additions & 5 deletions internal/reactable/swirl.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,19 @@ func (r *Reactable) queueSwirl(rt core.ReactionType, ele core.EleType, tag core.
Element: ele,
IgnoreDefPercent: 1,
}
ai.FlatDmg = 0.6 * r.calcReactionDmg(ai)
char := r.core.Chars[charIndex]
em := char.Stat(core.EM)
ai.FlatDmg = 0.6 * r.calcReactionDmg(ai, em)
snap := core.Snapshot{
CharLvl: char.Level(),
ActorEle: char.Ele(),
}
snap.Stats[core.EM] = em
//first attack is self no hitbox
r.core.Combat.QueueAttack(
r.core.Combat.QueueAttackWithSnap(
ai,
snap,
core.NewDefSingleTarget(r.self.Index(), r.self.Type()),
-1,
1,
)
//next is aoe - hydro swirls never do AoE damage, as they only spread the element
Expand All @@ -38,10 +45,10 @@ func (r *Reactable) queueSwirl(rt core.ReactionType, ele core.EleType, tag core.
}
ai.Durability = dur
ai.Abil = string(rt) + " (aoe)"
r.core.Combat.QueueAttack(
r.core.Combat.QueueAttackWithSnap(
ai,
snap,
core.NewDefCircHit(5, false, core.TargettableEnemy),
-1,
1,
)
}
Expand Down

0 comments on commit bfdc55c

Please sign in to comment.