static void this_is_postfix(ref IEnumerable <Gizmo> __result, ref Pawn __instance)
        {
            //Log.Message("[rjw]Harmony patch submit_button is called");
            var pawn    = __instance;
            var gizmos  = __result.ToList();
            var enabled = RJWSettings.submit_button_enabled;

            if (enabled && pawn.IsColonistPlayerControlled && pawn.Drafted)
            {
                if (pawn.CanChangeDesignationColonist())
                {
                    if (!(pawn.kindDef.race.defName.Contains("Droid") && !AndroidsCompatibility.IsAndroid(pawn)))
                    {
                        gizmos.Add(new Command_Action
                        {
                            defaultLabel = "CommandSubmit".Translate(),
                            icon         = submit_icon,
                            defaultDesc  = "CommandSubmitDesc".Translate(),
                            action       = delegate
                            {
                                LayDownAndAccept(pawn);
                            },
                            hotKey = KeyBindingDefOf.Misc3
                        });
                    }
                }
            }
            __result = gizmos.AsEnumerable();
        }
Exemple #2
0
        public static void ChangeSex(Pawn pawn, Sex oldsex, Sex newsex)
        {
            // Wakeup pawn sexuality if it has none before

            if (!(CompRJW.Comp(pawn).orientation == Orientation.Asexual || CompRJW.Comp(pawn).orientation == Orientation.None))
            {
                if (oldsex == newsex)
                {
                    return;
                }
            }

            //update ingame genders
            if (newsex == Sex.none)
            {
                return;
            }
            else if (newsex == Sex.male || newsex == Sex.trap)
            {
                pawn.gender = Gender.Male;
            }
            else
            {
                pawn.gender = Gender.Female;
            }

            // Sexualize pawn after installation of parts if it was "not interested in".
            if (oldsex == Sex.none || CompRJW.Comp(pawn).orientation == Orientation.Asexual || CompRJW.Comp(pawn).orientation == Orientation.None)
            {
                if (pawn.kindDef.race.defName.ToLower().Contains("droid") && !AndroidsCompatibility.IsAndroid(pawn))
                {
                    //basic droids,they dont care
                    return;
                }
                else
                {
                    CompRJW.Comp(pawn).Sexualize(pawn, true);
                }
            }

            var old_thought = IsInDenial(pawn);
            var react       = GetReactionHediff(oldsex, newsex);

            if (old_thought == null || old_thought.is_happy())          //pawn either liked it or got used already
            {
                //Log.Message("ChangeSex 1 old_thought" + old_thought);
                //Log.Message("ChangeSex 1 react" + react);
                if (react != null)
                {
                    GiveThought(pawn, react, pawn.IsDesignatedHero());                    //give unhappy, if not hero
                }
                if (old_thought != null)
                {
                    pawn.health.RemoveHediff(old_thought);
                }

                //add tracking hediff
                pawn.health.AddHediff(sex_to_old_sex[oldsex]);
            }
            else                                 //pawn was unhappy
            {
                if (WasThisBefore(pawn, newsex)) //pawn is happy to be previous self
                {
                    GiveThought(pawn, react, happy: true);
                    pawn.health.RemoveHediff(old_thought);
                }
                else                                                         //pawn is still unhappy mix the unhappiness from two
                {
                    react = GetReactionHediff(GetOriginalSex(pawn), newsex); //check reaction from original sex
                    if (react != null)
                    {
                        GiveThought(pawn, react, old_thought: old_thought);
                        pawn.health.RemoveHediff(old_thought);
                    }
                    //else pawn keeps old unhappy thought
                }
            }
        }
        // The main method for adding genitalia and orientation.
        public void Sexualize(Pawn pawn, bool reroll = false)
        {
            if (reroll)
            {
                Comp(pawn).orientation = Orientation.None;

                if (xxx.has_quirk(pawn, "Fertile"))
                {
                    Hediff fertility = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("IncreasedFertility"));
                    if (fertility != null)
                    {
                        pawn.health.RemoveHediff(fertility);
                    }
                }
                if (xxx.has_quirk(pawn, "Infertile"))
                {
                    Hediff fertility = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("DecreasedFertility"));
                    if (fertility != null)
                    {
                        pawn.health.RemoveHediff(fertility);
                    }
                }
                quirks = new StringBuilder();
            }
            else if (Comp(pawn).orientation != Orientation.None)
            {
                return;
            }

            //roll random RJW orientation
            Comp(pawn).orientation = xxx.is_animal(pawn) ? RollAnimalOrientation(pawn) : RollOrientation(pawn);

            //Asexual nymp re-roll
            //if (xxx.is_nympho(pawn))
            //	while (Comp(pawn).orientation == Orientation.Asexual)
            //	{
            //		Comp(pawn).orientation = RollOrientation();
            //	}

            //Log.Message("Sexualizing pawn " + pawn?.Name + ", def: " + pawn?.def?.defName);

            if (!reroll)
            {
                Sexualizer.sexualize_pawn(pawn);
            }
            //Log.Message("Orientation for pawn " + pawn?.Name + " is " + orientation);

            if (xxx.has_traits(pawn) && Genital_Helper.has_genitals(pawn) && !(pawn.kindDef.race.defName.ToLower().Contains("droid") && !AndroidsCompatibility.IsAndroid(pawn)))
            {
                if (RJWPreferenceSettings.sexuality_distribution == RJWPreferenceSettings.Rjw_sexuality.Vanilla)
                {
                    VanillaTraitCheck(pawn);
                }
                if (RJWPreferenceSettings.sexuality_distribution == RJWPreferenceSettings.Rjw_sexuality.Psychology)
                {
                    CopyPsychologySexuality(pawn);
                }
                if (RJWPreferenceSettings.sexuality_distribution == RJWPreferenceSettings.Rjw_sexuality.SYRIndividuality)
                {
                    CopyIndividualitySexuality(pawn);
                }
            }
            else if ((pawn.kindDef.race.defName.ToLower().Contains("droid") && !AndroidsCompatibility.IsAndroid(pawn)) || !Genital_Helper.has_genitals(pawn))
            {
                // Droids with no genitalia are set as asexual.
                // If player later adds genitalia to the droid, the droid 'sexuality' gets rerolled.
                Comp(pawn).orientation = Orientation.Asexual;
            }

            QuirkAdder.Generate(pawn);

            if (quirks.Length == 0)
            {
                quirks.Append("None");
                quirksave = quirks.ToString();
            }
        }
Exemple #4
0
 public static bool IsSexyRobot(this Pawn pawn)
 {
     return(AndroidsCompatibility.IsAndroid(pawn));
 }
        public override float CalculateCapacityLevel(HediffSet diffSet, List <PawnCapacityUtility.CapacityImpactor> impactors = null)
        {
            Pawn pawn = diffSet.pawn;

            if (!Genital_Helper.has_penis(pawn) && !Genital_Helper.has_vagina(pawn))
            {
                return(0);
            }

            if (Genital_Helper.has_ovipositorF(pawn) || Genital_Helper.has_ovipositorM(pawn))
            {
                return(0);
            }

            //Log.Message("[RJW]PawnCapacityWorker_Fertility::CalculateCapacityLevel is called for: " + xxx.get_pawnname(pawn));
            RaceProperties race = diffSet.pawn.RaceProps;

            if (!pawn.RaceHasFertility())
            {
                //Log.Message(" Fertility_filter, no fertility for : " + pawn.kindDef.defName);
                return(0f);
            }

            //androids only fertile with archotech parts
            if (AndroidsCompatibility.IsAndroid(pawn) && !(AndroidsCompatibility.AndroidPenisFertility(pawn) || AndroidsCompatibility.AndroidVaginaFertility(pawn)))
            {
                //Log.Message(" Android has no archotech genitals set fertility to 0 for: " + pawn.kindDef.defName);
                return(0f);
            }

            //archotech always fertile mode
            if (pawn.health.hediffSet.HasHediff(HediffDef.Named("FertilityEnhancer")))
            {
                //Log.Message(" has archotech FertilityEnhancer set fertility to 100%");
                return(1f);
            }

            float startAge      = 0f;                                                                        //raise fertility
            float startMaxAge   = 0f;                                                                        //max fertility
            float endAge        = race.lifeExpectancy * (RJWPregnancySettings.fertility_endage_male * 0.7f); // Age when males start to lose potency.
            float zeroFertility = race.lifeExpectancy * RJWPregnancySettings.fertility_endage_male;          // Age when fertility hits 0%.

            if (xxx.is_female(pawn))
            {
                if (xxx.is_animal(pawn))
                {
                    endAge        = race.lifeExpectancy * (RJWPregnancySettings.fertility_endage_female_animal * 0.6f);
                    zeroFertility = race.lifeExpectancy * RJWPregnancySettings.fertility_endage_female_animal;
                }
                else
                {
                    endAge        = race.lifeExpectancy * (RJWPregnancySettings.fertility_endage_female_humanlike * 0.6f);            // Age when fertility begins to drop.
                    zeroFertility = race.lifeExpectancy * RJWPregnancySettings.fertility_endage_female_humanlike;                     // Age when fertility hits 0%.
                }
            }

            foreach (LifeStageAge lifestage in race.lifeStageAges)
            {
                if (lifestage.def.reproductive)
                {
                    //presumably teen stage
                    if (startAge == 0f && startMaxAge == 0f)
                    {
                        startAge    = lifestage.minAge;
                        startMaxAge = (Mathf.Max(startAge + (startAge + endAge) * 0.08f, startAge));
                    }
                    //presumably adult stage
                    else
                    {
                        if (startMaxAge > lifestage.minAge)
                        {
                            startMaxAge = lifestage.minAge;
                        }
                    }
                }
            }
            //Log.Message(" Fertility ages for " + pawn.Name + " are: " + startAge + ", " + startMaxAge + ", " + endAge + ", " + endMaxAge);

            float result = PawnCapacityUtility.CalculateTagEfficiency(diffSet, BodyPartTagDefOf.RJW_FertilitySource, 1f, FloatRange.ZeroToOne, impactors);

            result *= GenMath.FlatHill(startAge, startMaxAge, endAge, zeroFertility, pawn.ageTracker.AgeBiologicalYearsFloat);

            //Log.Message("[RJW]PawnCapacityWorker_Fertility::CalculateCapacityLevel result is: " + result);
            return(result);
        }
        ///<summary>For checking normal pregnancy, should not for egg implantion or such.</summary>
        public static bool CanImpregnate(Pawn f****r, Pawn f****d, xxx.rjwSextype sextype = xxx.rjwSextype.Vaginal)
        {
            if (f****r == null || f****d == null)
            {
                return(false);
            }

            if (RJWSettings.DevMode)
            {
                Log.Message("Rimjobworld::CanImpregnate checks (" + sextype + "):: " + xxx.get_pawnname(f****r) + " + " + xxx.get_pawnname(f****d) + ":");
            }

            if (sextype == xxx.rjwSextype.MechImplant && !RJWPregnancySettings.mechanoid_pregnancy_enabled)
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(" mechanoid 'pregnancy' disabled");
                }
                return(false);
            }

            if (!(sextype == xxx.rjwSextype.Vaginal || sextype == xxx.rjwSextype.DoublePenetration))
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(" sextype cannot result in pregnancy");
                }
                return(false);
            }

            if (AndroidsCompatibility.IsAndroid(f****r) && AndroidsCompatibility.IsAndroid(f****d))
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(xxx.get_pawnname(f****d) + " androids cant breed/reproduce androids");
                }
                return(false);
            }

            if (!f****r.RaceHasPregnancy())
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(xxx.get_pawnname(f****d) + " filtered race that cant be pregnant");
                }
                return(false);
            }

            if (!f****d.RaceHasPregnancy())
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(xxx.get_pawnname(f****r) + " filtered race that cant impregnate");
                }
                return(false);
            }

            if (f****d.health.hediffSet.HasHediff(HediffDef.Named("RJW_pregnancy")) ||
                f****d.health.hediffSet.HasHediff(HediffDef.Named("RJW_pregnancy_beast")) ||
                f****d.health.hediffSet.HasHediff(HediffDef.Named("Pregnant")))
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(" already pregnant.");
                }
                return(false);
            }

            if ((from x in f****d.health.hediffSet.GetHediffs <Hediff_InsectEgg>() where x.def == DefDatabase <HediffDef_InsectEgg> .GetNamed(x.def.defName) select x).Any())
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(xxx.get_pawnname(f****d) + " cant get pregnant while eggs inside");
                }
                return(false);
            }

            if (!(Genital_Helper.has_penis(f****r) && Genital_Helper.has_vagina(f****d)) && !(Genital_Helper.has_penis(f****d) && Genital_Helper.has_vagina(f****r)))
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(" missing genitals for impregnation");
                }
                return(false);
            }

            if (f****r.health.capacities.GetLevel(xxx.reproduction) <= 0 || f****d.health.capacities.GetLevel(xxx.reproduction) <= 0)
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(" one (or both) pawn(s) infertile");
                }
                return(false);
            }

            if (xxx.is_human(f****d) && xxx.is_human(f****r) && (RJWPregnancySettings.humanlike_impregnation_chance == 0 || !RJWPregnancySettings.humanlike_pregnancy_enabled))
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(" human pregnancy chance set to 0% or pregnancy disabled.");
                }
                return(false);
            }
            else if (((xxx.is_animal(f****r) && xxx.is_human(f****d)) || (xxx.is_human(f****r) && xxx.is_animal(f****d))) && !RJWPregnancySettings.bestial_pregnancy_enabled)
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(" bestiality pregnancy chance set to 0% or pregnancy disabled.");
                }
                return(false);
            }
            else if (xxx.is_animal(f****d) && xxx.is_animal(f****r) && (RJWPregnancySettings.animal_impregnation_chance == 0 || !RJWPregnancySettings.animal_pregnancy_enabled))
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(" animal-animal pregnancy chance set to 0% or pregnancy disabled.");
                }
                return(false);
            }
            else if (f****r.def.defName != f****d.def.defName && (RJWPregnancySettings.interspecies_impregnation_modifier <= 0.0f && !RJWPregnancySettings.complex_interspecies))
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(" interspecies pregnancy disabled.");
                }
                return(false);
            }

            return(true);
        }
        public static void Doimpregnate(Pawn pawn, Pawn partner)
        {
            if (RJWSettings.DevMode)
            {
                Log.Message("[RJW] Doimpregnate " + xxx.get_pawnname(pawn) + " is a father, " + xxx.get_pawnname(partner) + " is a mother");
            }

            if (AndroidsCompatibility.IsAndroid(pawn) && !AndroidsCompatibility.AndroidPenisFertility(pawn))
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(" Father is android with no arcotech penis, abort");
                }
                return;
            }
            if (AndroidsCompatibility.IsAndroid(partner) && !AndroidsCompatibility.AndroidVaginaFertility(partner))
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(" Mother is android with no arcotech v****a, abort");
                }
                return;
            }

            // fertility check
            float fertility = RJWPregnancySettings.humanlike_impregnation_chance / 100f;

            if (xxx.is_animal(partner))
            {
                fertility = RJWPregnancySettings.animal_impregnation_chance / 100f;
            }

            // Interspecies modifier
            if (pawn.def.defName != partner.def.defName)
            {
                if (RJWPregnancySettings.complex_interspecies)
                {
                    fertility *= SexUtility.BodySimilarity(pawn, partner);
                }
                else
                {
                    fertility *= RJWPregnancySettings.interspecies_impregnation_modifier;
                }
            }

            //Rand.PopState();
            //Rand.PushState(RJW_Multiplayer.PredictableSeed());
            float          ReproductionFactor   = Math.Min(pawn.health.capacities.GetLevel(xxx.reproduction), partner.health.capacities.GetLevel(xxx.reproduction));
            float          pregnancy_threshold  = fertility * ReproductionFactor;
            float          non_pregnancy_chance = Rand.Value;
            BodyPartRecord torso = partner.RaceProps.body.AllParts.Find(x => x.def == BodyPartDefOf.Torso);

            if (non_pregnancy_chance > pregnancy_threshold || pregnancy_threshold == 0)
            {
                if (RJWSettings.DevMode)
                {
                    Log.Message(" Impregnation failed. Chance: " + pregnancy_threshold.ToStringPercent() + " roll: " + non_pregnancy_chance.ToStringPercent());
                }
                return;
            }
            if (RJWSettings.DevMode)
            {
                Log.Message(" Impregnation succeeded. Chance: " + pregnancy_threshold.ToStringPercent() + " roll: " + non_pregnancy_chance.ToStringPercent());
            }

            PregnancyDecider(partner, pawn);
        }
 public static void Generate(Pawn pawn)
 {
     if (!pawn.RaceHasSexNeed() || (pawn.kindDef.race.defName.ToLower().Contains("droid") && !AndroidsCompatibility.IsAndroid(pawn)))
     {
         return;
     }
     else if (pawn.IsAnimal())
     {
         GenerateForAnimal(pawn);
     }
     else
     {
         GenerateForHumanlike(pawn);
     }
 }
