Beispiel #1
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            Need_Soul soul = p.needs.TryGetNeed <Need_Soul>();

            if (soul != null && soul.CulturalTolerance != CulturalToleranceCategory.Neutral)
            {
                int peeps;
                int foreigners;
                this.AliensPresent(p, out peeps, out foreigners);

                if (soul.CulturalTolerance == CulturalToleranceCategory.Xenophobe)
                {
                    if (foreigners > peeps)
                    {
                        return(ThoughtState.ActiveAtStage(2));
                    }
                    else if (foreigners > 0)
                    {
                        return(ThoughtState.ActiveAtStage(1));
                    }
                    return(ThoughtState.ActiveAtStage(0));
                }

                if (soul.CulturalTolerance == CulturalToleranceCategory.Xenophile)
                {
                    if (foreigners > 0)
                    {
                        return(ThoughtState.ActiveAtStage(4));
                    }
                    return(ThoughtState.ActiveAtStage(3));
                }
            }

            return(ThoughtState.Inactive);
        }
        protected override ThoughtState CurrentStateInternal(Pawn pawn)
        {
            int catCount = pawn.Map?.mapPawns.SpawnedPawnsInFaction(Faction.OfPlayer)
                           .Count(CatIdentifier.IsCat) ?? -1;

            if (catCount < 0)
            {
                return(ThoughtState.Inactive);
            }
            if (catCount == 0)
            {
                return(ThoughtState.ActiveAtStage(0));
            }
            if (catCount == 1)
            {
                return(ThoughtState.ActiveAtStage(1));
            }
            if (catCount == 2)
            {
                return(ThoughtState.ActiveAtStage(2));
            }
            if (catCount < 5)
            {
                return(ThoughtState.ActiveAtStage(3));
            }
            if (catCount < 10)
            {
                return(ThoughtState.ActiveAtStage(4));
            }
            return(ThoughtState.ActiveAtStage(5));
        }
Beispiel #3
0
 protected override ThoughtState CurrentStateInternal(Pawn p)
 {
     if (!p.Spawned)
     {
         return(ThoughtState.Inactive);
     }
     if (!p.RaceProps.Humanlike)
     {
         return(ThoughtState.Inactive);
     }
     if (!p.story.traits.HasTrait(TraitDefOfPsychology.Pluviophile))
     {
         return(ThoughtState.Inactive);
     }
     if (p.Map.weatherManager.RainRate < 0.25f)
     {
         return(ThoughtState.Inactive);
     }
     if (p.Map.weatherManager.SnowRate > 0.25f)
     {
         return(ThoughtState.Inactive);
     }
     if (p.Position.Roofed(p.Map))
     {
         return(ThoughtState.ActiveAtStage(0));
     }
     return(ThoughtState.ActiveAtStage(1));
 }
Beispiel #4
0
        // Token: 0x06000A5C RID: 2652 RVA: 0x00050834 File Offset: 0x0004EC34
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            var need = (PS_Needs_Reconditioning)p.needs.AllNeeds.Where(x => x.def.defName == "PS_Needs_Reconditioning").FirstOrDefault();

            if (need == null)
            {
                return(ThoughtState.Inactive);
            }

            switch (need.CurCategory)
            {
            case ConditioningCategory.Fresh:
                return(ThoughtState.Inactive);

            case ConditioningCategory.Strong:
                return(ThoughtState.Inactive);

            case ConditioningCategory.Weakened:
                return(ThoughtState.ActiveAtStage(0));

            case ConditioningCategory.Slipping:
                return(ThoughtState.ActiveAtStage(1));

            default:
                throw new NotImplementedException();
            }
        }
        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 == SrvDefOf.SRV_Burlap && (wornApparel[i].def.apparel.layers.Contains(ApparelLayerDefOf.OnSkin) || wornApparel[i].def.apparel.layers.Contains(ApparelLayerDefOf.Overhead)))
                {
                    if (text == null)
                    {
                        text = wornApparel[i].def.label;
                    }
                    num++;
                }
            }
            if (num == 0)
            {
                return(ThoughtState.Inactive);
            }
            if (num >= 4)
            {
                return(ThoughtState.ActiveAtStage(3, text));
            }
            return(ThoughtState.ActiveAtStage(num - 1, text));
        }
