示例#1
0
        protected override ThoughtState CurrentSocialStateInternal(Pawn p, Pawn other)
        {
            if (!p.RaceProps.Humanlike)
            {
                return((ThoughtState)false);
            }

            if (!RelationsUtility.PawnsKnowEachOther(p, other))
            {
                return((ThoughtState)false);
            }

            Religion thisPawnReligion  = p.GetReligionComponent().Religion;
            Religion otherPawnReligion = other.GetReligionComponent().Religion;

            ReligionSettings_Social opinionSettings = thisPawnReligion.GetSettings <ReligionSettings_Social>(SettingsTagDefOf.OpinionTag);

            if (opinionSettings == null)
            {
                return((ThoughtState)false);
            }

            ReligionProperty property = opinionSettings.GetPropertyByObject(p, otherPawnReligion.Def, other);

            if (property == null || property.Witness == null || property.Witness.OpinionThought == null || property.Witness.OpinionThought != this.def)
            {
                return((ThoughtState)false);
            }

            return(ThoughtState.ActiveAtStage(p.GetReligionComponent().PietyTracker.PietyNeed.CurCategoryInt, otherPawnReligion.Def.LabelCap));
        }
        static float DrawReligionRow(Religion religion, float rowY, Rect fillRect)
        {
            Rect          rect1         = new Rect(35f, rowY, 250f, 80f);
            StringBuilder stringBuilder = new StringBuilder();
            string        str1          = stringBuilder.ToString();
            float         width         = fillRect.width - rect1.xMax;
            float         num           = Verse.Text.CalcHeight(str1, width);
            float         height        = Mathf.Max(80f, num);
            Rect          position      = new Rect(10f, rowY + 10f, 15f, 15f);
            Rect          rect2         = new Rect(0.0f, rowY, fillRect.width, height);

            if (Mouse.IsOver(rect2))
            {
                GUI.DrawTexture(rect2, (Texture)TexUI.HighlightTex);
            }
            Verse.Text.Font   = GameFont.Small;
            Verse.Text.Anchor = TextAnchor.UpperLeft;
            string label1 = religion.Label.CapitalizeFirst();

            Widgets.Label(rect1, label1);
            Rect rect3 = new Rect(rect1.xMax, rowY, 60f, 80f);

            ReligionInfo(rect3.x, rect3.y, religion);
            Rect rect4 = new Rect(rect3.xMax, rowY, 250f, 80f);

            Widgets.Label(new Rect(rect4.xMax, rowY, width, num), str1);
            Verse.Text.Anchor = TextAnchor.UpperLeft;
            return(height);
        }
 static bool ReligionInfo(float x, float y, Religion religion)
 {
     if (!InfoCardButtonWorker(x, y))
     {
         return(false);
     }
     Find.WindowStack.Add((Window) new Dialog_ReligionInfo(religion));
     return(true);
 }
示例#4
0
 private void ChangeReligion(Religion religion)
 {
     this.religion = religion;
     pietyTracker  = new Pawn_PietyTracker((Pawn)parent, religion);
     prayTracker   = new Pawn_PrayTracker((Pawn)parent, religion);
     religionCompability.RecalculateCompabilities();
     religionRestrictions.RestoreToDefault();
     BillUtility.Notify_ColonistUnavailable((Pawn)this.parent);
 }
示例#5
0
 public bool TryChangeReligion(Religion religion)
 {
     if (religionCompability.CompabilityFor(religion) != 0f && religion != this.religion)
     {
         ChangeReligion(religion);
         return(true);
     }
     return(false);
 }
示例#6
0
 public Dialog_ReligionInfoMain(Religion religion)
 {
     this.religion   = religion;
     this.forcePause = true;
     scrollPosition  = new Vector2();
     this.doCloseX   = true;
     this.absorbInputAroundWindow = true;
     this.closeOnClickedOutside   = true;
     this.soundAppear             = SoundDefOf.InfoCard_Open;
     this.soundClose = SoundDefOf.InfoCard_Close;
 }
示例#7
0
        public Pawn_PietyTracker(Pawn pawn, Religion religion)
        {
            this.pawn = pawn;

            if (religion.GetSettings <ReligionSettings_PietyNeed>(SettingsTagDefOf.NeedTag) != null)
            {
                this.piety = new Need_Piety(pawn)
                {
                    def = religion.GetSettings <ReligionSettings_PietyNeed>(SettingsTagDefOf.NeedTag).PietyNeed
                };
            }
        }
        public Pawn_PrayTracker(Pawn pawn, Religion religion)
        {
            this.pawn = pawn;

            if (religion.GetSettings <ReligionSettings_Prayings>(SettingsTagDefOf.PrayingsTag) != null)
            {
                this.pray = new Need_Pray(pawn)
                {
                    def = religion.GetSettings <ReligionSettings_Prayings>(SettingsTagDefOf.PrayingsTag).Need
                };
            }
        }
 public Dialog_ReligionInfo(Religion religion)
 {
     this.religion   = religion;
     this.forcePause = true;
     //this.doCloseButton = true;
     this.doCloseX = true;
     this.absorbInputAroundWindow = true;
     this.closeOnClickedOutside   = true;
     this.soundAppear             = SoundDefOf.InfoCard_Open;
     this.soundClose      = SoundDefOf.InfoCard_Close;
     scrollPosition       = new Vector2();
     secondScrollPosition = new Vector2();
     //cachedEntries.Clear();
     selected = null;
 }
