Ejemplo n.º 1
0
        public static Pregnancy Start(Sim woman, SimDescription man, bool handlePlantSim)
        {
            if (handlePlantSim)
            {
                if ((SimTypes.IsSelectable(woman)) || (SimTypes.IsSelectable(man)))
                {
                    if (woman.SimDescription.IsPlantSim || man.IsPlantSim)
                    {
                        IGameObject obj2 = GlobalFunctions.CreateObjectOutOfWorld("forbiddenFruit", ProductVersion.EP9, "Sims3.Gameplay.Objects.Gardening.ForbiddenFruit", null);
                        if (obj2 != null)
                        {
                            Inventories.TryToMove(obj2, woman);
                            Audio.StartSound("sting_baby_conception");
                        }

                        return(null);
                    }
                }
            }

            AgingManager.Singleton.CancelAgingAlarmsForSim(woman.SimDescription.AgingState);
            Pregnancy p = null;

            if (woman.IsHuman)
            {
                p = new Pregnancy(woman, man);
            }
            else
            {
                p = new PetPregnancy(woman, man);
            }

            p.PreggersAlarm = woman.AddAlarmRepeating(1f, TimeUnit.Hours, p.HourlyCallback, 1f, TimeUnit.Hours, "Hourly Pregnancy Update Alarm", AlarmType.AlwaysPersisted);
            woman.SimDescription.Pregnancy = p;

            EventTracker.SendEvent(new PregnancyEvent(EventTypeId.kGotPregnant, woman, man.CreatedSim, p, null));
            return(p);
        }
Ejemplo n.º 2
0
        public static bool CanHaveRomanceWith(Logger log, SimDescription ths, SimDescription other, bool testAge, bool allowAdultTeen, bool testRelation, bool thoroughCheck)
        {
            if (!SimTypes.IsEquivalentSpecies(ths, other))
            {
                if (log != null)
                {
                    log("Species Mismatch");
                }
                return(false);
            }

            bool flag = false;

            if (!testAge)
            {
                flag = true;
            }
            else
            {
                switch (ths.Age)
                {
                case CASAgeGenderFlags.Adult:
                case CASAgeGenderFlags.Elder:
                case CASAgeGenderFlags.YoungAdult:
                    if (other.YoungAdultOrAbove)
                    {
                        flag = true;
                    }
                    else if (allowAdultTeen)
                    {
                        if (other.Teen)
                        {
                            flag = true;
                        }
                    }
                    break;

                case CASAgeGenderFlags.Teen:
                    if (allowAdultTeen)
                    {
                        if (other.TeenOrAbove)
                        {
                            flag = true;
                        }
                    }
                    else
                    {
                        if (other.Teen)
                        {
                            flag = true;
                        }
                    }
                    break;
                }
            }

            if (!flag)
            {
                if (log != null)
                {
                    log("Age Mismatch: " + ths.Age + " - " + other.Age);
                }
                return(false);
            }

            if ((testRelation) && (IsCloselyRelated(ths.Genealogy, other.Genealogy, thoroughCheck)))
            {
                if (log != null)
                {
                    log("IsCloselyRelated");
                }
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        public static bool CopyGenetics(SimDescriptionCore source, SimDescriptionCore destination, bool onlyNonZero, bool onlySliders)
        {
            SimOutfit sourceOutfit = CASParts.GetOutfit(source, CASParts.sPrimary, false);

            if (sourceOutfit == null)
            {
                return(false);
            }

            SimOutfit sourceWerewolfOutfit = CASParts.GetOutfit(source, new CASParts.Key(OutfitCategories.Supernatural, 0), false);

            SimDescription sourceDesc = source as SimDescription;
            SimDescription destDesc   = destination as SimDescription;

            if ((!onlySliders) && (!SimTypes.IsSkinJob(sourceDesc)) && (!SimTypes.IsSkinJob(destDesc)))
            {
                destDesc.SkinToneKey   = sourceDesc.SkinToneKey;
                destDesc.SkinToneIndex = sourceDesc.SkinToneIndex;
            }

            destDesc.SecondaryNormalMapWeights = sourceDesc.SecondaryNormalMapWeights.Clone() as float[];

            using (SimBuilder sourceBuilder = new SimBuilder())
            {
                OutfitUtils.SetOutfit(sourceBuilder, sourceOutfit, source);

                using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(destination, CASParts.sPrimary))
                {
                    if (!builder.OutfitValid)
                    {
                        return(false);
                    }

                    if ((!onlySliders) && (destDesc != null))
                    {
                        builder.Builder.SkinTone      = destDesc.SkinToneKey;
                        builder.Builder.SkinToneIndex = destDesc.SkinToneIndex;
                    }

                    foreach (FacialBlend blend in FaceBlends)
                    {
                        float amount = GetBlendAmount(sourceBuilder, blend);

                        if (onlyNonZero)
                        {
                            if (amount == 0.0)
                            {
                                continue;
                            }
                        }

                        SetBlendAmount(builder.Builder, blend, amount);
                    }

                    foreach (FacialBlend blend in FurBlends)
                    {
                        float amount = GetBlendAmount(sourceBuilder, blend);

                        if (onlyNonZero)
                        {
                            if (amount == 0.0)
                            {
                                continue;
                            }
                        }

                        SetBlendAmount(builder.Builder, blend, amount);
                    }

                    if (!onlySliders)
                    {
                        builder.CopyGeneticParts(sourceOutfit);
                    }
                }

                sourceBuilder.Clear();

                if ((sourceWerewolfOutfit != null) && (destDesc.IsWerewolf))
                {
                    OutfitUtils.SetOutfit(sourceBuilder, sourceWerewolfOutfit, source);

                    using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(destination, new CASParts.Key(OutfitCategories.Supernatural, 0)))
                    {
                        if ((!onlySliders) && (destDesc != null))
                        {
                            builder.Builder.SkinTone      = destDesc.SkinToneKey;
                            builder.Builder.SkinToneIndex = destDesc.SkinToneIndex;
                        }

                        foreach (FacialBlend blend in FaceBlends)
                        {
                            float amount = GetBlendAmount(sourceBuilder, blend);

                            if (onlyNonZero)
                            {
                                if (amount == 0.0)
                                {
                                    continue;
                                }
                            }

                            SetBlendAmount(builder.Builder, blend, amount);
                        }

                        builder.Components = CASLogic.sWerewolfPreserveComponents;
                    }
                }
            }

            return(true);
        }