Exemple #1
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map map = (Map)parms.target;

            if (!TryFindSpawnSpot(map, out IntVec3 spawnSpot))
            {
                return(false);
            }
            if (!TryFindEnemyFaction(out Faction enemyFac))
            {
                return(false);
            }
            int           @int      = Rand.Int;
            IncidentParms raidParms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.ThreatBig, map);

            raidParms.forced             = true;
            raidParms.faction            = enemyFac;
            raidParms.raidStrategy       = RaidStrategyDefOf.ImmediateAttack;
            raidParms.raidArrivalMode    = PawnsArrivalModeDefOf.EdgeWalkIn;
            raidParms.spawnCenter        = spawnSpot;
            raidParms.points             = Mathf.Max(raidParms.points * RaidPointsFactorRange.RandomInRange, enemyFac.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat));
            raidParms.pawnGroupMakerSeed = @int;
            PawnGroupMakerParms defaultPawnGroupMakerParms = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(PawnGroupKindDefOf.Combat, raidParms);

            defaultPawnGroupMakerParms.points = IncidentWorker_Raid.AdjustedRaidPoints(defaultPawnGroupMakerParms.points, raidParms.raidArrivalMode, raidParms.raidStrategy, defaultPawnGroupMakerParms.faction, PawnGroupKindDefOf.Combat);
            IEnumerable <PawnKindDef> pawnKinds = PawnGroupMakerUtility.GeneratePawnKindsExample(defaultPawnGroupMakerParms);
            PawnGenerationRequest     request   = new PawnGenerationRequest(PawnKindDefOf.SpaceRefugee, null, PawnGenerationContext.NonPlayer, -1, forceGenerateNewPawn: false, newborn: false, allowDead: false, allowDowned: false, canGeneratePawnRelations: true, mustBeCapableOfViolence: false, 20f);
            Pawn refugee = PawnGenerator.GeneratePawn(request);

            refugee.relations.everSeenByPlayer = true;
            string text = "RefugeeChasedInitial".Translate(refugee.Name.ToStringFull, refugee.story.Title, enemyFac.def.pawnsPlural, enemyFac.Name, refugee.ageTracker.AgeBiologicalYears, PawnUtility.PawnKindsToCommaList(pawnKinds, useAnd: true), refugee.Named("PAWN"));

            text = text.AdjustedFor(refugee);
            PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, refugee);
            DiaNode   diaNode   = new DiaNode(text);
            DiaOption diaOption = new DiaOption("RefugeeChasedInitial_Accept".Translate());

            diaOption.action = delegate
            {
                GenSpawn.Spawn(refugee, spawnSpot, map);
                refugee.SetFaction(Faction.OfPlayer);
                CameraJumper.TryJump(refugee);
                QueuedIncident qi = new QueuedIncident(new FiringIncident(IncidentDefOf.RaidEnemy, null, raidParms), Find.TickManager.TicksGame + RaidDelay.RandomInRange);
                Find.Storyteller.incidentQueue.Add(qi);
            };
            diaOption.resolveTree = true;
            diaNode.options.Add(diaOption);
            string    text2      = "RefugeeChasedRejected".Translate(refugee.LabelShort, refugee);
            DiaNode   diaNode2   = new DiaNode(text2);
            DiaOption diaOption2 = new DiaOption("OK".Translate());

            diaOption2.resolveTree = true;
            diaNode2.options.Add(diaOption2);
            DiaOption diaOption3 = new DiaOption("RefugeeChasedInitial_Reject".Translate());

            diaOption3.action = delegate
            {
                Find.WorldPawns.PassToWorld(refugee);
            };
            diaOption3.link = diaNode2;
            diaNode.options.Add(diaOption3);
            string title = "RefugeeChasedTitle".Translate(map.Parent.Label);

            Find.WindowStack.Add(new Dialog_NodeTreeWithFactionInfo(diaNode, enemyFac, delayInteractivity: true, radioMode: true, title));
            Find.Archive.Add(new ArchivedDialog(diaNode.text, title, enemyFac));
            return(true);
        }
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map map = (Map)parms.target;

            this.ResolveRaidPoints(parms);
            bool result;

            if (!this.TryResolveRaidFaction(parms))
            {
                result = false;
            }
            else
            {
                PawnGroupKindDef combat = PawnGroupKindDefOf.Combat;
                this.ResolveRaidStrategy(parms, combat);
                this.ResolveRaidArriveMode(parms);
                if (!parms.raidArrivalMode.Worker.TryResolveRaidSpawnCenter(parms))
                {
                    result = false;
                }
                else
                {
                    parms.points *= parms.raidArrivalMode.pointsFactor;
                    parms.points *= parms.raidStrategy.pointsFactor;
                    parms.points  = Mathf.Max(parms.points, parms.raidStrategy.Worker.MinimumPoints(parms.faction, combat) * 1.05f);
                    PawnGroupMakerParms defaultPawnGroupMakerParms = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(combat, parms, false);
                    List <Pawn>         list = PawnGroupMakerUtility.GeneratePawns(defaultPawnGroupMakerParms, true).ToList <Pawn>();
                    if (list.Count == 0)
                    {
                        Log.Error("Got no pawns spawning raid from parms " + parms, false);
                        result = false;
                    }
                    else
                    {
                        parms.raidArrivalMode.Worker.Arrive(list, parms);
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.AppendLine("Points = " + parms.points.ToString("F0"));
                        foreach (Pawn pawn in list)
                        {
                            string str = (pawn.equipment == null || pawn.equipment.Primary == null) ? "unarmed" : pawn.equipment.Primary.LabelCap;
                            stringBuilder.AppendLine(pawn.KindLabel + " - " + str);
                        }
                        string letterLabel = this.GetLetterLabel(parms);
                        string letterText  = this.GetLetterText(parms, list);
                        PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(list, ref letterLabel, ref letterText, this.GetRelatedPawnsInfoLetterText(parms), true, true);
                        List <TargetInfo> list2 = new List <TargetInfo>();
                        if (parms.pawnGroups != null)
                        {
                            List <List <Pawn> > list3 = IncidentParmsUtility.SplitIntoGroups(list, parms.pawnGroups);
                            List <Pawn>         list4 = list3.MaxBy((List <Pawn> x) => x.Count);
                            if (list4.Any <Pawn>())
                            {
                                list2.Add(list4[0]);
                            }
                            for (int i = 0; i < list3.Count; i++)
                            {
                                if (list3[i] != list4)
                                {
                                    if (list3[i].Any <Pawn>())
                                    {
                                        list2.Add(list3[i][0]);
                                    }
                                }
                            }
                        }
                        else if (list.Any <Pawn>())
                        {
                            list2.Add(list[0]);
                        }
                        Find.LetterStack.ReceiveLetter(letterLabel, letterText, this.GetLetterDef(), list2, parms.faction, stringBuilder.ToString());
                        if (this.GetLetterDef() == LetterDefOf.ThreatBig)
                        {
                            TaleRecorder.RecordTale(TaleDefOf.RaidArrived, new object[0]);
                        }
                        parms.raidStrategy.Worker.MakeLords(parms, list);
                        AvoidGridMaker.RegenerateAvoidGridsFor(parms.faction, map);
                        LessonAutoActivator.TeachOpportunity(ConceptDefOf.EquippingWeapons, OpportunityType.Critical);
                        if (!PlayerKnowledgeDatabase.IsComplete(ConceptDefOf.ShieldBelts))
                        {
                            for (int j = 0; j < list.Count; j++)
                            {
                                Pawn pawn2 = list[j];
                                if (pawn2.apparel.WornApparel.Any((Apparel ap) => ap is ShieldBelt))
                                {
                                    LessonAutoActivator.TeachOpportunity(ConceptDefOf.ShieldBelts, OpportunityType.Critical);
                                    break;
                                }
                            }
                        }
                        result = true;
                    }
                }
            }
            return(result);
        }