示例#10
0
        public ReligionActivityData(Religion religion, Pawn organizer, ActivityTask task, IEnumerable <LocalTargetInfo> relics = null)
        {
            if (Scribe.mode == LoadSaveMode.Inactive)
            {
                this.relics = new List <LocalTargetInfo>();
                if (relics != null)
                {
                    this.relics.AddRange(relics);
                }
                this.activityJobNodes = new List <ActivityJobNode>();
                this.activityJobNodes.Add(new ActivityJobNode(MiscDefOf.ReligionActivityPreparations, null));
                this.activityJobNodes.AddRange(task.ActivityTaskDef.ActivityQueue.ActivityNodes);
            }

            this.religion  = religion;
            this.organizer = organizer;
            this.task      = task;
        }
        public override bool TryStart(Pawn pawn, string reason, bool causedByMood)
        {
            Religion religion = ReligionExtensions.GetReligionManager().AllReligions.RandomElement();

            if (religion.GetSettings <ReligionSettings_MentalBreaks>(SettingsTagDefOf.MentalBreaksTag) != null)
            {
                ReligionSettings_MentalBreaks settings = religion.GetSettings <ReligionSettings_MentalBreaks>(SettingsTagDefOf.MentalBreaksTag);
                if (settings.MentalBreaks.Any(x => x == this.def))
                {
                    if (!pawn.GetReligionComponent().TryChangeReligion(religion))
                    {
                        return(false);
                    }
                    return(base.TryStart(pawn, reason, causedByMood));
                }
            }
            return(false);
        }
示例#12
0
 private Toil StartActivity()
 {
     return(new Toil()
     {
         initAction = delegate
         {
             Religion religion = TargetFacility.AssignedReligion;
             Pawn organizer = pawn;
             List <LocalTargetInfo> targets = new List <LocalTargetInfo>();
             if (job.placedThings != null)
             {
                 foreach (ThingCountClass tcc in job.placedThings)
                 {
                     targets.Add(tcc.thing);
                 }
             }
             ActivityUtility.StartActivity(religion, organizer, ((ActivityJob)job).activityTask, targets);
         }
     });
 }
示例#13
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Religion religion = ReligionExtensions.GetReligionManager().AllReligions.RandomElement();

            if (religion.GetSettings <ReligionSettings_Incidents>(SettingsTagDefOf.IncidentsTag) != null)
            {
                ReligionSettings_Incidents settings = religion.GetSettings <ReligionSettings_Incidents>(SettingsTagDefOf.IncidentsTag);
                if (settings.Incidents.Any(x => x == this.def))
                {
                    Pawn pawn = PotentialVictimCandidates(parms.target).RandomElement();
                    if (pawn == null)
                    {
                        return(false);
                    }
                    if (!pawn.GetReligionComponent().TryChangeReligion(religion))
                    {
                        return(false);
                    }
                    Find.LetterStack.ReceiveLetter(this.def.letterLabel, pawn.LabelCap + " " + def.letterText + " " + religion.Label, this.def.letterDef, (LookTargets)pawn, (Faction)null, (string)null);
                    return(true);
                }
            }
            return(false);
        }
 public bool TryUnassignReligion()
 {
     assignedReligion = null;
     UnassignAllBuildingsAndNotify();
     return(true);
 }
示例#15
0
 private void CreateNoPawnsOfReligionDialog(Religion religion)
 {
     Find.WindowStack.Add((Window) new Dialog_MessageBox("ReligionInfo_NoPawnsOfReligion".Translate((NamedArgument)religion.Label), (string)null, (Action)null, (string)null, (Action)null, (string)null, false, (Action)null, (Action)null));
 }
        public static void StartActivity(Religion religion, Pawn organizer, ActivityTask task, IEnumerable <LocalTargetInfo> relics = null)
        {
            ReligionActivityData data = new ReligionActivityData(religion, organizer, task, relics);

            LordMaker.MakeNewLord(organizer.Faction, new LordJob_ReligionActivity(data), organizer.Map, new[] { organizer });
        }
 public float CompabilityFor(Religion religion)
 {
     return(compabilities[religion]);
 }
 public bool TryAssignReligion(Religion religion)
 {
     assignedReligion = religion;
     UnassignAllBuildingsAndNotify();
     return(true);
 }