public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn)
        {
            ///This code returns all the other float menu options first!
            var enumerator = base.GetFloatMenuOptions(myPawn).GetEnumerator();

            while (enumerator.MoveNext())
            {
                var current = enumerator.Current;
                yield return(current);
            }

            if (CultUtility.AreCultObjectsAvailable(Map) == false)
            {
                if (CultUtility.IsSomeoneInvestigating(Map) == false)
                {
                    void action0()
                    {
                        var job = new Job(CultsDefOf.Cults_Investigate, myPawn, this)
                        {
                            playerForced = true
                        };

                        myPawn.jobs.TryTakeOrderedJob(job);
                        //mypawn.CurJob.EndCurrentJob(JobCondition.InterruptForced);
                    }

                    yield return(new FloatMenuOption("Cults_Investigate".Translate(), action0));
                }
            }
        }
        public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn)
        {
            ///This code returns all the other float menu options first!
            IEnumerator <FloatMenuOption> enumerator = base.GetFloatMenuOptions(myPawn).GetEnumerator();

            while (enumerator.MoveNext())
            {
                FloatMenuOption current = enumerator.Current;
                yield return(current);
            }

            if (this.def != null && this is Building_Monolith)
            {
                if (this.def.hasInteractionCell)
                {
                    if (CultUtility.AreCultObjectsAvailable(Map) == false)
                    {
                        if (CultUtility.IsSomeoneInvestigating(Map) == false)
                        {
                            if (Map.reservationManager.CanReserve(myPawn, this))
                            {
                                Action action0 = delegate
                                {
                                    Job job = new Job(CultsDefOf.Cults_Investigate, myPawn, this);
                                    job.playerForced = true;
                                    myPawn.jobs.TryTakeOrderedJob(job);
                                    //mypawn.CurJob.EndCurrentJob(JobCondition.InterruptForced);
                                };
                                yield return(new FloatMenuOption("Investigate", action0, MenuOptionPriority.Default, null, null, 0f, null));
                            }
                        }
                    }
                }
            }
        }
