using HarmonyLib; namespace IdleSpectator; /// War genesis/end patches from mutation discovery. [HarmonyPatch] public static class WarEventPatches { [HarmonyPatch(typeof(WarManager), nameof(WarManager.newWar))] [HarmonyPostfix] public static void PostfixNewWar(War __result) { if (__result == null || AgentHarness.Busy) { return; } try { WarInterestFeed.EmitFromWarObject(__result, phase: "new"); } catch { // Fallback: poll path still covers ongoing wars. } } [HarmonyPatch(typeof(WarManager), nameof(WarManager.endWar))] [HarmonyPostfix] public static void PostfixEndWar(object[] __args) { if (AgentHarness.Busy || __args == null || __args.Length == 0 || __args[0] == null) { return; } try { WarInterestFeed.EmitFromWarObject(__args[0], phase: "end"); } catch { // ignore } } }