-
Notifications
You must be signed in to change notification settings - Fork 34
Light Cone: Poised to Bloom #319
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
6000j
wants to merge
8
commits into
simimpact:main
Choose a base branch
from
6000j:poised-to-bloom
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7800553
Poised to Bloom initial implementation
6000j 6645c03
corrected stacking type
6000j b75fb01
reverting unneeded changes to generated files due to mismatched proto…
6000j 6bb074a
fix tests failing due to not waiting for sim to finish (#320)
srliao a189a4b
Poised to Bloom initial implementation
6000j 3c9347a
corrected stacking type
6000j 58fe80c
reverting unneeded changes to generated files due to mismatched proto…
6000j 350c207
Merge branch 'poised-to-bloom' of https://github.com/6000j/srsim into…
6000j 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,77 @@ | ||
| package poisedtobloom | ||
|
|
||
| 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 ( | ||
| poised key.Modifier = "poised-to-bloom" | ||
| poisedCritDmg key.Modifier = "poised-to-bloom-crit-dmg" | ||
| ) | ||
|
|
||
| // Lose Not, Forget Not | ||
| // Increases the wearer's ATK by 16/20/24/28/32%. Upon entering battle, | ||
| // if two or more characters follow the same Path, | ||
| // then these characters' CRIT DMG increases by 16/20/24/28/32%. | ||
| // Abilities of the same type cannot stack. | ||
|
|
||
| func init() { | ||
| lightcone.Register(key.PoisedToBloom, lightcone.Config{ | ||
| CreatePassive: Create, | ||
| Rarity: 4, | ||
| Path: model.Path_HARMONY, | ||
| Promotions: promotions, | ||
| }) | ||
|
|
||
| modifier.Register(poised, modifier.Config{}) | ||
|
|
||
| modifier.Register(poisedCritDmg, modifier.Config{ | ||
| Stacking: modifier.Unique, | ||
| }) | ||
| } | ||
|
|
||
| func Create(engine engine.Engine, owner key.TargetID, lc info.LightCone) { | ||
| atkAmt := 0.12 + 0.04*float64(lc.Imposition) | ||
| critDmgAmt := 0.12 + 0.04*float64(lc.Imposition) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: can use the same variable for both |
||
|
|
||
| engine.AddModifier(owner, info.Modifier{ | ||
| Name: poised, | ||
| Source: owner, | ||
| Stats: info.PropMap{prop.ATKPercent: atkAmt}, | ||
| }) | ||
|
|
||
| engine.Events().BattleStart.Subscribe(func(event event.BattleStart) { | ||
| // This is probably slow, but I can't think of other good ways to iterate | ||
| // and store paths that don't involve allocating memory | ||
| // that might not be used, which I suspect would be slower | ||
| // It's still only called once per iteration though, so it should | ||
| // be fine. | ||
|
|
||
| // Iterating over all the characters | ||
| for _, charA := range engine.Characters() { | ||
| charAInfo, _ := engine.CharacterInfo(charA) | ||
| // Checking for pairs with them | ||
| for _, charB := range engine.Characters() { | ||
| charBInfo, _ := engine.CharacterInfo(charB) | ||
| // If there's a pair, we apply the crit dmg buff to charA | ||
| // we could also apply it to charB, but with no way to remove | ||
| // them from the future iterations, that would actually be slower | ||
| if charB != charA && charAInfo.Path == charBInfo.Path { | ||
| engine.AddModifier(charA, info.Modifier{ | ||
| Name: poisedCritDmg, | ||
| Source: owner, | ||
| Stats: info.PropMap{prop.CritDMG: critDmgAmt}, | ||
| }) | ||
| break | ||
| } | ||
| } | ||
| } | ||
| }) | ||
| } | ||
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
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
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,63 @@ | ||
| package lightcone | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/simimpact/srsim/pkg/engine/prop" | ||
| "github.com/simimpact/srsim/tests/testcfg/testchar" | ||
| "github.com/simimpact/srsim/tests/testcfg/testcone" | ||
| "github.com/simimpact/srsim/tests/teststub" | ||
| "github.com/stretchr/testify/suite" | ||
| ) | ||
|
|
||
| type PTBTest struct { | ||
| teststub.Stub | ||
| } | ||
|
|
||
| func TestPTBTest(t *testing.T) { | ||
| suite.Run(t, new(PTBTest)) | ||
| } | ||
|
|
||
| // Testing that PTB indeed does add the correct ATK amount | ||
| func (t *PTBTest) Test_AtkAdd() { | ||
| bronyaModel := testchar.Bronya() | ||
| bronyaModel.LightCone = testcone.PoisedToBloom() | ||
| t.Characters.ResetCharacters() | ||
| bronya := t.Characters.AddCharacter(bronyaModel) | ||
| t.StartSimulation() | ||
| // She should have no other atk buffs from anywhere | ||
| bronya.Equal(prop.ATKPercent, 0.16) | ||
| } | ||
|
|
||
| // Testing that PTB adds crit damage to only characters who share a path with another character in the party | ||
| func (t *PTBTest) Test_CritDMG() { | ||
| bronyaModel := testchar.Bronya() | ||
| bronyaModel.LightCone = testcone.PoisedToBloom() | ||
| t.Characters.ResetCharacters() | ||
| bronya := t.Characters.AddCharacter(bronyaModel) | ||
| dan1 := t.Characters.AddCharacter(testchar.DanHung()) | ||
| dan2 := t.Characters.AddCharacter(testchar.DanHung()) | ||
| t.StartSimulation() | ||
| // 0.50 from base crit damage + 0.16 from poised buff | ||
| dan1.Equal(prop.CritDMG, 0.66) | ||
| dan2.Equal(prop.CritDMG, 0.66) | ||
| // Just the 0.50 base crit damage | ||
| bronya.Equal(prop.CritDMG, 0.50) | ||
| } | ||
|
|
||
| // Testing that PTB adds crit damage to only characters who share a path with another character in the party | ||
| func (t *PTBTest) Test_No_Stacking() { | ||
| // I'm a bit concerned about using the same character twice, but hopefully all should be good? | ||
| bronyaModel1 := testchar.Bronya() | ||
| bronyaModel1.LightCone = testcone.PoisedToBloom() | ||
| bronyaModel2 := testchar.Bronya() | ||
| bronyaModel2.LightCone = testcone.PoisedToBloom() | ||
| t.Characters.ResetCharacters() | ||
| bronya1 := t.Characters.AddCharacter(bronyaModel1) | ||
| bronya2 := t.Characters.AddCharacter(bronyaModel2) | ||
|
|
||
| t.StartSimulation() | ||
| // 0.50 from base crit damage + 0.16 from poised buff | ||
| bronya1.Equal(prop.CritDMG, 0.66) | ||
| bronya2.Equal(prop.CritDMG, 0.66) | ||
| } |
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,27 @@ | ||
| package testchar | ||
|
|
||
| import ( | ||
| "github.com/simimpact/srsim/pkg/key" | ||
| "github.com/simimpact/srsim/pkg/model" | ||
| "github.com/simimpact/srsim/tests/testcfg/testcone" | ||
| ) | ||
|
|
||
| func Bronya() *model.Character { | ||
| return &model.Character{ | ||
| Key: key.Bronya.String(), | ||
| Level: 80, | ||
| MaxLevel: 80, | ||
| Eidols: 0, | ||
| Traces: nil, | ||
| Abilities: &model.Abilities{ | ||
| Attack: 1, | ||
| Skill: 1, | ||
| Ult: 1, | ||
| Talent: 1, | ||
| }, | ||
| LightCone: testcone.DanceDanceDance(), | ||
| Relics: nil, | ||
| StartHp: 0, | ||
| StartEnergy: 0, | ||
| } | ||
| } |
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,15 @@ | ||
| package testcone | ||
|
|
||
| import ( | ||
| "github.com/simimpact/srsim/pkg/key" | ||
| "github.com/simimpact/srsim/pkg/model" | ||
| ) | ||
|
|
||
| func DanceDanceDance() *model.LightCone { | ||
| return &model.LightCone{ | ||
| Key: key.DanceDanceDance.String(), | ||
| Level: 80, | ||
| MaxLevel: 80, | ||
| Imposition: 1, | ||
| } | ||
| } |
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,15 @@ | ||
| package testcone | ||
|
|
||
| import ( | ||
| "github.com/simimpact/srsim/pkg/key" | ||
| "github.com/simimpact/srsim/pkg/model" | ||
| ) | ||
|
|
||
| func PoisedToBloom() *model.LightCone { | ||
| return &model.LightCone{ | ||
| Key: key.PoisedToBloom.String(), | ||
| Level: 80, | ||
| MaxLevel: 80, | ||
| Imposition: 1, | ||
| } | ||
| } |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requires
StatusType: model.StatusType_STATUS_BUFF,nit:
StackingisUniqueby default so can be removedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can also use
CanDispel: true,now