public void StartSocialFight(Pawn otherPawn)
        {
            if (PawnUtility.ShouldSendNotificationAbout(this.pawn) || PawnUtility.ShouldSendNotificationAbout(otherPawn))
            {
                Messages.Message("MessageSocialFight".Translate(new object[]
                {
                    this.pawn.LabelShort,
                    otherPawn.LabelShort
                }), this.pawn, MessageTypeDefOf.ThreatSmall, true);
            }
            MentalStateHandler arg_76_0       = this.pawn.mindState.mentalStateHandler;
            MentalStateDef     socialFighting = MentalStateDefOf.SocialFighting;

            arg_76_0.TryStartMentalState(socialFighting, null, false, false, otherPawn, false);
            MentalStateHandler arg_9A_0 = otherPawn.mindState.mentalStateHandler;

            socialFighting = MentalStateDefOf.SocialFighting;
            Pawn otherPawn2 = this.pawn;

            arg_9A_0.TryStartMentalState(socialFighting, null, false, false, otherPawn2, false);
            TaleRecorder.RecordTale(TaleDefOf.SocialFight, new object[]
            {
                this.pawn,
                otherPawn
            });
        }
Пример #2
0
        public void StartSocialFight(Pawn otherPawn)
        {
            if (PawnUtility.ShouldSendNotificationAbout(this.pawn) || PawnUtility.ShouldSendNotificationAbout(otherPawn))
            {
                Thought thought = default(Thought);
                if (!InteractionUtility.TryGetRandomSocialFightProvokingThought(this.pawn, otherPawn, out thought))
                {
                    Log.Warning("Pawn " + this.pawn + " started a social fight with " + otherPawn + ", but he has no negative opinion thoughts towards " + otherPawn + ".");
                }
                else
                {
                    Messages.Message("MessageSocialFight".Translate(this.pawn.LabelShort, otherPawn.LabelShort, thought.LabelCapSocial), this.pawn, MessageTypeDefOf.ThreatSmall);
                }
            }
            MentalStateHandler mentalStateHandler = this.pawn.mindState.mentalStateHandler;
            MentalStateDef     socialFighting     = MentalStateDefOf.SocialFighting;

            mentalStateHandler.TryStartMentalState(socialFighting, null, false, false, otherPawn);
            MentalStateHandler mentalStateHandler2 = otherPawn.mindState.mentalStateHandler;

            socialFighting = MentalStateDefOf.SocialFighting;
            Pawn otherPawn2 = this.pawn;

            mentalStateHandler2.TryStartMentalState(socialFighting, null, false, false, otherPawn2);
            TaleRecorder.RecordTale(TaleDefOf.SocialFight, this.pawn, otherPawn);
        }
Пример #3
0
        static void Postfix(MentalStateHandler __instance)
        {
            if (Multiplayer.Client == null)
            {
                return;
            }

            // Pawns in a mental state can't be sold
            Multiplayer.WorldComp.DirtyColonyTradeForMap(__instance.pawn.Map);
        }
 private static void Postfix(MentalStateHandler __instance, Pawn ___pawn, bool __result, MentalStateDef stateDef, string reason = null, bool forceWake = false, bool causedByMood = false, Pawn otherPawn = null, bool transitionSilently = false)
 {
     if (__result)
     {
         if (stateDef == MentalStateDefOf.Wander_OwnRoom)
         {
             if (Rand.Chance(0.1f))
             {
                 TaleRecorder.RecordTale(VSIE_DefOf.VSIE_HideInRoom, ___pawn);
             }
         }
         else if (stateDef == MentalStateDefOf.Wander_Sad)
         {
             if (Rand.Chance(0.1f))
             {
                 TaleRecorder.RecordTale(VSIE_DefOf.VSIE_WanderedInSaddness, ___pawn);
             }
         }
         else if (stateDef == VSIE_DefOf.SadisticRage)
         {
             if (Rand.Chance(0.1f))
             {
                 TaleRecorder.RecordTale(VSIE_DefOf.VSIE_WentIntoSadisticRage, ___pawn);
             }
         }
         else if (stateDef == VSIE_DefOf.Tantrum || stateDef == VSIE_DefOf.BedroomTantrum || stateDef == VSIE_DefOf.TargetedTantrum)
         {
             if (Rand.Chance(0.1f))
             {
                 TaleRecorder.RecordTale(VSIE_DefOf.VSIE_ThrewTantrum, ___pawn);
             }
         }
         else if (stateDef == MentalStateDefOf.Berserk)
         {
             if (Rand.Chance(0.1f))
             {
                 TaleRecorder.RecordTale(VSIE_DefOf.VSIE_WentBerserk, ___pawn);
             }
         }
         else if (stateDef == VSIE_DefOf.FireStartingSpree)
         {
             if (Rand.Chance(0.1f))
             {
                 TaleRecorder.RecordTale(VSIE_DefOf.VSIE_WentOnFireStartingSpree, ___pawn);
             }
         }
         else if (stateDef == VSIE_DefOf.MurderousRage)
         {
             if (Rand.Chance(0.1f))
             {
                 TaleRecorder.RecordTale(VSIE_DefOf.VSIE_WentOnMurderousRage, ___pawn);
             }
         }
     }
 }
        static void Postfix(MentalStateHandler __instance, MentalStateDef stateDef, ref Pawn ___pawn)
        {
            if (stateDef != MentalStateDefOf.PanicFlee)
            {
                return;
            }
            CompRunAndGun comp = ___pawn.TryGetComp <CompRunAndGun>();

            if (comp != null && Base.enableForAI.Value)
            {
                comp.isEnabled = shouldRunAndGun();
            }
        }
