From 8e0a517a182b867c4ad0008771b8d4a42af9614a Mon Sep 17 00:00:00 2001 From: starfish <50672801+starfi5h@users.noreply.github.com> Date: Fri, 19 Jul 2024 23:23:15 +0800 Subject: [PATCH] Fix NRE in Bomb.TickSkillLogic for client --- .../Patches/Dynamic/SkillSystem_Common_Patch.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/NebulaPatcher/Patches/Dynamic/SkillSystem_Common_Patch.cs b/NebulaPatcher/Patches/Dynamic/SkillSystem_Common_Patch.cs index cc51d0f1e..e9d46421d 100644 --- a/NebulaPatcher/Patches/Dynamic/SkillSystem_Common_Patch.cs +++ b/NebulaPatcher/Patches/Dynamic/SkillSystem_Common_Patch.cs @@ -11,8 +11,20 @@ namespace NebulaPatcher.Patches.Dynamic; internal class SkillSystem_Common_Patch { [HarmonyPrefix] - [HarmonyPatch(typeof(GeneralShieldBurst), nameof(GeneralShieldBurst.TickSkillLogic))] + [HarmonyPatch(typeof(Bomb_Explosive), nameof(Bomb_Explosive.TickSkillLogic))] + [HarmonyPatch(typeof(Bomb_Liquid), nameof(Bomb_Liquid.TickSkillLogic))] + [HarmonyPatch(typeof(Bomb_EMCapsule), nameof(Bomb_EMCapsule.TickSkillLogic))] + public static void Bomb_TickSkillLogic(ref int ___nearPlanetAstroId, ref int ___life) + { + if (___nearPlanetAstroId > 0 && GameMain.spaceSector.skillSystem.astroFactories[___nearPlanetAstroId] == null) + { + // The nearest planetFactory hasn't loaded yet, skip and remove + ___life = 0; + } + } + [HarmonyPrefix] + [HarmonyPatch(typeof(GeneralShieldBurst), nameof(GeneralShieldBurst.TickSkillLogic))] public static bool GeneralShieldBurst_Prefix(ref GeneralShieldBurst __instance, SkillSystem skillSystem) { if (!Multiplayer.IsActive || __instance.caster.type != ETargetType.Player) return true;