예제 #1
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            if (p.needs.comfort == null)
            {
                return(ThoughtState.Inactive);
            }
            switch (p.needs.comfort.CurCategory)
            {
            case ComfortCategory.Uncomfortable:
                return(ThoughtState.ActiveAtStage(0));

            case ComfortCategory.Normal:
                return(ThoughtState.Inactive);

            case ComfortCategory.Comfortable:
                return(ThoughtState.ActiveAtStage(1));

            case ComfortCategory.VeryComfortable:
                return(ThoughtState.ActiveAtStage(2));

            case ComfortCategory.ExtremelyComfortable:
                return(ThoughtState.ActiveAtStage(3));

            case ComfortCategory.LuxuriantlyComfortable:
                return(ThoughtState.ActiveAtStage(4));

            default:
                throw new NotImplementedException();
            }
        }
예제 #2
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            if (p.Map.terrainGrid.TerrainAt(p.Position).defName == "HardVacuum")
            {
                if (p.story.traits.HasTrait(TraitDefOf.Undergrounder) || p.story.traits.HasTrait(TraitDef.Named("Wimp")))
                {
                    return(ThoughtState.ActiveAtStage(3));
                }
                else
                {
                    return(ThoughtState.ActiveAtStage(2));
                }
            }
            else if (p.Map.terrainGrid.TerrainAt(IntVec3.Zero).defName == "HardVacuum")
            {
                if (p.story.traits.HasTrait(TraitDefOf.Undergrounder) || p.story.traits.HasTrait(TraitDef.Named("Wimp")))
                {
                    return(ThoughtState.ActiveAtStage(1));
                }
                else
                {
                    return(ThoughtState.ActiveAtStage(0));
                }
            }

            return(ThoughtState.Inactive);
        }
예제 #3
0
        protected override ThoughtState CurrentSocialStateInternal(Pawn pawn, Pawn other)
        {
            if (!other.RaceProps.Humanlike || !RelationsUtility.PawnsKnowEachOther(pawn, other))
            {
                return(false);
            }
            if (RelationsUtility.IsDisfigured(other))
            {
                return(false);
            }
            if (!pawn.health.capacities.CapableOf(PawnCapacityDefOf.Sight))
            {
                return(false);
            }
            float statValue = other.GetStatValue(StatDefOf.PawnBeauty);

            if (statValue >= 2f)
            {
                return(ThoughtState.ActiveAtStage(1));
            }
            if (statValue >= 1f)
            {
                return(ThoughtState.ActiveAtStage(0));
            }
            return(false);
        }
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            float        statValue          = p.GetStatValue(StatDefOf.ComfyTemperatureMin, true);
            float        ambientTemperature = p.AmbientTemperature;
            float        num = statValue - ambientTemperature;
            ThoughtState result;

            if (num <= 0f)
            {
                result = ThoughtState.Inactive;
            }
            else if (num < 10f)
            {
                result = ThoughtState.ActiveAtStage(0);
            }
            else if (num < 20f)
            {
                result = ThoughtState.ActiveAtStage(1);
            }
            else if (num < 30f)
            {
                result = ThoughtState.ActiveAtStage(2);
            }
            else
            {
                result = ThoughtState.ActiveAtStage(3);
            }
            return(result);
        }
예제 #5
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            ThoughtState result;

            if (p.story.traits.HasTrait(TraitDefOf.Ascetic))
            {
                result = ThoughtState.Inactive;
            }
            else
            {
                Room room = p.GetRoom(RegionType.Set_Passable);
                if (room == null)
                {
                    result = ThoughtState.Inactive;
                }
                else
                {
                    int scoreStageIndex = RoomStatDefOf.Impressiveness.GetScoreStageIndex(room.GetStat(RoomStatDefOf.Impressiveness));
                    if (this.def.stages[scoreStageIndex] == null)
                    {
                        result = ThoughtState.Inactive;
                    }
                    else
                    {
                        result = ThoughtState.ActiveAtStage(scoreStageIndex);
                    }
                }
            }
            return(result);
        }