Beispiel #6
0
 public static void Listener(Pawn p, ref ThoughtState __result)
 {
     if (Utils.ExceptionAndroidListBasic.Contains(p.def.defName))
     {
         __result = ThoughtState.Inactive;
     }
 }
        public static ThoughtState ActiveAtStage(int stageIndex)
        {
            ThoughtState result = default(ThoughtState);

            result.stageIndex = stageIndex;
            return(result);
        }
        // Token: 0x06000A2A RID: 2602 RVA: 0x0004FCF4 File Offset: 0x0004E0F4
        public 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.defName.Contains("Alien_Tau") || wornApparel[i].Stuff.defName.Contains("Alien_Kroot"))
                {
                    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));
        }
Beispiel #9
0
 protected override ThoughtState CurrentStateInternal(Pawn p)
 {
     if (!p.Spawned)
     {
         return(ThoughtState.Inactive);
     }
     if (!p.RaceProps.Humanlike)
     {
         return(ThoughtState.Inactive);
     }
     if (!p.story.traits.HasTrait(TraitDefOfPsychology.Photosensitive))
     {
         return(ThoughtState.Inactive);
     }
     if (p.Position == null)
     {
         return(ThoughtState.Inactive);
     }
     if (!p.Awake())
     {
         return(ThoughtState.Inactive);
     }
     if (Find.GlowGrid.PsychGlowAt(p.Position) == PsychGlow.Dark)
     {
         return(ThoughtState.ActiveAtStage(0));
     }
     if (Find.GlowGrid.PsychGlowAt(p.Position) == PsychGlow.Overlit)
     {
         return(ThoughtState.ActiveAtStage(2));
     }
     return(ThoughtState.ActiveAtStage(1));
 }
Beispiel #10
0
            public static void Listener(Pawn p, ref ThoughtState __result)
            {
                try
                {
                    if (!__result.Active)
                    {
                        return;
                    }

                    CompSurrogateOwner cso = p.TryGetComp <CompSurrogateOwner>();

                    Pawn otherPawn          = LovePartnerRelationUtility.ExistingMostLikedLovePartnerRel(p, false).otherPawn;
                    CompSurrogateOwner cso2 = null;
                    if (otherPawn != null)
                    {
                        cso2 = otherPawn.TryGetComp <CompSurrogateOwner>();
                    }

                    if (p.IsAndroidTier() || p.IsSurrogateAndroid() || (cso != null && cso.skyCloudHost != null) || (otherPawn != null && (otherPawn.IsAndroidTier() || otherPawn.IsSurrogateAndroid() || (cso2 != null && cso2.skyCloudHost != null))))
                    {
                        __result = false;
                    }
                }
                catch (Exception e)
                {
                    Log.Message("[ATTP] ThoughtWorker_WantToSleepWithSpouseOrLover.CurrentStateInternal " + e.Message + " " + e.StackTrace);
                }
            }
Beispiel #11
0
        protected override ThoughtState CurrentStateInternal(Pawn pawn)
        {
            Room room = pawn.GetRoom(RegionType.Set_Passable);

            if (!pawn.Spawned)
            {
                return(ThoughtState.Inactive);
            }
            if (!pawn.RaceProps.Humanlike)
            {
                return(ThoughtState.Inactive);
            }
            if (!pawn.story.traits.HasTrait(GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_PlayLeader))
            {
                return(ThoughtState.Inactive);
            }
            if (room.Role == RoomRoleDefOf.RecRoom)
            {
                return(ThoughtState.Inactive);
            }
            if (room == null)
            {
                return(ThoughtState.Inactive);
            }
            return(ThoughtState.ActiveAtStage(0));
        }
Beispiel #12
0
 public static void Disable(ref ThoughtState __result, Pawn pawn, Pawn other)
 {
     if (pawn is PsychologyPawn && other is PsychologyPawn)
     {
         __result = false;
     }
 }
