Пример #1
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            if (pawn.needs.TryGetNeed <Need_Soul>() != null)
            {
                this.soul = pawn.needs.TryGetNeed <Need_Soul>();
            }
            yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell));

            yield return(TakeBookFromBookshelf(TargetIndex.A, pawn, TargetIndex.B));

            yield return(CarryBookToSeat(pawn));

            yield return(PlaceItemToRead(TargetIndex.B));

            yield return(Toils_Reserve.Reserve(TargetIndex.B, 1));

            yield return(ReadingBook(pawn, 1500, TargetIndex.A, TargetIndex.B));

            //         yield return ReadEnd(pawn, TargetIndex.B, TargetIndex.A);Toil toil2 = null;
            //yield return Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.B);
            //yield return Toils_Haul.StartCarryThing(TargetIndex.B);
            //yield return Toils_Haul.CarryHauledThingToCell(TargetIndex.A);

            this.AddFinishAction(delegate
            {
                Job newjob = new Job(DefDatabase <JobDef> .GetNamed("AddBookToLibrary"), TargetB, TargetA);
                pawn.QueueJob(newjob);
            });
            //   yield return Bookshelf.PlaceBookInShelf(tempbook, this.TargetA.Thing as Bookshelf);
            yield break;
        }
Пример #2
0
        private static void DrawCorruptionBodyOverlay(Pawn pawn, Rot4 bodyFacing, List <Material> listIn, out List <Material> listOut)
        {
            List <Material> list = listIn;
            Need_Soul       soul = pawn.needs.TryGetNeed <Need_Soul>();

            if (soul != null)
            {
                string patronName = soul.patronInfo.PatronName;
                if (!soul.NoPatron && patronName != "Slaanesh")
                {
                    list.Add(AfflictionDrawerUtility.GetHeadGraphic(pawn, patronName).MatAt(bodyFacing));
                    list.Add(AfflictionDrawerUtility.GetBodyOverlay(pawn.story.bodyType, patronName).MatAt(bodyFacing));
                }
            }
            listOut = list;
        }
        public void ReadCorruptionTick(Pawn pawn, ReadableBooks book)
        {
            Need_Soul soul = pawn.needs.TryGetNeed <Need_Soul>();

            if (soul != null)
            {
                float num;
                int   sign = 0;
                switch (book.Tdef.soulItemCategory)
                {
                case (SoulItemCategories.Neutral):
                {
                    sign = 0;
                    break;
                }

                case (SoulItemCategories.Corruption):
                {
                    sign = -1;
                    break;
                }

                case (SoulItemCategories.Redemption):
                {
                    sign = 1;
                    break;
                }

                default:
                {
                    Log.Error("No Soul Item Category Found");
                    break;
                }
                }
                num = sign * this.Tdef.SoulGainRate * 0.2f / 1200;
                soul.GainNeed(num);
            }
        }
Пример #4
0
        public override Job TryGiveJob(Pawn pawn)
        {
            if (pawn.ownership == null)
            {
                return(null);
            }

            Room ownedRoom = pawn.ownership.OwnedRoom;

            if (ownedRoom == null)
            {
                return(null);
            }
            Need_Soul soul = pawn.needs.TryGetNeed <Need_Soul>();

            if (soul != null)
            {
                float chance;
                switch (soul.DevotionTraitDegree.degree)
                {
                case -2:
                {
                    chance = 0f;
                    break;
                }

                case -1:
                {
                    chance = 0.1f;
                    break;
                }

                case 0:
                {
                    chance = 0.5f;
                    break;
                }

                case 1:
                {
                    chance = 0.8f;
                    break;
                }

                case 2:
                {
                    chance = 1f;
                    break;
                }

                default:
                {
                    chance = 0f;
                    break;
                }
                }

                if (chance > Rand.Range(0f, 1f))
                {
                    IntVec3 c2;
                    if (!(from c in ownedRoom.Cells
                          where c.Standable(pawn.Map) && !c.IsForbidden(pawn) && pawn.CanReserveAndReach(c, PathEndMode.OnCell, Danger.None, 1)
                          select c).TryRandomElement(out c2))
                    {
                        return(null);
                    }
                    return(new Job(this.def.jobDef, c2));
                }
            }
            return(null);
        }
Пример #5
0
        public static void PerformPostChatActions(Pawn talker, Pawn talkee, IoMChatType chatType)
        {
            if (chatType != IoMChatType.ConvertTau)
            {
                Need_Soul talkerSoul = CorruptionStoryTrackerUtilities.GetPawnSoul(talker);
                Need_Soul talkeeSoul = CorruptionStoryTrackerUtilities.GetPawnSoul(talkee);

                if (talkerSoul != null && talkeeSoul != null)
                {
                    if (chatType != IoMChatType.InquisitorInvestigation)
                    {
                        if (talkerSoul.NoPatron && talkeeSoul.NoPatron)
                        {
                            if (Rand.Range(4, 6) + GetChatIntrigueFactor(talker, talkee) > 0)
                            {
                                talkeeSoul.GainNeed(-0.0005f);
                            }
                            else
                            {
                                talkee.needs.mood.thoughts.memories.TryGainMemoryThought(ThoughtDefOf.SleepDisturbed, talker);
                            }
                        }
                        else if (talkerSoul.NoPatron && !talkeeSoul.NoPatron)
                        {
                            StartReligiousSocialFight(talker, talkee);
                        }
                        else if (!talkerSoul.NoPatron && !talkeeSoul.NoPatron)
                        {
                            talkeeSoul.GainNeed(0.005f);
                        }
                        else if (!talkerSoul.NoPatron && talkeeSoul.NoPatron)
                        {
                            if (Rand.Range(-2, 0) + GetChatIntrigueFactor(talker, talkee) > 0)
                            {
                                talkeeSoul.GainNeed(-0.0005f);
                            }
                            else
                            {
                                StartReligiousSocialFight(talker, talkee);
                            }
                        }
                    }
                    else
                    {
                        //switch (talkeeSoul.CurCategory)
                        //{
                        //    case SoulAffliction.Lost:
                        //        {

                        //            return;
                        //        }
                        //    case SoulAffliction.Corrupted:
                        //        {

                        //            return;
                        //        }
                        //    case SoulAffliction.Tainted:
                        //        {

                        //            return;
                        //        }
                        //}
                        Lord lord = talker.GetLord();
                        LordJob_IntrusiveWanderer lordJob = lord.LordJob as LordJob_IntrusiveWanderer;
                        lordJob.InquisitorFoundHeretic = true;
                    }
                }
            }
            else
            {
            }
        }