Mind Control Threshold
Now MC weapons can replace the Mind Control stuff by alternative warheads if the enemy health percentage is over the MindControl.threshold value.
More information in the documentation.
Nightly build for this pull request:
- compiled-dll-b9b02876d5445b029f8082696031bf50b6aacc39.zip This comment is automatic and is meant to allow guests to get latest nightly builds without registering. It is updated on every successful build.
Can't such functionality be implemented using Crit.AffectsBelowPercent already without any modifications to the code?
Can't such functionality be implemented using
Crit.AffectsBelowPercentalready without any modifications to the code?
MindControl is special logic that doesn't quite work through the critical hit system. The crit warhead wouldn't count as mind control warhead and the unit wouldn't have the CaptureManagerClass set up or the MC pips if it is its only MC weapon either.
Also there's no need to reinvent the wheel with the odd percentage parsing and health calculations. INI parser happily parses percentages to double and ObjectClass::GetHealthPercentage() exists.
Use MapClass::SelectDamageAnimation() to pick the animation to display from the new warhead instead of reimplementing all the checks yourself. Current implementation doesn't even consider Conventional and excludes stuff like SplashList.
Having the threshold without having to set the Damage and Warhead could also be desirable.
Perhaps having an option to invert threshold would be good? I already see two usecases:
- weaken enemy until mind controllable;
- kill enemy if he's too weak to be controlled.
Also there's no need to reinvent the wheel with the odd percentage parsing and health calculations. INI parser happily parses percentages to
doubleandObjectClass::GetHealthPercentage()exists.
The only reason to reinvent the wheel was that in the first implementations that method returned unrealistic huge numbers so I made calculations by hand as you can see. After reading this message and with the current checks the object returns valid values between 0.0 to 1.00000000... so I'll do the suggested changes.
Use
MapClass::SelectDamageAnimation()to pick the animation to display from the new warhead instead of reimplementing all the checks yourself. Current implementation doesn't even considerConventionaland excludes stuff likeSplashList.
Phobos develop branch doesn't use this method so the only 2 valid examples are located in Ares sources... I'll try later (because ask for values I never used like land Type etc) but the current animation code is C&P from Crit system so if is incomplete here the same there.
Having the threshold without having to set the Damage and Warhead could also be desirable.
I don't understand this, can you explain it, please?
Perhaps having an option to invert threshold would be good? I already see two usecases:
- weaken enemy until mind controllable;
- kill enemy if he's too weak to be controlled.
Yes, the 2 user cases you mentioned are covered with the current tags. I had in mind the multi-engineer logic from RA1.
I don't know if that is useful. Inverting the threshold means:
- Mind control units until the unit HP % is lower than the threshold, then the unit can be hurt to death.
Maybe a 'healer' that can MC units if the HP % is over the threshold?
Applied feedback with those 2 internal changes. Looks that anims from the alternative WH works with water etc.
Max Lenarc here, just reporting my attempt to test the Mind Control Threshold from a while ago since I have not posted here in Github. I doubt it will be useful though. Ultimately failed to get the feature to work, not sure why though. I have the latest nightly build with the code given to me on Mod Haven. I think it may be a case of the code being put in the wrong spot in the INI? INI looks like this. "[Controller] Verses=100%,100%,100%,100%,100%,100%,0%,0%,0%,0%,100% MindControl=yes AnimList=YURICNTL AffectsAllies=no
Versus.mcvheavy=0% Versus.mcvheavy.Retaliate=no Versus.mcvheavy.ForceFire=no Versus.mcvheavy.PassiveAcquire=no
Versus.t2mediump=0% Versus.t2mediump.Retaliate=no Versus.t2mediump.ForceFire=no Versus.t2mediump.PassiveAcquire=no
Versus.t2heavyp=0% Versus.t2heavyp.Retaliate=no Versus.t2heavyp.ForceFire=no Versus.t2heavyp.PassiveAcquire=no
Versus.t3heavyp=0% Versus.t3heavyp.Retaliate=no Versus.t3heavyp.ForceFire=no Versus.t3heavyp.PassiveAcquire=no
Versus.mindarm=0% Versus.mindarm.Retaliate=no Versus.mindarm.ForceFire=no Versus.mindarm.PassiveAcquire=no Versus.sbanearmor=0%
Transact=true
DamageAirThreshold=-1 ; boolean
Transact.SpreadAmongTargets=false ; boolean
Transact.Experience.Source.Flat=0 ; integer
Transact.Experience.Source.Percent=0.40 ; float, percents or absolute (-1.0 - 1.0)
Transact.Experience.Source.Percent.CalcFromTarget=true ; boolean
Transact.Experience.Target.Flat=0 ; integer
Transact.Experience.Target.Percent=0.0 ; float, percents or absolute (-1.0 - 1.0)
Transact.Experience.Target.Percent.CalcFromSource=false ; boolean
MindControl.Threshold= 25% ; positive percentage. Represents a percentage from 0% to 100% MindControl.AlternativeDamage= 50 ; integer MindControl.AlternativeWarhead= PsychoFire; warhead MindControl.CanKill= false ; boolean MindControl.Threshold.Inverse= false ; boolean
[PsychoFire] Wall=no Wood=no Sparky=yes Verses=100%,100%,100%,100%,100%,100%,50%,50%,50%,100%,100% Conventional=yes InfDeath=10 AnimList=UCINIT ProneDamage=75%" Both of these are under the Warheads list. Apologies in advance if this ends of being a waste of time, also for the wall of text. Tested this on Rise of the East.
Ultimately failed to get the feature to work, not sure why though. I have the latest nightly build with the code given to me on Mod Haven. I think it may be a case of the code being put in the wrong spot in the INI?
There are some errors in the documentation. It says "AlternativeDamage/Warhead" but the actual tags are "AlternateDamage/Warhead". It also says "the health’s victim" when it should say "the victim's health" or to be consistent with the ini tags, "the victim's strength".
Ultimately failed to get the feature to work, not sure why though. I have the latest nightly build with the code given to me on Mod Haven. I think it may be a case of the code being put in the wrong spot in the INI?
There are some errors in the documentation. It says "AlternativeDamage/Warhead" but the actual tags are "AlternateDamage/Warhead". It also says "the health’s victim" when it should say "the victim's health" or to be consistent with the ini tags, "the victim's strength".
I updated the tag names in the docs with your feedback.
Max Lenarc here, just reporting my attempt to test the Mind Control Threshold from a while ago since I have not posted here in Github. I doubt it will be useful though. Ultimately failed to get the feature to work, not sure why though. I have the latest nightly build with the code given to me on Mod Haven. I think it may be a case of the code being put in the wrong spot in the INI? INI looks like this. "[Controller] Verses=100%,100%,100%,100%,100%,100%,0%,0%,0%,0%,100% MindControl=yes AnimList=YURICNTL AffectsAllies=no
Versus.mcvheavy=0% Versus.mcvheavy.Retaliate=no Versus.mcvheavy.ForceFire=no Versus.mcvheavy.PassiveAcquire=no
Versus.t2mediump=0% Versus.t2mediump.Retaliate=no Versus.t2mediump.ForceFire=no Versus.t2mediump.PassiveAcquire=no
Versus.t2heavyp=0% Versus.t2heavyp.Retaliate=no Versus.t2heavyp.ForceFire=no Versus.t2heavyp.PassiveAcquire=no
Versus.t3heavyp=0% Versus.t3heavyp.Retaliate=no Versus.t3heavyp.ForceFire=no Versus.t3heavyp.PassiveAcquire=no
Versus.mindarm=0% Versus.mindarm.Retaliate=no Versus.mindarm.ForceFire=no Versus.mindarm.PassiveAcquire=no Versus.sbanearmor=0%
Transact=true DamageAirThreshold=-1 ; boolean Transact.SpreadAmongTargets=false ; boolean Transact.Experience.Source.Flat=0 ; integer Transact.Experience.Source.Percent=0.40 ; float, percents or absolute (-1.0 - 1.0) Transact.Experience.Source.Percent.CalcFromTarget=true ; boolean Transact.Experience.Target.Flat=0 ; integer Transact.Experience.Target.Percent=0.0 ; float, percents or absolute (-1.0 - 1.0) Transact.Experience.Target.Percent.CalcFromSource=false ; boolean
MindControl.Threshold= 25% ; positive percentage. Represents a percentage from 0% to 100% MindControl.AlternativeDamage= 50 ; integer MindControl.AlternativeWarhead= PsychoFire; warhead MindControl.CanKill= false ; boolean MindControl.Threshold.Inverse= false ; boolean
[PsychoFire] Wall=no Wood=no Sparky=yes Verses=100%,100%,100%,100%,100%,100%,50%,50%,50%,100%,100% Conventional=yes InfDeath=10 AnimList=UCINIT ProneDamage=75%" Both of these are under the Warheads list. Apologies in advance if this ends of being a waste of time, also for the wall of text. Tested this on Rise of the East.
The problem was the tag names, I updated the docs.
So that was the problem. Thanks for the info!
So that was the problem. Thanks for the info!
Try it so we can label it as tested
Got to testing it again. Everyone works as intended. Admittedly I misunderstood what MindControl.Threshold.Inverse did at first; I thought it killed Mind Controlled units under the Threshold, not kill unit enemy units under the Threshold. I think it is good to go. One of the coolest logics I've seen here!
Finally I remade it, simplified it and in the way fixing the only nasty bug it had :-D
Nightly build for this pull request:
- compiled-dll-767cbde54464cb44a90c8285436f40bf66e36d2c.zip These artifacts will expire in 90 days and will not be available for download after that time.
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.
[!WARNING]
Rate Limit Exceeded
@FS-21 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 28 minutes and 45 seconds before requesting another review.
How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the
@coderabbitai reviewcommand as a PR comment. Alternatively, push new commits to this PR.We recommend that you space out your commits to avoid hitting the rate limit.
How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information.
Commits
Files that changed from the base of the PR and between eef9bc09a7ddb490667bb65cc777dbe91d592ba3 and b97dde5b249c0b08add2fcddd00eb923580f5bf5.
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?
Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>.Generate unit-tests for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit tests for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin 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 tests.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger a review. This is useful when automatic reviews are disabled for the repository.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai helpto get help.
Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
CodeRabbit Configration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - The JSON schema for the configuration file is available here.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json
CodeRabbit Discord Community
Join our Discord Community to get help, request features, and share feedback.