static void Postfix(SimGameState __instance) //we're doing a new campaign, so we need to sync the json with the new addition
 {
     Holder.SyncNewCampaign();
 }
 static void Prefix(GameInstanceSave save)
 {
     Holder.Resync(save.SaveTime);
 }
 static void Postfix(GameInstanceSave __instance)
 {
     Holder.SerializeStorageJson(__instance.InstanceGUID, __instance.SaveTime);
 }
Ejemplo n.º 4
0
        public static void Prefix(AbstractActor __instance)
        {
            if (!(__instance is Mech mech) || mech.IsDead || (mech.IsFlaggedForDeath && mech.HasHandledDeath))
            {
                return;
            }

            bool  FoundPilot = false;
            Pilot pilot      = mech.GetPilot();
            int   index      = -1;

            if (pilot == null)
            {
                return;
            }

            index = PanicHelpers.GetTrackedPilotIndex(mech);

            if (index > -1)
            {
                FoundPilot = true;
            }


            if (!FoundPilot)
            {
                PanicTracker panicTracker = new PanicTracker(mech);

                Holder.TrackedPilots.Add(panicTracker); //add a new tracker to tracked pilot, then we run it all over again;;
                index = PanicHelpers.GetTrackedPilotIndex(mech);
                if (index > -1)
                {
                    FoundPilot = true;
                }
                else
                {
                    return;
                }
            }
            PanicStatus originalStatus = Holder.TrackedPilots[index].pilotStatus;

            if (FoundPilot && !Holder.TrackedPilots[index].ChangedRecently)
            {
                if (Holder.TrackedPilots[index].pilotStatus == PanicStatus.Fatigued)
                {
                    Holder.TrackedPilots[index].pilotStatus = PanicStatus.Normal;
                }

                if (Holder.TrackedPilots[index].pilotStatus == PanicStatus.Stressed)
                {
                    Holder.TrackedPilots[index].pilotStatus = PanicStatus.Fatigued;
                }

                if (Holder.TrackedPilots[index].pilotStatus == PanicStatus.Panicked)
                {
                    Holder.TrackedPilots[index].pilotStatus = PanicStatus.Stressed;
                }
            }
            //reset panic values to account for panic level changes if we get this far, and we recovered.

            if (Holder.TrackedPilots[index].ChangedRecently)
            {
                Holder.TrackedPilots[index].ChangedRecently = false;
            }
            else if (Holder.TrackedPilots[index].pilotStatus != originalStatus)
            {
                __instance.StatCollection.ModifyStat <float>("Panic Turn Reset: Accuracy", -1, "AccuracyModifier", StatCollection.StatOperation.Set, 0f, -1, true);
                __instance.StatCollection.ModifyStat <float>("Panic Turn Reset: Mech To Hit", -1, "ToHitThisActor", StatCollection.StatOperation.Set, 0f, -1, true);


                if (Holder.TrackedPilots[index].pilotStatus == PanicStatus.Fatigued)
                {
                    __instance.Combat.MessageCenter.PublishMessage(new AddSequenceToStackMessage(new ShowActorInfoSequence(mech, $"Recovered To Fatigued!", FloatieMessage.MessageNature.Buff, true)));
                    __instance.StatCollection.ModifyStat <float>("Panic Turn: Fatigued Aim", -1, "AccuracyModifier", StatCollection.StatOperation.Float_Add, BasicPanic.Settings.FatiguedAimModifier, -1, true);
                }


                else if (Holder.TrackedPilots[index].pilotStatus == PanicStatus.Stressed)
                {
                    __instance.Combat.MessageCenter.PublishMessage(new AddSequenceToStackMessage(new ShowActorInfoSequence(mech, $"Recovered To Stressed!", FloatieMessage.MessageNature.Buff, true)));
                    __instance.StatCollection.ModifyStat <float>("Panic Turn: Stressed Aim", -1, "AccuracyModifier", StatCollection.StatOperation.Float_Add, BasicPanic.Settings.StressedAimModifier, -1, true);
                    __instance.StatCollection.ModifyStat <float>("Panic Turn: Stressed Defence", -1, "ToHitThisActor", StatCollection.StatOperation.Float_Add, BasicPanic.Settings.StressedToHitModifier, -1, true);
                }

                else //now normal
                {
                    __instance.Combat.MessageCenter.PublishMessage(new AddSequenceToStackMessage(new ShowActorInfoSequence(mech, $"Recovered To Normal!", FloatieMessage.MessageNature.Buff, true)));
                }
            }

            Holder.SerializeActiveJson();
        }
Ejemplo n.º 5
0
 static void Postfix()
 {
     Holder.Reset(); //don't keep data we don't need after a mission
 }
Ejemplo n.º 6
0
 static void Postfix()
 {
     // reset on new contracts
     Holder.Reset();
 }