Example #1
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map     map = (Map)parms.target;
            IntVec3 intVec;
            bool    result;

            if (!this.TryFindEntryCell(map, out intVec))
            {
                result = false;
            }
            else
            {
                PawnKindDef thrumbo = PawnKindDefOf.Thrumbo;
                float       num     = StorytellerUtility.DefaultThreatPointsNow(map);
                int         num2    = GenMath.RoundRandom(num / thrumbo.combatPower);
                int         max     = Rand.RangeInclusive(2, 4);
                num2 = Mathf.Clamp(num2, 1, max);
                int     num3    = Rand.RangeInclusive(90000, 150000);
                IntVec3 invalid = IntVec3.Invalid;
                if (!RCellFinder.TryFindRandomCellOutsideColonyNearTheCenterOfTheMap(intVec, map, 10f, out invalid))
                {
                    invalid = IntVec3.Invalid;
                }
                Pawn pawn = null;
                for (int i = 0; i < num2; i++)
                {
                    IntVec3 loc = CellFinder.RandomClosewalkCellNear(intVec, map, 10, null);
                    pawn = PawnGenerator.GeneratePawn(thrumbo, null);
                    GenSpawn.Spawn(pawn, loc, map, Rot4.Random, WipeMode.Vanish, false);
                    pawn.mindState.exitMapAfterTick = Find.TickManager.TicksGame + num3;
                    if (invalid.IsValid)
                    {
                        pawn.mindState.forcedGotoPosition = CellFinder.RandomClosewalkCellNear(invalid, map, 10, null);
                    }
                }
                Find.LetterStack.ReceiveLetter("LetterLabelThrumboPasses".Translate(new object[]
                {
                    thrumbo.label
                }).CapitalizeFirst(), "LetterThrumboPasses".Translate(new object[]
                {
                    thrumbo.label
                }), LetterDefOf.PositiveEvent, pawn, null, null);
                result = true;
            }
            return(result);
        }
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map     map = (Map)parms.target;
            IntVec3 intVec;

            if (!RCellFinder.TryFindRandomPawnEntryCell(out intVec, map, CellFinder.EdgeRoadChance_Animal + 0.2f, null))
            {
                return(false);
            }
            PawnKindDef thrumbo = PawnKindDefOf.Thrumbo;
            float       points  = StorytellerUtility.DefaultParmsNow(Find.Storyteller.def, IncidentCategory.ThreatBig, map).points;
            int         num     = GenMath.RoundRandom(points / thrumbo.combatPower);
            int         max     = Rand.RangeInclusive(2, 4);

            num = Mathf.Clamp(num, 1, max);
            int     num2    = Rand.RangeInclusive(90000, 150000);
            IntVec3 invalid = IntVec3.Invalid;

            if (!RCellFinder.TryFindRandomCellOutsideColonyNearTheCenterOfTheMap(intVec, map, 10f, out invalid))
            {
                invalid = IntVec3.Invalid;
            }
            Pawn pawn = null;

            for (int i = 0; i < num; i++)
            {
                IntVec3 loc = CellFinder.RandomClosewalkCellNear(intVec, map, 10, null);
                pawn = PawnGenerator.GeneratePawn(thrumbo, null);
                GenSpawn.Spawn(pawn, loc, map, Rot4.Random, false);
                pawn.mindState.exitMapAfterTick = Find.TickManager.TicksGame + num2;
                if (invalid.IsValid)
                {
                    pawn.mindState.forcedGotoPosition = CellFinder.RandomClosewalkCellNear(invalid, map, 10, null);
                }
            }
            Find.LetterStack.ReceiveLetter("LetterLabelThrumboPasses".Translate(new object[]
            {
                thrumbo.label
            }).CapitalizeFirst(), "LetterThrumboPasses".Translate(new object[]
            {
                thrumbo.label
            }), LetterDefOf.PositiveEvent, pawn, null);
            return(true);
        }
Example #3
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map map = (Map)parms.target;

            if (!TryFindEntryCell(map, out IntVec3 cell))
            {
                return(false);
            }
            PawnKindDef thrumbo = PawnKindDefOf.Thrumbo;
            float       num     = StorytellerUtility.DefaultThreatPointsNow(map);
            int         value   = GenMath.RoundRandom(num / thrumbo.combatPower);
            int         max     = Rand.RangeInclusive(2, 4);

            value = Mathf.Clamp(value, 1, max);
            int     num2   = Rand.RangeInclusive(90000, 150000);
            IntVec3 result = IntVec3.Invalid;

            if (!RCellFinder.TryFindRandomCellOutsideColonyNearTheCenterOfTheMap(cell, map, 10f, out result))
            {
                result = IntVec3.Invalid;
            }
            Pawn pawn = null;

            for (int i = 0; i < value; i++)
            {
                IntVec3 loc = CellFinder.RandomClosewalkCellNear(cell, map, 10);
                pawn = PawnGenerator.GeneratePawn(thrumbo);
                GenSpawn.Spawn(pawn, loc, map, Rot4.Random);
                pawn.mindState.exitMapAfterTick = Find.TickManager.TicksGame + num2;
                if (result.IsValid)
                {
                    pawn.mindState.forcedGotoPosition = CellFinder.RandomClosewalkCellNear(result, map, 10);
                }
            }
            Find.LetterStack.ReceiveLetter("LetterLabelThrumboPasses".Translate(thrumbo.label).CapitalizeFirst(), "LetterThrumboPasses".Translate(thrumbo.label), LetterDefOf.PositiveEvent, pawn);
            return(true);
        }