Пример #6
0
        static void Postfix(MentalStateHandler __instance, MentalStateDef stateDef)
        {
            if (stateDef != MentalStateDefOf.PanicFlee)
            {
                return;
            }
            Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue <Pawn>();

            CompRunAndGun comp = pawn.TryGetComp <CompRunAndGun>();

            if (comp != null && Base.enableForAI.Value)
            {
                comp.isEnabled = shouldRunAndGun();
            }
        }
Пример #7
0
            public static void Listener(MentalStateDef stateDef, string reason, bool forceWake, bool causedByMood, Pawn otherPawn, bool transitionSilently, Pawn ___pawn,
                                        MentalStateHandler __instance, ref bool __result)
            {
                if (!__result || !___pawn.IsSurrogateAndroid())
                {
                    return;
                }

                var cas = ___pawn.TryGetComp <CompAndroidState>();
                var cso = cas?.surrogateController?.TryGetComp <CompSurrogateOwner>();
                var csc = cso?.skyCloudHost?.TryGetComp <CompSkyCloudCore>();


                csc?.setMentalBreak(cas.surrogateController);
            }
Пример #8
0
        private static void StartReligiousSocialFight(Pawn talker, Pawn talkee)
        {
            Messages.Message("MessageReligiousSocialFight".Translate(new object[]
            {
                talker.LabelShort,
                talkee.LabelShort,
            }), talker, MessageSound.SeriousAlert);


            talker.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.SocialFighting, null, false, false, talkee);
            MentalStateHandler handlerTalkee = talkee.mindState.mentalStateHandler;
            Pawn otherPawn2 = talker;

            handlerTalkee.TryStartMentalState(MentalStateDefOf.SocialFighting, null, false, false, otherPawn2);
        }
 static bool Prefix(MentalStateHandler __instance, MentalStateDef stateDef)
 {
     if (stateDef == MentalStateDefOf.PanicFlee)
     {
         Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue <Pawn>();
         if (pawn.CurJob != null && pawn.CurJob.def == GUC_JobDefOf.Mounted)
         {
             ExtendedPawnData pawnData = Base.Instance.GetExtendedDataStorage().GetExtendedDataFor(pawn);
             if (pawnData.ownedBy != null && !pawnData.ownedBy.Dead && !pawnData.ownedBy.Downed)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Пример #10
0
        // Token: 0x06000056 RID: 86 RVA: 0x00003870 File Offset: 0x00001A70
        private void startFightingState(Fighter f)
        {
            f.p.mindState.enemyTarget = this.getOtherFighter(f).p;
            f.p.jobs.StopAll(false);
            f.p.mindState.mentalStateHandler.Reset();
            MentalStateHandler mentalStateHandler = f.p.mindState.mentalStateHandler;
            MentalStateDef     ArenaFighting      = MentalStateDefOfArena.Fighter;
            Pawn           pawn      = f.p;
            MentalStateDef stateDef  = ArenaFighting;
            Pawn           otherPawn = this.getOtherFighter(f).p;

            mentalStateHandler.TryStartMentalState(stateDef, "", false, false, null, true);
            MentalState_Fighter mentalState = f.p.MentalState as MentalState_Fighter;

            mentalState.otherPawn = this.getOtherFighter(f).p;
            mentalState.bellRef   = this;
        }
Пример #11
0
        public void StartSocialFight(Pawn otherPawn)
        {
            if (PawnUtility.ShouldSendNotificationAbout(pawn) || PawnUtility.ShouldSendNotificationAbout(otherPawn))
            {
                Messages.Message("MessageSocialFight".Translate(pawn.LabelShort, otherPawn.LabelShort, pawn.Named("PAWN1"), otherPawn.Named("PAWN2")), pawn, MessageTypeDefOf.ThreatSmall);
            }
            MentalStateHandler mentalStateHandler = pawn.mindState.mentalStateHandler;
            MentalStateDef     socialFighting     = MentalStateDefOf.SocialFighting;

            mentalStateHandler.TryStartMentalState(socialFighting, null, forceWake: false, causedByMood: false, otherPawn);
            MentalStateHandler mentalStateHandler2 = otherPawn.mindState.mentalStateHandler;

            socialFighting = MentalStateDefOf.SocialFighting;
            Pawn otherPawn2 = pawn;

            mentalStateHandler2.TryStartMentalState(socialFighting, null, forceWake: false, causedByMood: false, otherPawn2);
            TaleRecorder.RecordTale(TaleDefOf.SocialFight, pawn, otherPawn);
        }
Пример #12
0
        static bool Prefix(MentalStateHandler __instance, ref bool __result, MentalStateDef stateDef, string reason, bool forceWake, bool causedByMood, Pawn otherPawn)
        {
            if (!causedByMood)
            {
                return(true);
            }

            Pawn pawn = (Pawn)(typeof(MentalStateHandler).GetField("pawn", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance));

            if (pawn.IsPrisonerOfColony)
            {
                var need = pawn.needs.TryGetNeed <Need_Treatment>();
                if (need != null)
                {
                    TreatmentCategory treatmentCat = need.CurCategory;
                    bool  suspended = false;
                    float chance    = 0f;

                    switch (treatmentCat)
                    {
                    case TreatmentCategory.Normal:
                        chance = 0.1f;
                        break;

                    case TreatmentCategory.Bad:
                        chance = 0.5f;
                        break;

                    case TreatmentCategory.VeryBad:
                        chance = 1f;
                        break;
                    }

                    suspended = UnityEngine.Random.value < chance;

                    if (suspended)
                    {
                        __result = false;
                        return(false);
                    }
                }
            }
            return(true);
        }
        public void StartSocialFight(Pawn otherPawn)
        {
            if (PawnUtility.ShouldSendNotificationAbout(this.pawn) || PawnUtility.ShouldSendNotificationAbout(otherPawn))
            {
                Thought thought;
                if (!InteractionUtility.TryGetRandomSocialFightProvokingThought(this.pawn, otherPawn, out thought))
                {
                    Log.Warning(string.Concat(new object[]
                    {
                        "Pawn ",
                        this.pawn,
                        " started a social fight with ",
                        otherPawn,
                        ", but he has no negative opinion thoughts towards ",
                        otherPawn,
                        "."
                    }));
                }
                else
                {
                    Messages.Message("MessageSocialFight".Translate(new object[]
                    {
                        this.pawn.LabelShort,
                        otherPawn.LabelShort,
                        thought.LabelCapSocial
                    }), this.pawn, MessageTypeDefOf.ThreatSmall);
                }
            }
            MentalStateHandler arg_D6_0       = this.pawn.mindState.mentalStateHandler;
            MentalStateDef     socialFighting = MentalStateDefOf.SocialFighting;

            arg_D6_0.TryStartMentalState(socialFighting, null, false, false, otherPawn);
            MentalStateHandler arg_F9_0 = otherPawn.mindState.mentalStateHandler;

            socialFighting = MentalStateDefOf.SocialFighting;
            Pawn otherPawn2 = this.pawn;

            arg_F9_0.TryStartMentalState(socialFighting, null, false, false, otherPawn2);
            TaleRecorder.RecordTale(TaleDefOf.SocialFight, new object[]
            {
                this.pawn,
                otherPawn
            });
        }
Пример #14
0
            public static void Listener(MentalStateDef stateDef, string reason, bool forceWake, bool causedByMood, Pawn otherPawn, bool transitionSilently, Pawn ___pawn, MentalStateHandler __instance, ref bool __result)
            {
                if (__result && ___pawn.IsSurrogateAndroid())
                {
                    CompAndroidState cas = ___pawn.TryGetComp <CompAndroidState>();

                    if (cas == null || cas.surrogateController == null)
                    {
                        return;
                    }

                    CompSurrogateOwner cso = cas.surrogateController.TryGetComp <CompSurrogateOwner>();
                    if (cso.skyCloudHost != null)
                    {
                        CompSkyCloudCore csc = cso.skyCloudHost.TryGetComp <CompSkyCloudCore>();
                        if (csc == null)
                        {
                            return;
                        }


                        //Ajout a une liste de minds boudant avec timeout
                        csc.setMentalBreak(cas.surrogateController);
                    }
                }
            }