From 0375ab8841ed97a6595e4431acb14886ac89abd3 Mon Sep 17 00:00:00 2001 From: NetsuNegi39 Date: Sat, 20 Sep 2025 10:49:09 +0800 Subject: [PATCH] init --- CREDITS.md | 1 + docs/Fixed-or-Improved-Logics.md | 1 + docs/Whats-New.md | 1 + src/Ext/Cell/Hooks.cpp | 7 ++++++- src/Ext/Unit/Hooks.Crushing.cpp | 3 +++ src/Misc/Hooks.BugFixes.cpp | 27 +++++++++++++++++++++++++++ 6 files changed, 39 insertions(+), 1 deletion(-) diff --git a/CREDITS.md b/CREDITS.md index b03e2047e8..6de6d1f9e7 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -446,6 +446,7 @@ This page lists all the individual contributions to the project by their author. - Fix the bug that hover vehicle will sink if destroyed on bridge - Customize squid grapple animation - Fix the bug that armor multiplier of new attacheffect will have extra take effect once if restricted warheads + - Fix the bug that units keep attacking ground after target wall has been destroyed by adjacent damage/crush/wave damage - **Apollo** - Translucent SHP drawing patches - **ststl**: - Customizable `ShowTimer` priority of superweapons diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 30b3981296..c22c0f434a 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -262,6 +262,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - `DeployingAnim` using unit drawer now also tint accordingly with the unit. - Fixed an issue that jumpjets in air can not correctly spawn missiles. - Fixed an issue that the currently hovered planning node not update up-to-date, such as using hotkeys to select technos. +- Fixed the bug that units keep attacking ground after target wall has been destroyed by adjacent damage/crush/wave damage. ## Fixes / interactions with other extensions diff --git a/docs/Whats-New.md b/docs/Whats-New.md index cbb93cd75e..1060323c41 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -469,6 +469,7 @@ Vanilla fixes: - `DeployingAnim` using unit drawer now also tint accordingly with the unit (by Starkku) - Jumpjets in air now can correctly spawn missiles (by TaranDahl) - Fixed an issue that the currently hovered planning node not update up-to-date, such as using hotkeys to select technos (by CrimRecya) +- Fixed the bug that units keep attacking ground after target wall has been destroyed by adjacent damage/crush/wave damage (by NetsuNegi) Phobos fixes: - Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi) diff --git a/src/Ext/Cell/Hooks.cpp b/src/Ext/Cell/Hooks.cpp index 3472a5f499..09849757bf 100644 --- a/src/Ext/Cell/Hooks.cpp +++ b/src/Ext/Cell/Hooks.cpp @@ -2,10 +2,15 @@ #include -DEFINE_HOOK(0x480EA8, CellClass_DamageWall_AdjacentWallDamage, 0x7) +DEFINE_HOOK(0x480EA8, CellClass_DamageWall_AdjacentWallDamage, 0x5) { enum{ SkipGameCode = 0x480EB4 }; + GET(CellClass*, pThis, EAX); pThis->DamageWall(RulesExt::Global()->AdjacentWallDamage); + + if (pThis->OverlayTypeIndex == -1) + reinterpret_cast(0x70D4A0)(pThis);// pThis->BecomeUntargetable(); + return SkipGameCode; } diff --git a/src/Ext/Unit/Hooks.Crushing.cpp b/src/Ext/Unit/Hooks.Crushing.cpp index acd03863d4..888476a794 100644 --- a/src/Ext/Unit/Hooks.Crushing.cpp +++ b/src/Ext/Unit/Hooks.Crushing.cpp @@ -11,6 +11,9 @@ DEFINE_HOOK(0x73B05B, UnitClass_PerCellProcess_TiltWhenCrushes, 0x6) { enum { SkipGameCode = 0x73B074 }; + GET(CellClass*, pCell, EDI); + reinterpret_cast(0x70D4A0)(pCell);// pCell->BecomeUntargetable(); + GET(UnitClass*, pThis, EBP); auto const pType = pThis->Type; diff --git a/src/Misc/Hooks.BugFixes.cpp b/src/Misc/Hooks.BugFixes.cpp index 0a11a8b9af..bcb959343f 100644 --- a/src/Misc/Hooks.BugFixes.cpp +++ b/src/Misc/Hooks.BugFixes.cpp @@ -2657,3 +2657,30 @@ DEFINE_HOOK(0x741A66, UnitClass_SetDestination_JJVehFix, 0x5) } #pragma endregion + +DEFINE_HOOK(0x445B62, BuildingClass_Limbo_WallTower_AdjacentWallDamage, 0x5) +{ + enum { SkipGameCode = 0x445B6E }; + + GET(CellClass*, pThis, EDI); + pThis->DamageWall(200); + + if (pThis->OverlayTypeIndex == -1) + reinterpret_cast(0x70D4A0)(pThis);// pThis->BecomeUntargetable(); + + return SkipGameCode; +} + +DEFINE_HOOK(0x75F474, WaveClass_DamageCell_Wall, 0x8) +{ + enum { SkipGameCode = 0x75F47C }; + + GET(CellClass*, pCell, EDI); + GET(int, damage, ECX); + pCell->DamageWall(damage); + + if (pCell->OverlayTypeIndex == -1) + reinterpret_cast(0x70D4A0)(pCell);// pCell->BecomeUntargetable(); + + return SkipGameCode; +}