-
-
Notifications
You must be signed in to change notification settings - Fork 112
[Highly Customized] Directional armor #1623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
085afa7
380fb29
08f530d
61ae7f7
dbfcf95
8c616db
98762c8
7f96b91
06baa1d
be487d3
7131025
39a54c7
496dc06
42e8eb8
6e916e4
0144f8c
7bc8903
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ DEFINE_HOOK(0x701900, TechnoClass_ReceiveDamage_Shield, 0x6) | |
// Calculate Damage Multiplier | ||
if (!args->IgnoreDefenses && *args->Damage) | ||
{ | ||
const auto pTypeExt = pExt->TypeExtData; | ||
double multiplier = 1.0; | ||
|
||
if (!pSourceHouse || !pTargetHouse || !pSourceHouse->IsAlliedWith(pTargetHouse)) | ||
|
@@ -38,6 +39,21 @@ DEFINE_HOOK(0x701900, TechnoClass_ReceiveDamage_Shield, 0x6) | |
else | ||
multiplier = pWHExt->DamageOwnerMultiplier.Get(pRules->DamageOwnerMultiplier); | ||
|
||
if (pTypeExt->DirectionalArmor.Get(RulesExt::Global()->DirectionalArmor) && pThis->WhatAmI() == AbstractType::Unit && WarheadTypeExt::HitDirection >= 0 && args->DistanceToEpicenter <= 64) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why UnitClass only? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. becase only unit can move by reverse direction (need #1622) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe required distance could be made customisable? |
||
{ | ||
const int tarFacing = pThis->PrimaryFacing.Current().GetValue<16>(); | ||
const int angle = abs(WarheadTypeExt::HitDirection - tarFacing); | ||
const int frontField = static_cast<int>(16384 * pTypeExt->DirectionalArmor_FrontField.Get(RulesExt::Global()->DirectionalArmor_FrontField)); | ||
const int backField = static_cast<int>(16384 * pTypeExt->DirectionalArmor_BackField.Get(RulesExt::Global()->DirectionalArmor_BackField)); | ||
|
||
if (angle >= 32768 - frontField && angle <= 32768 + frontField) | ||
multiplier *= pTypeExt->DirectionalArmor_FrontMultiplier.Get(RulesExt::Global()->DirectionalArmor_FrontMultiplier) * pWHExt->Directional_Multiplier; | ||
else if ((angle < backField && angle >= 0) || (angle > 49152 + backField && angle <= 65536)) | ||
multiplier *= pTypeExt->DirectionalArmor_BackMultiplier.Get(RulesExt::Global()->DirectionalArmor_BackMultiplier) * pWHExt->Directional_Multiplier; | ||
else | ||
multiplier *= pTypeExt->DirectionalArmor_SideMultiplier.Get(RulesExt::Global()->DirectionalArmor_SideMultiplier) * pWHExt->Directional_Multiplier; | ||
} | ||
|
||
if (multiplier != 1.0) | ||
{ | ||
const auto sgnDamage = *args->Damage > 0 ? 1 : -1; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the use case of this flag?