Beispiel #1
0
        public static void Prefix(AttackStackSequence __instance, MessageCenterMessage message)
        {
            AttackCompleteMessage attackCompleteMessage = message as AttackCompleteMessage;
            bool ShouldPanic  = false;
            bool IsEarlyPanic = false;
            Mech mech         = null;

            if (attackCompleteMessage == null || attackCompleteMessage.stackItemUID != __instance.SequenceGUID)
            {
                return;
            }


            if (__instance.directorSequences[0].target is Mech)
            {
                mech        = __instance.directorSequences[0].target as Mech;
                ShouldPanic = RollHelpers.ShouldPanic(mech, attackCompleteMessage.attackSequence);
            }

            if (mech == null || mech.GUID == null || attackCompleteMessage == null)
            {
                return;
            }

            Holder.SerializeActiveJson();

            if (PanicHelpers.IsPanicking(mech, ref IsEarlyPanic) && BasicPanic.RollForEjectionResult(mech, attackCompleteMessage.attackSequence, IsEarlyPanic))
            {
                mech.EjectPilot(mech.GUID, attackCompleteMessage.stackItemUID, DeathMethod.PilotEjection, false);
            }
        }
Beispiel #2
0
        static void Postfix(Mech __instance)
        {
            if (__instance == null || __instance.IsDead || (__instance.IsFlaggedForDeath && __instance.HasHandledDeath))
            {
                return;
            }
            int index = PanicHelpers.GetTrackedPilotIndex(__instance);

            if (BasicPanic.Settings.LosingLimbAlwaysPanics)
            {
                if (index < 0)
                {
                    Holder.TrackedPilots.Add(new PanicTracker(__instance)); //add a new tracker to tracked pilot, then we run it all over again;
                    index = PanicHelpers.GetTrackedPilotIndex(__instance);
                    if (index < 0)
                    {
                        return;
                    }
                }

                if (Holder.TrackedPilots[index].trackedMech != __instance.GUID)
                {
                    return;
                }

                if (Holder.TrackedPilots[index].trackedMech == __instance.GUID && Holder.TrackedPilots[index].ChangedRecently && BasicPanic.Settings.AlwaysGatedChanges)
                {
                    return;
                }
                RollHelpers.ApplyPanicDebuff(__instance, index);
            }
        }