Skip to content

Commit

Permalink
Rewrite Calamity Queller (genshinsim#227)
Browse files Browse the repository at this point in the history
* Rewrite Calamity Queller

* Move ATK buff inside event

* Add active char check
  • Loading branch information
shizukayuki committed Feb 5, 2022
1 parent 29fb95c commit 685b04c
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 49 deletions.
1 change: 1 addition & 0 deletions imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ import (
_ "github.com/genshinsim/gcsim/internal/weapons/claymore/wolf"
_ "github.com/genshinsim/gcsim/internal/weapons/spear/blackcliff"
_ "github.com/genshinsim/gcsim/internal/weapons/spear/blacktassel"
_ "github.com/genshinsim/gcsim/internal/weapons/spear/calamity"
_ "github.com/genshinsim/gcsim/internal/weapons/spear/catch"
_ "github.com/genshinsim/gcsim/internal/weapons/spear/crescent"
_ "github.com/genshinsim/gcsim/internal/weapons/spear/deathmatch"
Expand Down
98 changes: 49 additions & 49 deletions internal/weapons/spear/calamity/calamity.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,66 +11,66 @@ func init() {
core.RegisterWeaponFunc("calamityqueller", weapon)
}

// Gain 12/15/18/21/24% All Elemental DMG Bonus.
// Obtain Consummation for 20s after using an Elemental Skill, causing ATK to increase by 3.2/4/4.8/5.6/6.4% per second.
// This ATK increase has a maximum of 6 stacks.
// When the character equipped with this weapon is not on the field, Consummation's ATK increase is doubled.
func weapon(char core.Character, c *core.Core, r int, param map[string]int) string {
stacks := 0
var ctick func(core.Character, *core.Core, int) func()
ctick = func(char core.Character, c *core.Core, skillInitF int) func() {
return func() {
if c.F != skillInitF {
return
}
if c.Status.Duration("consummation-"+char.Name()) <= 0 {
stacks = 0
return
}
if stacks < 6 {
stacks++
}
c.Log.Debugw("consummation-"+char.Name()+" buff ticking", "frame", c.F, "event", core.LogCharacterEvent, "stacks", stacks)
if stacks == 6 {
char.AddTask(ctick(char, c, skillInitF), "consummation-"+char.Name()+"-tick", c.Status.Duration("consummation-"+char.Name()))
} else {
char.AddTask(ctick(char, c, skillInitF), "consummation-"+char.Name()+"-tick", 60)
}
}
}

c.Events.Subscribe(core.OnAttackWillLand, func(args ...interface{}) bool {
atk := args[1].(*core.AttackEvent)
if atk.Info.ActorIndex != char.CharIndex() {
dmg := .09 + float64(r)*.03
atkbonus := .024 + float64(r)*.008

skillInitF := -1

c.Events.Subscribe(core.PreSkill, func(args ...interface{}) bool {
if c.ActiveChar != char.CharIndex() {
return false
}
if atk.Info.AttackTag != core.AttackTagElementalArt && atk.Info.AttackTag != core.AttackTagElementalArtHold {
return false

// update init frame on first cast or after 20s from last cast
dur := 60 * 20
if skillInitF == -1 || (skillInitF+dur) < c.F {
skillInitF = c.F
}
c.Status.AddStatus("consummation-"+char.Name(), 20*60)
ctick(char, c, c.F)()
return false

}, fmt.Sprintf("consummation-%v", char.Name()))
char.AddMod(core.CharStatMod{
Key: "calamity-consummation",
Expiry: c.F + dur,
Amount: func() ([]float64, bool) {
m := make([]float64, core.EndStatType)

stacks := (c.F - skillInitF) / 60
if stacks > 6 {
stacks = 6
}

atk := atkbonus * float64(stacks)
if c.ActiveChar != char.CharIndex() {
atk *= 2
}
m[core.ATKP] = atk

return m, true
},
})

return false
}, fmt.Sprintf("calamity-queller-%v", char.Name()))

val := make([]float64, core.EndStatType)
mod := float64(r - 1)
m := make([]float64, core.EndStatType)
m[core.PyroP] = dmg
m[core.HydroP] = dmg
m[core.CryoP] = dmg
m[core.ElectroP] = dmg
m[core.AnemoP] = dmg
m[core.GeoP] = dmg
m[core.DendroP] = dmg

char.AddMod(core.CharStatMod{
Key: "calamityqueller",
Key: "calamity-queller",
Expiry: -1,
Amount: func() ([]float64, bool) {
val[core.PyroP] = 0.12 + 0.03*mod
val[core.HydroP] = 0.12 + 0.03*mod
val[core.CryoP] = 0.12 + 0.03*mod
val[core.ElectroP] = 0.12 + 0.03*mod
val[core.AnemoP] = 0.12 + 0.03*mod
val[core.GeoP] = 0.12 + 0.03*mod
val[core.PhyP] = 0.12 + 0.03*mod
val[core.DendroP] = 0.12 + 0.03*mod
if c.ActiveChar == char.CharIndex() {
val[core.ATKP] = (0.032 + mod*0.008) * 2.0 * float64(stacks)

} else {
val[core.ATKP] = (0.032 + mod*0.008) * float64(stacks)
}
return val, true
return m, true
},
})

Expand Down
37 changes: 37 additions & 0 deletions pkg/character/curves/weaponcurves.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,43 @@ var WeaponBaseMap = map[string]WeaponBase{
},
},
},
"calamityqueller": {
AtkCurve: GROW_CURVE_ATTACK_303,
SpecializedCurve: GROW_CURVE_CRITICAL_301,
BaseAtk: 49.137699127197266,
BaseSpecialized: 0.035999998450279236,
Specialized: core.ATKP,
PromotionBonus: []PromoData{
{
MaxLevel: 20,
Atk: 0,
},
{
MaxLevel: 40,
Atk: 31.100000381469727,
},
{
MaxLevel: 50,
Atk: 62.20000076293945,
},
{
MaxLevel: 60,
Atk: 93.4000015258789,
},
{
MaxLevel: 70,
Atk: 124.5,
},
{
MaxLevel: 80,
Atk: 155.60000610351562,
},
{
MaxLevel: 90,
Atk: 186.6999969482422,
},
},
},
"cinnabarspindle": {
AtkCurve: GROW_CURVE_ATTACK_204,
SpecializedCurve: GROW_CURVE_CRITICAL_201,
Expand Down
41 changes: 41 additions & 0 deletions scripts/weapstat/weapons.json
Original file line number Diff line number Diff line change
Expand Up @@ -3101,6 +3101,47 @@
}
]
},
"calamityqueller": {
"base": {
"attack": 49.137699127197266,
"specialized": 0.035999998450279236
},
"curve": {
"attack": "GROW_CURVE_ATTACK_303",
"specialized": "GROW_CURVE_CRITICAL_301"
},
"specialized": "FIGHT_PROP_ATTACK_PERCENT",
"promotion": [
{
"maxlevel": 20,
"attack": 0
},
{
"maxlevel": 40,
"attack": 31.100000381469727
},
{
"maxlevel": 50,
"attack": 62.20000076293945
},
{
"maxlevel": 60,
"attack": 93.4000015258789
},
{
"maxlevel": 70,
"attack": 124.5
},
{
"maxlevel": 80,
"attack": 155.60000610351562
},
{
"maxlevel": 90,
"attack": 186.6999969482422
}
]
},
"engulfinglightning": {
"base": {
"attack": 45.9364013671875,
Expand Down

0 comments on commit 685b04c

Please sign in to comment.