From 27675c3d74408f81bedac3aa438120ca2a3beb22 Mon Sep 17 00:00:00 2001 From: kdovtdc Date: Sat, 28 Sep 2024 23:21:13 +0200 Subject: [PATCH 1/4] Implement Baptism of Pure Thought (LC) * init lc setup * register modifiers * added CDmg to owner * implemented logic for applying CDmg to hit based on debuff count * implemented logic for applying Disputation buff * implemented logic for applying Defense ignore from Disputation buff has comments for potential future changes fixing bugs/inaccuracies --- .../baptismofpurethought.go | 100 ++++++++++++++++++ .../hunt/baptismofpurethought/data.go | 71 +++++++++++++ pkg/key/lightcone.go | 1 + pkg/simulation/imports.go | 1 + 4 files changed, 173 insertions(+) create mode 100644 internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go create mode 100644 internal/lightcone/hunt/baptismofpurethought/data.go diff --git a/internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go b/internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go new file mode 100644 index 00000000..82508f53 --- /dev/null +++ b/internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go @@ -0,0 +1,100 @@ +package baptismofpurethought + +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 = "baptism-of-pure-thought" + Disputation = "baptism-of-pure-thought-disputation-buff" +) + +type state struct { + cdmgBonusInc float64 + dmgBonus float64 + defignore float64 +} + +// Increases the wearer's CRIT DMG by 20/23/26/29/32%. For every debuff on the enemy target, +// the wearer's CRIT DMG dealt against this target additionally increases by 8/9/10/11/12%, stacking up to 3 times. +// When using Ultimate to attack the enemy target, the wearer receives the Disputation effect, +// which increases DMG dealt by 36/42/48/54/60% and enables their follow-up attacks to ignore 24/28/32/36/40% of the target's DEF. +// This effect lasts for 2 turns. + +func init() { + lightcone.Register(key.BaptismofPureThought, lightcone.Config{ + CreatePassive: Create, + Rarity: 5, + Path: model.Path_HUNT, + Promotions: promotions, + }) + + modifier.Register(Check, modifier.Config{ + Listeners: modifier.Listeners{ + OnBeforeHitAll: applyCdmgInc, + OnBeforeAttack: applyDisputation, + }, + }) + + modifier.Register(Disputation, modifier.Config{ + StatusType: model.StatusType_STATUS_BUFF, + Stacking: modifier.ReplaceBySource, + // CanDispel: true, + Listeners: modifier.Listeners{ + OnBeforeHitAll: applyDefignore, + }, + }) +} + +func Create(engine engine.Engine, owner key.TargetID, lc info.LightCone) { + cdmgAmt := 0.17 + 0.03*float64(lc.Imposition) + cdmgIncAmt := 0.07 + 0.01*float64(lc.Imposition) + dmgAmt := 0.3 + 0.06*float64(lc.Imposition) + defignoreAmt := 0.2 + 0.04*float64(lc.Imposition) + + engine.AddModifier(owner, info.Modifier{ + Name: Check, + Source: owner, + Stats: info.PropMap{prop.CritDMG: cdmgAmt}, + State: &state{ + cdmgBonusInc: cdmgIncAmt, + dmgBonus: dmgAmt, + defignore: defignoreAmt, + }, + }) +} + +func applyCdmgInc(mod *modifier.Instance, e event.HitStart) { + debuffCount := mod.Engine().ModifierStatusCount(e.Defender, model.StatusType_STATUS_DEBUFF) + if debuffCount > 3 { + debuffCount = 3 + } + cdmgBonusInc := mod.State().(state).cdmgBonusInc + e.Hit.Attacker.AddProperty(Check, prop.CritDMG, float64(debuffCount)*cdmgBonusInc) +} + +func applyDisputation(mod *modifier.Instance, e event.AttackStart) { + // this might need to be a SkillType/ActionType check in the future + if e.AttackType == model.AttackType_ULT { + st := mod.State().(state) + mod.Engine().AddModifier(mod.Owner(), info.Modifier{ + Name: Disputation, + Source: mod.Owner(), + Stats: info.PropMap{prop.AllDamagePercent: st.dmgBonus}, + State: st, + }) + } +} + +func applyDefignore(mod *modifier.Instance, e event.HitStart) { + if e.Hit.AttackType == model.AttackType_INSERT { + e.Hit.Defender.AddProperty(Disputation, prop.DEFPercent, -mod.State().(state).defignore) + } +} diff --git a/internal/lightcone/hunt/baptismofpurethought/data.go b/internal/lightcone/hunt/baptismofpurethought/data.go new file mode 100644 index 00000000..c66ebd6f --- /dev/null +++ b/internal/lightcone/hunt/baptismofpurethought/data.go @@ -0,0 +1,71 @@ +// Code generated by "weapstat"; DO NOT EDIT. + +package baptismofpurethought + +import "github.com/simimpact/srsim/pkg/engine/equip/lightcone" + +var promotions = []lightcone.PromotionData{ + { + MaxLevel: 20, + HPBase: 43.2, + HPAdd: 6.48, + ATKBase: 26.4, + ATKAdd: 3.96, + DEFBase: 24, + DEFAdd: 3.6, + }, + { + MaxLevel: 30, + HPBase: 95.04, + HPAdd: 6.48, + ATKBase: 58.08, + ATKAdd: 3.96, + DEFBase: 52.8, + DEFAdd: 3.6, + }, + { + MaxLevel: 40, + HPBase: 164.16, + HPAdd: 6.48, + ATKBase: 100.32, + ATKAdd: 3.96, + DEFBase: 91.2, + DEFAdd: 3.6, + }, + { + MaxLevel: 50, + HPBase: 233.28, + HPAdd: 6.48, + ATKBase: 142.56, + ATKAdd: 3.96, + DEFBase: 129.6, + DEFAdd: 3.6, + }, + { + MaxLevel: 60, + HPBase: 302.4, + HPAdd: 6.48, + ATKBase: 184.8, + ATKAdd: 3.96, + DEFBase: 168, + DEFAdd: 3.6, + }, + { + MaxLevel: 70, + HPBase: 371.52, + HPAdd: 6.48, + ATKBase: 227.04, + ATKAdd: 3.96, + DEFBase: 206.4, + DEFAdd: 3.6, + }, + { + MaxLevel: 80, + HPBase: 440.64, + HPAdd: 6.48, + ATKBase: 269.28, + ATKAdd: 3.96, + DEFBase: 244.8, + DEFAdd: 3.6, + }, +} \ No newline at end of file diff --git a/pkg/key/lightcone.go b/pkg/key/lightcone.go index a2a912c6..7200373c 100644 --- a/pkg/key/lightcone.go +++ b/pkg/key/lightcone.go @@ -30,6 +30,7 @@ const ( ReturntoDarkness LightCone = "return_to_darkness" SleepLiketheDead LightCone = "sleep_like_the_dead" IntheNight LightCone = "in_the_night" + BaptismofPureThought LightCone = "baptism_of_pure_thought" ) // Nihility diff --git a/pkg/simulation/imports.go b/pkg/simulation/imports.go index 491d8566..a6f4c9b4 100644 --- a/pkg/simulation/imports.go +++ b/pkg/simulation/imports.go @@ -67,6 +67,7 @@ import ( _ "github.com/simimpact/srsim/internal/lightcone/harmony/planetaryrendezvous" _ "github.com/simimpact/srsim/internal/lightcone/hunt/adversarial" _ "github.com/simimpact/srsim/internal/lightcone/hunt/arrows" + _ "github.com/simimpact/srsim/internal/lightcone/hunt/baptismofpurethought" _ "github.com/simimpact/srsim/internal/lightcone/hunt/cruisinginthestellarsea" _ "github.com/simimpact/srsim/internal/lightcone/hunt/dartingarrow" _ "github.com/simimpact/srsim/internal/lightcone/hunt/inthenight" From d252a1b865a6600986b01e82dc88cc70acba3c82 Mon Sep 17 00:00:00 2001 From: kdovtdc Date: Sat, 28 Sep 2024 23:30:41 +0200 Subject: [PATCH 2/4] Change `applyDisputation` to only pass `defignore` value --- .../hunt/baptismofpurethought/baptismofpurethought.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go b/internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go index 82508f53..effa727b 100644 --- a/internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go +++ b/internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go @@ -88,13 +88,13 @@ func applyDisputation(mod *modifier.Instance, e event.AttackStart) { Name: Disputation, Source: mod.Owner(), Stats: info.PropMap{prop.AllDamagePercent: st.dmgBonus}, - State: st, + State: st.defignore, }) } } func applyDefignore(mod *modifier.Instance, e event.HitStart) { if e.Hit.AttackType == model.AttackType_INSERT { - e.Hit.Defender.AddProperty(Disputation, prop.DEFPercent, -mod.State().(state).defignore) + e.Hit.Defender.AddProperty(Disputation, prop.DEFPercent, -mod.State().(float64)) } } From c4952971edf82af1c01031d41b1ee20dd51ecfca Mon Sep 17 00:00:00 2001 From: kdovtdc Date: Fri, 1 Nov 2024 17:16:12 +0100 Subject: [PATCH 3/4] Remove comment --- .../lightcone/hunt/baptismofpurethought/baptismofpurethought.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go b/internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go index effa727b..f7f765ed 100644 --- a/internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go +++ b/internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go @@ -46,7 +46,6 @@ func init() { modifier.Register(Disputation, modifier.Config{ StatusType: model.StatusType_STATUS_BUFF, Stacking: modifier.ReplaceBySource, - // CanDispel: true, Listeners: modifier.Listeners{ OnBeforeHitAll: applyDefignore, }, From 1bf9bfb0f5b84595806cb2a4c961e6e875aaaa53 Mon Sep 17 00:00:00 2001 From: kdovtdc Date: Sun, 24 Nov 2024 18:27:48 +0100 Subject: [PATCH 4/4] Update with `CanDispel` field --- .../lightcone/hunt/baptismofpurethought/baptismofpurethought.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go b/internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go index f7f765ed..ded30ec2 100644 --- a/internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go +++ b/internal/lightcone/hunt/baptismofpurethought/baptismofpurethought.go @@ -46,6 +46,7 @@ func init() { modifier.Register(Disputation, modifier.Config{ StatusType: model.StatusType_STATUS_BUFF, Stacking: modifier.ReplaceBySource, + CanDispel: true, Listeners: modifier.Listeners{ OnBeforeHitAll: applyDefignore, },