Exemplo n.º 1
0
        public static bool CreateIncidentCaravan_Animal <T>(IncidentDef incidentDef, IncidentParms parms) where T : InterceptedIncident, new()
        {
            if (PES_Settings.DebugModeOn)
            {
                Log.Message("-=PS=- CreateIncidentCaravan_Animal Start", false);
                IncidentInterceptorUtility.DebugParms(parms, incidentDef);
            }
            if (parms != null && parms.questTag != null)             //Lt. Bob - "Temporary" bypass fix? for Quest handling
            {
                Log.Message("-=PS=- CreateIncidentCaravan_Animal - questTag!=Null == " + parms.questTag);
            }
            InterceptedIncident incident = new T();

            incident.incidentDef = incidentDef;
            incident.parms       = parms;
            if (!incident.ManualDeterminParams())
            {
                return(false);
            }
            if (!IncidentCaravanUtility.AddNewIncidentCaravan(incident))
            {
                Log.Error("Fail to create Incident Caravan");
                return(false);
            }
            //Hoxing Should be done in the patch
            //IsHoaxingStoryTeller = true;
            if (PES_Settings.DebugModeOn)
            {
                Messages.Message("PES_Debug: Successfully intercepted an animal Incident", MessageTypeDefOf.NeutralEvent);
            }
            return(true);
        }
Exemplo n.º 2
0
        public static bool CreateIncidentCaraven_HumanNeutral <T>(IncidentDef incidentDef, IncidentParms parms) where T : InterceptedIncident, new()
        {
            if (PES_Settings.DebugModeOn)
            {
                Log.Message("-=PS=- CreateIncidentCaraven_HumanNeutral Start", false);
                IncidentInterceptorUtility.DebugParms(parms, incidentDef);
            }
            if (incidentDef.defName == "CaravanArrivalTributeCollector")                //Lt. Bob - "Temporary" bypass fix for Tribute Collector
            {
                Log.Message("-=PS=- CaravanArrivalTributeCollector caught - Exiting CreateIncidentCaraven_HumanNeutral as false");
                Log.Message("   PS=- questTag == " + parms.questTag);
                return(false);
            }
            InterceptedIncident incident = new T();

            incident.incidentDef = incidentDef;
            incident.parms       = parms;
            if (!incident.ManualDeterminParams())
            {
                return(false);
            }
            if (!IncidentCaravanUtility.AddNewIncidentCaravan(incident))
            {
                Log.Error("Fail to create Incident Caravan");
                return(false);
            }
            IsHoaxingStoryTeller = true;
            if (PES_Settings.DebugModeOn)
            {
                Messages.Message("PES_Debug: Successfully intercepted a neutral Incident", MessageTypeDefOf.NeutralEvent);
            }
            //IsIntercepting_PawnGeneration = GeneratorPatchFlag.ReturnZero;
            return(true);
        }
Exemplo n.º 3
0
        public static bool Intercept_SkyFaller <T>(IncidentDef incidentDef, IncidentParms parms, bool needHoaxing = false, bool checkHostileFaction = false) where T : InterceptedIncident_SkyFaller, new()
        {
            if (PES_Settings.DebugModeOn)
            {
                Log.Message("-=PS=- Intercept_SkyFaller Start", false);
                IncidentInterceptorUtility.DebugParms(parms, incidentDef);
            }
            if (parms != null && parms.questTag != null)             //Lt. Bob - "Temporary" bypass fix? for Quest handling
            {
                Log.Message("-=PS=- Intercept_SkyFaller - questTag!=Null == " + parms.questTag);
            }

            if (checkHostileFaction && parms.faction.PlayerRelationKind != FactionRelationKind.Hostile)
            {
                return(false);
            }

            if (incidentDef == null)
            {
                Log.Error("PES: A raid incident that is not compatible with Preemptive Strike is trying to execute. So this incident won't be intercepted by PES and will be executed in it vanilla way");
                return(false);
            }

            InterceptedIncident_SkyFaller incident = new T();

            incident.incidentDef = incidentDef;
            incident.parms       = parms;
            if (incident.FallerType == SkyFallerType.Big && !PESDefOf.PES_SkyIDL.IsFinished)
            {
                return(false);
            }
            if (incident.FallerType == SkyFallerType.Small && !PESDefOf.PES_SkyIDS.IsFinished)
            {
                return(false);
            }
            if (!incident.PreCalculateDroppingSpot())
            {
                return(false);
            }
            int totDuration = incident.FallerType == SkyFallerType.Big ? PES_Settings.LargeSkyFallerDuration : PES_Settings.SmallSkyFallerDuration;
            int decTime     = incident.FallerType == SkyFallerType.Big ? PES_Settings.LargeSkyFallerIdentificationTime : PES_Settings.SmallSkyFallerIdentificationTime;

            if (!IncidentCaravanUtility.AddSimpleIncidentCaravan(incident, totDuration, decTime))
            {
                Log.Error("Fail to create Incident Caravan");
                return(false);
            }
            if (needHoaxing)
            {
                IsHoaxingStoryTeller = true;
            }
            if (PES_Settings.DebugModeOn)
            {
                Messages.Message("PES_Debug: Successfully intercepted a skyfaller Incident", MessageTypeDefOf.NeutralEvent);
            }
            return(true);
        }