namespace Aeshnidae.Invasions; /// /// Two hooks: the world tick drives the scheduler and the invasion, and a creature's death /// counts a kill the moment it happens (with the damage history as it stood at the death). /// Neither changes what ACE does. /// [HarmonyPatch] public static class Patches { [HarmonyPostfix] [HarmonyPatch(typeof(LandblockManager), nameof(LandblockManager.Tick))] public static void PostTick() { try { Invasions.Tick(); } catch (Exception ex) { ModManager.Log($"[{Mod.Name}] tick failed: {ex}", ModManager.LogLevel.Error); } } [HarmonyPostfix] [HarmonyPatch(typeof(Creature), "Die", new[] { typeof(DamageHistoryInfo), typeof(DamageHistoryInfo) })] public static void PostCreatureDie(Creature __instance) { try { if (Invasions.Current is not null) Invasions.OnCreatureDie(__instance); } catch (Exception ex) { ModManager.Log($"[{Mod.Name}] kill count failed: {ex.Message}", ModManager.LogLevel.Warn); } } }