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

Warhead that can not kill #1518

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

Conversation

FS-21
Copy link
Contributor

@FS-21 FS-21 commented Feb 5, 2025

  • Warheads can now damage the enemy without killing them (minimum health will be 1).
  • I tested this tag against conventional weapons and radiation types.

In rulesmd.ini:

[SOMEWARHEAD] ; Warhead
CanKill=true; boolean

FS-21 added 2 commits February 5, 2025 09:11
- Warheads can now damage the enemy without killing them (minimum health will be 1).
- Verified in conventional weapons and radiation types.

In `rulesmd.ini`:

[SOMEWARHEAD]  ; Warhead
CanKill=false  ; boolean
CanKill is by default true
Copy link

github-actions bot commented Feb 5, 2025

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.

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.

idk if setting the target's health to 1 is the correct way, since there's other logic that rely damage greater than 0 to work. Perhaps it would be safer to set the damage to current health - 1.

Also those check warning issues should be fixed as well.

regarding the WH re-declaration warning and the double to int
@FS-21
Copy link
Contributor Author

FS-21 commented Feb 6, 2025

Since this code was born from a split from another feature I forgot to delete the WH declaration of the posterior if-else :-D thanks!

And I'm against to set -1 since all the games's logic understand positive values but I don't know how are the checks with negative ones. Moreover, probably lots of Phobos checks could break because some checks could be written against health=0 and not negative health (I don't have time for confirming it).

The only reason of the feature is that in case of having a weapon that can potentially kill the object (due to the gamage value and the target's current health) it just leave only 1 point of life, anything else will be able to kill it.

Useful for debuff/plagues, auxiliary logics, etc. This had in mind the PR #1398 and both together fulfills the closed #627

@Metadorius
Copy link
Member

And I'm against to set -1 since all the games's logic understand positive values but I don't know how are the checks with negative ones. Moreover, probably lots of Phobos checks could break because some checks could be written against health=0 and not negative health (I don't have time for confirming it).

You misunderstood. @Coronia meant that instead of setting health to 1 it's better to modify the damage before actually applying anything to deal current health - 1 amount of damage, this way it won't be possible for health to go lower than 1.

@FS-21
Copy link
Contributor Author

FS-21 commented Feb 6, 2025

You misunderstood. @Coronia meant that instead of setting health to 1 it's better to modify the damage before actually applying anything to deal current health - 1 amount of damage, this way it won't be possible for health to go lower than 1.

I see, sorry I though wrongly it was that different approach when I readed the message :-P
Anyways (unless a skilled one enlight me why I'm thinking wrongly) you can't simply reduce the damage value (integer) until it matches health 1 because the armour (double) calculation not done here and probably other multipliers.
Try to get a value to find the health= 1 if the weapon damage does 125 and it uses a warhead with a 12500% against that target's armour.

Isn't simplier this approach that if the final calculation surpasses the target's health set that minimum health and skip the checks for ending it?

@Otamaa
Copy link
Contributor

Otamaa commented Feb 6, 2025

You misunderstood. @Coronia meant that instead of setting health to 1 it's better to modify the damage before actually applying anything to deal current health - 1 amount of damage, this way it won't be possible for health to go lower than 1.

I see, sorry I though wrongly it was that different approach when I readed the message :-P Anyways (unless a skilled one enlight me why I'm thinking wrongly) you can't simply reduce the damage value (integer) until it matches health 1 because the armour (double) calculation not done here and probably other multipliers. Try to get a value to find the health= 1 if the weapon damage does 125 and it uses a warhead with a 12500% against that target's armour.

Isn't simplier this approach that if the final calculation surpasses the target's health set that minimum health and skip the checks for ending it?

if you return that early , isnt that mean you will skip some of ares affect then , is it intended behavoiur ?.

- I used a wrong function for cheking the damage value xD
- Small changes so now it doesn't skip code in ReceiveDamage hook.
@FS-21
Copy link
Contributor Author

FS-21 commented Feb 6, 2025

if you return that early , isnt that mean you will skip some of ares affect then , is it intended behavoiur ?.

I changed that behaviour so now it doesn't skip code. I don't see any side effects.

@Coronia
Copy link
Contributor

Coronia commented Feb 13, 2025

correct me if I'm wrong, but I think all ReceiveDamage call for techno will go through (0x701900, TechnoClass_ReceiveDamage_Shield) hook, so I'm not sure if a specific handler should be made for rad here. And it might again skip some logic related to receive damage (e.g. shield damage calculation)

CrimRecya and others added 6 commits February 14, 2025 00:27
Co-Authored-By: Netsu_Negi <71598172+NetsuNegi@users.noreply.github.com>
…e on uncrushable unit (Phobos-developers#1529)

- Fix an issue where a unit will leave an impassable invisible barrier
in its original position when it is teleported by ChronoSphere onto an
uncrushable unit and self destruct.

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

Successfully merging this pull request may close these issues.

5 participants