Beispiel #13
0
 protected override ThoughtState CurrentStateInternal(Pawn p)
 {
     if (p.health.hediffSet.HasHediff(HediffDef.Named("Enslaved")))
     {
         Hediff_Enslaved enslaved_def = SlaveUtility.GetEnslavedHediff(p);
         if (enslaved_def.ageTicks < 2500 * 3.5f && enslaved_def.SlaveWillpower > 0)                 // Gets some flavour text just after being enslaved
         {
             return(ThoughtState.ActiveAtStage(0));
         }
         if (enslaved_def.SlaveWillpower > 75)
         {
             return(ThoughtState.ActiveAtStage(1));
         }
         else if (enslaved_def.SlaveWillpower > 50)
         {
             return(ThoughtState.ActiveAtStage(2));
         }
         else if (enslaved_def.SlaveWillpower > 25 || (enslaved_def.SlaveWillpower <= 50 && IsSteadfast(p)))
         {
             return(ThoughtState.ActiveAtStage(3));
         }
         else if (Math.Round(enslaved_def.SlaveWillpower) <= 1)
         {
             return(ThoughtState.ActiveAtStage(4));
         }
     }
     return(ThoughtState.Inactive);
 }
Beispiel #14
0
        protected override ThoughtState CurrentSocialStateInternal(Pawn p, Pawn otherPawn)
        {
            if (!RelationsUtility.PawnsKnowEachOther(p, otherPawn))
            {
                return(false);
            }
            if (!LovePartnerRelationUtility.LovePartnerRelationExists(p, otherPawn))
            {
                return(false);
            }
            if (!PsycheHelper.PsychologyEnabled(p))
            {
                return(false);
            }
            if (p.Map == otherPawn.Map)
            {
                PsycheHelper.Comp(p).LDRTick = Find.TickManager.TicksAbs;
                return(false);
            }
            int tickSinceLastSeen = PsycheHelper.Comp(p).LDRTick;
            int ticksApart        = Find.TickManager.TicksAbs - tickSinceLastSeen;
            int quadrumsApart     = Mathf.FloorToInt((float)ticksApart / (float)GenDate.TicksPerQuadrum);
            int maxApart          = (p.relations.GetDirectRelation(PawnRelationDefOf.Spouse, otherPawn) == null ? 7 : 6);

            if (quadrumsApart > maxApart)
            {
                quadrumsApart = maxApart;
            }
            if (quadrumsApart > 1)
            {
                return(ThoughtState.ActiveAtStage(quadrumsApart - 1));
            }
            return(false);
        }
        protected override ThoughtState CurrentStateInternal(Pawn pawn)
        {
            try
            {
                if (pawn == null)
                {
                    return(ThoughtState.Inactive);
                }
                if (pawn.thingIDNumber == 0)
                {
                    return(ThoughtState.Inactive);                         // What do you know!!!
                }
                if (Current.ProgramState != ProgramState.Playing)
                {
                    return(ThoughtState.Inactive);
                }
                if (!pawn.IsGuest())
                {
                    return(ThoughtState.Inactive);
                }

                var compGuest = pawn.GetComp <CompGuest>();
                if (compGuest == null)
                {
                    return(ThoughtState.Inactive);
                }
                if (!compGuest.arrived)
                {
                    return(ThoughtState.Inactive);
                }

                var area = pawn.GetGuestArea();
                if (area == null)
                {
                    return(ThoughtState.ActiveAtStage(0));
                }

                var visitors = pawn.MapHeld.lordManager.lords.Where(l => l != null).SelectMany(l => l.ownedPawns).Count(p => StaysInArea(p, area));
                var bedCount = pawn.GetGuestBeds().Count();

                if (bedCount == 0)
                {
                    return(ThoughtState.ActiveAtStage(0));
                }
                if (bedCount < visitors && !pawn.InBed())
                {
                    return(ThoughtState.ActiveAtStage(1));
                }
                if (bedCount > visitors * 1.3f && bedCount > visitors + 3)
                {
                    return(ThoughtState.ActiveAtStage(3));
                }
                return(ThoughtState.ActiveAtStage(2));
            }
            catch (Exception e)
            {
                Log.Warning(e.Message);
                return(ThoughtState.Inactive);
            }
        }
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            var sex_need = p.needs.TryGetNeed <Need_Sex>();
            var p_age    = p.ageTracker.AgeBiologicalYears;

            if (sex_need != null && (p_age >= RJWSettings.sex_minimum_age || (!xxx.is_human(p) && p.ageTracker.CurLifeStage.reproductive)))
            {
                var lev = sex_need.CurLevel;
                if (lev <= sex_need.thresh_frustrated())
                {
                    return(ThoughtState.ActiveAtStage(0));
                }
                else if (lev <= sex_need.thresh_horny())
                {
                    return(ThoughtState.ActiveAtStage(1));
                }
                else if (lev >= sex_need.thresh_ahegao())
                {
                    return(ThoughtState.ActiveAtStage(3));
                }
                else if (lev >= sex_need.thresh_satisfied())
                {
                    return(ThoughtState.ActiveAtStage(2));
                }
                else
                {
                    return(ThoughtState.Inactive);
                }
            }
            else
            {
                return(ThoughtState.Inactive);
            }
        }
Beispiel #17
0
        public static ThoughtState CurrentStateInternal(RimWorld.ThoughtWorker_BarracksImpressiveness _this, Pawn p)
        {
            if (p == null)
            {
                return(ThoughtState.Inactive);                                                             // Added
            }
            ThoughtState result = ThoughtWorker_SleepingRoomImpressiveness.CurrentStateInternal(_this, p); // Had to change

            if (!result.Active)
            {
                return(ThoughtState.Inactive);                // Changed
            }
            #region Added
            if (p.IsGuest())
            {
                var room = p.GetGuestRoom();
                if (room != null && room.Role == RoomRoleDefOf.Barracks)
                {
                    return(result);
                }
                return(ThoughtState.Inactive);
            }
            #endregion

            // BASE
            if (p.ownership.OwnedBed.GetRoom().Role == RoomRoleDefOf.Barracks)
            {
                return(result);
            }
            return(ThoughtState.Inactive);
        }
Beispiel #18
0
 // RimWorld.ThoughtWorker_CabinFever
 public static void Vamp_NoCabinFever(Pawn p, ref ThoughtState __result)
 {
     if (p.IsVampire())
     {
         __result = ThoughtState.Inactive;
     }
 }
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            // TODO: There's gotta be a better way of doin' this!
            if (!AncestorUtils.IsAncestor(p))
            {
                return(ThoughtState.Inactive);
            }

            var shrine = AncestorUtils.GetMapComponent().CurrentSpawner;

            if (shrine == null)
            {
                return(ThoughtState.ActiveAtStage(1));
            }

            // HACK ALERT! Change Shrines to have an Interaction cell, and use that instead of a random one!
            var room = RoomQuery.RoomAtFast(shrine.RandomAdjacentCellCardinal());

            if (room == null)
            {
                return(ThoughtState.ActiveAtStage(1));
            }
            else if (room.Role != shrineRoomDef)
            {
                return(ThoughtState.ActiveAtStage(1));
            }
            else
            {
                return(ThoughtState.Inactive);
            }
        }
Beispiel #20
0
 //ThoughtWorker_Hot
 public static void Vamp_IgnoreHotAndCold(Pawn p, ref ThoughtState __result)
 {
     if (p != null && p.IsVampire())
     {
         __result = ThoughtState.Inactive;
     }
 }
        public static ThoughtState ActiveWithReason(string reason)
        {
            ThoughtState activeDefault = ThoughtState.ActiveDefault;

            activeDefault.reason = reason;
            return(activeDefault);
        }
Beispiel #22
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            foreach (HediffDef hdef in this.HediffDefs)
            {
                if (p.health.hediffSet.hediffs.Any(x => x.def == hdef))
                {
                    SumOfGifts += 1;
                    if (hdef == C_HediffDefOf.NurglesRot)
                    {
                        SumOfGifts += 2;
                    }
                }
            }

            if (SumOfGifts > 3)
            {
                return(ThoughtState.ActiveAtStage(2));
            }
            if (SumOfGifts > 1)
            {
                return(ThoughtState.ActiveAtStage(1));
            }
            if (SumOfGifts > 0)
            {
                return(ThoughtState.ActiveAtStage(0));
            }
            return(ThoughtState.Inactive);
        }
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            // No carnies
            if (p.IsCarny())
            {
                return(false);
            }

            if (CarnUtils.Info.Active)
            {
                // Pessimists / Depressives get reduced benefit
                var naturalMood = p.story.traits.GetTrait(TraitDefOf.NaturalMood);
                if (naturalMood != null && naturalMood.Degree < 0)
                {
                    // for some reason, reasons do not do anything?
                    return(ThoughtState.ActiveAtStage(1, "CarnInTownThought1".Translate(naturalMood.Label, p.NameStringShort)));
                }
                else
                {
                    // for some reason, reasons do not do anything?
                    return(ThoughtState.ActiveAtStage(0, "CarnInTownThought0".Translate()));
                }
            }

            return(false);
        }
