Phobos icon indicating copy to clipboard operation
Phobos copied to clipboard

SW tag that grants 1-time-use super weapons

Open FS-21 opened this issue 1 year ago • 9 comments

  • Superweapons can add 1-time superweapons to the firer like the nuke crate. Granted types can be additionally randomized using the same rules as with LimboDelivery (see above).
  • 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.
  • SW.GrantOneTime.ReadyIfExists specifies if superweapons should be ready for launch if already exists. If not set this behaviour will be managed by SW.GrantOneTime.InitialReady or SW.InitialReady of the granted superweapon.
  • SW.GrantOneTime.ResetIfExists specifies if superweapons timers should be reset if already exists. Takes precedence over SW.GrantOneTime.ReadyIfExists, SW.GrantOneTime.InitialReady and SW.InitialReady.
  • 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.
  • These superweapons can be made random with these optional tags. The game will randomly choose only a single superweapon from the list for each roll chance provided.
    • SW.GrantOneTime.RollChances lists chances of each "dice roll" happening. Valid values range from 0% (never happens) to 100% (always happens). Defaults to a single sure roll.
    • SW.GrantOneTime.RandomWeightsN lists the weights for each "dice roll" that increase the probability of picking a specific superweapon. Valid values are 0 (don't pick) and above (the higher value, the bigger the likelyhood). RandomWeights are a valid alias for RandomWeights0. If a roll attempt doesn't have weights specified, the last weights will be used.

In rulesmd.ini:

[SOMESW]                             ; Super Weapon
SW.GrantOneTime=                     ; List of super weapons
SW.GrantOneTime.RollChances=         ; List of percentages.
SW.GrantOneTime.RandomWeightsN=      ; List of integers.
SW.GrantOneTime.InitialReady=        ; boolean
SW.GrantOneTime.ReadyIfExists=       ; boolean
SW.GrantOneTime.ResetIfExists=false  ; 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.

FS-21 avatar Feb 08 '24 05:02 FS-21

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:

:bangbang: 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

coderabbitai[bot] avatar Feb 08 '24 05:02 coderabbitai[bot]

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.

github-actions[bot] avatar Feb 08 '24 06:02 github-actions[bot]

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

Coronia avatar May 19 '24 10:05 Coronia