|
8 | 8 | #include <Ext/Techno/Body.h>
|
9 | 9 | #include <Misc/FlyingStrings.h>
|
10 | 10 | #include <Utilities/Constructs.h>
|
| 11 | +#include "AresHelper.h" |
11 | 12 |
|
12 | 13 | bool GeneralUtils::IsValidString(const char* str)
|
13 | 14 | {
|
@@ -70,23 +71,38 @@ const double GeneralUtils::GetRangedRandomOrSingleValue(PartialVector2D<double>
|
70 | 71 | return range.X >= range.Y || range.ValueCount < 2 ? range.X : (ScenarioClass::Instance->Random.RandomRanged(min, max) / 100.0);
|
71 | 72 | }
|
72 | 73 |
|
73 |
| -const double GeneralUtils::GetWarheadVersusArmor(WarheadTypeClass* pWH, Armor ArmorType) |
| 74 | +struct VersesData |
74 | 75 | {
|
75 |
| - return double(MapClass::GetTotalDamage(100, pWH, ArmorType, 0)) / 100.0; |
| 76 | + double Verses; |
| 77 | + WarheadFlags Flags; |
| 78 | +}; |
| 79 | + |
| 80 | +struct DummyTypeExtHere |
| 81 | +{ |
| 82 | + char _[0x24]; |
| 83 | + std::vector<VersesData> Verses; |
| 84 | +}; |
| 85 | + |
| 86 | +const double GeneralUtils::GetWarheadVersusArmor(WarheadTypeClass* pWH, Armor armorType) |
| 87 | +{ |
| 88 | + if (!AresHelper::CanUseAres) |
| 89 | + return pWH->Verses[static_cast<int>(armorType)]; |
| 90 | + |
| 91 | + return reinterpret_cast<DummyTypeExtHere*>(*(uintptr_t*)((char*)pWH + 0x1CC))->Verses[static_cast<int>(armorType)].Verses; |
76 | 92 | }
|
77 | 93 |
|
78 | 94 | const double GeneralUtils::GetWarheadVersusArmor(WarheadTypeClass* pWH, TechnoClass* pThis, TechnoTypeClass* pType)
|
79 | 95 | {
|
80 | 96 | if (!pType)
|
81 | 97 | pType = pThis->GetTechnoType();
|
82 | 98 |
|
83 |
| - auto ArmorType = pType->Armor; |
| 99 | + auto armorType = pType->Armor; |
84 | 100 | auto const pShield = TechnoExt::ExtMap.Find(pThis)->Shield.get();
|
85 | 101 |
|
86 | 102 | if (pShield && pShield->IsActive() && !pShield->CanBePenetrated(pWH))
|
87 |
| - ArmorType = pShield->GetArmorType(); |
| 103 | + armorType = pShield->GetArmorType(); |
88 | 104 |
|
89 |
| - return double(MapClass::GetTotalDamage(100, pWH, ArmorType, 0)) / 100.0; |
| 105 | + return GeneralUtils::GetWarheadVersusArmor(pWH, armorType); |
90 | 106 | }
|
91 | 107 |
|
92 | 108 | // Weighted random element choice (weight) - roll for one.
|
|
0 commit comments