From 8ec1f29c9c5409cb3b15dee991448d105265bc17 Mon Sep 17 00:00:00 2001 From: ducc Date: Sat, 2 Nov 2024 21:30:30 -0400 Subject: [PATCH 01/17] Basic attack impl --- internal/character/hanya/attack.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 internal/character/hanya/attack.go diff --git a/internal/character/hanya/attack.go b/internal/character/hanya/attack.go new file mode 100644 index 00000000..bc19169b --- /dev/null +++ b/internal/character/hanya/attack.go @@ -0,0 +1,26 @@ +package hanya + +import ( + "github.com/simimpact/srsim/pkg/engine/info" + "github.com/simimpact/srsim/pkg/key" + "github.com/simimpact/srsim/pkg/model" +) + +const ( + Normal key.Attack = "hanya-normal" +) + +func (c *char) Attack(target key.TargetID, state info.ActionState) { + c.engine.Attack(info.Attack{ + Key: Normal, + Source: c.id, + Targets: []key.TargetID{target}, + BaseDamage: info.DamageMap{ + model.DamageFormula_BY_ATK: basic[c.info.AttackLevelIndex()], + }, + StanceDamage: 30, + EnergyGain: 20, + }) + + state.EndAttack() +} From 19fc6362da14ce7920bdab4fab1ed4dcafd1e891 Mon Sep 17 00:00:00 2001 From: ducc Date: Sat, 2 Nov 2024 21:30:41 -0400 Subject: [PATCH 02/17] mvs --- internal/character/hanya/data.go | 164 +++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 internal/character/hanya/data.go diff --git a/internal/character/hanya/data.go b/internal/character/hanya/data.go new file mode 100644 index 00000000..ab1d27ad --- /dev/null +++ b/internal/character/hanya/data.go @@ -0,0 +1,164 @@ +// Code generated by "charstat"; DO NOT EDIT. + +package hanya + +import ( + "github.com/simimpact/srsim/pkg/engine/prop" + "github.com/simimpact/srsim/pkg/engine/target/character" +) + +var promotions = []character.PromotionData{ + { + MaxLevel: 20, + ATKBase: 76.8, + ATKAdd: 3.84, + DEFBase: 48, + DEFAdd: 2.4, + HPBase: 124.8, + HPAdd: 6.24, + SPD: 110, + CritChance: 0.05, + CritDMG: 0.5, + Aggro: 100, + }, + { + MaxLevel: 30, + ATKBase: 107.52, + ATKAdd: 3.84, + DEFBase: 67.2, + DEFAdd: 2.4, + HPBase: 174.72, + HPAdd: 6.24, + SPD: 110, + CritChance: 0.05, + CritDMG: 0.5, + Aggro: 100, + }, + { + MaxLevel: 40, + ATKBase: 138.24, + ATKAdd: 3.84, + DEFBase: 86.4, + DEFAdd: 2.4, + HPBase: 224.64, + HPAdd: 6.24, + SPD: 110, + CritChance: 0.05, + CritDMG: 0.5, + Aggro: 100, + }, + { + MaxLevel: 50, + ATKBase: 168.96, + ATKAdd: 3.84, + DEFBase: 105.6, + DEFAdd: 2.4, + HPBase: 274.56, + HPAdd: 6.24, + SPD: 110, + CritChance: 0.05, + CritDMG: 0.5, + Aggro: 100, + }, + { + MaxLevel: 60, + ATKBase: 199.68, + ATKAdd: 3.84, + DEFBase: 124.8, + DEFAdd: 2.4, + HPBase: 324.48, + HPAdd: 6.24, + SPD: 110, + CritChance: 0.05, + CritDMG: 0.5, + Aggro: 100, + }, + { + MaxLevel: 70, + ATKBase: 230.4, + ATKAdd: 3.84, + DEFBase: 144, + DEFAdd: 2.4, + HPBase: 374.4, + HPAdd: 6.24, + SPD: 110, + CritChance: 0.05, + CritDMG: 0.5, + Aggro: 100, + }, + { + MaxLevel: 80, + ATKBase: 261.12, + ATKAdd: 3.84, + DEFBase: 163.2, + DEFAdd: 2.4, + HPBase: 424.32, + HPAdd: 6.24, + SPD: 110, + CritChance: 0.05, + CritDMG: 0.5, + Aggro: 100, + }, +} + +var traces = character.TraceMap{ + "101": { + Ascension: 2, + }, + "102": { + Ascension: 4, + }, + "103": { + Ascension: 6, + }, + "201": { + Stat: prop.ATKPercent, + Amount: 0.04, + Level: 1, + }, + "202": { + Stat: prop.SPDFlat, + Amount: 2, + Ascension: 2, + }, + "203": { + Stat: prop.ATKPercent, + Amount: 0.04, + Ascension: 3, + }, + "204": { + Stat: prop.HPPercent, + Amount: 0.04, + Ascension: 3, + }, + "205": { + Stat: prop.ATKPercent, + Amount: 0.06, + Ascension: 4, + }, + "206": { + Stat: prop.SPDFlat, + Amount: 3, + Ascension: 5, + }, + "207": { + Stat: prop.ATKPercent, + Amount: 0.06, + Ascension: 5, + }, + "208": { + Stat: prop.HPPercent, + Amount: 0.06, + Ascension: 6, + }, + "209": { + Stat: prop.SPDFlat, + Amount: 4, + Level: 75, + }, + "210": { + Stat: prop.ATKPercent, + Amount: 0.08, + Level: 80, + }, +} \ No newline at end of file From e36d9c94e8bc913f8ff7e2cffa130499f81e2a88 Mon Sep 17 00:00:00 2001 From: ducc Date: Sat, 2 Nov 2024 21:31:03 -0400 Subject: [PATCH 03/17] setup --- internal/character/hanya/hanya.go | 56 +++++++++++++++++++++++++++++++ pkg/key/character.go | 1 + pkg/simulation/imports.go | 1 + 3 files changed, 58 insertions(+) create mode 100644 internal/character/hanya/hanya.go diff --git a/internal/character/hanya/hanya.go b/internal/character/hanya/hanya.go new file mode 100644 index 00000000..4ef47f15 --- /dev/null +++ b/internal/character/hanya/hanya.go @@ -0,0 +1,56 @@ +package hanya + +import ( + "github.com/simimpact/srsim/pkg/engine" + "github.com/simimpact/srsim/pkg/engine/info" + "github.com/simimpact/srsim/pkg/engine/target/character" + "github.com/simimpact/srsim/pkg/key" + "github.com/simimpact/srsim/pkg/model" +) + +func init() { + character.Register(key.Hanya, character.Config{ + Create: NewInstance, + Rarity: 4, + Element: model.DamageType_PHYSICAL, + Path: model.Path_HARMONY, + MaxEnergy: 140, + Promotions: promotions, + Traces: traces, + SkillInfo: character.SkillInfo{ + Attack: character.Attack{ + SPAdd: 1, + TargetType: model.TargetType_ENEMIES, + }, + Skill: character.Skill{ + SPNeed: 1, + TargetType: model.TargetType_ENEMIES, + }, + Ult: character.Ult{ + TargetType: model.TargetType_ALLIES, + }, + Technique: character.Technique{ + TargetType: model.TargetType_ENEMIES, + IsAttack: true, + }, + }, + }) +} + +type char struct { + engine engine.Engine + id key.TargetID + info info.Character +} + +func NewInstance(engine engine.Engine, id key.TargetID, charInfo info.Character) info.CharInstance { + c := &char{ + engine: engine, + id: id, + info: charInfo, + } + + // c.engine.Events().ActionStart.Subscribe() + + return c +} diff --git a/pkg/key/character.go b/pkg/key/character.go index 72994e95..6ab4494d 100644 --- a/pkg/key/character.go +++ b/pkg/key/character.go @@ -28,6 +28,7 @@ const ( Natasha Character = "natasha" March7th Character = "march7th" Seele Character = "seele" + Hanya Character = "hanya" Huohuo Character = "huohuo" ) diff --git a/pkg/simulation/imports.go b/pkg/simulation/imports.go index dd758b1c..cec11dcd 100644 --- a/pkg/simulation/imports.go +++ b/pkg/simulation/imports.go @@ -11,6 +11,7 @@ import ( _ "github.com/simimpact/srsim/internal/character/dummy" _ "github.com/simimpact/srsim/internal/character/gepard" _ "github.com/simimpact/srsim/internal/character/guinaifen" + _ "github.com/simimpact/srsim/internal/character/hanya" _ "github.com/simimpact/srsim/internal/character/herta" _ "github.com/simimpact/srsim/internal/character/himeko" _ "github.com/simimpact/srsim/internal/character/hook" From 64f4e544afe3315db30f41e846eca30c0e758593 Mon Sep 17 00:00:00 2001 From: ducc Date: Sat, 2 Nov 2024 21:31:11 -0400 Subject: [PATCH 04/17] eidolons --- internal/character/hanya/eidolon.go | 63 +++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 internal/character/hanya/eidolon.go diff --git a/internal/character/hanya/eidolon.go b/internal/character/hanya/eidolon.go new file mode 100644 index 00000000..69abbf9f --- /dev/null +++ b/internal/character/hanya/eidolon.go @@ -0,0 +1,63 @@ +package hanya + +import ( + "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 ( + E1 = "hanya-e1" + E1Cooldown = "hanya-e1-cooldown" + E2 = "hanya-e2" +) + +func init() { + modifier.Register(E1, modifier.Config{ + Stacking: modifier.ReplaceBySource, + Listeners: modifier.Listeners{ + OnTriggerDeath: E1HanyaAdv, + }, + }) + + modifier.Register(E1Cooldown, modifier.Config{ + Listeners: modifier.Listeners{ + OnPhase2: E1HanyaCD, + }, + }) + + modifier.Register(E2, modifier.Config{ + StatusType: model.StatusType_STATUS_BUFF, + Stacking: modifier.ReplaceBySource, + Duration: 1, + }) +} + +func (c *char) initEidolons() { + if c.info.Eidolon >= 2 { + c.engine.AddModifier(c.id, info.Modifier{ + Name: E2, + Source: c.id, + Stats: info.PropMap{ + prop.SPDConvert: 0.2, + }, + }) + } +} + +func E1HanyaAdv(mod *modifier.Instance, target key.TargetID) { + if !mod.Engine().HasModifier(mod.Source(), E1Cooldown) { + mod.Engine().ModifyGaugeNormalized(info.ModifyAttribute{ + Key: E1, + Source: mod.Owner(), + Target: mod.Source(), + Amount: -1500, + }) + } +} + +func E1HanyaCD(mod *modifier.Instance) { + mod.RemoveSelf() +} From 0f82921c90ab1dad0b4c4bcc8821c1ee22abcee1 Mon Sep 17 00:00:00 2001 From: ducc Date: Sat, 2 Nov 2024 21:31:22 -0400 Subject: [PATCH 05/17] eidolons --- internal/character/hanya/hanya.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/character/hanya/hanya.go b/internal/character/hanya/hanya.go index 4ef47f15..de26400e 100644 --- a/internal/character/hanya/hanya.go +++ b/internal/character/hanya/hanya.go @@ -50,7 +50,7 @@ func NewInstance(engine engine.Engine, id key.TargetID, charInfo info.Character) info: charInfo, } - // c.engine.Events().ActionStart.Subscribe() + c.initEidolons() return c } From 9d7776650536580158904d8cec2b6f99e53aeafd Mon Sep 17 00:00:00 2001 From: ducc Date: Sat, 2 Nov 2024 21:31:28 -0400 Subject: [PATCH 06/17] skill impl --- internal/character/hanya/skill.go | 132 ++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 internal/character/hanya/skill.go diff --git a/internal/character/hanya/skill.go b/internal/character/hanya/skill.go new file mode 100644 index 00000000..099ea234 --- /dev/null +++ b/internal/character/hanya/skill.go @@ -0,0 +1,132 @@ +package hanya + +import ( + "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 ( + Skill key.Attack = "hanya-skill" + Burden = "hanya-burden" + Sanction = "hanya-sanction" +) + +type BurdenState struct { + atkCount int + triggersRemaining int +} + +func init() { + modifier.Register(Burden, modifier.Config{ + Listeners: modifier.Listeners{ + OnBeforeBeingAttacked: BurdenCallbackBuff, + OnAfterBeingAttacked: BurdenCallbackSP, + OnBeforeDying: BurdenAboutToDie, + }, + }) + + modifier.Register(Sanction, modifier.Config{ + Stacking: modifier.ReplaceBySource, + }) +} + +func (c *char) Skill(target key.TargetID, state info.ActionState) { + c.engine.Attack(info.Attack{ + Key: Skill, + Source: c.id, + Targets: []key.TargetID{target}, + AttackType: model.AttackType_SKILL, + DamageType: model.DamageType_PHYSICAL, + BaseDamage: info.DamageMap{ + model.DamageFormula_BY_ATK: skill[c.info.SkillLevelIndex()], + }, + StanceDamage: 60, + EnergyGain: 30, + }) + + if c.engine.HPRatio(target) > 0 { + c.engine.AddModifier(target, info.Modifier{ + Name: Burden, + Source: c.id, + State: BurdenState{ + atkCount: 0, + triggersRemaining: 2, + }, + }) + } + +} + +func BurdenCallbackBuff(mod *modifier.Instance, e event.AttackStart) { + if e.AttackType != model.AttackType_SKILL && e.AttackType != model.AttackType_NORMAL && e.AttackType != model.AttackType_ULT { + return + } + if mod.Engine().IsCharacter(e.Attacker) { + hanya, _ := mod.Engine().CharacterInfo(mod.Source()) + damageBuff := talent[hanya.TalentLevelIndex()] + if hanya.Eidolon >= 6 { + damageBuff += 0.1 + } + mod.Engine().AddModifier(mod.Owner(), info.Modifier{ + Name: Sanction, + Source: mod.Source(), + Duration: 2, + Stats: info.PropMap{ + prop.AllDamagePercent: damageBuff, + }, + }) + } + +} + +func BurdenCallbackSP(mod *modifier.Instance, e event.AttackEnd) { + if e.AttackType != model.AttackType_SKILL && e.AttackType != model.AttackType_NORMAL && e.AttackType != model.AttackType_ULT { + return + } + state := mod.State().(*BurdenState) + state.atkCount += 1 + // It shouldn't ever actually be greater than 2 + if state.atkCount >= 2 { + state.atkCount = 0 + state.triggersRemaining -= 1 + mod.Engine().ModifySP(info.ModifySP{ + Key: Burden, + Source: mod.Source(), + Amount: 1, + }) + mod.Engine().AddModifier(e.Attacker, info.Modifier{ + Name: A2, + Source: mod.Source(), + Duration: 1, + }) + hanya, _ := mod.Engine().CharacterInfo(mod.Source()) + // A6 + if hanya.Traces["103"] { + mod.Engine().ModifyEnergy(info.ModifyAttribute{ + Key: A6, + Source: mod.Source(), + Target: mod.Source(), + Amount: 2, + }) + } + if state.triggersRemaining < 1 { + mod.RemoveSelf() + } + } +} + +func BurdenAboutToDie(mod *modifier.Instance) { + hanya, _ := mod.Engine().CharacterInfo(mod.Source()) + // A4 + if hanya.Traces["102"] && mod.State().(BurdenState).atkCount <= 1 { + mod.Engine().ModifySP(info.ModifySP{ + Key: A4, + Source: mod.Source(), + Amount: 1, + }) + } +} From db99ce0e20308c389aa445b306417d69259a66d6 Mon Sep 17 00:00:00 2001 From: ducc Date: Sat, 2 Nov 2024 21:31:31 -0400 Subject: [PATCH 07/17] mvs --- internal/character/hanya/stats.go | 84 +++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 internal/character/hanya/stats.go diff --git a/internal/character/hanya/stats.go b/internal/character/hanya/stats.go new file mode 100644 index 00000000..0b8ccdf5 --- /dev/null +++ b/internal/character/hanya/stats.go @@ -0,0 +1,84 @@ +package hanya + +var ( + basic = []float64{ + 0.5, + 0.6, + 0.7, + 0.8, + 0.9, + 1, + 1.1, + 1.2, + 1.3, + } + skill = []float64{ + 1.2, + 1.32, + 1.44, + 1.56, + 1.68, + 1.8, + 1.95, + 2.1, + 2.25, + 2.4, + 2.52, + 2.64, + 2.76, + 2.88, + 3, + } + + ultAtkBuff = []float64{ + 0.36, + 0.384, + 0.408, + 0.432, + 0.456, + 0.48, + 0.51, + 0.54, + 0.57, + 0.6, + 0.624, + 0.648, + 0.672, + 0.696, + 0.72, + } + ultSpdBuff = []float64{ + 0.15, + 0.155, + 0.16, + 0.165, + 0.17, + 0.175, + 0.18125, + 0.1875, + 0.19375, + 0.2, + 0.205, + 0.21, + 0.215, + 0.22, + 0.225, + } + talent = []float64{ + 0.15, + 0.165, + 0.18, + 0.195, + 0.21, + 0.225, + 0.24375, + 0.2625, + 0.28125, + 0.3, + 0.315, + 0.33, + 0.345, + 0.36, + 0.375, + } +) From 4fae4cf2643ddad6b2be97a5fca95d47f5cb28ce Mon Sep 17 00:00:00 2001 From: ducc Date: Sat, 2 Nov 2024 21:31:53 -0400 Subject: [PATCH 08/17] technique --- internal/character/hanya/technique.go | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 internal/character/hanya/technique.go diff --git a/internal/character/hanya/technique.go b/internal/character/hanya/technique.go new file mode 100644 index 00000000..27e77417 --- /dev/null +++ b/internal/character/hanya/technique.go @@ -0,0 +1,28 @@ +package hanya + +import ( + "github.com/simimpact/srsim/pkg/engine/info" + "github.com/simimpact/srsim/pkg/key" +) + +func (c *char) Technique(target key.TargetID, state info.ActionState) { + victim := c.engine.Retarget(info.Retarget{ + Targets: c.engine.Enemies(), + Filter: func(target key.TargetID) bool { + return c.engine.HPRatio(target) > 0 + }, + Max: 1, + IncludeLimbo: false, + })[0] + + if c.engine.HPRatio(victim) > 0 { + c.engine.AddModifier(victim, info.Modifier{ + Name: Burden, + Source: c.id, + State: BurdenState{ + atkCount: 0, + triggersRemaining: 2, + }, + }) + } +} From e8a3e5448245baf83b75b1818790cb2c9740a201 Mon Sep 17 00:00:00 2001 From: ducc Date: Sat, 2 Nov 2024 21:32:02 -0400 Subject: [PATCH 09/17] traces --- internal/character/hanya/trace.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 internal/character/hanya/trace.go diff --git a/internal/character/hanya/trace.go b/internal/character/hanya/trace.go new file mode 100644 index 00000000..7086d7a5 --- /dev/null +++ b/internal/character/hanya/trace.go @@ -0,0 +1,19 @@ +package hanya + +import ( + "github.com/simimpact/srsim/pkg/engine/modifier" + "github.com/simimpact/srsim/pkg/model" +) + +const ( + A2 = "hanya-a2" + A4 = "hanya-a4" + A6 = "hanya-a6" +) + +func init() { + modifier.Register(A2, modifier.Config{ + StatusType: model.StatusType_STATUS_BUFF, + Stacking: modifier.ReplaceBySource, + }) +} From 90ed42c65b446351eb106b68ba110bbf8d7260e0 Mon Sep 17 00:00:00 2001 From: ducc Date: Sat, 2 Nov 2024 21:32:08 -0400 Subject: [PATCH 10/17] ult impl --- internal/character/hanya/ult.go | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 internal/character/hanya/ult.go diff --git a/internal/character/hanya/ult.go b/internal/character/hanya/ult.go new file mode 100644 index 00000000..f76a0aff --- /dev/null +++ b/internal/character/hanya/ult.go @@ -0,0 +1,46 @@ +package hanya + +import ( + "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 ( + Ultimate = "hanya-ult" +) + +func init() { + modifier.Register(Ultimate, modifier.Config{ + StatusType: model.StatusType_STATUS_BUFF, + Stacking: modifier.Replace, + }) +} + +func (c *char) Ult(target key.TargetID, state info.ActionState) { + ultdur := 2 + if c.info.Eidolon >= 4 { + ultdur = 3 + } + + c.engine.AddModifier(target, info.Modifier{ + Name: Ultimate, + Source: c.id, + Duration: ultdur, + Stats: info.PropMap{ + prop.ATKPercent: ultAtkBuff[c.info.UltLevelIndex()], + prop.SPDFlat: ultSpdBuff[c.info.UltLevelIndex()] * c.engine.Stats(c.id).SPD(), + }, + }) + + if c.info.Eidolon >= 1 { + c.engine.AddModifier(target, info.Modifier{ + Name: E1, + Source: c.id, + Duration: ultdur, + }) + } + +} From 8b5ed33cac9a3a037baf452e5770eef858f390e6 Mon Sep 17 00:00:00 2001 From: ducc Date: Sat, 2 Nov 2024 21:53:15 -0400 Subject: [PATCH 11/17] linting --- internal/character/hanya/attack.go | 2 ++ internal/character/hanya/skill.go | 8 +++----- internal/character/hanya/ult.go | 1 - 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/character/hanya/attack.go b/internal/character/hanya/attack.go index bc19169b..8170c399 100644 --- a/internal/character/hanya/attack.go +++ b/internal/character/hanya/attack.go @@ -20,6 +20,8 @@ func (c *char) Attack(target key.TargetID, state info.ActionState) { }, StanceDamage: 30, EnergyGain: 20, + AttackType: model.AttackType_MAZE_NORMAL, + DamageType: model.DamageType_PHYSICAL, }) state.EndAttack() diff --git a/internal/character/hanya/skill.go b/internal/character/hanya/skill.go index 099ea234..bd7d1e3e 100644 --- a/internal/character/hanya/skill.go +++ b/internal/character/hanya/skill.go @@ -10,9 +10,9 @@ import ( ) const ( - Skill key.Attack = "hanya-skill" - Burden = "hanya-burden" - Sanction = "hanya-sanction" + Skill = "hanya-skill" + Burden = "hanya-burden" + Sanction = "hanya-sanction" ) type BurdenState struct { @@ -58,7 +58,6 @@ func (c *char) Skill(target key.TargetID, state info.ActionState) { }, }) } - } func BurdenCallbackBuff(mod *modifier.Instance, e event.AttackStart) { @@ -80,7 +79,6 @@ func BurdenCallbackBuff(mod *modifier.Instance, e event.AttackStart) { }, }) } - } func BurdenCallbackSP(mod *modifier.Instance, e event.AttackEnd) { diff --git a/internal/character/hanya/ult.go b/internal/character/hanya/ult.go index f76a0aff..1fbcffb3 100644 --- a/internal/character/hanya/ult.go +++ b/internal/character/hanya/ult.go @@ -42,5 +42,4 @@ func (c *char) Ult(target key.TargetID, state info.ActionState) { Duration: ultdur, }) } - } From 86da1da2c5af2c38fe56992f9501413a6e79310a Mon Sep 17 00:00:00 2001 From: ducc Date: Mon, 4 Nov 2024 00:13:15 -0500 Subject: [PATCH 12/17] Changed approach to e2 impl --- internal/character/hanya/eidolon.go | 36 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/internal/character/hanya/eidolon.go b/internal/character/hanya/eidolon.go index 69abbf9f..59ac5d6d 100644 --- a/internal/character/hanya/eidolon.go +++ b/internal/character/hanya/eidolon.go @@ -3,7 +3,6 @@ package hanya import ( "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" ) @@ -29,23 +28,24 @@ func init() { }) modifier.Register(E2, modifier.Config{ - StatusType: model.StatusType_STATUS_BUFF, - Stacking: modifier.ReplaceBySource, - Duration: 1, + StatusType: model.StatusType_STATUS_BUFF, + Stacking: modifier.ReplaceBySource, + Duration: 1, + BehaviorFlags: []model.BehaviorFlag{model.BehaviorFlag_STAT_SPEED_UP}, + // Listeners: modifier.Listeners{ + // OnAfterAction: E2SpeedBuffCallback, + // }, }) } -func (c *char) initEidolons() { - if c.info.Eidolon >= 2 { - c.engine.AddModifier(c.id, info.Modifier{ - Name: E2, - Source: c.id, - Stats: info.PropMap{ - prop.SPDConvert: 0.2, - }, - }) - } -} +// func (c *char) initEidolons() { +// if c.info.Eidolon >= 2 { +// c.engine.AddModifier(c.id, info.Modifier{ +// Name: E2, +// Source: c.id, +// }) +// } +// } func E1HanyaAdv(mod *modifier.Instance, target key.TargetID) { if !mod.Engine().HasModifier(mod.Source(), E1Cooldown) { @@ -53,7 +53,11 @@ func E1HanyaAdv(mod *modifier.Instance, target key.TargetID) { Key: E1, Source: mod.Owner(), Target: mod.Source(), - Amount: -1500, + Amount: -0.15, + }) + mod.Engine().AddModifier(mod.Source(), info.Modifier{ + Name: E1Cooldown, + Source: mod.Source(), }) } } From 18b83bfd1bd6f8fa3120a83fd6e5a8f8d46c4249 Mon Sep 17 00:00:00 2001 From: ducc Date: Mon, 4 Nov 2024 00:13:36 -0500 Subject: [PATCH 13/17] Added listener to ensure only 1 instance of burden ever exists --- internal/character/hanya/skill.go | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/internal/character/hanya/skill.go b/internal/character/hanya/skill.go index bd7d1e3e..a85cfefe 100644 --- a/internal/character/hanya/skill.go +++ b/internal/character/hanya/skill.go @@ -26,6 +26,7 @@ func init() { OnBeforeBeingAttacked: BurdenCallbackBuff, OnAfterBeingAttacked: BurdenCallbackSP, OnBeforeDying: BurdenAboutToDie, + OnAdd: RemoveFromOthers, }, }) @@ -48,16 +49,30 @@ func (c *char) Skill(target key.TargetID, state info.ActionState) { EnergyGain: 30, }) + // Prevents the same skill usage that applies Burden from counting towards trigger count + state.EndAttack() + if c.engine.HPRatio(target) > 0 { c.engine.AddModifier(target, info.Modifier{ Name: Burden, Source: c.id, - State: BurdenState{ + State: &BurdenState{ atkCount: 0, triggersRemaining: 2, }, }) } + + if c.info.Eidolon >= 2 { + c.engine.AddModifier(c.id, info.Modifier{ + Name: E2, + Stats: info.PropMap{ + prop.SPDPercent: 0.2, + }, + Source: c.id, + Duration: 1, + }) + } } func BurdenCallbackBuff(mod *modifier.Instance, e event.AttackStart) { @@ -128,3 +143,11 @@ func BurdenAboutToDie(mod *modifier.Instance) { }) } } + +func RemoveFromOthers(mod *modifier.Instance) { + for _, enemy := range mod.Engine().Enemies() { + if enemy != mod.Owner() { + mod.Engine().RemoveModifier(enemy, Burden) + } + } +} From 9bd8cea281fe0078295b93a43701594656efaf21 Mon Sep 17 00:00:00 2001 From: ducc Date: Mon, 4 Nov 2024 00:14:09 -0500 Subject: [PATCH 14/17] Added missing behavior flags, changed spd bufff to spd convert --- internal/character/hanya/ult.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/character/hanya/ult.go b/internal/character/hanya/ult.go index 1fbcffb3..6693d708 100644 --- a/internal/character/hanya/ult.go +++ b/internal/character/hanya/ult.go @@ -14,8 +14,9 @@ const ( func init() { modifier.Register(Ultimate, modifier.Config{ - StatusType: model.StatusType_STATUS_BUFF, - Stacking: modifier.Replace, + StatusType: model.StatusType_STATUS_BUFF, + Stacking: modifier.Replace, + BehaviorFlags: []model.BehaviorFlag{model.BehaviorFlag_STAT_SPEED_UP}, }) } @@ -24,14 +25,14 @@ func (c *char) Ult(target key.TargetID, state info.ActionState) { if c.info.Eidolon >= 4 { ultdur = 3 } - + hanyaStats := c.engine.Stats(c.id) c.engine.AddModifier(target, info.Modifier{ Name: Ultimate, Source: c.id, Duration: ultdur, Stats: info.PropMap{ prop.ATKPercent: ultAtkBuff[c.info.UltLevelIndex()], - prop.SPDFlat: ultSpdBuff[c.info.UltLevelIndex()] * c.engine.Stats(c.id).SPD(), + prop.SPDConvert: ultSpdBuff[c.info.UltLevelIndex()]*hanyaStats.SPD() - hanyaStats.GetProperty(prop.SPDConvert), }, }) From dd632cb1f4bd8e0a17c891f5940012cc9a8e4c53 Mon Sep 17 00:00:00 2001 From: ducc Date: Mon, 4 Nov 2024 00:14:24 -0500 Subject: [PATCH 15/17] Fixed improper handling of modifier state --- internal/character/hanya/technique.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/character/hanya/technique.go b/internal/character/hanya/technique.go index 27e77417..4a2a8dbe 100644 --- a/internal/character/hanya/technique.go +++ b/internal/character/hanya/technique.go @@ -19,7 +19,7 @@ func (c *char) Technique(target key.TargetID, state info.ActionState) { c.engine.AddModifier(victim, info.Modifier{ Name: Burden, Source: c.id, - State: BurdenState{ + State: &BurdenState{ atkCount: 0, triggersRemaining: 2, }, From 735299598efc12376ec371583cd99a2fba5d14a9 Mon Sep 17 00:00:00 2001 From: ducc Date: Mon, 4 Nov 2024 00:17:59 -0500 Subject: [PATCH 16/17] Commenting out potentially unneeded/nonexistent function for now --- internal/character/hanya/hanya.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/character/hanya/hanya.go b/internal/character/hanya/hanya.go index de26400e..10789431 100644 --- a/internal/character/hanya/hanya.go +++ b/internal/character/hanya/hanya.go @@ -50,7 +50,7 @@ func NewInstance(engine engine.Engine, id key.TargetID, charInfo info.Character) info: charInfo, } - c.initEidolons() + //c.initEidolons() return c } From ef43a1131d5fd66f65ee477982e94f17ced823dc Mon Sep 17 00:00:00 2001 From: ducc Date: Mon, 4 Nov 2024 00:18:27 -0500 Subject: [PATCH 17/17] linter --- internal/character/hanya/hanya.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/character/hanya/hanya.go b/internal/character/hanya/hanya.go index 10789431..6b998546 100644 --- a/internal/character/hanya/hanya.go +++ b/internal/character/hanya/hanya.go @@ -50,7 +50,7 @@ func NewInstance(engine engine.Engine, id key.TargetID, charInfo info.Character) info: charInfo, } - //c.initEidolons() + // c.initEidolons() return c }