예제 #1
0
        private bool canAutoLove(Pawn pawn, Pawn pawn2)
        {
            var tick = Find.TickManager.TicksGame;

            return(WoohooSettingHelper.latest.allowAIWoohoo &&
                   pawn.mindState.canLovinTick < tick
                   //idle
                   && JobUtilityIdle.isIdle(pawn2)

                   //still enjoys woohoo

                   && !(pawn2.needs.joy?.tolerances?.BoredOf(Constants.Joy_Woohoo) ?? false) &&
                   !pawn.needs.joy.tolerances.BoredOf(Constants.Joy_Woohoo) &&
                   (

                       ((pawn2.needs.joy?.CurLevel ?? 0f) < MINIMAL_JOY || pawn2.needs.mood.CurLevel < MINIMAL_JOY) &&
                       (pawn.needs.joy.CurLevel < MINIMAL_JOY || pawn.needs.mood.CurLevel < MINIMAL_JOY)
                   )

                   //and a 1d10
                   && (pawn.relations.DirectRelationExists(PawnRelationDefOf.Lover, pawn2) ||
                       pawn.relations.DirectRelationExists(PawnRelationDefOf.Fiance, pawn2) ||
                       pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, pawn2) ||
                       (Rand.Value < 0.1f / (pawn.GetSpouse() != null ? 4:1) &&
                        RelationsUtility.PawnsKnowEachOther(pawn, pawn2) &&
                        WoohooSettingHelper.latest.familyWeight * Math.Abs(LovePartnerRelationUtility.IncestOpinionOffsetFor(pawn2, pawn) * 0.01f) * Rand.Value < 0.5f
                       )
                       )
                   );
        }
        private bool canAutoLove(Pawn pawn, Pawn pawn2)
        {
            var tick = Find.TickManager.TicksGame;

            return(WoohooSettingHelper.latest.allowAIWoohoo &&
                   pawn.mindState.canLovinTick < tick &&
                   pawn2.mindState.canLovinTick < tick
                   //idle
                   && JobUtilityIdle.isIdle(pawn2)

                   //still enjoys woohoo
                   && pawn2?.needs?.joy?.tolerances != null &&
                   pawn?.needs?.joy?.tolerances != null &&
                   pawn2?.needs?.mood?.CurLevel != null &&
                   pawn?.needs?.mood?.CurLevel != null

                   && !pawn2.needs.joy.tolerances.BoredOf(Constants.Joy_Woohoo) &&
                   !pawn.needs.joy.tolerances.BoredOf(Constants.Joy_Woohoo) &&
                   ((pawn2.needs.joy.CurLevel < .6f || pawn2.needs.mood.CurLevel < .6f) &&
                    (pawn.needs.joy.CurLevel < .6f || pawn.needs.mood.CurLevel < .6f)
                   )

                   //and a 1d10
                   && Rand.Value < 0.1f &&
                   (RelationsUtility.PawnsKnowEachOther(pawn, pawn2)) &&
                   WoohooSettingHelper.latest.familyWeight * LovePartnerRelationUtility.IncestOpinionOffsetFor(pawn2, pawn) * Rand.Value < 0.5f

                   // && (Math.Abs(LovePartnerRelationUtility.IncestOpinionOffsetFor(pawn2, pawn)) < 0.01f || Rand.Value > WoohooSettingHelper.latest.familyWeight)

                   );
        }