Esempio n. 1
0
        protected override ThoughtState CurrentSocialStateInternal(Pawn p, Pawn other)
        {
            HediffWithTarget hediffWithTarget = (HediffWithTarget)p.health.hediffSet.GetFirstHediffOfDef(def.hediff);

            if (hediffWithTarget == null || hediffWithTarget.target != other)
            {
                return(ThoughtState.Inactive);
            }
            return(CurrentStateInternal(p));
        }
        public float SecondaryRomanceChanceFactor(Pawn otherPawn)
        {
            float num = 1f;

            foreach (PawnRelationDef relation in pawn.GetRelations(otherPawn))
            {
                num *= relation.romanceChanceFactor;
            }
            float            num2             = 1f;
            HediffWithTarget hediffWithTarget = (HediffWithTarget)pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.PsychicLove);

            if (hediffWithTarget != null && hediffWithTarget.target == otherPawn)
            {
                num2 = 10f;
            }
            return(SecondaryLovinChanceFactor(otherPawn) * num * num2);
        }
        public override float RandomSelectionWeight(Pawn initiator, Pawn recipient)
        {
            if (!LovePartnerRelationUtility.LovePartnerRelationExists(initiator, recipient))
            {
                return(0f);
            }
            float num  = Mathf.InverseLerp(100f, -100f, initiator.relations.OpinionOf(recipient));
            float num2 = 1f;

            if (initiator.relations.DirectRelationExists(PawnRelationDefOf.Spouse, recipient))
            {
                num2 = 0.4f;
            }
            float            num3             = 1f;
            HediffWithTarget hediffWithTarget = (HediffWithTarget)initiator.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.PsychicLove);

            if (hediffWithTarget != null && hediffWithTarget.target == recipient)
            {
                num3 = 0.1f;
            }
            return(0.02f * num * num2 * num3);
        }
        public override float RandomSelectionWeight(Pawn initiator, Pawn recipient)
        {
            DirectPawnRelation directRelation = initiator.relations.GetDirectRelation(PawnRelationDefOf.Lover, recipient);

            if (directRelation == null)
            {
                return(0f);
            }
            Pawn spouse  = recipient.GetSpouse();
            Pawn spouse2 = initiator.GetSpouse();

            if ((spouse != null && !spouse.Dead) || (spouse2 != null && !spouse2.Dead))
            {
                return(0f);
            }
            float num   = 0.4f;
            float value = (float)(Find.TickManager.TicksGame - directRelation.startTicks) / 60000f;

            num *= Mathf.InverseLerp(0f, 60f, value);
            num *= Mathf.InverseLerp(0f, 60f, initiator.relations.OpinionOf(recipient));
            if (recipient.relations.OpinionOf(initiator) < 0)
            {
                num *= 0.3f;
            }
            if (initiator.gender == Gender.Female)
            {
                num *= 0.2f;
            }
            HediffWithTarget hediffWithTarget = (HediffWithTarget)initiator.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.PsychicLove);

            if (hediffWithTarget != null && hediffWithTarget.target == recipient)
            {
                num *= 10f;
            }
            return(num);
        }