diff --git a/PunchinOut/BasicPanic.cs b/PunchinOut/BasicPanic.cs index 278bf2f..1c0c802 100644 --- a/PunchinOut/BasicPanic.cs +++ b/PunchinOut/BasicPanic.cs @@ -27,8 +27,9 @@ public static void Prefix(AttackStackSequence __instance, MessageCenterMessage m if (__instance.directorSequences[0].target is Mech) { - ShouldPanic = RollHelpers.ShouldPanic(__instance.directorSequences[0].target as Mech, attackCompleteMessage.attackSequence); mech = __instance.directorSequences[0].target as Mech; + ShouldPanic = RollHelpers.ShouldPanic(mech, attackCompleteMessage.attackSequence); + } @@ -194,6 +195,11 @@ public static int GetTrackedPilotIndex(Mech mech) return -1; } + if(Holder.TrackedPilots == null) + { + Holder.TrackedPilots = new List(); + } + for (int i = 0; i < Holder.TrackedPilots.Count; i++) { @@ -217,6 +223,11 @@ public static bool ShouldPanic(Mech mech, AttackDirector.AttackSequence attackSe return false; } + if(attackSequence == null) + { + return false; + } + if (!attackSequence.attackDidDamage) //no point in panicking over nothing { return false;