예제 #6
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            float        painTotal = p.health.hediffSet.PainTotal;
            ThoughtState result;

            if (painTotal < 0.0001f)
            {
                result = ThoughtState.Inactive;
            }
            else if (painTotal < 0.15f)
            {
                result = ThoughtState.ActiveAtStage(0);
            }
            else if (painTotal < 0.4f)
            {
                result = ThoughtState.ActiveAtStage(1);
            }
            else if (painTotal < 0.8f)
            {
                result = ThoughtState.ActiveAtStage(2);
            }
            else
            {
                result = ThoughtState.ActiveAtStage(3);
            }
            return(result);
        }
        protected override ThoughtState CurrentSocialStateInternal(Pawn p, Pawn other)
        {
            ThoughtState result;

            if (!p.RaceProps.Humanlike)
            {
                result = false;
            }
            else if (!p.story.traits.HasTrait(TraitDefOf.Transhumanist))
            {
                result = false;
            }
            else if (!RelationsUtility.PawnsKnowEachOther(p, other))
            {
                result = false;
            }
            else if (other.def != p.def)
            {
                result = false;
            }
            else
            {
                int num = other.health.hediffSet.CountAddedParts();
                if (num > 0)
                {
                    result = ThoughtState.ActiveAtStage(num - 1);
                }
                else
                {
                    result = false;
                }
            }
            return(result);
        }
예제 #8
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            Building_Bed building_Bed = p.CurrentBed();
            ThoughtState result;

            if (building_Bed == null || !building_Bed.Medical)
            {
                result = ThoughtState.Inactive;
            }
            else
            {
                Room room = p.GetRoom(RegionType.Set_Passable);
                if (room == null || room.Role != RoomRoleDefOf.Hospital)
                {
                    result = ThoughtState.Inactive;
                }
                else
                {
                    int scoreStageIndex = RoomStatDefOf.Impressiveness.GetScoreStageIndex(room.GetStat(RoomStatDefOf.Impressiveness));
                    if (this.def.stages[scoreStageIndex] != null)
                    {
                        result = ThoughtState.ActiveAtStage(scoreStageIndex);
                    }
                    else
                    {
                        result = ThoughtState.Inactive;
                    }
                }
            }
            return(result);
        }
예제 #9
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            if (p.needs.joy == null)
            {
                return(ThoughtState.Inactive);
            }
            switch (p.needs.joy.CurCategory)
            {
            case JoyCategory.Empty:
                return(ThoughtState.ActiveAtStage(0));

            case JoyCategory.VeryLow:
                return(ThoughtState.ActiveAtStage(1));

            case JoyCategory.Low:
                return(ThoughtState.ActiveAtStage(2));

            case JoyCategory.Satisfied:
                return(ThoughtState.Inactive);

            case JoyCategory.High:
                return(ThoughtState.ActiveAtStage(3));

            case JoyCategory.Extreme:
                return(ThoughtState.ActiveAtStage(4));

            default:
                throw new NotImplementedException();
            }
        }
예제 #10
0
        public static ThoughtState ActiveWithReason(string reason)
        {
            ThoughtState activeDefault = ThoughtState.ActiveDefault;

            activeDefault.reason = reason;
            return(activeDefault);
        }
예제 #11
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            string         text        = null;
            int            num         = 0;
            List <Apparel> wornApparel = p.apparel.WornApparel;

            for (int i = 0; i < wornApparel.Count; i++)
            {
                if (wornApparel[i].WornByCorpse)
                {
                    if (text == null)
                    {
                        text = wornApparel[i].def.label;
                    }
                    num++;
                }
            }
            if (num == 0)
            {
                return(ThoughtState.Inactive);
            }
            if (num >= 5)
            {
                return(ThoughtState.ActiveAtStage(4, text));
            }
            return(ThoughtState.ActiveAtStage(num - 1, text));
        }