Example #3
0
        public void ReceiveWorship(Pawn preacher)
        {
            int preacherSoc = preacher.skills.GetSkill(SkillDefOf.Social).Level;
            List <Pawn>
            congregation =
                CultTracker.Get.PlayerCult
                .members;         //preacher.Map.GetComponent<MapComponent_LocalCultTracker>().LocalCultMembers;

            if (preacher == null)
            {
                Log.Error("Preacher is null.");
            }
            if (congregation == null)
            {
                Log.Error("Congregation is null");
            }
            float value = (float)Math.Max(1, (preacherSoc));

            if (value != 0)
            {
                value /= (20 * ((float)((int)PlayerTier + 1)));
            }
            bool perfect           = false;
            bool sacrificialDagger = false;

            value += CultUtility.CongregationBonus(congregation, this, out perfect, out sacrificialDagger);
            Cthulhu.Utility.DebugReport("Worship Value: " + value.ToString());
            AffectFavor(value);
        }
        public void SetBaseLevels()
        {
            baseSet = true;
            var temp = CurLevel;

            if (pawn == null)
            {
                return;
            }

            temp += CultUtility.GetBaseCultistModifier(pawn);
            if (temp > 0.99f)
            {
                temp = 0.99f;
            }

            if (temp < 0.01f)
            {
                temp = 0.01f;
            }

            if (pawn?.Faction?.def?.defName == "ROM_TheAgency")
            {
                Utility.DebugReport(pawn.Name.ToStringFull + " is a member of the agency. Cult levels set to 1%.");
                temp = 0.01f;
            }

            CurLevel = temp;
        }
        private void DoubleTheFun(Map map)
        {
            FunSpell result = GenCollection.RandomElementByWeight <FunSpell>(TableOfFun, GetWeight);

            while (result.defName == "Cults_SpellDoubleTheFun")
            {
                result = GenCollection.RandomElementByWeight <FunSpell>(TableOfFun, GetWeight);
            }
            IncidentDef temp = DefDatabase <IncidentDef> .GetNamed(result.defName);

            FunSpell result2 = GenCollection.RandomElementByWeight <FunSpell>(TableOfFun, GetWeight);

            while (result2.defName == "Cults_SpellDoubleTheFun")
            {
                result2 = GenCollection.RandomElementByWeight <FunSpell>(TableOfFun, GetWeight);
            }
            IncidentDef temp2 = DefDatabase <IncidentDef> .GetNamed(result2.defName);

            if (temp != null && temp2 != null)
            {
                map.GetComponent <MapComponent_SacrificeTracker>().wasDoubleTheFun      = true;
                map.GetComponent <MapComponent_SacrificeTracker>().lastSideEffect       = temp;
                map.GetComponent <MapComponent_SacrificeTracker>().lastDoubleSideEffect = temp2;
                CultUtility.CastSpell(temp, map);
                CultUtility.CastSpell(temp2, map);
                return;
            }
            Cthulhu.Utility.DebugReport("Failed to utilize " + temp.ToString());
            Cthulhu.Utility.DebugReport("Failed to utilize " + temp2.ToString());
        }
        public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn)
        {
            ///This code returns all the other float menu options first!
            IEnumerator <FloatMenuOption> enumerator = base.GetFloatMenuOptions(myPawn).GetEnumerator();

            while (enumerator.MoveNext())
            {
                FloatMenuOption current = enumerator.Current;
                yield return(current);
            }

            if (this.def != null && this is Building_Monolith)
            {
                if (this.def.hasInteractionCell)
                {
                    if (CultUtility.AreCultObjectsAvailable(Map) == false)
                    {
                        if (CultUtility.IsSomeoneInvestigating(Map) == false)
                        {
                            if (Map.reservationManager.CanReserve(myPawn, this))
                            {
                                Action action0 = delegate
                                {
                                    DoInvestigateJob(myPawn);
                                };
                                yield return(new FloatMenuOption("Investigate", action0, MenuOptionPriority.Default, null, null, 0f, null));
                            }
                        }
                    }
                }
            }
        }
Example #7
0
        public override void Interacted(Pawn initiator, Pawn recipient, List <RulePackDef> extraSentencePacks, out string letterText, out string letterLabel, out LetterDef letterDef, out LookTargets lookTargets)
        {
            base.Interacted(initiator, recipient, extraSentencePacks, out letterText, out letterLabel, out letterDef, out lookTargets);

            CultUtility.AffectCultMindedness(recipient, Rand.Range(CULTMINDED_EFFECT_MIN, CULTMINDED_EFFECT_MAX));
            CultUtility.AffectCultMindedness(initiator, Rand.Range(CULTMINDED_EFFECT_MIN, CULTMINDED_EFFECT_MAX));
        }
Example #8
0
        public static void OpenPreacherSelectMenu(Building_SacrificialAltar altar)
        {
            List <FloatMenuOption> list = new List <FloatMenuOption>();

            list.Add(new FloatMenuOption("(" + "Auto".Translate() + ")", delegate
            {
                altar.tempPreacher = CultUtility.DetermineBestPreacher(altar.Map);
            }, MenuOptionPriority.Default, null, null, 0f, null));

            foreach (Pawn current in CultTracker.Get.PlayerCult.MembersAt(altar.Map))
            {
                if (current.health.capacities.CapableOf(PawnCapacityDefOf.Talking) &&
                    current.health.capacities.CapableOf(PawnCapacityDefOf.Moving))
                {
                    Action action;
                    Pawn   localCol = current;
                    action = delegate
                    {
                        //Map.GetComponent<MapComponent_SacrificeTracker>().lastUsedAltar = altar;
                        altar.tempPreacher = localCol;
                    };
                    list.Add(new FloatMenuOption(localCol.LabelShort, action, MenuOptionPriority.Default, null, null, 0f, null));
                }
            }
            Find.WindowStack.Add(new FloatMenu(list));
        }
