Skip to content

Commit 50990ad

Browse files
committed
Adjust health threshold checks again to make lower bound exclusive and ignore zero health technos.
1 parent 2479f3e commit 50990ad

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

docs/Fixed-or-Improved-Logics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,7 @@ Conventional.IgnoreUnits=false ; boolean
21112111

21122112
### Customizable Warhead trigger conditions
21132113

2114-
- It is now possible to make warheads only trigger when target's (TechnoTypes only) HP is above/below or equal to certain percentage. Both conditions need to evaluate to true in order for the warhead to trigger.
2114+
- It is now possible to make warheads only trigger when target's (TechnoTypes only) HP is above and/or below/equal to certain percentage. Both conditions need to evaluate to true in order for the warhead to trigger.
21152115
- If set to `false`, `AffectsNeutral` makes the warhead can't damage or affect target that belongs to neutral house.
21162116
- If set to `false`, `EffectsRequireVerses` makes the Phobos-introduced warhead effects trigger even if it can't damage the target because of it's current ArmorType (e.g. 0% in `Verses`).
21172117

docs/New-or-Enhanced-Logics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,7 +2119,7 @@ RemoveMindControl=false ; boolean
21192119
- `Crit.Warhead.FullDetonation` controls whether or not the Warhead is detonated fully on the targets (as part of a dummy weapon) or simply deals area damage and applies Phobos' Warhead effects.
21202120
- `Crit.Affects` can be used to customize types of targets that this Warhead can deal critical hits against. Critical hits cannot affect empty cells or cells containing only TerrainTypes, overlays etc.
21212121
- `Crit.AffectsHouses` can be used to customize houses that this Warhead can deal critical hits against.
2122-
- `Crit.AffectBelowPercent` and `Crit.AffectsAbovePercent` can be used to set the health percentage that targets must be below or above respectively to be affected by critical hits.
2122+
- `Crit.AffectBelowPercent` and `Crit.AffectsAbovePercent` can be used to set the health percentage that targets must be above and/or below/equal to respectively to be affected by critical hits.
21232123
- `Crit.AnimList` can be used to set a list of animations used instead of Warhead's `AnimList` if Warhead deals a critical hit to even one target. If `Crit.AnimList.PickRandom` is set (defaults to `AnimList.PickRandom`) then the animation is chosen randomly from the list. If `Crit.AnimList.CreateAll` is set (defaults to `AnimList.CreateAll`), all animations from the list are created.
21242124
- `Crit.AnimOnAffectedTargets`, if set, makes the animation(s) from `Crit.AnimList` play on each affected target *in addition* to animation from Warhead's `AnimList` playing as normal instead of replacing `AnimList` animation. Note that because these animations are independent from `AnimList`, `Crit.AnimList.PickRandom` and `Crit.AnimList.CreateAll` will not default to their `AnimList` counterparts here and need to be explicitly set if needed.
21252125
- `Crit.ActiveChanceAnims` can be used to set animation to be always displayed at the Warhead's detonation coordinates if the current Warhead has a chance to critically hit. If more than one animation is listed, a random one is selected.
@@ -2657,7 +2657,7 @@ This function is only used as an additional scattering visual display, which is
26572657
*`Weapon target filter - different weapon used against enemies & allies as well as units & buildings in [Project Phantom](https://www.moddb.com/mods/project-phantom)*
26582658

26592659
- You can now specify which targets or houses a weapon can fire at. This also affects weapon selection, other than certain special cases where the selection is fixed.
2660-
- `CanTarget.MaxHealth` and `CanTarget.MinHealth` set health percentage thresholds for allowed targets (TechnoTypes only), maximum/minimum respectively.
2660+
- `CanTarget.MaxHealth` and `CanTarget.MinHealth` set health percentage thresholds for allowed targets (TechnoTypes only) that the target's health must be above and/or below/equal to, respectively.
26612661

26622662
In `rulesmd.ini`:
26632663
```ini

src/Ext/Techno/Body.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,11 @@ bool TechnoExt::HandleDelayedFireWithPauseSequence(TechnoClass* pThis, int weapo
727727

728728
bool TechnoExt::IsHealthInThreshold(TechnoClass* pObject, double min, double max)
729729
{
730+
if (!pObject->Health)
731+
return true;
732+
730733
const double hp = pObject->GetHealthPercentage();
731-
return hp <= max && hp >= min;
734+
return hp < max && hp >= min;
732735
}
733736

734737
bool TechnoExt::CannotMove(UnitClass* pThis)

0 commit comments

Comments
 (0)