-
-
Notifications
You must be signed in to change notification settings - Fork 110
Penetration damage on garrisonable structures #1370
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
base: develop
Are you sure you want to change the base?
Penetration damage on garrisonable structures #1370
Conversation
- Warheads can now damage garrisoned infantry at impact. - `GarrisonPenetration` Enables the logic. - `GarrisonPenetration.RandomTarget` specifies if the damage will go at some random garrisoned soldier or if all infantry should be damaged at the same time. - `GarrisonPenetration.DamageMultiplier` can be used to modify the damage applied against the garrisoned infantry. A random percentage value will be picked between the specified range. - `GarrisonPenetration.CleanSound` can be used to specify a sound to play when the structure lost all the garrisoned soldiers with this logic. - `ImmuneToGarrisonPenetration` can be set on garrisonable buildings to protect the garrisoned infantry. If used on infantry these units won't affected by this logic. In `rulesmd.ini`: [SOMEWARHEAD] ; Warhead GarrisonPenetration=false ; boolean GarrisonPenetration.RandomTarget=true ; boolean GarrisonPenetration.DamageMultiplier=1.0,1.0 ; floating point value - single or comma-sep. range (percentages) GarrisonPenetration.CleanSound= ; sound entry [SOMETECHNO] ; TechnoType ImmuneToGarrisonPenetration=false ; boolean
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. |
Isn't it similar to Ares Pass Through? https://ares-developers.github.io/Ares-docs/new/buildings/urbancombattrenches.html |
There were some issues with that garrison logic that i do not remember right now, and this feature here might allow for better control over what can get cleared and what not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest to change these tags' names into PenetratesGarrison
, to keep consistent with the already exists PenetratesBunker
tag
src/Ext/WarheadType/Detonate.cpp
Outdated
damage = MapClass::GetTotalDamage(damage, pWH, pPassenger->Type->Armor, 0); | ||
|
||
pPassenger->Health = pPassenger->Health - damage; | ||
pPassenger->Health = pPassenger->Health < 0 ? 0 : pPassenger->Health; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging these 2 lines into 1:
pPassenger->Health = Math::clamp(pPassenger->Health - damage, 0, pPassenger->Type->Strength);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pPassenger->Health = Math::clamp(pPassenger->Health - damage, 0, pPassenger->Type->Strength);
I don't understand the use of pPassenger->Type->Strength here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we're now supporting negative damage for PenetrateGarrison, this is for preventing it from gaining more health than its limit. It can be ignored if there're already some other sorts of check elsewhere tho
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mean, since I never used that clamp method before:
Example:
Passenger->Health = 50
damage = -25 (healer example)
pPassenger->Type->Strength = 300
Current code:
Passenger->Health = 50 - (-25) = 75;
pPassenger->Health = 75 < 0 ? 0 : 75;
That new line for merging code:
pPassenger->Health = Math::clamp(75, 0, 300);
It does return "pPassenger->Health = 75" ? Just ignorant question
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does, clamp will return a value that's between minimum and maximum values, which are 0 and 300 in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the right answer of the example is 75, not 300 that is the max health the unit can have :-/
2128644
to
799ea22
Compare
From GarrisonPenetration to PenetratesGarrison
src/Ext/WarheadType/Detonate.cpp
Outdated
if (pTypeExt->ImmuneToPenetratesGarrison) | ||
return; | ||
|
||
damage = MapClass::GetTotalDamage(damage, pWH, pPassenger->Type->Armor, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should consider distance between epicenter as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are infantry gathered together inside a structure, I don't understand the point :-/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's about judging the distance between the warhead's detonation point and the garrisoned building, which is still necessary. Imagine the case when using a neutron bomb with large cellspread on these buildings, it's expected that infantry garrisoned in the edge should take less damage than those in the center
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you can't point at garrisoned infantry directly (maybe if the Techno Attachment is merged into develop, someday?).
If adding that change doesn't affect the current behaviour I'll check how is done in another part of the project and apply the suggested change here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can simply calculate the distance between the warhead's detonation point and the garrisoned building in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how should be done since I see no similar examples in Phobos.
Is this?
int distanceFromCenter = pTarget->DistanceFrom(pPassenger);
damage = MapClass::GetTotalDamage(damage, pWH, pPassenger->Type->Armor, distanceFromCenter);
or:
int distanceFromCenter = pBullet->DistanceFrom(pTarget);
damage = MapClass::GetTotalDamage(damage, pWH, pPassenger->Type->Armor, distanceFromCenter);
or:
int distanceFromCenter = pBullet->DistanceFrom(pPassenger);
damage = MapClass::GetTotalDamage(damage, pWH, pPassenger->Type->Armor, distanceFromCenter);
or none of the above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be the second one
b429215
to
280b1c8
Compare
…es-garrison # Conflicts: # CREDITS.md # YRpp # src/Ext/TechnoType/Body.cpp # src/Ext/WarheadType/Detonate.cpp
feba95c
to
7809074
Compare
PenetratesGarrison
Enables the logic.PenetratesGarrison.RandomTarget
specifies if the damage will go at some random garrisoned soldier or if all infantry should be damaged at the same time.PenetratesGarrison.DamageMultiplier
can be used to modify the damage applied against the garrisoned infantry. A random percentage value will be picked between the specified range.PenetratesGarrison.CleanSound
can be used to specify a sound to play when the structure lost all the garrisoned soldiers with this logic.PenetratesGarrison.Allowed
can be set on garrisonable buildings to protect the garrisoned infantry. If used on infantry these units won't affected by this logic.In
rulesmd.ini
: