Skip to content

Commit 4f73031

Browse files
committed
Fixed big mistake
- I used a wrong function for cheking the damage value xD - Small changes so now it doesn't skip code in ReceiveDamage hook.
1 parent b87371e commit 4f73031

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/Ext/RadSite/Body.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ bool RadSiteExt::ExtData::ApplyRadiationDamage(TechnoClass* pTarget, int& damage
1717
auto const pWHExt = WarheadTypeExt::ExtMap.Find(pWarhead);
1818

1919
// Check if the WH should affect the techno target or skip it
20-
double versus = MapClass::GetTotalDamage(damage, pWarhead, pTarget->GetTechnoType()->Armor, 0);
21-
int nDamageTotal = static_cast<int>(damage * versus);
20+
int nDamageTotal = MapClass::GetTotalDamage(damage, pWarhead, pTarget->GetTechnoType()->Armor, 0);
2221

2322
if (pTarget->Health > 0 && !pWHExt->CanKill && nDamageTotal >= pTarget->Health)
2423
{
24+
damage = 0;
2525
pTarget->Health = 1;
2626
pTarget->EstimatedHealth = 1;
2727

src/Ext/Techno/Hooks.ReceiveDamage.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ DEFINE_HOOK(0x701900, TechnoClass_ReceiveDamage_Shield, 0x6)
2020
const auto pExt = TechnoExt::ExtMap.Find(pThis);
2121

2222
int nDamageLeft = *args->Damage;
23-
double versus = MapClass::GetTotalDamage(nDamageLeft, args->WH, pThis->GetTechnoType()->Armor, 0);
24-
int nDamageTotal = static_cast<int>(nDamageLeft * versus);
23+
int nDamageTotal = MapClass::GetTotalDamage(nDamageLeft, args->WH, pThis->GetTechnoType()->Armor, 0);
2524
auto const pWHExt = WarheadTypeExt::ExtMap.Find(args->WH);
2625

2726
if (!args->IgnoreDefenses)
@@ -36,8 +35,7 @@ DEFINE_HOOK(0x701900, TechnoClass_ReceiveDamage_Shield, 0x6)
3635
*args->Damage = 0;
3736
pThis->Health = 1;
3837
pThis->EstimatedHealth = 1;
39-
40-
return SkipGameCode;
38+
ReceiveDamageTemp::SkipLowDamageCheck = true;
4139
}
4240

4341
return 0;
@@ -59,15 +57,14 @@ DEFINE_HOOK(0x701900, TechnoClass_ReceiveDamage_Shield, 0x6)
5957
}
6058

6159
// Update remaining damage and check if the target will die and should be avoided
62-
nDamageTotal = static_cast<int>(nDamageLeft * versus);
60+
nDamageTotal = MapClass::GetTotalDamage(nDamageLeft, args->WH, pThis->GetTechnoType()->Armor, 0);
6361

6462
if (pThis->Health > 0 && !pWHExt->CanKill && nDamageTotal >= pThis->Health)
6563
{
6664
*args->Damage = 0;
6765
pThis->Health = 1;
6866
pThis->EstimatedHealth = 1;
69-
70-
return SkipGameCode;
67+
ReceiveDamageTemp::SkipLowDamageCheck = true;
7168
}
7269

7370
return 0;

0 commit comments

Comments
 (0)