Example #9
0
        public static void OpenPreacherSelectMenu(Building_SacrificialAltar altar)
        {
            var list = new List <FloatMenuOption>
            {
                new FloatMenuOption("(" + "Auto".Translate() + ")",
                                    delegate { altar.tempPreacher = CultUtility.DetermineBestPreacher(altar.Map); })
            };

            foreach (var current in CultTracker.Get.PlayerCult.MembersAt(altar.Map))
            {
                if (!current.health.capacities.CapableOf(PawnCapacityDefOf.Talking) ||
                    !current.health.capacities.CapableOf(PawnCapacityDefOf.Moving))
                {
                    continue;
                }

                var localCol = current;

                void Action()
                {
                    //Map.GetComponent<MapComponent_SacrificeTracker>().lastUsedAltar = altar;
                    altar.tempPreacher = localCol;
                }

                list.Add(new FloatMenuOption(localCol.LabelShort, Action));
            }

            Find.WindowStack.Add(new FloatMenu(list));
        }
        private void GiveInteractionSanityLoss()
        {
            Pawn temp = InteractingPawn;
            ResearchProjectDef currentProject = Find.ResearchManager.currentProj;
            float modifier = 0.0040f;

            if (temp == null)
            {
                return;
            }
            if (currentProject == null)
            {
                return;
            }
            if (!IsThisCultistResearch(currentProject))
            {
                return;
            }
            UsageWarning(temp);
            if (Find.ResearchManager.currentProj == ResearchProjectDef.Named("Forbidden_Lore"))
            {
                modifier *= 1.2f;
                temp.skills.Learn(SkillDefOf.Social, SocialSkillBoost);
            }
            Cthulhu.Utility.ApplySanityLoss(temp, modifier, MaxSanityLoss);
            CultUtility.AffectCultMindedness(temp, modifier, MaxCultMindedBoost);
        }
        public void StartToWorship(bool forced = false)
        {
            preacher            = tempPreacher;
            currentWorshipDeity = tempCurrentWorshipDeity;

            if (this.Destroyed || !this.Spawned)
            {
                CultUtility.AbortCongregation(null, "The altar is unavailable.");
                return;
            }
            if (!Cthulhu.Utility.IsActorAvailable(this.preacher))
            {
                CultUtility.AbortCongregation(this, "The preacher, " + this.preacher.LabelShort + ", is unavaialable.");
                this.preacher = null;
                return;
            }

            Settlement factionBase = (Settlement)this.Map.info.parent;

            Messages.Message("WorshipGathering".Translate(new object[] {
                factionBase.Label
            }), TargetInfo.Invalid, MessageTypeDefOf.NeutralEvent);
            ChangeState(State.worshipping, WorshipState.started);
            //this.currentState = State.started;
            //Map.GetComponent<MapComponent_SacrificeTracker>().lastResult = CultUtility.SacrificeResult.none;

            Cthulhu.Utility.DebugReport("Force worship called");
            Job job = new Job(CultsDefOf.Cults_HoldWorship, this);

            job.playerForced = forced;
            preacher.jobs.TryTakeOrderedJob(job);
            //preacher.jobs.EndCurrentJob(JobCondition.InterruptForced);
            //GetWorshipGroup(this, Map, forced);
        }