예제 #12
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            if (p.needs.outdoors == null)
            {
                return(ThoughtState.Inactive);
            }
            if (p.HostFaction != null)
            {
                return(ThoughtState.Inactive);
            }
            switch (p.needs.outdoors.CurCategory)
            {
            case OutdoorsCategory.Entombed:
                return(ThoughtState.ActiveAtStage(0));

            case OutdoorsCategory.Trapped:
                return(ThoughtState.ActiveAtStage(1));

            case OutdoorsCategory.CabinFeverSevere:
                return(ThoughtState.ActiveAtStage(2));

            case OutdoorsCategory.CabinFeverLight:
                return(ThoughtState.ActiveAtStage(3));

            case OutdoorsCategory.NeedFreshAir:
                return(ThoughtState.ActiveAtStage(4));

            case OutdoorsCategory.Free:
                return(ThoughtState.Inactive);

            default:
                throw new InvalidOperationException("Unknown OutdoorsCategory");
            }
        }
        protected override ThoughtState CurrentSocialStateInternal(Pawn pawn, Pawn other)
        {
            ThoughtState result;

            if (!other.RaceProps.Humanlike || !RelationsUtility.PawnsKnowEachOther(pawn, other))
            {
                result = false;
            }
            else if (!pawn.health.capacities.CapableOf(PawnCapacityDefOf.Sight))
            {
                result = false;
            }
            else
            {
                int num = other.story.traits.DegreeOfTrait(TraitDefOf.Beauty);
                if (num == -1)
                {
                    result = ThoughtState.ActiveAtStage(0);
                }
                else if (num == -2)
                {
                    result = ThoughtState.ActiveAtStage(1);
                }
                else
                {
                    result = false;
                }
            }
            return(result);
        }
예제 #14
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            string         text        = null;
            int            num         = 0;
            List <Apparel> wornApparel = p.apparel.WornApparel;

            for (int i = 0; i < wornApparel.Count; i++)
            {
                if (wornApparel[i].Stuff == ThingDefOf.Human.race.leatherDef)
                {
                    if (text == null)
                    {
                        text = wornApparel[i].def.label;
                    }
                    num++;
                }
            }
            ThoughtState result;

            if (num == 0)
            {
                result = ThoughtState.Inactive;
            }
            else if (num >= 5)
            {
                result = ThoughtState.ActiveAtStage(4, text);
            }
            else
            {
                result = ThoughtState.ActiveAtStage(num - 1, text);
            }
            return(result);
        }
예제 #15
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            bool        selected = Find.Selector.SelectedObjects.Contains(p) && Prefs.DevMode;
            Comp_Yautja _Yautja  = p.TryGetComp <Comp_Yautja>();

            if ((_Yautja != null))
            {
                if ((_Yautja.inducted) || p.kindDef.race == YautjaDefOf.RRY_Alien_Yautja)
                {
                    //    if (selected) Log.Message(string.Format("{0} {1} == active", this, p.LabelShortCap));

                    if (YautjaBloodedUtility.Marked(p, out Hediff BloodHD))
                    {
                        //    if (selected) Log.Message(string.Format("{0} {1} == 2", this, p.LabelShortCap));
                        return(ThoughtState.ActiveAtStage(2));
                    }
                    if (p.health.hediffSet.HasHediff(unmarkedDef))
                    {
                        //    if (selected) Log.Message(string.Format("{0} {1} == 1", this, p.LabelShortCap));
                        return(ThoughtState.ActiveAtStage(1));
                    }
                    if (p.health.hediffSet.HasHediff(unbloodedDef))
                    {
                        //    if (selected) Log.Message(string.Format("{0} {1} == 0", this, p.LabelShortCap));
                        return(ThoughtState.ActiveAtStage(0));
                    }
                }
            }
            //    if (selected) Log.Message(string.Format("{0} {1} == Inactive", this, p.LabelShortCap));
            return(ThoughtState.Inactive);
        }