Exemple #3
0
        // Token: 0x06000E1C RID: 3612 RVA: 0x00069B78 File Offset: 0x00067F78
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            /*
             *          GameConditionManager gameConditionManager = parms.target.GameConditionManager;
             *          int duration = Mathf.RoundToInt(this.def.durationDays.RandomInRange * 60000f);
             *          GameCondition cond = GameConditionMaker.MakeCondition(this.def.gameCondition, duration, 0);
             *          gameConditionManager.RegisterCondition(cond);
             */
            Map     map = (Map)parms.target;
            IntVec3 spawnSpot;

            if (!this.TryFindSpawnSpot(map, out spawnSpot))
            {
                return(false);
            }
            Faction faction = Find.FactionManager.FirstFactionOfDef(XenomorphDefOf.RRY_Xenomorph);

            if (faction == null)
            {
                return(false);
            }
            int           @int      = Rand.Int;
            IncidentParms raidParms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.ThreatBig, map);

            raidParms.forced               = true;
            raidParms.faction              = faction;
            raidParms.raidStrategy         = RaidStrategyDefOf.ImmediateAttack;
            raidParms.raidArrivalMode      = PawnsArrivalModeDefOf.EdgeWalkIn;
            raidParms.spawnCenter          = spawnSpot;
            raidParms.generateFightersOnly = true;
            raidParms.points               = Mathf.Max(raidParms.points * IncidentWorker_PowerCutV2.RaidPointsFactorRange.RandomInRange, faction.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat));
            raidParms.pawnGroupMakerSeed   = new int?(@int);
            PawnGroupMakerParms defaultPawnGroupMakerParms = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(PawnGroupKindDefOf.Combat, raidParms, false);

            defaultPawnGroupMakerParms.points = IncidentWorker_Raid.AdjustedRaidPoints(defaultPawnGroupMakerParms.points, raidParms.raidArrivalMode, raidParms.raidStrategy, defaultPawnGroupMakerParms.faction, PawnGroupKindDefOf.Combat);
            IEnumerable <PawnKindDef> pawnKinds = PawnGroupMakerUtility.GeneratePawnKindsExample(defaultPawnGroupMakerParms);

            base.SendStandardLetter();
            QueuedIncident qi = new QueuedIncident(new FiringIncident(IncidentDefOf.RaidEnemy, null, raidParms), 0, 0);

            Find.Storyteller.incidentQueue.Add(qi);

            @int = Rand.Int;
            if (!this.TryFindSpawnSpot(map, out spawnSpot))
            {
                return(false);
            }
            raidParms                         = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.ThreatBig, map);
            raidParms.forced                  = true;
            raidParms.faction                 = faction;
            raidParms.raidStrategy            = RaidStrategyDefOf.ImmediateAttack;
            raidParms.raidArrivalMode         = PawnsArrivalModeDefOf.EdgeWalkIn;
            raidParms.spawnCenter             = spawnSpot;
            raidParms.generateFightersOnly    = true;
            raidParms.points                  = Mathf.Max(raidParms.points * IncidentWorker_PowerCutV2.RaidPointsFactorRange.RandomInRange, faction.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat));
            raidParms.pawnGroupMakerSeed      = new int?(@int);
            defaultPawnGroupMakerParms        = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(PawnGroupKindDefOf.Combat, raidParms, false);
            defaultPawnGroupMakerParms.points = IncidentWorker_Raid.AdjustedRaidPoints(defaultPawnGroupMakerParms.points, raidParms.raidArrivalMode, raidParms.raidStrategy, defaultPawnGroupMakerParms.faction, PawnGroupKindDefOf.Combat);
            pawnKinds                         = PawnGroupMakerUtility.GeneratePawnKindsExample(defaultPawnGroupMakerParms);
            base.SendStandardLetter();

            /*
             * qi = new QueuedIncident(new FiringIncident(IncidentDefOf.RaidEnemy, null, raidParms), Find.TickManager.TicksGame + IncidentWorker_PowerCutV2.RaidDelay.RandomInRange, 0);
             * Find.Storyteller.incidentQueue.Add(qi);
             */

            List <Building> list   = map.listerBuildings.allBuildingsColonist.FindAll(x => x.TryGetComp <CompPowerPlant>() != null);
            float           chance = 1f;

            foreach (var item in list.OrderBy(x => x.TryGetComp <CompPowerPlant>().EnergyOutputPerTick))
            {
                CompPowerPlant powerPlant = item.TryGetComp <CompPowerPlant>();
                if (powerPlant != null)
                {
                    CompBreakdownable breakdownable = item.TryGetComp <CompBreakdownable>();

                    if (Rand.ChanceSeeded(chance, AvPConstants.AvPSeed))
                    {
                        if (breakdownable != null)
                        {
                            breakdownable.DoBreakdown();
                            chance -= 0.00001f * powerPlant.PowerOutput;
                        }
                        else
                        {
                        }

                        chance -= 0.05f;
                    }
                }
            }

            /*
             * DiaNode diaNode = new DiaNode(text);
             * DiaOption diaOption = new DiaOption("RefugeeChasedInitial_Accept".Translate());
             * diaOption.action = delegate ()
             * {
             *  QueuedIncident qi = new QueuedIncident(new FiringIncident(IncidentDefOf.RaidEnemy, null, raidParms), Find.TickManager.TicksGame + IncidentWorker_PowerCut.RaidDelay.RandomInRange, 0);
             *  Find.Storyteller.incidentQueue.Add(qi);
             * };
             * diaOption.resolveTree = true;
             * diaNode.options.Add(diaOption);
             * string text2 = "RefugeeChasedRejected".Translate(refugee.LabelShort, refugee);
             * DiaNode diaNode2 = new DiaNode(text2);
             * DiaOption diaOption2 = new DiaOption("OK".Translate());
             * diaOption2.resolveTree = true;
             * diaNode2.options.Add(diaOption2);
             * DiaOption diaOption3 = new DiaOption("RefugeeChasedInitial_Reject".Translate());
             * diaOption3.action = delegate ()
             * {
             *  Find.WorldPawns.PassToWorld(refugee, PawnDiscardDecideMode.Decide);
             * };
             * diaOption3.link = diaNode2;
             * diaNode.options.Add(diaOption3);
             * string title = "RefugeeChasedTitle".Translate(map.Parent.Label);
             * Find.WindowStack.Add(new Dialog_NodeTreeWithFactionInfo(diaNode, faction, true, true, title));
             * Find.Archive.Add(new ArchivedDialog(diaNode.text, title, faction));
             */
            return(true);
        }
