Skip to content

Commit 187aea2

Browse files
committed
fix with over damage again
1 parent 3b8d56d commit 187aea2

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/Ext/Techno/Body.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class TechnoExt
267267
static void UpdateSharedAmmo(TechnoClass* pThis);
268268
static double GetCurrentSpeedMultiplier(FootClass* pThis);
269269
static double GetCurrentFirepowerMultiplier(TechnoClass* pThis);
270-
static int CalculateArmorMultipliers(TechnoClass* pThis, int damage, WarheadTypeClass* pWarhead);
270+
static double CalculateArmorMultipliers(TechnoClass* pThis, WarheadTypeClass* pWarhead);
271271
static void DrawSelfHealPips(TechnoClass* pThis, Point2D* pLocation, RectangleStruct* pBounds);
272272
static void DrawInsignia(TechnoClass* pThis, Point2D* pLocation, RectangleStruct* pBounds);
273273
static void ApplyGainedSelfHeal(TechnoClass* pThis);

src/Ext/Techno/Hooks.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ DEFINE_HOOK(0x4DB218, FootClass_GetMovementSpeed_SpeedMultiplier, 0x6)
452452
return 0;
453453
}
454454

455-
int TechnoExt::CalculateArmorMultipliers(TechnoClass* pThis, int damage, WarheadTypeClass* pWarhead)
455+
double TechnoExt::CalculateArmorMultipliers(TechnoClass* pThis, WarheadTypeClass* pWarhead)
456456
{
457457
auto const pExt = TechnoExt::ExtMap.Find(pThis);
458458
double mult = pExt->AE.ArmorMultiplier;
@@ -476,7 +476,7 @@ int TechnoExt::CalculateArmorMultipliers(TechnoClass* pThis, int damage, Warhead
476476
}
477477
}
478478

479-
return static_cast<int>(damage / mult);
479+
return mult;
480480
}
481481

482482
DEFINE_HOOK(0x6FDC87, TechnoClass_AdjustDamage_ArmorMultiplier, 0x6)
@@ -485,7 +485,7 @@ DEFINE_HOOK(0x6FDC87, TechnoClass_AdjustDamage_ArmorMultiplier, 0x6)
485485
GET(const int, damage, EAX);
486486
GET_STACK(WeaponTypeClass*, pWeapon, STACK_OFFSET(0x18, 0x8));
487487

488-
R->EAX(TechnoExt::CalculateArmorMultipliers(pTarget, damage, pWeapon->Warhead));
488+
R->EAX(static_cast<int>(damage / TechnoExt::CalculateArmorMultipliers(pTarget, pWeapon->Warhead)));
489489

490490
return 0;
491491
}
@@ -496,7 +496,7 @@ DEFINE_HOOK(0x701966, TechnoClass_ReceiveDamage_ArmorMultiplier, 0x6)
496496
GET(const int, damage, EAX);
497497
GET_STACK(WarheadTypeClass*, pWarhead, STACK_OFFSET(0xC4, 0xC));
498498

499-
R->EAX(TechnoExt::CalculateArmorMultipliers(pThis, damage, pWarhead));
499+
R->EAX(static_cast<int>(damage / TechnoExt::CalculateArmorMultipliers(pThis, pWarhead)));
500500

501501
return 0;
502502
}

src/New/Entity/ShieldClass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ int ShieldClass::ReceiveDamage(args_ReceiveDamage* args)
210210
if (pTechno->HasAbility(Ability::Stronger))
211211
armorMultiplier *= RulesClass::Instance->VeteranArmor;
212212

213-
nDamage = Math::max(TechnoExt::CalculateArmorMultipliers(pTechno, static_cast<int>(nDamage / armorMultiplier), pWH), 0);
213+
armorMultiplier *= TechnoExt::CalculateArmorMultipliers(pTechno, pWH);
214+
nDamage = Math::max(static_cast<int>(nDamage / armorMultiplier), 0);
214215
}
215216

216217
nDamage = MapClass::GetTotalDamage(nDamage, pWH, this->GetArmorType(pTechnoType), args->DistanceToEpicenter);

0 commit comments

Comments
 (0)