Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
102 changes: 102 additions & 0 deletions internal/lightcone/erudition/beforedawn/beforedawn.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package beforedawn

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"
)

//Increases the wearer's CRIT DMG by x%. Increases the wearer's Skill and Ultimate DMG by x%.
//After the wearer uses their Skill or Ultimate, they gain Somnus Corpus.
//Upon triggering a follow-up attack, Somnus Corpus will be consumed and the follow-up attack DMG increases by x%.
const (
BeforeDawn key.Modifier = "before_dawn"
SomnusCorpus key.Modifier = "somnus_corpus"
)

type somnusState struct {
amt float64
used bool
}

//
func init() {
lightcone.Register(key.BeforeDawn, lightcone.Config{
CreatePassive: Create,
Rarity: 5,
Path: model.Path_ERUDITION,
Promotions: promotions,
})

modifier.Register(BeforeDawn, modifier.Config{
Listeners: modifier.Listeners{
OnBeforeHit: onBeforeHit,
OnAfterAction: onAfterAction,
},
})

modifier.Register(SomnusCorpus, modifier.Config{
StatusType: model.StatusType_STATUS_BUFF,
Listeners: modifier.Listeners{
OnBeforeHit: onBeforeHitSomnus,
OnAfterAttack: onAfterAttack,
},
})
}

//Add crit dmg modifier
func Create(engine engine.Engine, owner key.TargetID, lc info.LightCone) {
amt := 0.30 + 0.06*float64(lc.Ascension)
engine.AddModifier(owner, info.Modifier{
Name: BeforeDawn,
Source: owner,
Stats: info.PropMap{prop.CritDMG: amt},
State: float64(lc.Ascension),
})

}

//BeforeHit if its ult or skill add the dmg% to that hit
func onBeforeHit(mod *modifier.ModifierInstance, e event.HitStartEvent) {
if e.Hit.AttackType == model.AttackType_ULT ||
e.Hit.AttackType == model.AttackType_SKILL {
e.Hit.Attacker.AddProperty(prop.AllDamagePercent, 0.15+0.03*mod.State().(float64))
}
}

//Beforehit if its follow and it has the SomnusCorpusMod add the dmg% to that hit and change used to true
func onBeforeHitSomnus(mod *modifier.ModifierInstance, e event.HitStartEvent) {
state := mod.State().(*somnusState)
if e.Hit.AttackType == model.AttackType_INSERT {
e.Hit.Attacker.AddProperty(prop.AllDamagePercent, state.amt)
state.used = true
}
}

//after attack if SomnusCorpMod is used, remove self.
func onAfterAttack(mod *modifier.ModifierInstance, e event.AttackEndEvent) {
state := mod.State().(*somnusState)
if state.used {
mod.RemoveSelf()
}
}

//AfterAction if its ult or skill add the SomnusCorpusMod
func onAfterAction(mod *modifier.ModifierInstance, e event.ActionEvent) {
if e.AttackType == model.AttackType_ULT ||
e.AttackType == model.AttackType_SKILL {
amt := mod.State().(float64)
mod.Engine().AddModifier(mod.Owner(), info.Modifier{
Name: SomnusCorpus,
Source: mod.Owner(),
State: &somnusState{
amt: 0.40 + 0.08*amt,
},
})
}
}
71 changes: 71 additions & 0 deletions internal/lightcone/erudition/beforedawn/data.go

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

1 change: 1 addition & 0 deletions pkg/key/lightcone.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const (
// Erudition
Passkey LightCone = "passkey"
DataBank LightCone = "data_bank"
BeforeDawn LightCone = "before_dawn"

// Harmony
Chorus LightCone = "chorus"
Expand Down
1 change: 1 addition & 0 deletions pkg/simulation/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
_ "github.com/simimpact/srsim/internal/global"
_ "github.com/simimpact/srsim/internal/lightcone/abundance/finefruit"
_ "github.com/simimpact/srsim/internal/lightcone/destruction/themoleswelcomeyou"
_ "github.com/simimpact/srsim/internal/lightcone/erudition/beforedawn"
_ "github.com/simimpact/srsim/internal/lightcone/erudition/databank"
_ "github.com/simimpact/srsim/internal/lightcone/erudition/passkey"
_ "github.com/simimpact/srsim/internal/lightcone/harmony/chorus"
Expand Down