Beispiel #24
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            if (p.needs.water() == null)
            {
                return(ThoughtState.Inactive);
            }
            switch (p.needs.water().CurCategory)
            {
            case ThirstCategory.Healthy:
                return(ThoughtState.Inactive);

            case ThirstCategory.SlightlyThirsty:
                return(ThoughtState.ActiveAtStage(0));

            case ThirstCategory.Thirsty:
                return(ThoughtState.ActiveAtStage(1));

            case ThirstCategory.UrgentlyThirsty:
                return(ThoughtState.ActiveAtStage(2));

            case ThirstCategory.Dehydration:
            {
                Hediff firstHediffOfDef = p.health.hediffSet.GetFirstHediffOfDef(MizuDef.Hediff_Dehydration, false);
                int    num = (firstHediffOfDef != null) ? firstHediffOfDef.CurStageIndex : 0;
                // 脱水症状の1段階目=喉の渇き心情の4段階目 => +3する
                return(ThoughtState.ActiveAtStage(3 + num));
            }

            default:
                throw new NotImplementedException();
            }
        }
Beispiel #25
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            if (p.apparel != null)
            {
                bool bound = false, gagged = false;
                foreach (var app in p.apparel.WornApparel)
                {
                    var gear_def = app.def as bondage_gear_def;
                    if (gear_def != null)
                    {
                        bound  |= gear_def.gives_bound_moodlet;
                        gagged |= gear_def.gives_gagged_moodlet;
                    }
                }

                if (bound && gagged)
                {
                    return(ThoughtState.ActiveAtStage(2));
                }
                if (gagged)
                {
                    return(ThoughtState.ActiveAtStage(1));
                }
                if (bound)
                {
                    return(ThoughtState.ActiveAtStage(0));
                }
            }
            return(ThoughtState.Inactive);
        }
        protected override ThoughtState CurrentSocialStateInternal(Pawn p, Pawn other)
        {
            int num = p.story.traits.DegreeOfTrait(TraitDefOf.FeelingsTowardHumanity);

            if (!p.RaceProps.Humanlike)
            {
                return(false);
            }
            if (!RelationsUtility.PawnsKnowEachOther(p, other))
            {
                return(false);
            }
            if (other.IsAndroid() == true)
            {
                return(false);
            }
            if (num == 1)
            {
                return(ThoughtState.ActiveAtStage(0));
            }
            if (num == 2)
            {
                return(ThoughtState.ActiveAtStage(1));
            }
            return(false);
        }
 protected override ThoughtState CurrentStateInternal(Pawn p)
 {
     if (p.HasTrait(VTEDefOf.VTE_Menagerist))
     {
         Map map = null;
         if (p.ownership?.OwnedBed?.Map != null)
         {
             map = p.ownership.OwnedBed.Map;
         }
         else
         {
             map = p.Map;
         }
         if (map != null)
         {
             var animalCount = GetAllAnimals(map, p.Faction).Count();
             if (animalCount <= 15)
             {
                 return(ThoughtState.ActiveAtStage(animalCount));
             }
             else
             {
                 return(ThoughtState.ActiveAtStage(15));
             }
         }
     }
     return(ThoughtState.Inactive);
 }
Beispiel #28
0
 public static void Listener(Pawn p, ref ThoughtState __result)
 {
     if ((Utils.ExceptionAndroidListBasic.Contains(p.def.defName) || (p.story != null && p.story.traits.HasTrait(Utils.traitSimpleMinded))))
     {
         __result = ThoughtState.Inactive;
     }
 }
 public static void Listener(Pawn p, ref ThoughtState __result)
 {
     if (Utils.IsBasicAndroidTier(p) || Utils.pawnCurrentlyControlRemoteSurrogate(p))
     {
         __result = ThoughtState.Inactive;
     }
 }
Beispiel #30
0
        protected override ThoughtState CurrentSocialStateInternal(Pawn pawn, Pawn other)
        {
            ThoughtState result;

            if (!other.RaceProps.Humanlike || !RelationsUtility.PawnsKnowEachOther(pawn, other))
            {
                result = false;
            }
            else if (RelationsUtility.IsDisfigured(other))
            {
                result = false;
            }
            else
            {
                if (other.health.hediffSet.HasHediff(PolarisblocDefOf.PolarisCombatChip_Charm))
                {
                    result = ThoughtState.ActiveAtStage(0);
                }

                /*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);
        }