예제 #1
0
        public static bool Prefix(Pawn pawn, Pawn partner) // partner has v****a
        {
            if (partner.IsAnimal() && !Configurations.EnableAnimalCycle)
            {
                return(true);
            }
            HediffComp_Menstruation comp = partner.GetMenstruationComp();

            if (comp != null)
            {
                if (AndroidsCompatibility.IsAndroid(pawn) && !AndroidsCompatibility.AndroidPenisFertility(pawn))
                {
                    comp.CumIn(pawn, pawn.GetCumVolume(), 0);
                    return(false);
                }
                else
                {
                    comp.CumIn(pawn, pawn.GetCumVolume(), pawn.health.capacities.GetLevel(xxx.reproduction));
                }
                return(false);
            }
            ModLog.Message("used original rjw method: Comp missing");
            return(true);
        }
예제 #2
0
        /// <summary>
        /// Decide pawnkind from mother and father <para/>
        /// Come from RJW
        /// </summary>
        /// <param name="mother"></param>
        /// <param name="father"></param>
        /// <returns></returns>
        public PawnKindDef BabyPawnKindDecider(Pawn mother, Pawn father)
        {
            PawnKindDef spawn_kind_def = mother.kindDef;

            int flag = 0;

            if (xxx.is_human(mother))
            {
                flag += 2;
            }
            if (xxx.is_human(father))
            {
                flag += 1;
            }
            //Mother - Father = Flag
            //Human  - Human  =  3
            //Human  - Animal =  2
            //Animal - Human  =  1
            //Animal - Animal =  0

            switch (flag)
            {
            case 3:
                if (!Rand.Chance(RJWPregnancySettings.humanlike_DNA_from_mother))
                {
                    spawn_kind_def = father.kindDef;
                }
                break;

            case 2:
                if (RJWPregnancySettings.bestiality_DNA_inheritance == 0f)
                {
                    spawn_kind_def = father.kindDef;
                }
                else if (!Rand.Chance(RJWPregnancySettings.bestial_DNA_from_mother))
                {
                    spawn_kind_def = father.kindDef;
                }
                break;

            case 1:
                if (RJWPregnancySettings.bestiality_DNA_inheritance == 1f)
                {
                    spawn_kind_def = father.kindDef;
                }
                else if (!Rand.Chance(RJWPregnancySettings.bestial_DNA_from_mother))
                {
                    spawn_kind_def = father.kindDef;
                }
                break;

            case 0:
                if (!Rand.Chance(RJWPregnancySettings.bestial_DNA_from_mother))
                {
                    spawn_kind_def = father.kindDef;
                }
                break;
            }

            bool IsAndroidmother = AndroidsCompatibility.IsAndroid(mother);
            bool IsAndroidfather = AndroidsCompatibility.IsAndroid(father);

            if (IsAndroidmother && !IsAndroidfather)
            {
                spawn_kind_def = father.kindDef;
            }
            else if (!IsAndroidmother && IsAndroidfather)
            {
                spawn_kind_def = mother.kindDef;
            }

            string MotherRaceName = "";
            string FatherRaceName = "";

            MotherRaceName = mother.kindDef?.race?.defName;
            PawnKindDef tmp = spawn_kind_def;

            if (father != null)
            {
                FatherRaceName = father.kindDef?.race?.defName;
            }


            if (FatherRaceName != "" && Configurations.UseHybridExtention)
            {
                spawn_kind_def = GetHybrid(father, mother);
                //Log.Message("pawnkind: " + spawn_kind_def?.defName);
            }

            if (MotherRaceName != FatherRaceName && FatherRaceName != "")
            {
                if (!Configurations.UseHybridExtention || spawn_kind_def == null)
                {
                    spawn_kind_def = tmp;
                    var groups = DefDatabase <RaceGroupDef> .AllDefs.Where(x => !(x.hybridRaceParents.NullOrEmpty() || x.hybridChildKindDef.NullOrEmpty()));


                    //ModLog.Message(" found custom RaceGroupDefs " + groups.Count());
                    foreach (var t in groups)
                    {
                        if ((t.hybridRaceParents.Contains(MotherRaceName) && t.hybridRaceParents.Contains(FatherRaceName)) ||
                            (t.hybridRaceParents.Contains("Any") && (t.hybridRaceParents.Contains(MotherRaceName) || t.hybridRaceParents.Contains(FatherRaceName))))
                        {
                            //ModLog.Message(" has hybridRaceParents");
                            if (t.hybridChildKindDef.Contains("MotherKindDef"))
                            {
                                spawn_kind_def = mother.kindDef;
                            }
                            else if (t.hybridChildKindDef.Contains("FatherKindDef") && father != null)
                            {
                                spawn_kind_def = father.kindDef;
                            }
                            else
                            {
                                //ModLog.Message(" trying hybridChildKindDef " + t.defName);
                                var child_kind_def_list = new List <PawnKindDef>();
                                child_kind_def_list.AddRange(DefDatabase <PawnKindDef> .AllDefs.Where(x => t.hybridChildKindDef.Contains(x.defName)));

                                //ModLog.Message(" found custom hybridChildKindDefs " + t.hybridChildKindDef.Count);
                                if (!child_kind_def_list.NullOrEmpty())
                                {
                                    spawn_kind_def = child_kind_def_list.RandomElement();
                                }
                            }
                        }
                    }
                }
            }
            else if (!Configurations.UseHybridExtention || spawn_kind_def == null)
            {
                spawn_kind_def = mother.RaceProps?.AnyPawnKind ?? mother.kindDef;
            }

            if (spawn_kind_def.defName.Contains("Nymph"))
            {
                //child is nymph, try to find other PawnKindDef
                var spawn_kind_def_list = new List <PawnKindDef>();
                spawn_kind_def_list.AddRange(DefDatabase <PawnKindDef> .AllDefs.Where(x => x.race == spawn_kind_def.race && !x.defName.Contains("Nymph")));
                //no other PawnKindDef found try mother
                if (spawn_kind_def_list.NullOrEmpty())
                {
                    spawn_kind_def_list.AddRange(DefDatabase <PawnKindDef> .AllDefs.Where(x => x.race == mother.kindDef.race && !x.defName.Contains("Nymph")));
                }
                //no other PawnKindDef found try father
                if (spawn_kind_def_list.NullOrEmpty() && father != null)
                {
                    spawn_kind_def_list.AddRange(DefDatabase <PawnKindDef> .AllDefs.Where(x => x.race == father.kindDef.race && !x.defName.Contains("Nymph")));
                }
                //no other PawnKindDef found fallback to generic colonist
                if (spawn_kind_def_list.NullOrEmpty())
                {
                    spawn_kind_def = PawnKindDefOf.Colonist;
                }

                if (!spawn_kind_def_list.NullOrEmpty())
                {
                    spawn_kind_def = spawn_kind_def_list.RandomElement();
                }
            }



            return(spawn_kind_def);
        }