Example #12
0
        private void DoubleTheFun(Map map)
        {
            var result = TableOfFun.RandomElementByWeight(GetWeight);

            while (result.defName == "Cults_SpellDoubleTheFun")
            {
                result = TableOfFun.RandomElementByWeight(GetWeight);
            }

            var temp = DefDatabase <IncidentDef> .GetNamed(result.defName);

            var result2 = TableOfFun.RandomElementByWeight(GetWeight);

            while (result2.defName == "Cults_SpellDoubleTheFun")
            {
                result2 = TableOfFun.RandomElementByWeight(GetWeight);
            }

            var temp2 = DefDatabase <IncidentDef> .GetNamed(result2.defName);

            if (temp != null && temp2 != null)
            {
                map.GetComponent <MapComponent_SacrificeTracker>().wasDoubleTheFun      = true;
                map.GetComponent <MapComponent_SacrificeTracker>().lastSideEffect       = temp;
                map.GetComponent <MapComponent_SacrificeTracker>().lastDoubleSideEffect = temp2;
                CultUtility.CastSpell(temp, map);
                CultUtility.CastSpell(temp2, map);
                return;
            }

            Utility.DebugReport("Failed to utilize " + temp);
            Utility.DebugReport("Failed to utilize " + temp2);
        }
        private void TryTimedWorship()
        {
            if (tempCurrentWorshipDeity == null)
            {
                Messages.Message("Cults_NoWorshipWithoutDeity".Translate(), MessageTypeDefOf.RejectInput);
                //CancelWorship();
                return;
            }

            if (tempPreacher == null)
            {
                tempPreacher = CultUtility.DetermineBestPreacher(Map);
            }

            if (Utility.IsMorning(Map))
            {
                didMorningRitual = true;
            }

            if (Utility.IsEvening(Map))
            {
                didEveningRitual = true;
            }

            TryWorship();
        }
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map     map = parms.target as Map;
            IntVec3 intVec;

            //Find a drop spot
            if (!CultUtility.TryFindDropCell(map.Center, map, 999999, out intVec))
            {
                return(false);
            }
            //Spawn 1 relic
            Building_LandedShip thing = (Building_LandedShip)ThingMaker.MakeThing(CultsDefOf.Cults_LandedShip, null);

            GenPlace.TryPlaceThing(thing, intVec.RandomAdjacentCell8Way(), map, ThingPlaceMode.Near);

            //Spawn 2 treasure chest
            Building_TreasureChest thing2 = (Building_TreasureChest)ThingMaker.MakeThing(CultsDefOf.Cults_TreasureChest, null);

            GenPlace.TryPlaceThing(thing2, intVec.RandomAdjacentCell8Way(), map, ThingPlaceMode.Near);
            Building_TreasureChest thing3 = (Building_TreasureChest)ThingMaker.MakeThing(CultsDefOf.Cults_TreasureChest, null);

            GenPlace.TryPlaceThing(thing3, intVec.RandomAdjacentCell8Way(), map, ThingPlaceMode.Near);

            map.GetComponent <MapComponent_SacrificeTracker>().lastLocation = intVec;
            Messages.Message("Treasures from the deep mysteriously appear.", new TargetInfo(intVec, map), MessageTypeDefOf.PositiveEvent);
            Cthulhu.Utility.ApplyTaleDef("Cults_SpellBountyOfTheSea", map);
            return(true);
        }
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            //Log.Message("Building_LandedShip TrySetDeepOneFaction");
            if (!TrySetDeepOneFaction(parms))
            {
                return(false);
            }

            var map = parms.target as Map;

            //Find a drop spot
            if (!CultUtility.TryFindDropCell(map.Center, map, 70, out var intVec))
            {
                return(false);
            }

            parms.spawnCenter = intVec;
            var list = SpawnPawns(parms);

            if (list.Count == 0)
            {
                return(false);
            }

            var spotFound = RCellFinder.TryFindRandomSpotJustOutsideColony(list[0], out var chillSpot);
            //LordJob_VisitColony lordJob = new LordJob_VisitColony(parms.faction, chillSpot);

            //If they have the sign of dagon, then use it.
            var chillSpot2 = IntVec3.Invalid;
            var dagonSign  =
                map.listerBuildings.allBuildingsColonist.FirstOrDefault(bld => bld.def == CultsDefOf.Cults_SignOfDagon);

            if (dagonSign != null)
            {
                chillSpot2 = dagonSign.Position;
            }

            if (chillSpot2 != null)
            {
                chillSpot = chillSpot2;
            }

            if (chillSpot == null)
            {
                return(false);
            }

            //Log.Message("SpellWorker_DefendTheBrood LordJob_DefendPoint");
            var lordJob = new LordJob_DefendPoint(chillSpot);

            Utility.TemporaryGoodwill(parms.faction);
            LordMaker.MakeNewLord(parms.faction, lordJob, map, list);
            //Find.LetterStack.ReceiveLetter("DeepOnesArrive".Translate(), "DeepOnesArriveDesc".Translate(), letterDef.Good, list[0]);
            map.GetComponent <MapComponent_SacrificeTracker>().lastLocation = list[0].Position;
            map.GetComponent <MapComponent_SacrificeTracker>().defendTheBroodPawns.AddRange(list);


            return(true);
        }
 public override void MentalStateTick()
 {
     base.MentalStateTick();
     if (pawn.IsHashIntervalTick(1000))
     {
         CultUtility.AffectCultMindedness(pawn, -0.05f);
         //Cthulhu.Utility.ApplySanityLoss(this.pawn, -0.05f);
     }
 }
Example #17
0
        private static string PreacherLabel(Building_SacrificialAltar altar)
        {
            if (altar.tempPreacher != null)
            {
                return(altar.tempPreacher.Name.ToStringShort);
            }

            altar.tempPreacher = CultUtility.DetermineBestPreacher(altar.Map);
            return(altar.tempPreacher == null ? "None" : altar.tempPreacher.Name.ToStringShort);
        }
Example #18
0
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            if (t == null)
            {
                return(false);
            }

            if (t.def != CultsDefOf.Cults_PlantTreeNightmare &&
                t.def != CultsDefOf.Cults_MonolithNightmare)
            {
                return(false);
            }

            //Log.Message("1");

            //Log.Message("2");

            MapComponent_LocalCultTracker cultTracker = pawn.MapHeld.GetComponent <MapComponent_LocalCultTracker>();

            if (cultTracker != null && cultTracker.CurrentSeedState > CultSeedState.NeedSeeing)
            {
                return(false);
            }
            //Log.Message("3");

            if (CultUtility.AreCultObjectsAvailable(pawn.MapHeld) == false)
            {
                if (CultUtility.IsSomeoneInvestigating(pawn.MapHeld))
                {
                    return(false);
                }
            }
            //Log.Message("4");

            if (pawn.Faction != Faction.OfPlayerSilentFail)
            {
                return(false);
            }
            //if (pawn.Faction == Faction.OfPlayer && !pawn.Map.areaManager.Home[t.Position])
            //{
            //    JobFailReason.Is(WorkGiver_FixBrokenDownBuilding.NotInHomeAreaTrans);
            //    return false;
            //}
            //Log.Message("5");

            if (!pawn.CanReserveAndReach(t, PathEndMode.ClosestTouch, Danger.None))
            {
                return(false);                                                                   // pawn.Map.reservationManager.IsReserved(t, pawn.Faction)) return false;
            }
            //Log.Message("6");

            return(true);
        }
Example #19
0
        protected override AcceptanceReport NameIsValid(string name)
        {
            var result = base.NameIsValid(name);

            if (!result.Accepted)
            {
                return(result);
            }

            return(name.Length == 0 || !CultUtility.CheckValidCultName(name)
                ? "NameIsInvalid".Translate()
                : (AcceptanceReport)true);
        }
Example #20
0
        public void ReceiveSacrifice(Pawn sacrifice, Map map, bool favorSpell = false, bool starsAreRight = false,
                                     bool starsAreWrong = false)
        {
            var tracker = map.GetComponent <MapComponent_SacrificeTracker>();
            var value   =
                (sacrifice.MarketValue + SacrificeBonus(sacrifice, map, favorSpell, starsAreRight, starsAreWrong)) /
                DIVIDER_HUMAN;

            value += CultUtility.CongregationBonus(tracker.lastUsedAltar.SacrificeData.Congregation, this, out _,
                                                   out _);
            Utility.DebugReport("Sacrifice Value: " + value);
            AffectFavor(value);
        }
Example #21
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map map = parms.target as Map;

            for (int i = 0; i < 2; i++)
            {
                if (!CultUtility.TrySpawnWalkInCultist(map, CultUtility.CultistType.Preacher, false))
                {
                    //Log.Messag("Failed to spawn walk in cultist");
                    return(false);
                }
            }
            return(true);
        }
        public void GetWorshipGroup(IEnumerable <IntVec3> inRangeCells, bool forced = false)
        {
            if (AvailableWorshippers == null || AvailableWorshippers.Count <= 0)
            {
                return;
            }

            foreach (var p in AvailableWorshippers)
            {
                if (CultUtility.ShouldAttendWorship(p, this))
                {
                    CultUtility.GiveAttendWorshipJob(this, p);
                }
            }
        }
Example #23
0
        public void ReceiveSacrifice(Pawn sacrifice, Map map, bool favorSpell = false, bool starsAreRight = false,
                                     bool starsAreWrong = false)
        {
            MapComponent_SacrificeTracker tracker = map.GetComponent <MapComponent_SacrificeTracker>();
            float value =
                (sacrifice.MarketValue + SacrificeBonus(sacrifice, map, favorSpell, starsAreRight, starsAreWrong)) /
                DIVIDER_HUMAN;
            bool perfect           = false;
            bool sacrificialDagger = false;

            value += CultUtility.CongregationBonus(tracker.lastUsedAltar.SacrificeData.Congregation, this, out perfect,
                                                   out sacrificialDagger);
            Cthulhu.Utility.DebugReport("Sacrifice Value: " + value.ToString());
            AffectFavor(value);
        }
Example #24
0
        public override void DoEffectOn(Pawn user, Thing target)
        {
            Pawn pawn = (Pawn)target;

            if (pawn.Dead)
            {
                return;
            }
            Cthulhu.Utility.ApplySanityLoss(pawn, 0.9f);
            CultUtility.AffectCultMindedness(pawn, 0.99f, 0.99f);
            Messages.Message("CompTargetEffectCultMinded".Translate(
                                 pawn.Label
                                 ), MessageTypeDefOf.NeutralEvent);
            //pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Berserk, null, false, false, null);
        }
        public override float RandomSelectionWeight(Pawn initiator, Pawn recipient)
        {
            //We need two individuals that are part of the colony
            if (!initiator.IsColonist || !initiator.IsPrisoner)
            {
                return(0f);
            }
            if (!recipient.IsColonist || !recipient.IsPrisoner)
            {
                return(0f);
            }

            //If they are sleeping, don't do this.
            if (initiator.jobs.curDriver.asleep)
            {
                return(0f);
            }
            if (recipient.jobs.curDriver.asleep)
            {
                return(0f);
            }

            //We need them to have different mindsets.
            if (CultUtility.IsCultMinded(recipient))
            {
                return(0f);
            }
            if (!CultUtility.IsCultMinded(initiator))
            {
                return(0f);
            }

            //Normally, it's double chance of happening.
            float math = 2f;

            //Subtract the social skill of the initiator by 10.
            //A social skill of 20 will return a 0 chance of this happening.
            math -= ((float)(initiator.skills.GetSkill(SkillDefOf.Social).Level) / 10);
            //Throw in random chance.
            math += Rand.Range(-0.5f, 0.5f);

            //Especially if they don't like the other guy.
            if (initiator.relations.OpinionOf(recipient) < 15)
            {
                return(Mathf.Clamp(math, 0f, 2f));
            }
            return(0f);
        }
        public void GetWorshipGroup(IEnumerable <IntVec3> inRangeCells, bool forced = false)
        {
            _ = Faction;
            _ = this.GetRoom();

            if (AvailableWorshippers != null && AvailableWorshippers.Count > 0)
            {
                foreach (var p in AvailableWorshippers)
                {
                    if (CultUtility.ShouldAttendWorship(p, this))
                    {
                        CultUtility.GiveAttendWorshipJob(this, p);
                    }
                }
            }
        }
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map     map = parms.target as Map;
            IntVec3 intVec;

            //Find a drop spot
            if (!CultUtility.TryFindDropCell(map.Center, map, 70, out intVec))
            {
                return(false);
            }
            parms.spawnCenter = intVec;
            Cthulhu.Utility.SpawnPawnsOfCountAt(CultsDefOf.Cults_Byakhee, intVec, map, 1, Faction.OfPlayer);

            map.GetComponent <MapComponent_SacrificeTracker>().lastLocation = intVec;
            return(true);
        }
        public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn myPawn)
        {
            using var enumerator = base.GetFloatMenuOptions(myPawn).GetEnumerator();
            while (enumerator.MoveNext())
            {
                var current = enumerator.Current;
                yield return(current);
            }

            if (def == null || this is not Building_Monolith)
            {
                yield break;
            }

            if (!def.hasInteractionCell)
            {
                yield break;
            }

            if (CultUtility.AreCultObjectsAvailable(Map))
            {
                yield break;
            }

            if (CultUtility.IsSomeoneInvestigating(Map))
            {
                yield break;
            }

            if (!Map.reservationManager.CanReserve(myPawn, this))
            {
                yield break;
            }

            void action0()
            {
                var job = new Job(CultsDefOf.Cults_Investigate, myPawn, this)
                {
                    playerForced = true
                };

                myPawn.jobs.TryTakeOrderedJob(job);
                //mypawn.CurJob.EndCurrentJob(JobCondition.InterruptForced);
            }

            yield return(new FloatMenuOption("Investigate", action0));
        }
