From 06a89d48cae5ab855a7446f0979646fc77e8ad8b Mon Sep 17 00:00:00 2001 From: kdovtdc Date: Sat, 28 Sep 2024 22:05:01 +0200 Subject: [PATCH 1/2] Implement Boundless Choreo (LC) * init lc setup * register check modifier * added cr to owner * implemented logic for modifier --- .../boundlesschoreo/boundlesschoreo.go | 56 +++++++++++++++ .../nihility/boundlesschoreo/data.go | 71 +++++++++++++++++++ pkg/key/lightcone.go | 1 + pkg/simulation/imports.go | 1 + 4 files changed, 129 insertions(+) create mode 100644 internal/lightcone/nihility/boundlesschoreo/boundlesschoreo.go create mode 100644 internal/lightcone/nihility/boundlesschoreo/data.go diff --git a/internal/lightcone/nihility/boundlesschoreo/boundlesschoreo.go b/internal/lightcone/nihility/boundlesschoreo/boundlesschoreo.go new file mode 100644 index 00000000..5675d83f --- /dev/null +++ b/internal/lightcone/nihility/boundlesschoreo/boundlesschoreo.go @@ -0,0 +1,56 @@ +package boundlesschoreo + +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 ( + Choreo = "boundless-choreo" + Check = "boundless-choreo-cdmg" +) + +// Increase the wearer's CRIT Rate by 8/10/12/14/16%. +// The wearer deals 24/30/36/42/48% more CRIT DMG to enemies that are currently Slowed or have reduced DEF. + +func init() { + lightcone.Register(key.BoundlessChoreo, lightcone.Config{ + CreatePassive: Create, + Rarity: 4, + Path: model.Path_NIHILITY, + Promotions: promotions, + }) + modifier.Register(Check, modifier.Config{ + Listeners: modifier.Listeners{ + OnBeforeHitAll: applyCdmg, + }, + }) +} + +func Create(engine engine.Engine, owner key.TargetID, lc info.LightCone) { + crAmt := 0.06 + 0.02*float64(lc.Imposition) + cdmgAmt := 0.18 + 0.06*float64(lc.Imposition) + engine.AddModifier(owner, info.Modifier{ + Name: Check, + Source: owner, + Stats: info.PropMap{prop.CritChance: crAmt}, + State: cdmgAmt, + }) +} + +func applyCdmg(mod *modifier.Instance, e event.HitStart) { + // bypass if any check fails + if !mod.Engine().HasBehaviorFlag(e.Defender, model.BehaviorFlag_STAT_SPEED_DOWN) { + return + } + if !mod.Engine().HasBehaviorFlag(e.Defender, model.BehaviorFlag_STAT_DEF_DOWN) { + return + } + e.Hit.Attacker.AddProperty(Check, prop.CritDMG, mod.State().(float64)) +} diff --git a/internal/lightcone/nihility/boundlesschoreo/data.go b/internal/lightcone/nihility/boundlesschoreo/data.go new file mode 100644 index 00000000..2708d85a --- /dev/null +++ b/internal/lightcone/nihility/boundlesschoreo/data.go @@ -0,0 +1,71 @@ +// Code generated by "weapstat"; DO NOT EDIT. + +package boundlesschoreo + +import "github.com/simimpact/srsim/pkg/engine/equip/lightcone" + +var promotions = []lightcone.PromotionData{ + { + MaxLevel: 20, + HPBase: 43.2, + HPAdd: 6.48, + ATKBase: 21.6, + ATKAdd: 3.24, + DEFBase: 15, + DEFAdd: 2.25, + }, + { + MaxLevel: 30, + HPBase: 95.04, + HPAdd: 6.48, + ATKBase: 47.52, + ATKAdd: 3.24, + DEFBase: 33, + DEFAdd: 2.25, + }, + { + MaxLevel: 40, + HPBase: 164.16, + HPAdd: 6.48, + ATKBase: 82.08, + ATKAdd: 3.24, + DEFBase: 57, + DEFAdd: 2.25, + }, + { + MaxLevel: 50, + HPBase: 233.28, + HPAdd: 6.48, + ATKBase: 116.64, + ATKAdd: 3.24, + DEFBase: 81, + DEFAdd: 2.25, + }, + { + MaxLevel: 60, + HPBase: 302.4, + HPAdd: 6.48, + ATKBase: 151.2, + ATKAdd: 3.24, + DEFBase: 105, + DEFAdd: 2.25, + }, + { + MaxLevel: 70, + HPBase: 371.52, + HPAdd: 6.48, + ATKBase: 185.76, + ATKAdd: 3.24, + DEFBase: 129, + DEFAdd: 2.25, + }, + { + MaxLevel: 80, + HPBase: 440.64, + HPAdd: 6.48, + ATKBase: 220.32, + ATKAdd: 3.24, + DEFBase: 153, + DEFAdd: 2.25, + }, +} \ No newline at end of file diff --git a/pkg/key/lightcone.go b/pkg/key/lightcone.go index a2a912c6..3588c790 100644 --- a/pkg/key/lightcone.go +++ b/pkg/key/lightcone.go @@ -46,6 +46,7 @@ const ( WeWillMeetAgain LightCone = "we_will_meet_again" Void LightCone = "void" PatienceIsAllYouNeed LightCone = "patience_is_all_you_need" + BoundlessChoreo LightCone = "boundless_choreo" ) // Erudition diff --git a/pkg/simulation/imports.go b/pkg/simulation/imports.go index 491d8566..b61778cd 100644 --- a/pkg/simulation/imports.go +++ b/pkg/simulation/imports.go @@ -77,6 +77,7 @@ import ( _ "github.com/simimpact/srsim/internal/lightcone/hunt/subscribeformore" _ "github.com/simimpact/srsim/internal/lightcone/hunt/swordplay" _ "github.com/simimpact/srsim/internal/lightcone/nihility/beforethetutorialmissionstarts" + _ "github.com/simimpact/srsim/internal/lightcone/nihility/boundlesschoreo" _ "github.com/simimpact/srsim/internal/lightcone/nihility/eyesoftheprey" _ "github.com/simimpact/srsim/internal/lightcone/nihility/fermata" _ "github.com/simimpact/srsim/internal/lightcone/nihility/goodnightandsleepwell" From 98ed0be8acf8e90551931a4f74cc3fca36f57c21 Mon Sep 17 00:00:00 2001 From: kdovtdc Date: Fri, 1 Nov 2024 17:29:51 +0100 Subject: [PATCH 2/2] Fix logic --- .../nihility/boundlesschoreo/boundlesschoreo.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/lightcone/nihility/boundlesschoreo/boundlesschoreo.go b/internal/lightcone/nihility/boundlesschoreo/boundlesschoreo.go index 5675d83f..8a187f32 100644 --- a/internal/lightcone/nihility/boundlesschoreo/boundlesschoreo.go +++ b/internal/lightcone/nihility/boundlesschoreo/boundlesschoreo.go @@ -45,12 +45,12 @@ func Create(engine engine.Engine, owner key.TargetID, lc info.LightCone) { } func applyCdmg(mod *modifier.Instance, e event.HitStart) { - // bypass if any check fails + // bypass if both checks fail if !mod.Engine().HasBehaviorFlag(e.Defender, model.BehaviorFlag_STAT_SPEED_DOWN) { - return - } - if !mod.Engine().HasBehaviorFlag(e.Defender, model.BehaviorFlag_STAT_DEF_DOWN) { - return + if !mod.Engine().HasBehaviorFlag(e.Defender, model.BehaviorFlag_STAT_DEF_DOWN) { + return + } } + e.Hit.Attacker.AddProperty(Check, prop.CritDMG, mod.State().(float64)) }