Skip to content
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions internal/character/sparkle/attack.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package sparkle

import (
"github.com/simimpact/srsim/pkg/engine/info"
"github.com/simimpact/srsim/pkg/key"
"github.com/simimpact/srsim/pkg/model"
)

const (
SparkleBasic key.Attack = "sparkle-basic"
)

func (c *char) Attack(target key.TargetID, state info.ActionState) {
// A2
if c.info.Traces["101"] {
c.engine.ModifyEnergy(info.ModifyAttribute{
Key: A2,
Amount: 10,
Target: c.id,
Source: c.id,
})
}

c.engine.Attack(info.Attack{
Key: SparkleBasic,
Source: c.id,
Targets: []key.TargetID{target},
DamageType: model.DamageType_QUANTUM,
AttackType: model.AttackType_NORMAL,
BaseDamage: info.DamageMap{
model.DamageFormula_BY_ATK: basic[c.info.AttackLevelIndex()],
},
EnergyGain: 20,
StanceDamage: 30,
})

state.EndAttack()
}
164 changes: 164 additions & 0 deletions internal/character/sparkle/data.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions internal/character/sparkle/eidolon.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package sparkle

import (
"github.com/simimpact/srsim/pkg/engine/event"
"github.com/simimpact/srsim/pkg/engine/modifier"
"github.com/simimpact/srsim/pkg/engine/prop"
)

const (
E2 = "sparkle-e2"
)

func init() {
modifier.Register(E2, modifier.Config{
Stacking: modifier.ReplaceBySource,
Listeners: modifier.Listeners{
OnBeforeHitAll: E2Callback,
},
MaxCount: 3,
})
}

func E2Callback(mod *modifier.Instance, e event.HitStart) {
e.Hit.Defender.AddProperty(E2, prop.DEFPercent, -0.08*mod.Count())
}
116 changes: 116 additions & 0 deletions internal/character/sparkle/skill.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
package sparkle

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 (
SparkleSkillBuff = "SparkleSkillBuff"
Dreamdiver = "dreamdiver"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naming-wise, I would probably call the first-applied mod "dreamdiver" and the a4 extension "dreamdiver-a4-extend" or something

SparkleSkill = "sparkle-skill"
)

func init() {
modifier.Register(SparkleSkillBuff, modifier.Config{
Stacking: modifier.ReplaceBySource,
CanDispel: true,
StatusType: model.StatusType_STATUS_BUFF,
Listeners: modifier.Listeners{
OnAdd: addActualBuff,
OnRemove: A4Extend,
},
TickMoment: modifier.ModifierPhase1End,
Duration: 1,
})

modifier.Register(Dreamdiver, modifier.Config{
Stacking: modifier.Replace,
CanDispel: true,
StatusType: model.StatusType_STATUS_BUFF,
Duration: 1,
})
}

type SkillBuffState struct {
cdmgBuff float64
}

func (c *char) Skill(target key.TargetID, state info.ActionState) {
c.engine.ModifyGaugeNormalized(info.ModifyAttribute{
Key: SparkleSkill,
Target: target,
Source: c.id,
Amount: -0.5,
})

sparkle := c.engine.Stats(c.id)
sparkleCdmg := sparkle.GetProperty(prop.CritDMG)
proportion := skillCdmgScaling[c.info.SkillLevelIndex()]
if c.info.Eidolon >= 6 {
proportion += 0.3
}
c.engine.AddModifier(target, info.Modifier{
Name: SparkleSkillBuff,
Source: c.id,
Duration: 1,
State: SkillBuffState{
cdmgBuff: proportion*sparkleCdmg + skillFlatCdmg[c.info.SkillLevelIndex()],
},
})

// At e6, when using skill sparkle should add skill buff to all teammates with cipher
if c.info.Eidolon >= 6 {
targets := make([]key.TargetID, 0, 4)
for _, char := range c.engine.Characters() {
if c.engine.HasModifier(char, Cipher) {
targets = append(targets, char)
}
}

for _, char := range targets {
c.engine.AddModifier(char, info.Modifier{
Name: SparkleSkillBuff,
Source: c.id,
Duration: 1,
State: SkillBuffState{
cdmgBuff: proportion*sparkleCdmg + skillFlatCdmg[c.info.SkillLevelIndex()],
},
})
}
}

c.engine.ModifyEnergy(info.ModifyAttribute{
Key: SparkleSkill,
Source: c.id,
Target: c.id,
Amount: 30,
})
}

func addActualBuff(mod *modifier.Instance) {
mod.Engine().RemoveModifier(mod.Owner(), Dreamdiver)
mod.Engine().AddModifier(mod.Owner(), info.Modifier{
Name: Dreamdiver,
Source: mod.Source(),
Stats: info.PropMap{
prop.CritDMG: mod.State().(SkillBuffState).cdmgBuff,
},
})
}

func A4Extend(mod *modifier.Instance) {
sparkleinfo, _ := mod.Engine().CharacterInfo(mod.Source())
if sparkleinfo.Traces["102"] {
mod.Engine().AddModifier(mod.Owner(), info.Modifier{
Name: Dreamdiver,
Source: mod.Source(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TargetSelf as caster should mean source is mod.Owner() I believe

Stats: info.PropMap{
prop.CritDMG: mod.State().(SkillBuffState).cdmgBuff,
},
})
}
}
Loading
Loading