Skip to content

Warhead activation target health thresholds #1398

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

Conversation

Metadorius
Copy link
Member

Customizable Warhead trigger conditions

  • It is now possible to make warheads only trigger when target's HP is above and/or below certain percentage.
    • Both conditions need to evaluate to true in order for the warhead to trigger.

In rulesmd.ini:

[SOMEWARHEAD]               ; WarheadType
AffectsAbovePercent=0.0     ; floating point value, percents or absolute
AffectsBelowPercent=1.0     ; floating point value, percents or absolute

@Metadorius
Copy link
Member Author

This PR is supposed to be a reimpl. of #627. @FS-21 please verify that it can achieve the same functionality, keeping in mind what we commented earlier.

Copy link

github-actions bot commented Sep 27, 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.

@FS-21
Copy link
Contributor

FS-21 commented Oct 1, 2024

So basically we have to set multiple warheads in the same weapon and depending the threshold of the damage produced by the warhead it does any damage (or not)? Is for preparing the tests

@Metadorius
Copy link
Member Author

depending the threshold of the damage produced

No, depending on the target health at the moment of hit.

@Metadorius
Copy link
Member Author

Otherwise you're correct.

@FS-21
Copy link
Contributor

FS-21 commented Oct 1, 2024

So you said:

1º) The weapon hits the target.
2º) Checks the target health
3º) checks if there are the 2 new tags
4º) if meets the criteria the weapon works or does nothing if doesn't meet the criteria of the new 2 tags.

I tried With a Yuri mind control weapon (as the ones used in #627 ):

[EMindControl]
Damage=1 ;Number of mind control links
ROF=20
Range=7
Projectile=PsychicControl
Speed=100
Warhead=PsyController
Anim=YURICNTL
FireOnce=yes
CanTargetHouses=enemies

[PsyController] ;Mind control warhead. Will skip normal damage like EMP did
Verses=100%,100%,100%,100%,0%,100%,0%,0%,0%,100%,100%
MindControl=yes
AnimList=YURICNTL
; ...
PenetratesBunker=no
AffectsAbovePercent=0.0 ; floating point value, percents or absolute
AffectsBelowPercent=0.5 ; floating point value, percents or absolute

It ignores this new logic and mind controls the target. Same with ExtraWarheads logic.

Anotehr test in a Chrono legionnaire temporal weapon
[ChronoBeam]
Verses=100%,100%,100%,100%,100%,100%,100%,100%,100%,100%,0%
Temporal=yes
Versus.ImmuneToTemporal_concrete_armor=0%
Versus.defender_armor=0%
Versus.defender_armor.ForceFire=no
Versus.defender_armor.Retaliate=no
Versus.defender_armor.PassiveAcquire=no
AffectsAbovePercent=0.0 ; floating point value, percents or absolute
AffectsBelowPercent=0.5 ; floating point value, percents or absolute

These tags are ignored and attacks & erase the target.
I also tried the Ares KillDriver=yes logic in WH and the same, these tags doesn't work

@FS-21
Copy link
Contributor

FS-21 commented Oct 1, 2024

Wait, I checked in the code that exists a EffectsRequireVerses=false, I want re-test these cases sicne they should be considered effects.
EDIT: nah, it still doesn't works

@Metadorius
Copy link
Member Author

Meh I know what's the issue, currently it only applies to Phobos warhead effects... will see later if it's possible to fix this

@FS-21
Copy link
Contributor

FS-21 commented Oct 1, 2024

If helps : 0x4690B0 -> void __thiscall BulletClass::Logics(BulletClass *this, CoordStruct *coords) <- controls some WH effects (or all, I don't remember. Is what I was using in #627 for replacing the original warhead by another one if the threshold was reached)

@Metadorius
Copy link
Member Author

If helps : 0x4690B0 -> void __thiscall BulletClass::Logics(BulletClass *this, CoordStruct *coords) <- controls some WH effects (or all, I don't remember. Is what I was using in #627 for replacing the original warhead by another one if the threshold was reached)

Yeah I am looking at this one too. I figured I'll ask other devs since for some reason it isn't hooked in order to be able to control all effects, might be cause of Ares. I might just move that check in the beginning of the function.

@FS-21
Copy link
Contributor

FS-21 commented Feb 4, 2025

I updated the code with the suggested changes and I did basic tests and looks that it just works.

Copy link
Member Author

@Metadorius Metadorius left a comment

Choose a reason for hiding this comment

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

@FS-21 couple of changes, also @Starkku please have a look too

- The important code chunk that is repeated converted into a function:
bool IsHealthInThreshold(TechnoClass* pTarget) const;
- Small code tweaks.
- Added contribution in credits file.
@FS-21
Copy link
Contributor

FS-21 commented Feb 6, 2025

Applied feedback, pending that question between devs.

@FS-21 FS-21 mentioned this pull request Feb 6, 2025
Starkku
Starkku previously requested changes Feb 6, 2025
Copy link
Contributor

@Starkku Starkku left a comment

Choose a reason for hiding this comment

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

Besides the thing I mentioned in comments about applying EffectsRequireVerses on ExtraWarheads not being appropriate, there's this one other thing that probably needs changing.

Removed extra checks I added regarding effects.
Metadorius and others added 2 commits February 12, 2025 13:17
replacing code with a function that does the same
@FS-21
Copy link
Contributor

FS-21 commented Feb 19, 2025

Finally I tested this online and no desyncs. Then should this be merged?

@Metadorius Metadorius force-pushed the feature/warhead-activation-threshold branch from 04ac501 to c19d8bc Compare February 20, 2025 12:51
@FS-21
Copy link
Contributor

FS-21 commented Feb 21, 2025

I just noticed EffectsRequireVerses is true by default and the documentation mentions it is false by default.

I'll change the docs later

A suicide weapon (like the demolition truck) didn't trigger the weapon damage, only played the hit animation
@Coronia Coronia added the ⚙️T1 T1 maintainer review is sufficient label Mar 25, 2025
@Coronia
Copy link
Contributor

Coronia commented Mar 28, 2025

tested, and it can do the effect we've expected: setting a series of ExtraWarheads with each of them having a warhead activation threshold, then it can detonate different warhead based on the target's strength

@Coronia Coronia requested a review from Starkku May 26, 2025 03:19
@Starkku Starkku dismissed their stale review June 13, 2025 12:11

Outdated

Copy link
Contributor

@Starkku Starkku left a comment

Choose a reason for hiding this comment

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

LGTM.

@Metadorius Metadorius merged commit fc7d6a4 into Phobos-developers:develop Jun 13, 2025
6 checks passed
DeathFishAtEase added a commit to DeathFishAtEase/Phobos that referenced this pull request Jun 15, 2025
Phobos-developers#1398
AffectsAbovePercent
AffectsBelowPercent
EffectsRequireVerses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix and merge this ⚙️T1 T1 maintainer review is sufficient Tested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants