Beispiel #1
0
        /// <param name="heroine">Heroine to test</param>
        /// <param name="afterWasDiscovered">The girl knows about it / tested it</param>
        public static bool IsHeroinePregnant(this SaveData.Heroine heroine, bool afterWasDiscovered)
        {
            if (heroine == null)
            {
                return(false);
            }

            return(heroine.GetRelatedChaFiles().Any(control => IsChaFilePregnant(control, afterWasDiscovered)));
        }
            private static void GetMenstruationOverridePrefix()
            {
                if (_lastHeroine != null)
                {
                    // Get a schedule directly this way since the controller is not spawned in class roster
                    var schedule = _lastHeroine.GetRelatedChaFiles()
                                   .Select(c => PregnancyData.Load(ExtendedSave.GetExtendedDataById(c, GUID))?.MenstruationSchedule ?? MenstruationSchedule.Default)
                                   .FirstOrDefault(x => x != MenstruationSchedule.Default);

                    _menstruationsBackup = HFlag.menstruations;
                    HFlag.menstruations  = PregnancyCharaController.GetMenstruationsArr(schedule);
                }
            }
            private static bool CanGetSpawned(SaveData.Heroine heroine)
            {
                var isOnLeave = heroine.GetRelatedChaFiles()
                                .Any(c =>
                {
                    var pd = PregnancyData.Load(ExtendedSave.GetExtendedDataById(heroine.charFile, GUID));
                    if (pd == null)
                    {
                        return(false);
                    }
                    return(pd.GameplayEnabled && pd.Week >= PregnancyData.LeaveSchoolWeek);
                });

                return(!isOnLeave);
            }
        /// <param name="heroine">Heroine to test</param>
        ///// <param name="afterWasDiscovered">The girl knows about it / tested it</param>
        public static PregnancyData GetPregnancyData(this SaveData.Heroine heroine)
        {
            if (heroine == null)
            {
                return(new PregnancyData());
            }

            // Figure out which data to take if there are multiple
            // probably not necessary? null check should be enough?
            return(heroine.GetRelatedChaFiles()
                   .Select(GetPregnancyData)
                   .Where(x => x != null)
                   .OrderByDescending(x => x.PregnancyCount)
                   .ThenByDescending(x => x.WeeksSinceLastPregnancy)
                   .ThenByDescending(x => x.Week)
                   .ThenByDescending(x => x.MenstruationSchedule)
                   .ThenByDescending(x => x.GameplayEnabled)
                   .FirstOrDefault() ?? new PregnancyData());
        }
            private static void GetMenstruationOverridePrefix()
            {
                if (_lastHeroine != null)
                {
                    // Get a schedule directly this way since the controller is not spawned in class roster
                    var schedule = _lastHeroine.GetRelatedChaFiles().Select(control =>
                    {
                        var d = ExtendedSave.GetExtendedDataById(control, GUID);
                        if (d == null)
                        {
                            return(PregnancyDataUtils.MenstruationSchedule.Default);
                        }
                        PregnancyDataUtils.DeserializeData(d, out _, out _, out _, out var s);
                        return(s);
                    }).FirstOrDefault(x => x != PregnancyDataUtils.MenstruationSchedule.Default);

                    _menstruationsBackup = HFlag.menstruations;
                    HFlag.menstruations  = PregnancyCharaController.GetMenstruationsArr(schedule);
                }
            }
            private static bool CanGetSpawned(SaveData.Heroine heroine)
            {
                var isOnLeave = heroine.GetRelatedChaFiles()
                                .Any(c =>
                {
                    var data = ExtendedSave.GetExtendedDataById(heroine.charFile, GUID);

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

                    PregnancyDataUtils.DeserializeData(data, out var week, out var gameplayEnabled, out _, out _);
                    if (gameplayEnabled && week >= PregnancyDataUtils.LeaveSchoolWeek)
                    {
                        return(true);
                    }

                    return(false);
                });

                return(!isOnLeave);
            }
Beispiel #7
0
 private static bool IsATrap(SaveData.Heroine heroine)
 {
     return(heroine.GetRelatedChaFiles().Any(IsATrap));
 }