From d4766e4f8362fe2f99e66eac1a14d009021d42e3 Mon Sep 17 00:00:00 2001 From: kdovtdc Date: Sun, 4 Aug 2024 17:14:52 +0200 Subject: [PATCH 1/3] Implement Destiny's Threads Forewoven (LC) * init lc setup * register modifiers * added EffRes buff to owner * added function to calculate and apply DMG increase buff --- .../destinysthreadsforewoven/data.go | 71 ++++++++++++++++++ .../destinysthreadsforewoven.go | 75 +++++++++++++++++++ pkg/key/lightcone.go | 1 + pkg/simulation/imports.go | 1 + 4 files changed, 148 insertions(+) create mode 100644 internal/lightcone/preservation/destinysthreadsforewoven/data.go create mode 100644 internal/lightcone/preservation/destinysthreadsforewoven/destinysthreadsforewoven.go diff --git a/internal/lightcone/preservation/destinysthreadsforewoven/data.go b/internal/lightcone/preservation/destinysthreadsforewoven/data.go new file mode 100644 index 00000000..825637c5 --- /dev/null +++ b/internal/lightcone/preservation/destinysthreadsforewoven/data.go @@ -0,0 +1,71 @@ +// Code generated by "weapstat"; DO NOT EDIT. + +package destinysthreadsforewoven + +import "github.com/simimpact/srsim/pkg/engine/equip/lightcone" + +var promotions = []lightcone.PromotionData{ + { + MaxLevel: 20, + HPBase: 43.2, + HPAdd: 6.48, + ATKBase: 16.8, + ATKAdd: 2.52, + DEFBase: 21, + DEFAdd: 3.15, + }, + { + MaxLevel: 30, + HPBase: 95.04, + HPAdd: 6.48, + ATKBase: 36.96, + ATKAdd: 2.52, + DEFBase: 46.2, + DEFAdd: 3.15, + }, + { + MaxLevel: 40, + HPBase: 164.16, + HPAdd: 6.48, + ATKBase: 63.84, + ATKAdd: 2.52, + DEFBase: 79.8, + DEFAdd: 3.15, + }, + { + MaxLevel: 50, + HPBase: 233.28, + HPAdd: 6.48, + ATKBase: 90.72, + ATKAdd: 2.52, + DEFBase: 113.4, + DEFAdd: 3.15, + }, + { + MaxLevel: 60, + HPBase: 302.4, + HPAdd: 6.48, + ATKBase: 117.6, + ATKAdd: 2.52, + DEFBase: 147, + DEFAdd: 3.15, + }, + { + MaxLevel: 70, + HPBase: 371.52, + HPAdd: 6.48, + ATKBase: 144.48, + ATKAdd: 2.52, + DEFBase: 180.6, + DEFAdd: 3.15, + }, + { + MaxLevel: 80, + HPBase: 440.64, + HPAdd: 6.48, + ATKBase: 171.36, + ATKAdd: 2.52, + DEFBase: 214.2, + DEFAdd: 3.15, + }, +} \ No newline at end of file diff --git a/internal/lightcone/preservation/destinysthreadsforewoven/destinysthreadsforewoven.go b/internal/lightcone/preservation/destinysthreadsforewoven/destinysthreadsforewoven.go new file mode 100644 index 00000000..dc2f2b6b --- /dev/null +++ b/internal/lightcone/preservation/destinysthreadsforewoven/destinysthreadsforewoven.go @@ -0,0 +1,75 @@ +package destinysthreadsforewoven + +import ( + "math" + + "github.com/simimpact/srsim/pkg/engine" + "github.com/simimpact/srsim/pkg/engine/equip/lightcone" + "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 = "destinys-threads-forewoven" + buff = "destinys-threads-forewoven-dmg-buff" +) + +type state struct { + dmgPer float64 + dmgMax float64 +} + +func init() { + lightcone.Register(key.DestinysThreadsForewoven, lightcone.Config{ + CreatePassive: Create, + Rarity: 4, + Path: model.Path_PRESERVATION, + Promotions: promotions, + }) + + modifier.Register(check, modifier.Config{ + Listeners: modifier.Listeners{ + OnAdd: onCheck, + OnPropertyChange: onCheck, + }, + }) + + modifier.Register(buff, modifier.Config{ + StatusType: model.StatusType_STATUS_BUFF, + Stacking: modifier.ReplaceBySource, + }) +} + +func Create(engine engine.Engine, owner key.TargetID, lc info.LightCone) { + effres := 0.1 + 0.02*float64(lc.Imposition) + dmgPer := 0.007 + 0.001*float64(lc.Imposition) + dmgMax := 0.28 + 0.04*float64(lc.Imposition) + + engine.AddModifier(owner, info.Modifier{ + Name: check, + Source: owner, + Stats: info.PropMap{prop.EffectRES: effres}, + State: state{ + dmgPer: dmgPer, + dmgMax: dmgMax, + }, + }) +} + +func onCheck(mod *modifier.Instance) { + state := mod.State().(state) + def := mod.OwnerStats().DEF() + dmg := math.Floor(def/100) * state.dmgPer + if dmg > state.dmgMax { + dmg = state.dmgMax + } + + mod.Engine().AddModifier(mod.Owner(), info.Modifier{ + Name: buff, + Source: mod.Owner(), + Stats: info.PropMap{prop.AllDamagePercent: dmg}, + }) +} diff --git a/pkg/key/lightcone.go b/pkg/key/lightcone.go index a2a912c6..7d8e199d 100644 --- a/pkg/key/lightcone.go +++ b/pkg/key/lightcone.go @@ -85,6 +85,7 @@ const ( Pioneering LightCone = "pioneering" WeAreWildfire LightCone = "we_are_wildfire" LandausChoice LightCone = "landaus_choice" + DestinysThreadsForewoven LightCone = "destinys_threads_forewoven" ) // Abundance diff --git a/pkg/simulation/imports.go b/pkg/simulation/imports.go index 3408e437..594be336 100644 --- a/pkg/simulation/imports.go +++ b/pkg/simulation/imports.go @@ -88,6 +88,7 @@ import ( _ "github.com/simimpact/srsim/internal/lightcone/preservation/amber" _ "github.com/simimpact/srsim/internal/lightcone/preservation/dayoneofmynewlife" _ "github.com/simimpact/srsim/internal/lightcone/preservation/defense" + _ "github.com/simimpact/srsim/internal/lightcone/preservation/destinysthreadsforewoven" _ "github.com/simimpact/srsim/internal/lightcone/preservation/landauschoice" _ "github.com/simimpact/srsim/internal/lightcone/preservation/momentofvictory" _ "github.com/simimpact/srsim/internal/lightcone/preservation/pioneering" From 9997f6e686c0a131508164659f69ab30ad471e8c Mon Sep 17 00:00:00 2001 From: kdovtdc Date: Sun, 4 Aug 2024 18:26:13 +0200 Subject: [PATCH 2/3] Add LC effect description --- .../destinysthreadsforewoven/destinysthreadsforewoven.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/lightcone/preservation/destinysthreadsforewoven/destinysthreadsforewoven.go b/internal/lightcone/preservation/destinysthreadsforewoven/destinysthreadsforewoven.go index dc2f2b6b..6d3b6454 100644 --- a/internal/lightcone/preservation/destinysthreadsforewoven/destinysthreadsforewoven.go +++ b/internal/lightcone/preservation/destinysthreadsforewoven/destinysthreadsforewoven.go @@ -22,6 +22,10 @@ type state struct { dmgMax float64 } +// Increases the wearer's Effect RES by 12%. +// For every 100 of DEF the wearer has, increases the wearer's DMG dealt by 0.8%, +// up to a maximum DMG increase of 32%. + func init() { lightcone.Register(key.DestinysThreadsForewoven, lightcone.Config{ CreatePassive: Create, From 6e358f3c4a4ee9ccf3d8e5d2d31cda231213ff49 Mon Sep 17 00:00:00 2001 From: kdovtdc Date: Sun, 24 Nov 2024 18:20:27 +0100 Subject: [PATCH 3/3] Update with `CanDispel` field --- .../destinysthreadsforewoven/destinysthreadsforewoven.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/lightcone/preservation/destinysthreadsforewoven/destinysthreadsforewoven.go b/internal/lightcone/preservation/destinysthreadsforewoven/destinysthreadsforewoven.go index 6d3b6454..535139ae 100644 --- a/internal/lightcone/preservation/destinysthreadsforewoven/destinysthreadsforewoven.go +++ b/internal/lightcone/preservation/destinysthreadsforewoven/destinysthreadsforewoven.go @@ -44,6 +44,7 @@ func init() { modifier.Register(buff, modifier.Config{ StatusType: model.StatusType_STATUS_BUFF, Stacking: modifier.ReplaceBySource, + CanDispel: true, }) }