Exemple #4
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            parms.points *= IncidentWorker_CaravanDemand.IncidentPointsFactorRange.RandomInRange;
            Caravan caravan = (Caravan)parms.target;

            if (!PawnGroupMakerUtility.TryGetRandomFactionForCombatPawnGroup(parms.points, out parms.faction, null, false, false, false, true))
            {
                return(false);
            }
            List <ThingCount> demands = this.GenerateDemands(caravan);

            if (demands.NullOrEmpty <ThingCount>())
            {
                return(false);
            }
            PawnGroupMakerParms defaultPawnGroupMakerParms = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(PawnGroupKindDefOf.Combat, parms, false);

            defaultPawnGroupMakerParms.generateFightersOnly            = true;
            defaultPawnGroupMakerParms.dontUseSingleUseRocketLaunchers = true;
            List <Pawn> attackers = PawnGroupMakerUtility.GeneratePawns(defaultPawnGroupMakerParms, true).ToList <Pawn>();

            if (attackers.Count == 0)
            {
                Log.Error(string.Concat(new object[]
                {
                    "Caravan demand incident couldn't generate any enemies even though min points have been checked. faction=",
                    defaultPawnGroupMakerParms.faction,
                    "(",
                    (defaultPawnGroupMakerParms.faction == null) ? "null" : defaultPawnGroupMakerParms.faction.def.ToString(),
                    ") parms=",
                    parms
                }), false);
                return(false);
            }
            CameraJumper.TryJumpAndSelect(caravan);
            DiaNode   diaNode   = new DiaNode(this.GenerateMessageText(parms.faction, attackers.Count, demands, caravan));
            DiaOption diaOption = new DiaOption("CaravanDemand_Give".Translate());

            diaOption.action = delegate
            {
                this.ActionGive(caravan, demands, attackers);
            };
            diaOption.resolveTree = true;
            diaNode.options.Add(diaOption);
            DiaOption diaOption2 = new DiaOption("CaravanDemand_Fight".Translate());

            diaOption2.action = delegate
            {
                this.ActionFight(caravan, attackers);
            };
            diaOption2.resolveTree = true;
            diaNode.options.Add(diaOption2);
            string text = "CaravanDemandTitle".Translate(new object[]
            {
                parms.faction.Name
            });
            WindowStack arg_206_0          = Find.WindowStack;
            DiaNode     nodeRoot           = diaNode;
            Faction     faction            = parms.faction;
            bool        delayInteractivity = true;
            string      title = text;

            arg_206_0.Add(new Dialog_NodeTreeWithFactionInfo(nodeRoot, faction, delayInteractivity, false, title));
            Find.Archive.Add(new ArchivedDialog(diaNode.text, text, parms.faction));
            return(true);
        }
 protected override void ResolveParmsPoints(IncidentParms parms)
 {
     parms.points = TraderCaravanUtility.GenerateGuardPoints();
     IncidentParmsUtility.AdjustPointsForGroupArrivalParams(parms);
 }
