예제 #1
0
        private void UpdateRoyalTitle(Faction faction)
        {
            RoyalTitleDef currentTitle = GetCurrentTitle(faction);

            if (currentTitle != null && !currentTitle.Awardable)
            {
                return;
            }
            RoyalTitleDef nextTitle = currentTitle.GetNextTitle(faction);

            if (nextTitle == null)
            {
                return;
            }
            int num = GetFavor(faction);

            if (num >= nextTitle.favorCost)
            {
                OnPreTitleChanged(faction, currentTitle, nextTitle);
                SetFavor(faction, num - nextTitle.favorCost);
                int index = FindFactionTitleIndex(faction, createIfNotExisting: true);
                titles[index].def = nextTitle;
                CleanupThoughts(currentTitle);
                CleanupThoughts(nextTitle);
                if (nextTitle.awardThought != null && pawn.needs != null && pawn.needs.mood != null)
                {
                    Thought_MemoryRoyalTitle thought_MemoryRoyalTitle = (Thought_MemoryRoyalTitle)ThoughtMaker.MakeThought(nextTitle.awardThought);
                    thought_MemoryRoyalTitle.titleDef = nextTitle;
                    pawn.needs.mood.thoughts.memories.TryGainMemory(thought_MemoryRoyalTitle);
                }
                UpdateRoyalTitle(faction);
            }
        }
예제 #2
0
        public void ReduceTitle(Faction faction)
        {
            RoyalTitleDef currentTitle = GetCurrentTitle(faction);

            if (currentTitle != null && currentTitle.Awardable)
            {
                RoyalTitleDef previousTitle = currentTitle.GetPreviousTitle(faction);
                OnPreTitleChanged(faction, currentTitle, previousTitle);
                CleanupThoughts(currentTitle);
                CleanupThoughts(previousTitle);
                if (currentTitle.awardThought != null && pawn.needs.mood != null)
                {
                    Thought_MemoryRoyalTitle thought_MemoryRoyalTitle = (Thought_MemoryRoyalTitle)ThoughtMaker.MakeThought(currentTitle.lostThought);
                    thought_MemoryRoyalTitle.titleDef = currentTitle;
                    pawn.needs.mood.thoughts.memories.TryGainMemory(thought_MemoryRoyalTitle);
                }
                int index = FindFactionTitleIndex(faction);
                if (previousTitle == null)
                {
                    titles.RemoveAt(index);
                }
                else
                {
                    titles[index].def = previousTitle;
                }
                SetFavor(faction, 0);
                OnPostTitleChanged(faction, previousTitle);
            }
        }