Skip to content

Commit 1830fd0

Browse files
committed
NegativeDamage.Multiplier
1 parent eff2cf0 commit 1830fd0

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

docs/New-or-Enhanced-Logics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ This page describes all the engine features that are either new and introduced b
8181
- `DisableWeapons` can be used to disable ability to fire any and all weapons.
8282
- On TechnoTypes with `OpenTopped=true`, `OpenTopped.CheckTransportDisableWeapons` can be set to true to make passengers not be able to fire out if transport's weapons are disabled by `DisableWeapons`.
8383
- `Unkillable` can be used to prevent the techno from being killed by taken damage (minimum health will be 1).
84-
- `PreventNegativeDamage` can be used to prevent the techno from taking negative damage. This includes both negative `Damage` and negative `Verses`.
84+
- `NegativeDamage.Multiplier` will be multiplied on the negative damage taken by the attached object. This includes both negative `Damage` and negative `Verses`.
8585
- It is possible to set groups for attach effect types by defining strings in `Groups`.
8686
- Groups can be used instead of types for removing effects and weapon filters.
8787

@@ -200,7 +200,7 @@ ReflectDamage.Override= ; integer
200200
ReflectDamage.UseInvokerAsOwner=false ; boolean
201201
DisableWeapons=false ; boolean
202202
Unkillable=false ; boolean
203-
PreventNegativeDamage=false ; boolean
203+
NegativeDamage.Multiplier=1.0 ; floating point value
204204
LaserTrail.Type= ; lasertrail type
205205
Groups= ; comma-separated list of strings (group IDs)
206206

src/Ext/Techno/Body.Update.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void TechnoExt::ExtData::OnEarlyUpdate()
4343
this->ApplyMindControlRangeLimit();
4444
this->UpdateRecountBurst();
4545
this->UpdateRearmInEMPState();
46-
46+
4747
if (this->AttackMoveFollowerTempCount)
4848
{
4949
this->AttackMoveFollowerTempCount--;
@@ -1833,11 +1833,11 @@ void TechnoExt::ExtData::RecalculateStatMultipliers()
18331833
double armor = 1.0;
18341834
double speed = 1.0;
18351835
double ROF = 1.0;
1836+
double negativeDamage = 1.0;
18361837
bool cloak = false;
18371838
bool forceDecloak = false;
18381839
bool disableWeapons = false;
18391840
bool unkillable = false;
1840-
bool preventNegativeDamage = false;
18411841
bool hasRangeModifier = false;
18421842
bool hasTint = false;
18431843
bool reflectsDamage = false;
@@ -1857,11 +1857,11 @@ void TechnoExt::ExtData::RecalculateStatMultipliers()
18571857
speed *= type->SpeedMultiplier;
18581858
armor *= type->ArmorMultiplier;
18591859
ROF *= type->ROFMultiplier;
1860+
negativeDamage *= type->NegativeDamage_Multiplier;
18601861
cloak |= type->Cloakable;
18611862
forceDecloak |= type->ForceDecloak;
18621863
disableWeapons |= type->DisableWeapons;
18631864
unkillable |= type->Unkillable;
1864-
preventNegativeDamage |= type->PreventNegativeDamage;
18651865
hasRangeModifier |= (type->WeaponRange_ExtraRange != 0.0 || type->WeaponRange_Multiplier != 0.0);
18661866
hasTint |= type->HasTint();
18671867
reflectsDamage |= type->ReflectDamage;
@@ -1876,11 +1876,11 @@ void TechnoExt::ExtData::RecalculateStatMultipliers()
18761876
pAE.ArmorMultiplier = armor;
18771877
pAE.SpeedMultiplier = speed;
18781878
pAE.ROFMultiplier = ROF;
1879+
pAE.NegativeDamageMultiplier = negativeDamage;
18791880
pAE.Cloakable = cloak;
18801881
pAE.ForceDecloak = forceDecloak;
18811882
pAE.DisableWeapons = disableWeapons;
18821883
pAE.Unkillable = unkillable;
1883-
pAE.PreventNegativeDamage = preventNegativeDamage;
18841884
pAE.HasRangeModifier = hasRangeModifier;
18851885
pAE.HasTint = hasTint;
18861886
pAE.ReflectDamage = reflectsDamage;

src/Ext/Techno/Hooks.ReceiveDamage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ DEFINE_HOOK(0x701900, TechnoClass_ReceiveDamage_Shield, 0x6)
138138
ReceiveDamageTemp::SkipLowDamageCheck = true;
139139
}
140140

