Skip to content
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

SW tag that grants 1-time-use super weapons #1199

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from

Conversation

FS-21
Copy link
Contributor

@FS-21 FS-21 commented Feb 8, 2024

  • Now super weapons can add 1-time super weapons to the firer like the famous nuke crate.
  • SW.GrantOneTime.InitialReady specifies if all new granted superweapons will be ready for launch. If not set this behaviour will be managed by SW.InitialReady of the granted superweapon.
  • Message.GrantOneTimeLaunched will be displayed to the firer when the main superweapon is launched.
  • EVA.GrantOneTimeLaunched will be played to the firer when the main superweapon is launched.

In rulesmd.ini:

[SOMESW]                       ; Super Weapon
SW.GrantOneTime=               ; List of Superweapons
SW.GrantOneTime.InitialReady=  ; boolean
Message.GrantOneTimeLaunched=  ; CSF entry key
EVA.GrantOneTimeLaunched=      ; EVA entry
  • Tested in skirmish & in online and no desyncs were found.
  • This grants a list of super weapons of only 1 use. Is like if you picked a Nuke SW from a crate so if you remember it doesn't follow the standard checks of the super weapons like aux./neg buildings etc.

Summary by CodeRabbit

  • New Features
    • Enhanced gameplay with the ability to grant one-time superweapons, adding strategic depth to the game.
  • Documentation
    • Updated documentation to explain the new one-time superweapon granting system and its impact on gameplay.
  • Enhancements
    • Improved superweapon mechanics to support one-time use superweapons, including readiness management and in-game messaging for a better player experience.

- Superweapons can add 1-time superweapons to the firer like the famous nuke crate.
- `SW.GrantOneTime.InitialReady` specifies if all new granted superweapons will be ready for launch. If not set this behaviour will be managed by `SW.InitialReady` of the granted superweapon.
- `Message.GrantOneTimeLaunched` will be displayed to the firer when the main superweapon is launched.
- `EVA.GrantOneTimeLaunched` will be played to the firer when the main superweapon is launched.

In `rulesmd.ini`:
```ini
[SOMESW]                       ; Super Weapon
SW.GrantOneTime=               ; List of Superweapons
SW.GrantOneTime.InitialReady=  ; boolean
Message.GrantOneTimeLaunched=  ; CSF entry key
EVA.GrantOneTimeLaunched=      ; EVA entry
```

- Tested in skirmish & in online and no desyncs were found.
- This grants super weapons of only 1 use. Is like if you picked a Nuke SW from a crate so it doesn't follow the standard checks of the super weapons like aux./neg buildings etc.
Copy link

coderabbitai bot commented Feb 8, 2024

Walkthrough

The project introduced a new feature that allows the granting of one-time superweapons to units, similar to acquiring a nuke crate. This enhancement includes serialization for persistence, initial readiness state management, and user feedback through messages. Starkku and FS-21 contributed to these changes, focusing on improving gameplay dynamics by adding more strategic options for players.

Changes

Files Change Summary
docs/New-or-Enhanced-Logics.md Added functionality to grant new superweapons in superweapons, allowing superweapons to add 1-time superweapons to the firer like the nuke crate. Introduces parameters for managing readiness and messaging related to the granted superweapons.
src/Ext/SWType/Body.cpp, src/Ext/SWType/Body.h Added serialization and deserialization processes for SW_GrantOneTime, SW_GrantOneTime_InitialReady, SW_GrantOneTime_RandomWeightsData, SW_GrantOneTime_RollChances, Message_GrantOneTimeLaunched, and EVA_GrantOneTimeLaunched in the ExtData class. Added new member variables SW_GrantOneTime, SW_GrantOneTime_InitialReady, SW_GrantOneTime_RollChances, Message_GrantOneTimeLaunched, and EVA_GrantOneTimeLaunched, along with the method GrantOneTimeFromList, to the SWTypeExt class in Body.h.
src/Ext/SWType/FireSuperWeapon.cpp Added functionality to grant super weapons one time from a list based on certain conditions, including resetting readiness and displaying messages.

🐰✨
In the realm of code, where battles are fought,
A new power emerges, not sold but sought.
With a hop and a skip, Starkku's magic unfurls,
Granting one-time wonders, changing the world.
🚀💥


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 193223e and 8b5270c.
Files selected for processing (6)
  • CREDITS.md (1 hunks)
  • docs/New-or-Enhanced-Logics.md (1 hunks)
  • docs/Whats-New.md (1 hunks)
  • src/Ext/SWType/Body.cpp (2 hunks)
  • src/Ext/SWType/Body.h (3 hunks)
  • src/Ext/SWType/FireSuperWeapon.cpp (3 hunks)
Additional comments: 9
src/Ext/SWType/Body.h (2)
  • 66-69: Ensure the naming convention of the new member variables is consistent with the existing codebase and accurately reflects their purpose.
  • 130-130: The method GrantOneTimeFromList is correctly placed within the class and follows the naming conventions. Ensure its implementation aligns with the intended functionality.
