Skip to content

Commit

Permalink
fix the attack speed buff for some characters (#1296)
Browse files Browse the repository at this point in the history
  • Loading branch information
imring authored Feb 20, 2023
1 parent 402e1b9 commit 9e34476
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 19 deletions.
10 changes: 6 additions & 4 deletions internal/characters/cyno/cons.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cyno

import (
"github.com/genshinsim/gcsim/pkg/core/action"
"github.com/genshinsim/gcsim/pkg/core/attributes"
"github.com/genshinsim/gcsim/pkg/core/combat"
"github.com/genshinsim/gcsim/pkg/core/event"
Expand All @@ -23,10 +24,11 @@ const (
func (c *char) c1() {
m := make([]float64, attributes.EndStatType)
m[attributes.AtkSpd] = 0.2
c.AddAttackMod(character.AttackMod{
Base: modifier.NewBaseWithHitlag(c1Key, 600), // 10s
Amount: func(atk *combat.AttackEvent, t combat.Target) ([]float64, bool) {
if atk.Info.AttackTag != combat.AttackTagNormal {
c.AddStatMod(character.StatMod{
Base: modifier.NewBaseWithHitlag(c1Key, 600), // 10s
AffectedStat: attributes.AtkSpd,
Amount: func() ([]float64, bool) {
if c.Core.Player.CurrentState() != action.NormalAttackState {
return nil, false
}
return m, true
Expand Down
11 changes: 6 additions & 5 deletions internal/characters/diluc/diluc.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ func init() {

type char struct {
*tmpl.Character
eCounter int
a4buff []float64
c2buff []float64
c2stack int
c4buff []float64
eCounter int
a4buff []float64
c2buff []float64
c2stack int
c4buff []float64
savedNormalCounter int
c6Count int
}

const eWindowKey = "diluc-e-window"
Expand Down
25 changes: 20 additions & 5 deletions internal/characters/diluc/skill.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,38 @@ func (c *char) Skill(p map[string]int) action.ActionInfo {
// C6: After casting Searing Onslaught, the next 2 Normal Attacks within the
// next 6s will have their DMG and ATK SPD increased by 30%.
if c.Base.Cons >= 6 {
count := 0
c.c6Count = 0
m := make([]float64, attributes.EndStatType)
m[attributes.DmgP] = 0.3
m[attributes.AtkSpd] = 0.3
c.AddAttackMod(character.AttackMod{
Base: modifier.NewBaseWithHitlag("diluc-c6", 360),
Base: modifier.NewBaseWithHitlag("diluc-c6-dmg", 360),
Amount: func(atk *combat.AttackEvent, t combat.Target) ([]float64, bool) {
if atk.Info.AttackTag != combat.AttackTagNormal {
return nil, false
}
if count > 1 {
if c.c6Count > 1 {
return nil, false
}
count++
c.c6Count++
return m, true
},
})

mAtkSpd := make([]float64, attributes.EndStatType)
mAtkSpd[attributes.AtkSpd] = 0.3
c.AddStatMod(character.StatMod{
Base: modifier.NewBaseWithHitlag("diluc-c6-speed", 360),
AffectedStat: attributes.AtkSpd,
Amount: func() ([]float64, bool) {
if c.Core.Player.CurrentState() != action.NormalAttackState {
return nil, false
}
if c.c6Count > 1 {
return nil, false
}
return mAtkSpd, true
},
})
}

hitmark := skillHitmarks[c.eCounter]
Expand Down
17 changes: 15 additions & 2 deletions internal/characters/rosaria/cons.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package rosaria

import (
"github.com/genshinsim/gcsim/pkg/core/action"
"github.com/genshinsim/gcsim/pkg/core/attributes"
"github.com/genshinsim/gcsim/pkg/core/combat"
"github.com/genshinsim/gcsim/pkg/core/player/character"
Expand Down Expand Up @@ -28,17 +29,29 @@ func (c *char) makeC1CB() combat.AttackCBFunc {
}

m := make([]float64, attributes.EndStatType)
m[attributes.AtkSpd] = 0.1
m[attributes.DmgP] = 0.1
c.AddAttackMod(character.AttackMod{
Base: modifier.NewBaseWithHitlag("rosaria-c1", 240), //4s
Base: modifier.NewBaseWithHitlag("rosaria-c1-dmg", 240), //4s
Amount: func(atk *combat.AttackEvent, _ combat.Target) ([]float64, bool) {
if atk.Info.AttackTag != combat.AttackTagNormal {
return nil, false
}
return m, true
},
})

mAtkSpd := make([]float64, attributes.EndStatType)
mAtkSpd[attributes.AtkSpd] = 0.1
c.AddStatMod(character.StatMod{
Base: modifier.NewBaseWithHitlag("rosaria-c1-speed", 240), //4s
AffectedStat: attributes.AtkSpd,
Amount: func() ([]float64, bool) {
if c.Core.Player.CurrentState() != action.NormalAttackState {
return nil, false
}
return mAtkSpd, true
},
})
}
}

Expand Down
11 changes: 8 additions & 3 deletions internal/characters/xinyan/cons.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package xinyan

import (
"github.com/genshinsim/gcsim/pkg/core/action"
"github.com/genshinsim/gcsim/pkg/core/attributes"
"github.com/genshinsim/gcsim/pkg/core/combat"
"github.com/genshinsim/gcsim/pkg/core/player/character"
Expand Down Expand Up @@ -33,9 +34,13 @@ func (c *char) makeC1CB() combat.AttackCBFunc {

m := make([]float64, attributes.EndStatType)
m[attributes.AtkSpd] = 0.12
c.AddAttackMod(character.AttackMod{
Base: modifier.NewBaseWithHitlag("xinyan-c1", 5*60),
Amount: func(atk *combat.AttackEvent, t combat.Target) ([]float64, bool) {
c.AddStatMod(character.StatMod{
Base: modifier.NewBaseWithHitlag("xinyan-c1", 5*60),
AffectedStat: attributes.AtkSpd,
Amount: func() ([]float64, bool) {
if c.Core.Player.CurrentState() != action.NormalAttackState && c.Core.Player.CurrentState() != action.ChargeAttackState {
return nil, false
}
return m, true
},
})
Expand Down

0 comments on commit 9e34476

Please sign in to comment.