Exemple #9
0
        public void GenerateQuirks(Pawn pawn)
        {
            // No quirks for droids, at least not for now.
            if (!AndroidsCompatibility.IsAndroid(pawn))
            {
                if (pawn.kindDef.race.defName.ToLower().Contains("droid") || xxx.is_mechanoid(pawn))
                {
                    return;
                }
            }

            //Rand.PopState();
            //Rand.PushState(RJW_Multiplayer.PredictableSeed());
            if (Rand.Chance(0.025f))
            {
                quirks.AppendWithComma("Messy");                 // Increased cum generation.
            }
            if (!AndroidsCompatibility.IsAndroid(pawn))
            {
                if (Rand.Chance(0.04f))
                {
                    quirks.AppendWithComma("Fertile");
                    pawn.health.AddHediff(HediffDef.Named("IncreasedFertility"));
                }
                else if (Rand.Chance(0.06f))
                {
                    quirks.AppendWithComma("Infertile");
                    pawn.health.AddHediff(HediffDef.Named("DecreasedFertility"));
                }
            }

            if (Rand.Chance(0.03f) && (!xxx.has_traits(pawn) || pawn.story.traits.DegreeOfTrait(TraitDef.Named("Immunity")) != -1))
            {
                quirks.AppendWithComma("Vigorous");
            }

            if (Rand.Chance(0.0f))
            {
                if (pawn.gender == Gender.Female && xxx.is_insect(pawn))
                {
                    quirks.AppendWithComma("Incubator");
                }
                //add checks to seed random stats with age/traits/quirks?
                //pawn.records.AddTo(xxx.CountOfBirthEgg, Rand.Range(0, 1000));

                //Log.Message("Gender for pawn " + xxx.get_pawnname(pawn) + " is " + pawn.gender);
            }

            if (Rand.Chance(0.0f))
            {
                if (pawn.gender == Gender.Female && xxx.is_animal(pawn) && !xxx.is_insect(pawn))
                {
                    quirks.AppendWithComma("Breeder");
                }
            }

            if (xxx.is_animal(pawn) || !xxx.has_traits(pawn) || Comp(pawn).orientation == Orientation.Asexual)
            {
                return;
            }

            // Adjusts generation frequency by player's footjob setting.
            if (Rand.Chance(0.05f * RJWPreferenceSettings.footjob))
            {
                quirks.AppendWithComma("Podophile");                 // Foot fetish
            }
            if (Rand.Chance(0.02f))
            {
                quirks.AppendWithComma("Teratophile");                 // Attraction to monsters/disfiguration
            }
            if (!pawn.story.traits.HasTrait(TraitDefOf.Nudist) && Rand.Chance(0.005f))
            {
                quirks.AppendWithComma("Endytophile");                 // Clothed sex
            }
            if (Rand.Chance(0.055f))
            {
                quirks.AppendWithComma("Exhibitionist");
            }

            if (Rand.Chance(0.015f))
            {
                quirks.AppendWithComma("Gerontophile");                 // Attraction to the elderly.
            }
            if (Rand.Chance(0.02f))
            {
                quirks.AppendWithComma("Somnophile");                 // Sleep sex
            }
            if (Rand.Chance(0.06f) && !xxx.is_bloodlust(pawn))
            {
                quirks.AppendWithComma("Sapiosexual");                 // Attraction to intelligence.
            }
            if (Rand.Chance(0.03f) && Comp(pawn).orientation != Orientation.Homosexual && Comp(pawn).orientation != Orientation.MostlyHomosexual)
            {
                quirks.AppendWithComma("Impregnation fetish");
            }

            if ((Genital_Helper.has_penis(pawn) && Rand.Chance(0.02f)) || Rand.Chance(0.003f))
            {
                quirks.AppendWithComma("Pregnancy fetish");
            }
        }