public override float RandomSelectionWeight(Pawn initiator, Pawn recipient) { if (LovePartnerRelationUtility.LovePartnerRelationExists(initiator, recipient)) { return(0f); } float num = initiator.relations.SecondaryRomanceChanceFactor(recipient); if (num < 0.25f) { return(0f); } int num2 = initiator.relations.OpinionOf(recipient); if (num2 < 5) { return(0f); } if (recipient.relations.OpinionOf(initiator) < 5) { return(0f); } float num3 = 1f; Pawn pawn = LovePartnerRelationUtility.ExistingMostLikedLovePartner(initiator, false); if (pawn != null) { float value = (float)initiator.relations.OpinionOf(pawn); num3 = Mathf.InverseLerp(50f, -50f, value); } float num4 = (!initiator.story.traits.HasTrait(TraitDefOf.Gay)) ? ((initiator.gender != Gender.Female) ? 1f : 0.15f) : 1f; float num5 = Mathf.InverseLerp(0.25f, 1f, num); float num6 = Mathf.InverseLerp(5f, 100f, (float)num2); float num7; if (initiator.gender == recipient.gender) { if (initiator.story.traits.HasTrait(TraitDefOf.Gay) && recipient.story.traits.HasTrait(TraitDefOf.Gay)) { num7 = 1f; } else { num7 = 0.15f; } } else if (!initiator.story.traits.HasTrait(TraitDefOf.Gay) && !recipient.story.traits.HasTrait(TraitDefOf.Gay)) { num7 = 1f; } else { num7 = 0.15f; } return(1.15f * num4 * num5 * num6 * num3 * num7); }
public override float RandomSelectionWeight(Pawn initiator, Pawn recipient) { if (TutorSystem.TutorialMode) { return(0f); } if (LovePartnerRelationUtility.LovePartnerRelationExists(initiator, recipient)) { return(0f); } float num = initiator.relations.SecondaryRomanceChanceFactor(recipient); if (num < 0.15f) { return(0f); } int num2 = initiator.relations.OpinionOf(recipient); if (num2 < 5) { return(0f); } if (recipient.relations.OpinionOf(initiator) < 5) { return(0f); } float num3 = 1f; Pawn pawn = LovePartnerRelationUtility.ExistingMostLikedLovePartner(initiator, allowDead: false); if (pawn != null) { float value = initiator.relations.OpinionOf(pawn); num3 = Mathf.InverseLerp(50f, -50f, value); } float num4 = (initiator.story.traits.HasTrait(TraitDefOf.Gay) ? 1f : ((initiator.gender == Gender.Female) ? 0.15f : 1f)); float num5 = Mathf.InverseLerp(0.15f, 1f, num); float num6 = Mathf.InverseLerp(5f, 100f, num2); float num7 = ((initiator.gender == recipient.gender) ? ((!initiator.story.traits.HasTrait(TraitDefOf.Gay) || !recipient.story.traits.HasTrait(TraitDefOf.Gay)) ? 0.15f : 1f) : ((initiator.story.traits.HasTrait(TraitDefOf.Gay) || recipient.story.traits.HasTrait(TraitDefOf.Gay)) ? 0.15f : 1f)); return(1.15f * num4 * num5 * num6 * num3 * num7); }
public override float RandomSelectionWeight(Pawn initiator, Pawn recipient) { if (LovePartnerRelationUtility.LovePartnerRelationExists(initiator, recipient)) { return(0f); } float num = initiator.relations.SecondaryRomanceChanceFactor(recipient); if (num < 0.25) { return(0f); } int num2 = initiator.relations.OpinionOf(recipient); if (num2 < 5) { return(0f); } if (recipient.relations.OpinionOf(initiator) < 5) { return(0f); } float num3 = 1f; Pawn pawn = LovePartnerRelationUtility.ExistingMostLikedLovePartner(initiator, false); if (pawn != null) { float value = (float)initiator.relations.OpinionOf(pawn); num3 = Mathf.InverseLerp(50f, -50f, value); } float num4 = (float)((!initiator.story.traits.HasTrait(TraitDefOf.Gay)) ? ((initiator.gender != Gender.Female) ? 1.0 : 0.15000000596046448) : 1.0); float num5 = Mathf.InverseLerp(0.25f, 1f, num); float num6 = Mathf.InverseLerp(5f, 100f, (float)num2); float num7 = (float)((initiator.gender != recipient.gender) ? ((initiator.story.traits.HasTrait(TraitDefOf.Gay) || recipient.story.traits.HasTrait(TraitDefOf.Gay)) ? 0.15000000596046448 : 1.0) : ((!initiator.story.traits.HasTrait(TraitDefOf.Gay) || !recipient.story.traits.HasTrait(TraitDefOf.Gay)) ? 0.15000000596046448 : 1.0)); return((float)(1.1499999761581421 * num4 * num5 * num6 * num3 * num7)); }
private bool NeedColonistBeds(Map map) { if (!map.IsPlayerHome) { return(false); } int num = 0; int num2 = 0; List <Building> allBuildingsColonist = map.listerBuildings.allBuildingsColonist; for (int i = 0; i < allBuildingsColonist.Count; i++) { Building_Bed building_Bed = allBuildingsColonist[i] as Building_Bed; if (building_Bed != null && !building_Bed.ForPrisoners && !building_Bed.Medical && building_Bed.def.building.bed_humanlike) { if (building_Bed.SleepingSlotsCount == 1) { num++; } else { num2++; } } } int num3 = 0; int num4 = 0; foreach (Pawn item in map.mapPawns.FreeColonistsSpawned) { Pawn pawn = LovePartnerRelationUtility.ExistingMostLikedLovePartner(item, allowDead: false); if (pawn == null || !pawn.Spawned || pawn.Map != item.Map || pawn.Faction != Faction.OfPlayer || pawn.HostFaction != null) { num3++; } else { num4++; } } if (num4 % 2 != 0) { Log.ErrorOnce("partneredCols % 2 != 0", 743211); } for (int j = 0; j < num4 / 2; j++) { if (num2 > 0) { num2--; } else { num -= 2; } } for (int k = 0; k < num3; k++) { if (num2 > 0) { num2--; } else { num--; } } return(num < 0 || num2 < 0); }