예제 #16
0
        public static ThoughtState ActiveAtStage(int stageIndex)
        {
            ThoughtState result = default(ThoughtState);

            result.stageIndex = stageIndex;
            return(result);
        }
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            if (p.needs.beauty == null)
            {
                return(ThoughtState.Inactive);
            }
            switch (p.needs.beauty.CurCategory)
            {
            case BeautyCategory.Hideous:
                return(ThoughtState.ActiveAtStage(0));

            case BeautyCategory.VeryUgly:
                return(ThoughtState.ActiveAtStage(1));

            case BeautyCategory.Ugly:
                return(ThoughtState.ActiveAtStage(2));

            case BeautyCategory.Neutral:
                return(ThoughtState.Inactive);

            case BeautyCategory.Pretty:
                return(ThoughtState.ActiveAtStage(3));

            case BeautyCategory.VeryPretty:
                return(ThoughtState.ActiveAtStage(4));

            case BeautyCategory.Beautiful:
                return(ThoughtState.ActiveAtStage(5));

            default:
                throw new InvalidOperationException("Unknown BeautyCategory");
            }
        }
        protected override ThoughtState CurrentSocialStateInternal(Pawn p, Pawn other)
        {
            if (!p.RaceProps.Humanlike)
            {
                return(false);
            }
            if (!p.story.traits.HasTrait(TraitDefOf.BodyPurist))
            {
                return(false);
            }
            if (!RelationsUtility.PawnsKnowEachOther(p, other))
            {
                return(false);
            }
            if (other.def != p.def)
            {
                return(false);
            }
            int num = other.health.hediffSet.CountAddedParts();

            if (num > 0)
            {
                return(ThoughtState.ActiveAtStage(num - 1));
            }
            return(false);
        }
예제 #19
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            if (p.needs.food != null)
            {
                switch (p.needs.food.CurCategory)
                {
                case HungerCategory.Fed:
                    return(ThoughtState.Inactive);

                case HungerCategory.Hungry:
                    return(ThoughtState.ActiveAtStage(0));

                case HungerCategory.UrgentlyHungry:
                    return(ThoughtState.ActiveAtStage(1));

                case HungerCategory.Starving:
                {
                    int num = p.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Malnutrition)?.CurStageIndex ?? 0;
                    return(ThoughtState.ActiveAtStage(2 + num));
                }

                default:
                    throw new NotImplementedException();
                }
            }
            return(ThoughtState.Inactive);
        }
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            float          num         = 999f;
            List <Apparel> wornApparel = p.apparel.WornApparel;

            for (int i = 0; i < wornApparel.Count; i++)
            {
                if (wornApparel[i].def.useHitPoints)
                {
                    float num2 = (float)wornApparel[i].HitPoints / (float)wornApparel[i].MaxHitPoints;
                    if (num2 < num)
                    {
                        num = num2;
                    }
                    if (num < 0.20000000298023224)
                    {
                        return(ThoughtState.ActiveAtStage(1));
                    }
                }
            }
            if (num < 0.5)
            {
                return(ThoughtState.ActiveAtStage(0));
            }
            return(ThoughtState.Inactive);
        }
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            ThoughtState result;

            if (p.needs.rest == null)
            {
                result = ThoughtState.Inactive;
            }
            else
            {
                switch (p.needs.rest.CurCategory)
                {
                case RestCategory.Rested:
                    result = ThoughtState.Inactive;
                    break;

                case RestCategory.Tired:
                    result = ThoughtState.ActiveAtStage(0);
                    break;

                case RestCategory.VeryTired:
                    result = ThoughtState.ActiveAtStage(1);
                    break;

                case RestCategory.Exhausted:
                    result = ThoughtState.ActiveAtStage(2);
                    break;

                default:
                    throw new NotImplementedException();
                }
            }
            return(result);
        }