src/Ext/SWType/Body.cpp (2)
  • 48-51: The serialization process for the new member variables is correctly implemented. Ensure it aligns with the project's data handling standards.
  • 187-190: The deserialization process for the new member variables from the INI file is correctly implemented. Verify that all necessary error handling and validation are in place.
src/Ext/SWType/FireSuperWeapon.cpp (2)
  • 37-38: The conditional check for the existence of one-time superweapons to grant is correctly implemented. Ensure the subsequent method call is properly handling all scenarios.
  • 322-378: The implementation of GrantOneTimeFromList method appears to correctly grant superweapons based on specified conditions. Ensure that performance implications of looping through superweapons and condition checks are acceptable and that all edge cases are handled.
CREDITS.md (1)
  • 132-132: The addition to the CREDITS.md file correctly acknowledges Starkku's contribution to the project. Ensure the formatting is consistent with the rest of the document.
docs/Whats-New.md (1)
  • 358-358: The addition of the feature to grant new superweapons in superweapons is documented. Ensure this feature is consistently referenced and detailed in other relevant documentation files to maintain coherence across the project documentation.
docs/New-or-Enhanced-Logics.md (1)
  • 652-667: The documentation clearly explains the new functionality for granting superweapons, including parameters for initial readiness, and user feedback through messages and EVA announcements.

Copy link

github-actions bot commented Feb 8, 2024

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

- Added the RandomWeights and RollChances tags like the ones used in LimboDelibery and SW.Next
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 8b5270c and 1bfa82f.
Files selected for processing (4)
  • docs/New-or-Enhanced-Logics.md (1 hunks)
  • src/Ext/SWType/Body.cpp (2 hunks)
  • src/Ext/SWType/Body.h (3 hunks)
  • src/Ext/SWType/FireSuperWeapon.cpp (3 hunks)
Files skipped from review as they are similar to previous changes (3)
  • docs/New-or-Enhanced-Logics.md
  • src/Ext/SWType/Body.cpp
  • src/Ext/SWType/FireSuperWeapon.cpp
Additional comments: 4
src/Ext/SWType/Body.h (4)
  • 63-63: Ensure SW_GrantOneTime_RandomWeightsData is used appropriately within the class, especially in the new GrantOneTimeFromList method, to manage the randomness of granting superweapons effectively.
  • 67-71: The addition of SW_GrantOneTime, SW_GrantOneTime_InitialReady, SW_GrantOneTime_RollChances, Message_GrantOneTimeLaunched, and EVA_GrantOneTimeLaunched variables is consistent with the PR objectives. Verify that these variables are properly initialized, serialized, and deserialized to ensure their correct functionality across game sessions.
  • 108-113: Initialization of the new member variables in the ExtData constructor is correct. However, ensure that Nullable and Valueable types are used appropriately throughout the class to handle optional and default values correctly, especially for SW_GrantOneTime_InitialReady and EVA_GrantOneTimeLaunched.
  • 134-134: The method GrantOneTimeFromList is crucial for the new feature. Ensure it correctly implements the logic for granting one-time-use superweapons, including handling the randomness, initial readiness, and user feedback through messages and EVA announcements. Additionally, verify that it properly interacts with other game systems and does not introduce any side effects or performance issues.

Copy link
Contributor

@Coronia Coronia left a comment

Choose a reason for hiding this comment

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

other than the issues in comment it looks fine

@Coronia
Copy link
Contributor

Coronia commented May 19, 2024

Honestly I'm not sure how'll SuperClass::Grant handle a superweapon that's already owned by the house. But I would suggest to add extra options for these already-existed SWs for more extendibility. An example below

In rulesmd.ini:

SW.GrantOneTime.ReadyIfExist= ; boolean, when the granted superweapon is already existed, its cooldown will be cleared if set to true
SW.GrantOneTime.ResetIfExist= ; boolean, when the granted superweapon is already existed, its cooldown will be reset if set to true

Technically you can even set superweapon's timer to any given value or percentage here

FS-21 added 5 commits August 28, 2024 17:13
Applied feedback from code reviews
SW.GrantOneTime.ReadyIfExists
SW.GrantOneTime.ResetIfExists
@FS-21
Copy link
Contributor Author

FS-21 commented Aug 29, 2024

Honestly I'm not sure how'll SuperClass::Grant handle a superweapon that's already owned by the house. But I would suggest to add extra options for these already-existed SWs for more extendibility. An example below

In rulesmd.ini:

SW.GrantOneTime.ReadyIfExist= ; boolean, when the granted superweapon is already existed, its cooldown will be cleared if set to true
SW.GrantOneTime.ResetIfExist= ; boolean, when the granted superweapon is already existed, its cooldown will be reset if set to true

Technically you can even set superweapon's timer to any given value or percentage here

Added, documented & tested these 2 tags in skirmish:
SW.GrantOneTime.ReadyIfExists
SW.GrantOneTime.ResetIfExists

Takes precedence this last one if requisites are met.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants