Skip to content

Commit 38c4f8a

Browse files
authored
[Vanilla Fix] Fix the bug that DamageSelf and AllowDamageOnSelf are ineffective on airforce (#1715)
1 parent 6c2af20 commit 38c4f8a

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ This page lists all the individual contributions to the project by their author.
408408
- Exclusive SuperWeapon Sidebar
409409
- Fix the bug that AlphaImage remained after unit entered tunnel
410410
- Weapon target filtering by health percentage
411+
- Fix the bug that `DamageSelf` and `AllowDamageOnSelf` are ineffective on airforce
411412
- **Apollo** - Translucent SHP drawing patches
412413
- **ststl**:
413414
- Customizable `ShowTimer` priority of superweapons

docs/Fixed-or-Improved-Logics.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
231231
- Second weapon with `ElectricAssault=yes` will not unconditionally attack your building with `Overpowerable=yes`.
232232
- Infantry support `IsGattling=yes`.
233233
- Fixed the issue that the widespread damage caused by detonation on the bridge/ground cannot affect objects on the ground/bridge who are in the opposite case.
234+
- Fixed the bug that `DamageSelf` and `AllowDamageOnSelf` are ineffective on airforce.
234235

235236
## Fixes / interactions with other extensions
236237

docs/Whats-New.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ Vanilla fixes:
415415
- Fixed the bug that uncontrolled scatter when elite techno attacked by aircraft or some unit try crush it (by NetsuNegi)
416416
- Second weapon with `ElectricAssault=yes` will not unconditionally attack your building with `Overpowerable=yes` (by FlyStar)
417417
- Fixed the issue that the widespread damage caused by detonation on the bridge/ground cannot affect objects on the ground/bridge who are in the opposite case (by CrimRecya)
418+
- Fixed the bug that `DamageSelf` and `AllowDamageOnSelf` are ineffective on airforce (by NetsuNegi)
418419
419420
Phobos fixes:
420421
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi)

src/Misc/Hooks.BugFixes.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,6 +2055,27 @@ DEFINE_HOOK(0x4D6FE1, FootClass_ElectricAssultFix2, 0x7) // Mission_AreaGuard
20552055

20562056
#pragma endregion
20572057

2058+
DEFINE_HOOK(0x489416, MapClass_DamageArea_AirDamageSelfFix, 0x6)
2059+
{
2060+
enum { NextTechno = 0x489547 };
2061+
2062+
GET(TechnoClass*, pAirTechno, EBX);
2063+
GET_BASE(TechnoClass*, pSourceTechno, 0x8);
2064+
2065+
if (pAirTechno != pSourceTechno)
2066+
return 0;
2067+
2068+
if (pSourceTechno->GetTechnoType()->DamageSelf)
2069+
return 0;
2070+
2071+
GET_BASE(WarheadTypeClass*, pWarhead, 0xC);
2072+
2073+
if (WarheadTypeExt::ExtMap.Find(pWarhead)->AllowDamageOnSelf)
2074+
return 0;
2075+
2076+
return NextTechno;
2077+
}
2078+
20582079
#pragma region DamageAreaItemsFix
20592080

20602081
// Obviously, it is unreasonable for a large-scale damage like a nuke to only cause damage to units

0 commit comments

Comments
 (0)