-
Notifications
You must be signed in to change notification settings - Fork 34
Implement 10 Relics #267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kdovtdc
wants to merge
12
commits into
simimpact:main
Choose a base branch
from
kdovtdc:10-relics
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Implement 10 Relics #267
Changes from 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
414d553
Implement 10 Relics
kdovtdc 485e37f
Fix Disciple Relic registration using wrong key
kdovtdc c7bd0d0
Fix: Some minor formatting/general changes
kdovtdc 35763c4
Finish Keel implementation
kdovtdc e91cb61
Merge branch 'simimpact:main' into 10-relics
kdovtdc dd0695f
Fix Messenger with comments
kdovtdc 9a5b226
add removal on death for Keel
kdovtdc 654b382
Merge branch 'main' into 10-relics
kdovtdc 346b5b2
fix typo
kdovtdc 061861b
gofmt
kdovtdc 51bb231
Merge branch 'main' into 10-relics
kdovtdc 86f1d92
Update relics with new logic + bugfixes
kdovtdc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| package band | ||
|
|
||
| import ( | ||
| "github.com/simimpact/srsim/pkg/engine" | ||
| "github.com/simimpact/srsim/pkg/engine/equip/relic" | ||
| "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 = "band-of-sizzling-thunder" | ||
| buff = "band-of-sizzling-thunder-buff" | ||
| ) | ||
|
|
||
| // 2pc: Increases Lightning DMG by 10%. | ||
| // 4pc: When the wearer uses their Skill, increases the wearer's ATK by 20% for 1 turn(s). | ||
|
|
||
| func init() { | ||
| relic.Register(key.BandOfSizzlingThunder, relic.Config{ | ||
| Effects: []relic.SetEffect{ | ||
| { | ||
| MinCount: 2, | ||
| Stats: info.PropMap{prop.ThunderDamagePercent: 0.1}, | ||
| }, | ||
| { | ||
| MinCount: 4, | ||
| CreateEffect: func(engine engine.Engine, owner key.TargetID) { | ||
| engine.AddModifier(owner, info.Modifier{ | ||
| Name: check, | ||
| Source: owner, | ||
| }) | ||
| }, | ||
| }, | ||
| }, | ||
| }) | ||
| modifier.Register(check, modifier.Config{ | ||
| Listeners: modifier.Listeners{ | ||
| OnBeforeAction: onBeforeSkill, | ||
| }, | ||
| }) | ||
| modifier.Register(buff, modifier.Config{ | ||
| Stacking: modifier.ReplaceBySource, | ||
| StatusType: model.StatusType_STATUS_BUFF, | ||
| Duration: 1, | ||
| }) | ||
| } | ||
|
|
||
| func onBeforeSkill(mod *modifier.Instance, e event.ActionStart) { | ||
| if e.AttackType == model.AttackType_SKILL { | ||
| mod.Engine().AddModifier(mod.Owner(), info.Modifier{ | ||
| Name: buff, | ||
| Source: mod.Owner(), | ||
| Stats: info.PropMap{prop.ATKPercent: 0.2}, | ||
| }) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| package disciple | ||
|
|
||
| import ( | ||
| "github.com/simimpact/srsim/pkg/engine" | ||
| "github.com/simimpact/srsim/pkg/engine/equip/relic" | ||
| "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 = "longevous-disciple" | ||
| crbuff = "longevous-disciple-cr-buff" | ||
| ) | ||
|
|
||
| // 2pc: Increases Max HP by 12%. | ||
| // 4pc: When the wearer is hit or has their HP consumed by an ally or themselves, | ||
| // their CRIT Rate increases by 8% for 2 turn(s) and up to 2 stacks. | ||
|
|
||
| // TO-DO: in onHPChange, assumes e.Target means source; check whether this is correct | ||
|
|
||
| func init() { | ||
| relic.Register(key.LongevousDisciple, relic.Config{ | ||
| Effects: []relic.SetEffect{ | ||
| { | ||
| MinCount: 2, | ||
| Stats: info.PropMap{prop.HPPercent: 0.12}, | ||
| }, | ||
| { | ||
| MinCount: 4, | ||
| CreateEffect: func(engine engine.Engine, owner key.TargetID) { | ||
| engine.AddModifier(owner, info.Modifier{ | ||
| Name: check, | ||
| Source: owner, | ||
| }) | ||
| }, | ||
| }, | ||
| }, | ||
| }) | ||
| modifier.Register(check, modifier.Config{ | ||
| Listeners: modifier.Listeners{ | ||
| OnHPChange: onHPChange, | ||
| OnAfterBeingAttacked: onAfterBeingAttacked, | ||
| }, | ||
| }) | ||
| modifier.Register(crbuff, modifier.Config{ | ||
| Stacking: modifier.ReplaceBySource, | ||
| StatusType: model.StatusType_STATUS_BUFF, | ||
| MaxCount: 2, | ||
| CountAddWhenStack: 1, | ||
| Duration: 2, | ||
| Listeners: modifier.Listeners{ | ||
| OnAdd: onAdd, | ||
| }, | ||
| }) | ||
| } | ||
|
|
||
| func onHPChange(mod *modifier.Instance, e event.HPChange) { | ||
| // source is friendly, not HP change by damage, hp change is negative | ||
| if mod.Engine().IsCharacter(e.Target) && !e.IsHPChangeByDamage && e.NewHP < e.OldHP { | ||
| mod.Engine().AddModifier(mod.Owner(), info.Modifier{ | ||
| Name: crbuff, | ||
| Source: mod.Owner(), | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func onAfterBeingAttacked(mod *modifier.Instance, e event.AttackEnd) { | ||
| mod.Engine().AddModifier(mod.Owner(), info.Modifier{ | ||
| Name: crbuff, | ||
| Source: mod.Owner(), | ||
| }) | ||
| } | ||
|
|
||
| func onAdd(mod *modifier.Instance) { | ||
| mod.AddProperty(prop.ATKPercent, 0.08*mod.Count()) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| package eagle | ||
|
|
||
| import ( | ||
| "github.com/simimpact/srsim/pkg/engine" | ||
| "github.com/simimpact/srsim/pkg/engine/equip/relic" | ||
| "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 eagle = "eagle-of-twilight-thunder" | ||
|
|
||
| // 2pc: Increases Wind DMG by 10%. | ||
| // 4pc: After the wearer uses their Ultimate, their action is Advanced Forward by 25%. | ||
|
|
||
| func init() { | ||
| relic.Register(key.EagleOfTwilightLine, relic.Config{ | ||
| Effects: []relic.SetEffect{ | ||
| { | ||
| MinCount: 2, | ||
| Stats: info.PropMap{prop.WindDamagePercent: 0.1}, | ||
| }, | ||
| { | ||
| MinCount: 4, | ||
| CreateEffect: func(engine engine.Engine, owner key.TargetID) { | ||
| engine.AddModifier(owner, info.Modifier{ | ||
| Name: eagle, | ||
| Source: owner, | ||
| }) | ||
| }, | ||
| }, | ||
| }, | ||
| }) | ||
| modifier.Register(eagle, modifier.Config{ | ||
| Listeners: modifier.Listeners{ | ||
| OnAfterAction: onAfterUltimate, | ||
| }, | ||
| }) | ||
| } | ||
|
|
||
| func onAfterUltimate(mod *modifier.Instance, e event.ActionEnd) { | ||
| if e.AttackType == model.AttackType_ULT { | ||
| mod.Engine().ModifyGaugeNormalized(info.ModifyAttribute{ | ||
| Key: eagle, | ||
| Target: mod.Owner(), | ||
| Source: mod.Owner(), | ||
| Amount: -0.25, | ||
| }) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| package firesmith | ||
|
|
||
| import ( | ||
| "github.com/simimpact/srsim/pkg/engine" | ||
| "github.com/simimpact/srsim/pkg/engine/equip/relic" | ||
| "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 = "firesmith-of-lava-forging" | ||
| buff = "firesmith-of-lava-forging-buff" | ||
| ) | ||
|
|
||
| // 2pc: Increases Fire DMG by 10%. | ||
| // 4pc: Increases the wearer's Skill DMG by 12%. | ||
| // After unleashing Ultimate, increases the wearer's Fire DMG by 12% for the next attack. | ||
|
|
||
| func init() { | ||
| relic.Register(key.FiresmithOfLavaForging, relic.Config{ | ||
| Effects: []relic.SetEffect{ | ||
| { | ||
| MinCount: 2, | ||
| Stats: info.PropMap{prop.FireDamagePercent: 0.1}, | ||
| }, | ||
| { | ||
| MinCount: 4, | ||
| CreateEffect: func(engine engine.Engine, owner key.TargetID) { | ||
| engine.AddModifier(owner, info.Modifier{ | ||
| Name: check, | ||
| Source: owner, | ||
| }) | ||
| }, | ||
| }, | ||
| }, | ||
| }) | ||
| modifier.Register(check, modifier.Config{ | ||
| Listeners: modifier.Listeners{ | ||
| OnBeforeHitAll: onBeforeHitAll, | ||
| OnAfterAction: onAfterUltimate, | ||
| }, | ||
| }) | ||
| modifier.Register(buff, modifier.Config{ | ||
| Stacking: modifier.ReplaceBySource, | ||
| StatusType: model.StatusType_STATUS_BUFF, | ||
| Listeners: modifier.Listeners{ | ||
| OnAfterAttack: removeBuff, | ||
| }, | ||
| }) | ||
| } | ||
|
|
||
| func onBeforeHitAll(mod *modifier.Instance, e event.HitStart) { | ||
| if e.Hit.AttackType == model.AttackType_SKILL { | ||
| e.Hit.Attacker.AddProperty(check, prop.AllDamagePercent, 0.12) | ||
| } | ||
| } | ||
|
|
||
| func onAfterUltimate(mod *modifier.Instance, e event.ActionEnd) { | ||
| if e.AttackType == model.AttackType_ULT { | ||
| mod.Engine().AddModifier(mod.Owner(), info.Modifier{ | ||
| Name: buff, | ||
| Source: mod.Owner(), | ||
| Stats: info.PropMap{prop.FireDamagePercent: 0.12}, | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func removeBuff(mod *modifier.Instance, e event.AttackEnd) { | ||
| mod.RemoveSelf() | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| package guard | ||
|
|
||
| import ( | ||
| "github.com/simimpact/srsim/pkg/engine" | ||
| "github.com/simimpact/srsim/pkg/engine/equip/relic" | ||
| "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 ( | ||
| guard = "guard-of-wuthering-snow" | ||
| heal = "guard-of-wuthering-snow-heal" | ||
| energy = "guard-of-wuthering-snow-energy" | ||
| ) | ||
|
|
||
| // 2pc: Reduces DMG taken by 8%. | ||
| // 4pc: At the beginning of the turn, if the wearer's HP is equal to or less than 50%, | ||
| // restores HP equal to 8% of their Max HP and regenerates 5 Energy. | ||
|
|
||
| func init() { | ||
| relic.Register(key.GuardOfWutheringSnow, relic.Config{ | ||
| Effects: []relic.SetEffect{ | ||
| { | ||
| MinCount: 2, | ||
| Stats: info.PropMap{prop.AllDamageReduce: 0.08}, | ||
| }, | ||
| { | ||
| MinCount: 4, | ||
| CreateEffect: func(engine engine.Engine, owner key.TargetID) { | ||
| engine.AddModifier(owner, info.Modifier{ | ||
| Name: guard, | ||
| Source: owner, | ||
| }) | ||
| }, | ||
| }, | ||
| }, | ||
| }) | ||
| modifier.Register(guard, modifier.Config{ | ||
| Listeners: modifier.Listeners{ | ||
| OnPhase1: onPhase1, | ||
| }, | ||
| }) | ||
| } | ||
|
|
||
| func onPhase1(mod *modifier.Instance) { | ||
| // if above 50% HP, bypass | ||
| if mod.Engine().HPRatio(mod.Owner()) > 0.5 { | ||
| return | ||
| } | ||
| mod.Engine().Heal(info.Heal{ | ||
| Key: heal, | ||
| Targets: []key.TargetID{mod.Owner()}, | ||
| Source: mod.Owner(), | ||
| BaseHeal: info.HealMap{model.HealFormula_BY_TARGET_MAX_HP: 0.08}, | ||
| }) | ||
| mod.Engine().ModifyEnergy(info.ModifyAttribute{ | ||
| Key: energy, | ||
| Target: mod.Owner(), | ||
| Source: mod.Owner(), | ||
| Amount: 5.0, | ||
| }) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.