diff --git a/internal/lightcone/hunt/shadowedbynight/data.go b/internal/lightcone/hunt/shadowedbynight/data.go new file mode 100644 index 00000000..d5fa8342 --- /dev/null +++ b/internal/lightcone/hunt/shadowedbynight/data.go @@ -0,0 +1,71 @@ +// Code generated by "weapstat"; DO NOT EDIT. + +package shadowedbynight + +import "github.com/simimpact/srsim/pkg/engine/equip/lightcone" + +var promotions = []lightcone.PromotionData{ + { + MaxLevel: 20, + HPBase: 38.4, + HPAdd: 5.76, + ATKBase: 21.6, + ATKAdd: 3.24, + DEFBase: 18, + DEFAdd: 2.7, + }, + { + MaxLevel: 30, + HPBase: 84.48, + HPAdd: 5.76, + ATKBase: 47.52, + ATKAdd: 3.24, + DEFBase: 39.6, + DEFAdd: 2.7, + }, + { + MaxLevel: 40, + HPBase: 145.92, + HPAdd: 5.76, + ATKBase: 82.08, + ATKAdd: 3.24, + DEFBase: 68.4, + DEFAdd: 2.7, + }, + { + MaxLevel: 50, + HPBase: 207.36, + HPAdd: 5.76, + ATKBase: 116.64, + ATKAdd: 3.24, + DEFBase: 97.2, + DEFAdd: 2.7, + }, + { + MaxLevel: 60, + HPBase: 268.8, + HPAdd: 5.76, + ATKBase: 151.2, + ATKAdd: 3.24, + DEFBase: 126, + DEFAdd: 2.7, + }, + { + MaxLevel: 70, + HPBase: 330.24, + HPAdd: 5.76, + ATKBase: 185.76, + ATKAdd: 3.24, + DEFBase: 154.8, + DEFAdd: 2.7, + }, + { + MaxLevel: 80, + HPBase: 391.68, + HPAdd: 5.76, + ATKBase: 220.32, + ATKAdd: 3.24, + DEFBase: 183.6, + DEFAdd: 2.7, + }, +} \ No newline at end of file diff --git a/internal/lightcone/hunt/shadowedbynight/shadowedbynight.go b/internal/lightcone/hunt/shadowedbynight/shadowedbynight.go new file mode 100644 index 00000000..e707fe58 --- /dev/null +++ b/internal/lightcone/hunt/shadowedbynight/shadowedbynight.go @@ -0,0 +1,93 @@ +package shadowedbynight + +import ( + "github.com/simimpact/srsim/pkg/engine" + "github.com/simimpact/srsim/pkg/engine/equip/lightcone" + "github.com/simimpact/srsim/pkg/engine/event" + "github.com/simimpact/srsim/pkg/engine/info" + "github.com/simimpact/srsim/pkg/engine/modifier" + "github.com/simimpact/srsim/pkg/engine/prop" + "github.com/simimpact/srsim/pkg/key" + "github.com/simimpact/srsim/pkg/model" +) + +const ( + check = "shadowed_by_night" + buff = "shadowed_by_night_spd_buff" +) + +type state struct { + spdAmt float64 + flag bool +} + +// Increases the wearer's Break Effect by 28/35/42/49/56%. +// When entering battle or after dealing Break DMG, increases SPD by 8/9/10/11/12%, lasting for 2 turn(s). +// This effect can only trigger once per turn. +func init() { + lightcone.Register(key.ShadowedbyNight, lightcone.Config{ + CreatePassive: Create, + Rarity: 4, + Path: model.Path_HUNT, + Promotions: promotions, + }) + + modifier.Register(check, modifier.Config{ + Listeners: modifier.Listeners{ + OnPhase1: resetFlag, + OnAfterHitAll: applySpdBuff, + }, + }) + + modifier.Register(buff, modifier.Config{ + Stacking: modifier.ReplaceBySource, + StatusType: model.StatusType_STATUS_BUFF, + CanDispel: true, + BehaviorFlags: []model.BehaviorFlag{model.BehaviorFlag_STAT_SPEED_UP}, + }) +} + +func Create(engine engine.Engine, owner key.TargetID, lc info.LightCone) { + beAmt := 0.21 + 0.07*float64(lc.Imposition) + spdAmt := 0.07 + 0.01*float64(lc.Imposition) + state := state{ + spdAmt: spdAmt, + flag: false, + } + engine.AddModifier(owner, info.Modifier{ + Name: check, + Source: owner, + Stats: info.PropMap{prop.BreakEffect: beAmt}, + State: &state, + }) + + engine.Events().BattleStart.Subscribe(func(event event.BattleStart) { + engine.AddModifier(owner, info.Modifier{ + Name: buff, + Source: owner, + Stats: info.PropMap{prop.SPDPercent: spdAmt}, + Duration: 2, + }) + }) +} + +func resetFlag(mod *modifier.Instance) { + st := mod.State().(*state) + st.flag = false +} + +func applySpdBuff(mod *modifier.Instance, e event.HitEnd) { + if e.Hit.AttackType != model.AttackType_ELEMENT_DAMAGE { + return + } + st := mod.State().(*state) + if !st.flag { + mod.Engine().AddModifier(mod.Owner(), info.Modifier{ + Name: buff, + Source: mod.Owner(), + Stats: info.PropMap{prop.SPDPercent: st.spdAmt}, + Duration: 2, + }) + } + st.flag = true +} diff --git a/pkg/key/lightcone.go b/pkg/key/lightcone.go index bf2afa89..17e3bdbe 100644 --- a/pkg/key/lightcone.go +++ b/pkg/key/lightcone.go @@ -31,6 +31,7 @@ const ( ReturntoDarkness LightCone = "return_to_darkness" SleepLiketheDead LightCone = "sleep_like_the_dead" IntheNight LightCone = "in_the_night" + ShadowedbyNight LightCone = "shadowed_by_night" ) // Nihility diff --git a/pkg/simulation/imports.go b/pkg/simulation/imports.go index 78e8c59e..bac59f66 100644 --- a/pkg/simulation/imports.go +++ b/pkg/simulation/imports.go @@ -82,6 +82,7 @@ import ( _ "github.com/simimpact/srsim/internal/lightcone/hunt/onlysilenceremains" _ "github.com/simimpact/srsim/internal/lightcone/hunt/returntodarkness" _ "github.com/simimpact/srsim/internal/lightcone/hunt/riverflowsinspring" + _ "github.com/simimpact/srsim/internal/lightcone/hunt/shadowedbynight" _ "github.com/simimpact/srsim/internal/lightcone/hunt/sleeplikethedead" _ "github.com/simimpact/srsim/internal/lightcone/hunt/subscribeformore" _ "github.com/simimpact/srsim/internal/lightcone/hunt/swordplay"