Exemple #6
0
        // Token: 0x06000E6F RID: 3695 RVA: 0x0006B3B8 File Offset: 0x000697B8
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map    map    = (Map)parms.target;
            string logmsg = string.Format("");

            logmsg = string.Format("map : {0}", map);
            Log.Message(logmsg);
            IntVec3 spawnSpot;

            if (!this.TryFindSpawnSpot(map, out spawnSpot))
            {
                return(false);
            }
            Faction faction;

            if (!this.TryFindEnemyFaction(out faction))
            {
                return(false);
            }
            int           @int      = Rand.Int;
            IncidentParms raidParms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.ThreatBig, map);

            raidParms.forced             = true;
            raidParms.faction            = faction;
            raidParms.raidStrategy       = RaidStrategyDefOf.ImmediateAttack;
            raidParms.raidArrivalMode    = PawnsArrivalModeDefOf.EdgeWalkIn;
            raidParms.spawnCenter        = spawnSpot;
            raidParms.points             = Mathf.Max(raidParms.points * IncidentWorker_RefugeeChased.RaidPointsFactorRange.RandomInRange, faction.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat));
            raidParms.pawnGroupMakerSeed = new int?(@int);
            PawnGroupMakerParms defaultPawnGroupMakerParms = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(PawnGroupKindDefOf.Combat, raidParms, false);

            defaultPawnGroupMakerParms.points = IncidentWorker_Raid.AdjustedRaidPoints(defaultPawnGroupMakerParms.points, raidParms.raidArrivalMode, raidParms.raidStrategy, defaultPawnGroupMakerParms.faction, PawnGroupKindDefOf.Combat);
            IEnumerable <PawnKindDef> pawnKinds = PawnGroupMakerUtility.GeneratePawnKindsExample(defaultPawnGroupMakerParms);
            PawnGenerationRequest     request   = new PawnGenerationRequest(PawnKindDefOf.SpaceRefugee, null, PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 20f, false, true, true, false, false, false, false, null, null, null, null, null, null, null, null);
            Pawn refugee = PawnGenerator.GeneratePawn(request);

            refugee.relations.everSeenByPlayer = true;
            string text = "RefugeeChasedInitial".Translate(new object[]
            {
                refugee.Name.ToStringFull,
                refugee.story.Title,
                faction.def.pawnsPlural,
                faction.Name,
                refugee.ageTracker.AgeBiologicalYears,
                PawnUtility.PawnKindsToCommaList(pawnKinds, true)
            });

            text = text.AdjustedFor(refugee, "PAWN");
            PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, refugee);
            DiaNode   diaNode   = new DiaNode(text);
            DiaOption diaOption = new DiaOption("RefugeeChasedInitial_Accept".Translate());

            diaOption.action = delegate()
            {
                GenSpawn.Spawn(refugee, spawnSpot, map, WipeMode.Vanish);
                refugee.SetFaction(Faction.OfPlayer, null);
                CameraJumper.TryJump(refugee);
                QueuedIncident qi = new QueuedIncident(new FiringIncident(IncidentDefOf.RaidEnemy, null, raidParms), Find.TickManager.TicksGame + IncidentWorker_RefugeeChased.RaidDelay.RandomInRange, 0);
                Find.Storyteller.incidentQueue.Add(qi);
            };
            diaOption.resolveTree = true;
            diaNode.options.Add(diaOption);
            string text2 = "RefugeeChasedRejected".Translate(new object[]
            {
                refugee.LabelShort
            });
            DiaNode   diaNode2   = new DiaNode(text2);
            DiaOption diaOption2 = new DiaOption("OK".Translate());

            diaOption2.resolveTree = true;
            diaNode2.options.Add(diaOption2);
            DiaOption diaOption3 = new DiaOption("RefugeeChasedInitial_Reject".Translate());

            diaOption3.action = delegate()
            {
                Find.WorldPawns.PassToWorld(refugee, PawnDiscardDecideMode.Decide);
            };
            diaOption3.link = diaNode2;
            diaNode.options.Add(diaOption3);
            string title = "RefugeeChasedTitle".Translate(new object[]
            {
                map.Parent.Label
            });

            Find.WindowStack.Add(new Dialog_NodeTreeWithFactionInfo(diaNode, faction, true, true, title));
            Find.Archive.Add(new ArchivedDialog(diaNode.text, title, faction));
            return(true);
        }
