From 64b2d704ef7e305bf253dcb991f29305b97e3014 Mon Sep 17 00:00:00 2001 From: clevernt Date: Tue, 8 Oct 2024 19:11:19 +0300 Subject: [PATCH 1/5] lc: Past Self in Mirror missing last part of passive, enemy wave isn't supported --- .../harmony/pastselfinmirror/data.go | 71 ++++++++++++++++++ .../pastselfinmirror/pastselfinmirror.go | 73 +++++++++++++++++++ pkg/key/lightcone.go | 1 + pkg/simulation/imports.go | 1 + 4 files changed, 146 insertions(+) create mode 100644 internal/lightcone/harmony/pastselfinmirror/data.go create mode 100644 internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go diff --git a/internal/lightcone/harmony/pastselfinmirror/data.go b/internal/lightcone/harmony/pastselfinmirror/data.go new file mode 100644 index 00000000..ac85ddeb --- /dev/null +++ b/internal/lightcone/harmony/pastselfinmirror/data.go @@ -0,0 +1,71 @@ +// Code generated by "weapstat"; DO NOT EDIT. + +package pastselfinmirror + +import "github.com/simimpact/srsim/pkg/engine/equip/lightcone" + +var promotions = []lightcone.PromotionData{ + { + MaxLevel: 20, + HPBase: 48, + HPAdd: 7.2, + ATKBase: 24, + ATKAdd: 3.6, + DEFBase: 24, + DEFAdd: 3.6, + }, + { + MaxLevel: 30, + HPBase: 105.6, + HPAdd: 7.2, + ATKBase: 52.8, + ATKAdd: 3.6, + DEFBase: 52.8, + DEFAdd: 3.6, + }, + { + MaxLevel: 40, + HPBase: 182.4, + HPAdd: 7.2, + ATKBase: 91.2, + ATKAdd: 3.6, + DEFBase: 91.2, + DEFAdd: 3.6, + }, + { + MaxLevel: 50, + HPBase: 259.2, + HPAdd: 7.2, + ATKBase: 129.6, + ATKAdd: 3.6, + DEFBase: 129.6, + DEFAdd: 3.6, + }, + { + MaxLevel: 60, + HPBase: 336, + HPAdd: 7.2, + ATKBase: 168, + ATKAdd: 3.6, + DEFBase: 168, + DEFAdd: 3.6, + }, + { + MaxLevel: 70, + HPBase: 412.8, + HPAdd: 7.2, + ATKBase: 206.4, + ATKAdd: 3.6, + DEFBase: 206.4, + DEFAdd: 3.6, + }, + { + MaxLevel: 80, + HPBase: 489.6, + HPAdd: 7.2, + ATKBase: 244.8, + ATKAdd: 3.6, + DEFBase: 244.8, + DEFAdd: 3.6, + }, +} \ No newline at end of file diff --git a/internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go b/internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go new file mode 100644 index 00000000..340ee0ae --- /dev/null +++ b/internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go @@ -0,0 +1,73 @@ +package pastselfinmirror + +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 ( + psim = "past-self-in-mirror" + psimDmgBuff = "past-self-in-mirror-dmg-buff" + psimEnergyRegen = "past-self-in-mirror-energy" +) + +// Increases the wearer's Break Effect by 60%. +// When the wearer uses their Ultimate, increases all allies' DMG by 24%, lasting for 3 turn(s). +// Should the wearer's Break Effect exceed or equal 150%, 1 Skill Point will be recovered. +// At the start of each wave, all allies regenerate 10 Energy immediately. Abilities of the same type cannot stack. +func init() { + lightcone.Register(key.PastSelfinMirror, lightcone.Config{ + CreatePassive: Create, + Rarity: 5, + Path: model.Path_HARMONY, + Promotions: promotions, + }) + modifier.Register(psimDmgBuff, modifier.Config{ + Listeners: modifier.Listeners{ + OnAfterAction: dmgBuffOnUlt, + }, + }) +} + +// Break Effect Buff +func Create(engine engine.Engine, owner key.TargetID, lc info.LightCone) { + amt := 0.5 + 0.1*float64(lc.Imposition) + engine.AddModifier(owner, info.Modifier{ + Name: psim, + Source: owner, + Stats: info.PropMap{prop.BreakEffect: amt}, + State: float64(lc.Imposition), + }) +} + +func dmgBuffOnUlt(mod *modifier.Instance, e event.ActionEnd) { + if e.AttackType != model.AttackType_ULT { + return + } + + // Restore 1 SP if BE >= 150% + if mod.OwnerStats().BreakEffect() >= 1.5 { + mod.Engine().ModifySP(info.ModifySP{ + Key: psim, + Source: mod.Owner(), + Amount: 1, + }) + } + + // DMG% buff for 3 turns + amt := 0.2 + 0.04*mod.State().(float64) + for _, char := range mod.Engine().Characters() { + mod.Engine().AddModifier(char, info.Modifier{ + Name: psimDmgBuff, + Source: mod.Owner(), + Stats: info.PropMap{prop.AllDamagePercent: amt}, + Duration: 3, + }) + } +} diff --git a/pkg/key/lightcone.go b/pkg/key/lightcone.go index a2a912c6..3ae14891 100644 --- a/pkg/key/lightcone.go +++ b/pkg/key/lightcone.go @@ -71,6 +71,7 @@ const ( MemoriesofthePast LightCone = "memories_of_the_past" DanceDanceDance LightCone = "dance_dance_dance" PlanetaryRendezvous LightCone = "planetary_rendezvous" + PastSelfinMirror LightCone = "past-self-in-mirror" ) // Preservation diff --git a/pkg/simulation/imports.go b/pkg/simulation/imports.go index 4a851c79..29c24577 100644 --- a/pkg/simulation/imports.go +++ b/pkg/simulation/imports.go @@ -66,6 +66,7 @@ import ( _ "github.com/simimpact/srsim/internal/lightcone/harmony/dancedancedance" _ "github.com/simimpact/srsim/internal/lightcone/harmony/memoriesofthepast" _ "github.com/simimpact/srsim/internal/lightcone/harmony/meshingcogs" + _ "github.com/simimpact/srsim/internal/lightcone/harmony/pastselfinmirror" _ "github.com/simimpact/srsim/internal/lightcone/harmony/planetaryrendezvous" _ "github.com/simimpact/srsim/internal/lightcone/hunt/adversarial" _ "github.com/simimpact/srsim/internal/lightcone/hunt/arrows" From dcb47455a45804984580824ab5c91780a0b28b37 Mon Sep 17 00:00:00 2001 From: clevernt Date: Tue, 8 Oct 2024 20:16:40 +0300 Subject: [PATCH 2/5] add energy on wave and rename listener --- .../pastselfinmirror/pastselfinmirror.go | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go b/internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go index 340ee0ae..2dbde677 100644 --- a/internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go +++ b/internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go @@ -12,9 +12,9 @@ import ( ) const ( - psim = "past-self-in-mirror" - psimDmgBuff = "past-self-in-mirror-dmg-buff" - psimEnergyRegen = "past-self-in-mirror-energy" + psim = "past-self-in-mirror" + psimDmgBuff = "past-self-in-mirror-dmg-buff" + psimEnergy = "past-self-in-mirror-energy" ) // Increases the wearer's Break Effect by 60%. @@ -30,7 +30,7 @@ func init() { }) modifier.Register(psimDmgBuff, modifier.Config{ Listeners: modifier.Listeners{ - OnAfterAction: dmgBuffOnUlt, + OnAfterAction: afterUlt, }, }) } @@ -44,9 +44,21 @@ func Create(engine engine.Engine, owner key.TargetID, lc info.LightCone) { Stats: info.PropMap{prop.BreakEffect: amt}, State: float64(lc.Imposition), }) + + energyAmt := 8.5 + 2.5*float64(lc.Imposition) + engine.Events().BattleStart.Subscribe(func(event event.BattleStart) { + for _, char := range engine.Characters() { + engine.ModifyEnergy(info.ModifyAttribute{ + Key: psimEnergy, + Target: char, + Source: owner, + Amount: energyAmt, + }) + } + }) } -func dmgBuffOnUlt(mod *modifier.Instance, e event.ActionEnd) { +func afterUlt(mod *modifier.Instance, e event.ActionEnd) { if e.AttackType != model.AttackType_ULT { return } From 8d6b516c895b53daad5b8cb6546dc2b590491020 Mon Sep 17 00:00:00 2001 From: clevernt Date: Tue, 8 Oct 2024 20:18:06 +0300 Subject: [PATCH 3/5] I can't do math. --- internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go b/internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go index 2dbde677..085d312a 100644 --- a/internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go +++ b/internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go @@ -45,7 +45,7 @@ func Create(engine engine.Engine, owner key.TargetID, lc info.LightCone) { State: float64(lc.Imposition), }) - energyAmt := 8.5 + 2.5*float64(lc.Imposition) + energyAmt := 7.5 + 2.5*float64(lc.Imposition) engine.Events().BattleStart.Subscribe(func(event event.BattleStart) { for _, char := range engine.Characters() { engine.ModifyEnergy(info.ModifyAttribute{ From 6f16f0168353ec9b2450ed85bbf6803b1b98e891 Mon Sep 17 00:00:00 2001 From: clevernt Date: Tue, 8 Oct 2024 20:31:30 +0300 Subject: [PATCH 4/5] underscore not hyphen --- pkg/key/lightcone.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/key/lightcone.go b/pkg/key/lightcone.go index 3ae14891..96a8381a 100644 --- a/pkg/key/lightcone.go +++ b/pkg/key/lightcone.go @@ -71,7 +71,7 @@ const ( MemoriesofthePast LightCone = "memories_of_the_past" DanceDanceDance LightCone = "dance_dance_dance" PlanetaryRendezvous LightCone = "planetary_rendezvous" - PastSelfinMirror LightCone = "past-self-in-mirror" + PastSelfinMirror LightCone = "past_self_in_mirror" ) // Preservation From 6503378d8a5a1a9d67132685aa67fb026f5ba91f Mon Sep 17 00:00:00 2001 From: clevernt Date: Tue, 8 Oct 2024 20:46:40 +0300 Subject: [PATCH 5/5] add `Stacking` and `StatusType` --- .../harmony/pastselfinmirror/pastselfinmirror.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go b/internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go index 085d312a..bfd335b1 100644 --- a/internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go +++ b/internal/lightcone/harmony/pastselfinmirror/pastselfinmirror.go @@ -12,9 +12,8 @@ import ( ) const ( - psim = "past-self-in-mirror" - psimDmgBuff = "past-self-in-mirror-dmg-buff" - psimEnergy = "past-self-in-mirror-energy" + psim = "past-self-in-mirror" + psimEnergy = "past-self-in-mirror-energy" ) // Increases the wearer's Break Effect by 60%. @@ -28,7 +27,9 @@ func init() { Path: model.Path_HARMONY, Promotions: promotions, }) - modifier.Register(psimDmgBuff, modifier.Config{ + modifier.Register(psim, modifier.Config{ + Stacking: modifier.ReplaceBySource, + StatusType: model.StatusType_STATUS_BUFF, Listeners: modifier.Listeners{ OnAfterAction: afterUlt, }, @@ -76,7 +77,7 @@ func afterUlt(mod *modifier.Instance, e event.ActionEnd) { amt := 0.2 + 0.04*mod.State().(float64) for _, char := range mod.Engine().Characters() { mod.Engine().AddModifier(char, info.Modifier{ - Name: psimDmgBuff, + Name: psim, Source: mod.Owner(), Stats: info.PropMap{prop.AllDamagePercent: amt}, Duration: 3,