diff --git a/internal/lightcone/preservation/inherentlyunjustdestiny/data.go b/internal/lightcone/preservation/inherentlyunjustdestiny/data.go new file mode 100644 index 00000000..478de58f --- /dev/null +++ b/internal/lightcone/preservation/inherentlyunjustdestiny/data.go @@ -0,0 +1,71 @@ +// Code generated by "weapstat"; DO NOT EDIT. + +package inherentlyunjustdestiny + +import "github.com/simimpact/srsim/pkg/engine/equip/lightcone" + +var promotions = []lightcone.PromotionData{ + { + MaxLevel: 20, + HPBase: 48, + HPAdd: 7.2, + ATKBase: 19.2, + ATKAdd: 2.88, + DEFBase: 30, + DEFAdd: 4.5, + }, + { + MaxLevel: 30, + HPBase: 105.6, + HPAdd: 7.2, + ATKBase: 42.24, + ATKAdd: 2.88, + DEFBase: 66, + DEFAdd: 4.5, + }, + { + MaxLevel: 40, + HPBase: 182.4, + HPAdd: 7.2, + ATKBase: 72.96, + ATKAdd: 2.88, + DEFBase: 114, + DEFAdd: 4.5, + }, + { + MaxLevel: 50, + HPBase: 259.2, + HPAdd: 7.2, + ATKBase: 103.68, + ATKAdd: 2.88, + DEFBase: 162, + DEFAdd: 4.5, + }, + { + MaxLevel: 60, + HPBase: 336, + HPAdd: 7.2, + ATKBase: 134.4, + ATKAdd: 2.88, + DEFBase: 210, + DEFAdd: 4.5, + }, + { + MaxLevel: 70, + HPBase: 412.8, + HPAdd: 7.2, + ATKBase: 165.12, + ATKAdd: 2.88, + DEFBase: 258, + DEFAdd: 4.5, + }, + { + MaxLevel: 80, + HPBase: 489.6, + HPAdd: 7.2, + ATKBase: 195.84, + ATKAdd: 2.88, + DEFBase: 306, + DEFAdd: 4.5, + }, +} \ No newline at end of file diff --git a/internal/lightcone/preservation/inherentlyunjustdestiny/inherentlyunjustdestiny.go b/internal/lightcone/preservation/inherentlyunjustdestiny/inherentlyunjustdestiny.go new file mode 100644 index 00000000..cb4cf5b4 --- /dev/null +++ b/internal/lightcone/preservation/inherentlyunjustdestiny/inherentlyunjustdestiny.go @@ -0,0 +1,110 @@ +package inherentlyunjustdestiny + +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 = "inherently-unjust-destiny" + ShieldCdmg = "inherently-unjust-destiny-cdmg-buff" + AllIn = "inherently-unjust-destiny-vuln-debuff" +) + +type state struct { + chance float64 + vuln float64 + applieddynamic bool +} + +// Increases the wearer's DEF by 40/46/52/58/64%. When the wearer provides a Shield to an ally, +// the wearer's CRIT DMG increases by 40/46/52/58/64%, lasting for 2 turn(s). +// When the wearer's follow-up attack hits an enemy target, there is a 100/115/130/145/160% base chance +// to increase the DMG taken by the attacked enemy target by 10/11.5/13/14.5/16%, lasting for 2 turn(s). + +func init() { + lightcone.Register(key.InherentlyUnjustDestiny, lightcone.Config{ + CreatePassive: Create, + Rarity: 5, + Path: model.Path_PRESERVATION, + Promotions: promotions, + }) + + modifier.Register(Check, modifier.Config{ + Listeners: modifier.Listeners{ + OnBeforeHitAll: applyVuln, + }, + }) + + modifier.Register(ShieldCdmg, modifier.Config{ + Stacking: modifier.Replace, + StatusType: model.StatusType_STATUS_BUFF, + CanDispel: true, + }) + + modifier.Register(AllIn, modifier.Config{ + Stacking: modifier.ReplaceBySource, + StatusType: model.StatusType_STATUS_DEBUFF, + CanDispel: true, + Listeners: modifier.Listeners{ + OnBeforeBeingHitAll: func(mod *modifier.Instance, e event.HitStart) { + e.Hit.Defender.AddProperty(AllIn, prop.AllDamageTaken, mod.State().(state).vuln) + }, + }, + }) +} + +func Create(engine engine.Engine, owner key.TargetID, lc info.LightCone) { + defncdmgAmt := 0.34 + 0.06*float64(lc.Imposition) + chanceAmt := 0.85 + 0.15*float64(lc.Imposition) + vulnAmt := chanceAmt * 0.1 + + engine.AddModifier(owner, info.Modifier{ + Name: Check, + Source: owner, + Stats: info.PropMap{prop.DEFPercent: defncdmgAmt}, + State: &state{ + chance: chanceAmt, + vuln: vulnAmt, + applieddynamic: false, + }, + }) + + // Special shield listener for owner providing shields + engine.Events().ShieldAdded.Subscribe(func(event event.ShieldAdded) { + if event.Info.Source == owner { + engine.AddModifier(owner, info.Modifier{ + Name: ShieldCdmg, + Source: owner, + Duration: 2, + Stats: info.PropMap{prop.CritDMG: defncdmgAmt}, + }) + } + }) +} + +func applyVuln(mod *modifier.Instance, e event.HitStart) { + st := mod.State().(*state) + if e.Hit.AttackType == model.AttackType_INSERT { + mod.Engine().AddModifier(e.Defender, info.Modifier{ + Name: AllIn, + Source: mod.Owner(), + Duration: 2, + Stats: info.PropMap{prop.AllDamageTaken: st.vuln}, + Chance: st.chance, + }) + } + // Logic to apply the debuff on the first hit, ensuring that this hit also benefits from the vuln effect + if !mod.Engine().HasModifierFromSource(e.Defender, mod.Owner(), AllIn) { + st.applieddynamic = false + } else if !st.applieddynamic { + e.Hit.Defender.AddProperty(AllIn, prop.AllDamageTaken, st.vuln) + st.applieddynamic = true + } +} diff --git a/pkg/key/lightcone.go b/pkg/key/lightcone.go index bf2afa89..2df88366 100644 --- a/pkg/key/lightcone.go +++ b/pkg/key/lightcone.go @@ -89,6 +89,7 @@ const ( Pioneering LightCone = "pioneering" WeAreWildfire LightCone = "we_are_wildfire" LandausChoice LightCone = "landaus_choice" + InherentlyUnjustDestiny LightCone = "inherently_unjust_destiny" ) // Abundance diff --git a/pkg/simulation/imports.go b/pkg/simulation/imports.go index 78e8c59e..57c8c6d5 100644 --- a/pkg/simulation/imports.go +++ b/pkg/simulation/imports.go @@ -101,6 +101,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/inherentlyunjustdestiny" _ "github.com/simimpact/srsim/internal/lightcone/preservation/landauschoice" _ "github.com/simimpact/srsim/internal/lightcone/preservation/momentofvictory" _ "github.com/simimpact/srsim/internal/lightcone/preservation/pioneering"