Exemple #7
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            ResolveRaidPoints(parms);
            if (!TryResolveRaidFaction(parms))
            {
                return(false);
            }
            PawnGroupKindDef combat = PawnGroupKindDefOf.Combat;

            ResolveRaidStrategy(parms, combat);
            ResolveRaidArriveMode(parms);
            parms.raidStrategy.Worker.TryGenerateThreats(parms);
            if (!parms.raidArrivalMode.Worker.TryResolveRaidSpawnCenter(parms))
            {
                return(false);
            }
            parms.points = AdjustedRaidPoints(parms.points, parms.raidArrivalMode, parms.raidStrategy, parms.faction, combat);
            List <Pawn> list = parms.raidStrategy.Worker.SpawnThreats(parms);

            if (list == null)
            {
                list = PawnGroupMakerUtility.GeneratePawns(IncidentParmsUtility.GetDefaultPawnGroupMakerParms(combat, parms)).ToList();
                if (list.Count == 0)
                {
                    Log.Error("Got no pawns spawning raid from parms " + parms);
                    return(false);
                }
                parms.raidArrivalMode.Worker.Arrive(list, parms);
            }
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("Points = " + parms.points.ToString("F0"));
            foreach (Pawn item in list)
            {
                string str = (item.equipment != null && item.equipment.Primary != null) ? item.equipment.Primary.LabelCap : "unarmed";
                stringBuilder.AppendLine(item.KindLabel + " - " + str);
            }
            TaggedString letterLabel = GetLetterLabel(parms);
            TaggedString letterText  = GetLetterText(parms, list);

            PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(list, ref letterLabel, ref letterText, GetRelatedPawnsInfoLetterText(parms), informEvenIfSeenBefore: true);
            List <TargetInfo> list2 = new List <TargetInfo>();

            if (parms.pawnGroups != null)
            {
                List <List <Pawn> > list3 = IncidentParmsUtility.SplitIntoGroups(list, parms.pawnGroups);
                List <Pawn>         list4 = list3.MaxBy((List <Pawn> x) => x.Count);
                if (list4.Any())
                {
                    list2.Add(list4[0]);
                }
                for (int i = 0; i < list3.Count; i++)
                {
                    if (list3[i] != list4 && list3[i].Any())
                    {
                        list2.Add(list3[i][0]);
                    }
                }
            }
            else if (list.Any())
            {
                foreach (Pawn item2 in list)
                {
                    list2.Add(item2);
                }
            }
            SendStandardLetter(letterLabel, letterText, GetLetterDef(), parms, list2);
            parms.raidStrategy.Worker.MakeLords(parms, list);
            LessonAutoActivator.TeachOpportunity(ConceptDefOf.EquippingWeapons, OpportunityType.Critical);
            if (!PlayerKnowledgeDatabase.IsComplete(ConceptDefOf.ShieldBelts))
            {
                for (int j = 0; j < list.Count; j++)
                {
                    if (list[j].apparel.WornApparel.Any((Apparel ap) => ap is ShieldBelt))
                    {
                        LessonAutoActivator.TeachOpportunity(ConceptDefOf.ShieldBelts, OpportunityType.Critical);
                        break;
                    }
                }
            }
            return(true);
        }
        // Token: 0x06000E1C RID: 3612 RVA: 0x00069B78 File Offset: 0x00067F78
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            GameConditionManager gameConditionManager = parms.target.GameConditionManager;
            int           duration = Mathf.RoundToInt(this.def.durationDays.RandomInRange * 60000f);
            GameCondition cond     = GameConditionMaker.MakeCondition(this.def.gameCondition, duration, 0);

            gameConditionManager.RegisterCondition(cond);
            Map     map = (Map)parms.target;
            IntVec3 spawnSpot;

            if (!this.TryFindSpawnSpot(map, out spawnSpot))
            {
                return(false);
            }
            Faction faction = Find.FactionManager.FirstFactionOfDef(XenomorphDefOf.RRY_Xenomorph);

            if (faction == null)
            {
                return(false);
            }
            int           @int      = Rand.Int;
            IncidentParms raidParms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.ThreatBig, map);

            raidParms.forced               = true;
            raidParms.faction              = faction;
            raidParms.raidStrategy         = RaidStrategyDefOf.ImmediateAttack;
            raidParms.raidArrivalMode      = PawnsArrivalModeDefOf.EdgeWalkIn;
            raidParms.spawnCenter          = spawnSpot;
            raidParms.generateFightersOnly = true;
            raidParms.points               = Mathf.Max(raidParms.points * IncidentWorker_PowerCut.RaidPointsFactorRange.RandomInRange, faction.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat));
            raidParms.pawnGroupMakerSeed   = new int?(@int);
            PawnGroupMakerParms defaultPawnGroupMakerParms = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(PawnGroupKindDefOf.Combat, raidParms, false);

            defaultPawnGroupMakerParms.points = IncidentWorker_Raid.AdjustedRaidPoints(defaultPawnGroupMakerParms.points, raidParms.raidArrivalMode, raidParms.raidStrategy, defaultPawnGroupMakerParms.faction, PawnGroupKindDefOf.Combat);
            IEnumerable <PawnKindDef> pawnKinds = PawnGroupMakerUtility.GeneratePawnKindsExample(defaultPawnGroupMakerParms);

            base.SendStandardLetter();
            QueuedIncident qi = new QueuedIncident(new FiringIncident(IncidentDefOf.RaidEnemy, null, raidParms), Find.TickManager.TicksGame + IncidentWorker_PowerCut.RaidDelay.RandomInRange, 0);

            Find.Storyteller.incidentQueue.Add(qi);

            /*
             * DiaNode diaNode = new DiaNode(text);
             * DiaOption diaOption = new DiaOption("RefugeeChasedInitial_Accept".Translate());
             * diaOption.action = delegate ()
             * {
             *  QueuedIncident qi = new QueuedIncident(new FiringIncident(IncidentDefOf.RaidEnemy, null, raidParms), Find.TickManager.TicksGame + IncidentWorker_PowerCut.RaidDelay.RandomInRange, 0);
             *  Find.Storyteller.incidentQueue.Add(qi);
             * };
             * diaOption.resolveTree = true;
             * diaNode.options.Add(diaOption);
             * string text2 = "RefugeeChasedRejected".Translate(refugee.LabelShort, refugee);
             * DiaNode diaNode2 = new DiaNode(text2);
             * DiaOption diaOption2 = new DiaOption("OK".Translate());
             * diaOption2.resolveTree = true;
             * diaNode2.options.Add(diaOption2);
             * DiaOption diaOption3 = new DiaOption("RefugeeChasedInitial_Reject".Translate());
             * diaOption3.action = delegate ()
             * {
             *  Find.WorldPawns.PassToWorld(refugee, PawnDiscardDecideMode.Decide);
             * };
             * diaOption3.link = diaNode2;
             * diaNode.options.Add(diaOption3);
             * string title = "RefugeeChasedTitle".Translate(map.Parent.Label);
             * Find.WindowStack.Add(new Dialog_NodeTreeWithFactionInfo(diaNode, faction, true, true, title));
             * Find.Archive.Add(new ArchivedDialog(diaNode.text, title, faction));
             */
            return(true);
        }