Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
 public override bool ManualDeterminParams()
 {
     //Need to first determine factions then do this!
     pawnList = IncidentInterceptorUtility.GenerateNeutralPawns(GetPawnGroupKind(), parms);
     if (pawnList == null || pawnList.Count <= 0)
     {
         Log.Error("Fail to generate pawns in neutral human crowd");
         return(false);
     }
     return(true);
 }
Beispiel #5
0
        public override bool PreCalculateDroppingSpot()
        {
            pawnList = IncidentInterceptorUtility.GenerateRaidPawns(parms);
            IncidentInterceptorUtility.IsIntercepting_GroupSpliter = GeneratorPatchFlag.Generate;
            GroupList = PawnsArrivalModeWorkerUtility.SplitIntoRandomGroupsNearMapEdge(pawnList, parms.target as Map, false);
            storage   = new GroupListStorage(GroupList);
            PawnsArrivalModeWorkerUtility.SetPawnGroupsInfo(parms, GroupList);
            var list1 = new List <TargetInfo>();

            foreach (var pair in GroupList)
            {
                if (pair.First.Count > 0)
                {
                    list1.Add(new TargetInfo(pair.Second, parms.target as Map, false));
                }
            }
            lookTargets = list1;
            return(true);
        }
        protected override void RevealCrowdSize()
        {
            crowdSize_revealed = true;
            if (pawnList == null)
            {
                pawnList = IncidentInterceptorUtility.GenerateNeutralPawns(GetPawnGroupKind(), parms);
            }

            if (PES_Settings.DebugModeOn)
            {
                Log.Message("CrowedSize revealed!!!");
                StringBuilder sb = new StringBuilder("pawn number:");
                sb.Append(pawnList.Count + " ");
                foreach (var x in pawnList)
                {
                    sb.Append("\n");
                    sb.Append(x.Name);
                }
                Log.Message(sb.ToString());
            }
        }
Beispiel #7
0
 public override bool ManualDeterminParams()
 {
     pawnList = IncidentInterceptorUtility.GenerateRaidPawns(parms);
     ResolveLookTargets();
     return(true);
 }