141-
if (pExt->AE.PreventNegativeDamage && nDamageLeft != 0 && pWHExt->CanTargetHouse(pSourceHouse, pThis)
141+
if (pExt->AE.NegativeDamageMultiplier != 1.0 && nDamageLeft != 0 && pWHExt->CanTargetHouse(pSourceHouse, pThis)
142142
&& MapClass::GetTotalDamage(nDamageLeft, args->WH, pThis->GetTechnoType()->Armor, args->DistanceToEpicenter) < 0)
143143
{
144-
damage = 0;
144+
damage = static_cast<int>(damage * pExt->AE.NegativeDamageMultiplier);
145145
}
146146
}
147147

src/New/Entity/AttachEffectClass.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ struct AttachEffectTechnoProperties
9696
double ArmorMultiplier;
9797
double SpeedMultiplier;
9898
double ROFMultiplier;
99+
double NegativeDamageMultiplier;
99100
bool Cloakable;
100101
bool ForceDecloak;
101102
bool DisableWeapons;
102103
bool Unkillable;
103-
bool PreventNegativeDamage;
104104
bool HasRangeModifier;
105105
bool HasTint;
106106
bool ReflectDamage;
@@ -115,11 +115,11 @@ struct AttachEffectTechnoProperties
115115
, ArmorMultiplier { 1.0 }
116116
, SpeedMultiplier { 1.0 }
117117
, ROFMultiplier { 1.0 }
118+
, NegativeDamageMultiplier { 1.0 }
118119
, Cloakable { false }
119120
, ForceDecloak { false }
120121
, DisableWeapons { false }
121122
, Unkillable { false }
122-
, PreventNegativeDamage { false }
123123
, HasRangeModifier { false }
124124
, HasTint { false }
125125
, ReflectDamage { false }

src/New/Entity/ShieldClass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ int ShieldClass::ReceiveDamage(args_ReceiveDamage* args)
222222
const int maxDmg = static_cast<int>(max * pWHExt->Shield_ReceivedDamage_MaxMultiplier);
223223
shieldDamage = Math::clamp(shieldDamage, minDmg, maxDmg);
224224

225-
if (shieldDamage < 0 && TechnoExt::ExtMap.Find(pTechno)->AE.PreventNegativeDamage)
226-
shieldDamage = 0;
225+
if (shieldDamage < 0)
226+
shieldDamage = static_cast<int>(shieldDamage * TechnoExt::ExtMap.Find(pTechno)->AE.NegativeDamageMultiplier);
227227

228228
if (Phobos::DisplayDamageNumbers && shieldDamage != 0)
229229
GeneralUtils::DisplayDamageNumberString(shieldDamage, DamageDisplayType::Shield, pTechno->GetRenderCoords(), TechnoExt::ExtMap.Find(pTechno)->DamageNumberOffset);

src/New/Type/AttachEffectTypeClass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ void AttachEffectTypeClass::LoadFromINI(CCINIClass* pINI)
195195

196196
this->DisableWeapons.Read(exINI, pSection, "DisableWeapons");
197197
this->Unkillable.Read(exINI, pSection, "Unkillable");
198-
this->PreventNegativeDamage.Read(exINI, pSection, "PreventNegativeDamage");
198+
this->NegativeDamage_Multiplier.Read(exINI, pSection, "NegativeDamage.Multiplier");
199199
this->LaserTrail_Type.Read(exINI, pSection, "LaserTrail.Type");
200200

201201
// Groups
@@ -293,7 +293,7 @@ void AttachEffectTypeClass::Serialize(T& Stm)
293293
.Process(this->ReflectDamage_UseInvokerAsOwner)
294294
.Process(this->DisableWeapons)
295295
.Process(this->Unkillable)
296-
.Process(this->PreventNegativeDamage)
296+
.Process(this->NegativeDamage_Multiplier)
297297
.Process(this->LaserTrail_Type)
298298
.Process(this->Groups)
299299
;

src/New/Type/AttachEffectTypeClass.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class AttachEffectTypeClass final : public Enumerable<AttachEffectTypeClass>
127127
Valueable<bool> ReflectDamage_UseInvokerAsOwner;
128128
Valueable<bool> DisableWeapons;
129129
Valueable<bool> Unkillable;
130-
Valueable<bool> PreventNegativeDamage;
130+
Valueable<double> NegativeDamage_Multiplier;
131131
ValueableIdx<LaserTrailTypeClass> LaserTrail_Type;
132132

133133
std::vector<std::string> Groups;
@@ -219,7 +219,7 @@ class AttachEffectTypeClass final : public Enumerable<AttachEffectTypeClass>
219219
, ReflectDamage_UseInvokerAsOwner { false }
220220
, DisableWeapons { false }
221221
, Unkillable { false }
222-
, PreventNegativeDamage { false }
222+
, NegativeDamage_Multiplier { 1.0 }
223223
, LaserTrail_Type { -1 }
224224
, Groups {}
225225
{};

0 commit comments

Comments
 (0)