Example #29
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.EndOnDespawnedOrNull(InvestigatorIndex);
            this.EndOnDespawnedOrNull(InvestigateeIndex);
            //this.EndOnDespawnedOrNull(Build, JobCondition.Incompletable);
            yield return(Toils_Reserve.Reserve(InvestigateeIndex, job.def.joyMaxParticipants));

            var gotoInvestigatee = Toils_Goto.GotoThing(InvestigateeIndex, PathEndMode.ClosestTouch);

            yield return(gotoInvestigatee);

            yield return(Toils_Goto.GotoCell(Investigatee.InteractionCell, PathEndMode.OnCell));

            var watchToil = new Toil
            {
                defaultCompleteMode = ToilCompleteMode.Delay,
                defaultDuration     = job.def.joyDuration
            };

            watchToil.WithProgressBarToilDelay(InvestigatorIndex);
            watchToil.AddPreTickAction(() =>
            {
                pawn.rotationTracker.FaceCell(TargetB.Cell);
                pawn.GainComfortFromCellIfPossible();
            });
            watchToil.AddFinishAction(() =>
                                      Map.GetComponent <MapComponent_LocalCultTracker>().CurrentSeedState = CultSeedState.FinishedSeeing);
            yield return(watchToil);

            AddFinishAction(() =>
            {
                //When the investigation is finished, apply effects.
                if (Map.GetComponent <MapComponent_LocalCultTracker>().CurrentSeedState != CultSeedState.FinishedSeeing)
                {
                    return;
                }

                CultUtility.InvestigatedCultSeed(Investigator, Investigatee);
                Utility.DebugReport("Called end tick check");

                //if (this.TargetB.HasThing)
                //{
                //    Find.Reservations.Release(this.job.targetC.Thing, pawn);
                //}
            });
        }
        public override void DoEffectOn(Pawn user, Thing target)
        {
            var pawn = (Pawn)target;

            if (pawn.Dead)
            {
                return;
            }

            Utility.ApplySanityLoss(pawn, 0.9f);
            CultUtility.AffectCultMindedness(pawn, 0.99f);
            Messages.Message("CompTargetEffectCultMinded".Translate(
                                 pawn.Label
                                 ), MessageTypeDefOf.NeutralEvent);
            //pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Berserk, null, false, false, null);
            Find.BattleLog.Add(new BattleLogEntry_ItemUsed(user, target, this.parent.def, RulePackDefOf.Event_ItemUsed));
        }