feat(persistence): add Crest of Monarch drop group in Icarus#709
feat(persistence): add Crest of Monarch drop group in Icarus#709olisikh wants to merge 3 commits intoMUnique:masterfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates the 'Crest of Monarch' item drop group into the game's Season 6 configuration for the Icarus map. It establishes a robust mechanism for this new drop through both initial data setup and a dedicated update plugin, ensuring consistent availability and proper behavior. The changes are thoroughly validated with new unit tests, confirming the drop group's correct properties and the update's idempotent nature. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds the 'Crest of Monarch' drop group to the Icarus map. This is achieved by adding a new update plugin for existing data and modifying the initial data creation for new setups. Tests have been added to verify the idempotency of the update plugin and the correctness of the initial data. My feedback includes a correction for a data issue with a timestamp and suggestions to replace magic numbers with named constants to improve code maintainability and consistency across the related files.
src/Persistence/Initialization/Updates/AddCrestOfMonarchDropGroupUpdateSeason6.cs
Show resolved
Hide resolved
| { | ||
| var map = gameConfiguration.Maps.First(m => m.Number == Icarus.Number && m.Discriminator == 0); | ||
| var lochsFeather = gameConfiguration.Items.First(item => item.Group == 13 && item.Number == 14); | ||
| var crestId = GuidHelper.CreateGuid<DropItemGroup>(Icarus.Number, 2); | ||
|
|
||
| var crestGroup = gameConfiguration.DropItemGroups.FirstOrDefault(group => group.GetId() == crestId); | ||
| if (crestGroup is null) | ||
| { | ||
| crestGroup = context.CreateNew<DropItemGroup>(); | ||
| crestGroup.SetGuid(Icarus.Number, 2); | ||
| gameConfiguration.DropItemGroups.Add(crestGroup); | ||
| } | ||
|
|
||
| crestGroup.Description = "Crest of Monarch"; | ||
| crestGroup.Chance = 0.001; | ||
| crestGroup.MinimumMonsterLevel = 82; | ||
| crestGroup.MaximumMonsterLevel = null; | ||
| crestGroup.ItemLevel = 1; | ||
| if (crestGroup.PossibleItems.Count != 1 || crestGroup.PossibleItems.First().GetItemId() != lochsFeather.GetItemId()) | ||
| { | ||
| crestGroup.PossibleItems.Clear(); | ||
| crestGroup.PossibleItems.Add(lochsFeather); | ||
| } | ||
|
|
||
| if (!map.DropItemGroups.Any(group => group.GetId() == crestGroup.GetId())) | ||
| { | ||
| map.DropItemGroups.Add(crestGroup); | ||
| } | ||
| } |
There was a problem hiding this comment.
This method contains several magic numbers (e.g., 13, 14, 2, 0.001, 82, 1). To improve readability and maintainability, consider defining these as named constants. This would also allow them to be shared with Icarus.cs and the test files, ensuring consistency.
For example, you could define constants at the class level:
private const byte LochsFeatherItemGroup = 13;
private const short LochsFeatherItemNumber = 14;
private const short CrestOfMonarchDropItemGroupId = 2;
private const double ItemDropChance = 0.001;
private const byte MinimumMonsterLevel = 82;
private const byte CrestOfMonarchItemLevel = 1;| Assert.That(groups[0].Description.ToString(), Is.EqualTo("Crest of Monarch")); | ||
| Assert.That(groups[0].Chance, Is.EqualTo(0.001)); | ||
| Assert.That(groups[0].MinimumMonsterLevel, Is.EqualTo((byte)82)); | ||
| Assert.That(groups[0].ItemLevel, Is.EqualTo((byte)1)); | ||
| Assert.That(groups[0].PossibleItems, Has.Count.EqualTo(1)); | ||
| Assert.That(groups[0].PossibleItems.Single().Group, Is.EqualTo((byte)13)); | ||
| Assert.That(groups[0].PossibleItems.Single().Number, Is.EqualTo((short)14)); |
There was a problem hiding this comment.
These assertions use hardcoded values (e.g., 82, 1, 13, 14). If you introduce constants for these magic numbers in the production code as suggested in other comments, please consider using those constants here as well. This makes the tests more robust to changes in these values and ensures consistency.
|
Can't tell why the build failed, managed to build it locally and run it just fine :( |
I think you can fix this by adding this line to the AssemblyInfo.cs in the Persistence.Initialization project: |
Adds a "Crest of Monarch" Drop Item group that drops a "Loch's feather +1" item, which is effectively a "Crest of Monarch" item, needed to craft "Cape of Lord" cape for Dark Lord class.
Asked LLM for help, I can read and understand C#, but I am not fluent in it.