예제 #22
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            if (p.needs.roomsize == null)
            {
                return(ThoughtState.Inactive);
            }
            Room room = p.GetRoom(RegionType.Set_Passable);

            if (room == null || room.PsychologicallyOutdoors)
            {
                return(ThoughtState.Inactive);
            }
            switch (p.needs.roomsize.CurCategory)
            {
            case RoomSizeCategory.VeryCramped:
                return(ThoughtState.ActiveAtStage(0));

            case RoomSizeCategory.Cramped:
                return(ThoughtState.ActiveAtStage(1));

            case RoomSizeCategory.Normal:
                return(ThoughtState.Inactive);

            case RoomSizeCategory.Spacious:
                return(ThoughtState.ActiveAtStage(2));

            default:
                throw new InvalidOperationException("Unknown RoomSizeCategory");
            }
        }
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            JobDriver curDriver = p.jobs.curDriver;

            if (curDriver == null)
            {
                return(ThoughtState.Inactive);
            }
            if (p.skills == null)
            {
                return(ThoughtState.Inactive);
            }
            if (curDriver.ActiveSkill == null)
            {
                return(ThoughtState.Inactive);
            }
            SkillRecord skill = p.skills.GetSkill(curDriver.ActiveSkill);

            if (skill == null)
            {
                return(ThoughtState.Inactive);
            }
            if (skill.passion == Passion.Minor)
            {
                return(ThoughtState.ActiveAtStage(0));
            }
            if (skill.passion == Passion.Major)
            {
                return(ThoughtState.ActiveAtStage(1));
            }
            return(ThoughtState.Inactive);
        }
예제 #24
0
        protected override ThoughtState CurrentSocialStateInternal(Pawn pawn, Pawn other)
        {
            if (!other.RaceProps.Humanlike || !RelationsUtility.PawnsKnowEachOther(pawn, other))
            {
                return(false);
            }
            if (RelationsUtility.IsDisfigured(other))
            {
                return(false);
            }
            if (!pawn.health.capacities.CapableOf(PawnCapacityDefOf.Sight))
            {
                return(false);
            }
            int num = other.story.traits.DegreeOfTrait(TraitDefOf.Beauty);

            if (num == 1)
            {
                return(ThoughtState.ActiveAtStage(0));
            }
            if (num == 2)
            {
                return(ThoughtState.ActiveAtStage(1));
            }
            return(false);
        }
예제 #25
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            ThoughtState result;

            if (!p.IsColonist)
            {
                result = false;
            }
            else
            {
                Room ownedRoom = p.ownership.OwnedRoom;
                if (ownedRoom == null)
                {
                    result = false;
                }
                else
                {
                    int scoreStageIndex = RoomStatDefOf.Impressiveness.GetScoreStageIndex(ownedRoom.GetStat(RoomStatDefOf.Impressiveness));
                    if (this.def.stages[scoreStageIndex] != null)
                    {
                        result = ThoughtState.ActiveAtStage(scoreStageIndex);
                    }
                    else
                    {
                        result = ThoughtState.Inactive;
                    }
                }
            }
            return(result);
        }
예제 #26
0
        public static ThoughtState ActiveAtStage(int stageIndex, string reason)
        {
            ThoughtState result = default(ThoughtState);

            result.stageIndex = stageIndex;
            result.reason     = reason;
            return(result);
        }
예제 #27
0
 private ThoughtState PostProcessedState(ThoughtState state)
 {
     if (this.def.invert)
     {
         state = ((!state.Active) ? ThoughtState.ActiveAtStage(0) : ThoughtState.Inactive);
     }
     return(state);
 }
예제 #28
0
 protected override ThoughtState CurrentStateInternal(Pawn p)
 {
     if (!Active(p))
     {
         return(ThoughtState.Inactive);
     }
     return(ThoughtState.ActiveAtStage(0));
 }
예제 #29
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            ExpectationDef expectationDef = ExpectationsUtility.CurrentExpectationFor(p);

            if (expectationDef == null)
            {
                return(ThoughtState.Inactive);
            }
            return(ThoughtState.ActiveAtStage(expectationDef.thoughtStage));
        }
예제 #30
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            Hediff firstHediffOfDef = p.health.hediffSet.GetFirstHediffOfDef(def.hediff);

            if (firstHediffOfDef == null || firstHediffOfDef.def.stages == null)
            {
                return(ThoughtState.Inactive);
            }
            return(ThoughtState.ActiveAtStage(Mathf.Min(firstHediffOfDef.CurStageIndex, firstHediffOfDef.def.stages.Count - 1, def.stages.Count - 1)));
        }