Ejemplo n.º 1
0
        private static float CalculateChance(SaveData.Heroine heroine, DialogInfo dialogInfo, int answer)
        {
            // ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault
            switch (dialogInfo.QuestionInfo.QuestionType)
            {
            case QuestionType.Likes:
                // memory + relationship at 23:1 ratio
                return(CalculateChance(heroine, dialogInfo.QuestionId, answer, 23, 1));

            case QuestionType.Personality:
                // memory + relationship at 1:1 ratio
                return(CalculateChance(heroine, dialogInfo.QuestionId, answer, 1, 1));

            case QuestionType.PhysicalAttributes:
                // memory + relationship + intelligence at 5:1:3 ratio + intimacy bonus
                return(CalculateChance(heroine, dialogInfo.QuestionId, answer, 5, 1, 3, heroine.intimacy / 1000f));


            case QuestionType.Invitation:
                // memory + relationship + intelligence at 1:3:5 ratio + bonus (because obvious)
                return(CalculateChance(heroine, dialogInfo.QuestionId, answer, 1, 3, 5, InvitationBonus));
            }

            return(0f);
        }
Ejemplo n.º 2
0
 private static void MakeHorny(SaveData.Heroine currentAdvGirl)
 {
     currentAdvGirl.hCount   = Mathf.Max(1, currentAdvGirl.hCount);
     currentAdvGirl.isVirgin = false;
     SetGirlHExp(currentAdvGirl, 100f);
     currentAdvGirl.lewdness = 100;
 }
Ejemplo n.º 3
0
            /// <summary>
            ///     Enable/disable pregnancy icon on quick status container
            /// </summary>
            /// <param name="characterImageObj">The heroine image object</param>
            /// <param name="heroine">Is the preg icon shown</param>
            /// <param name="xOffset">Offset from the character image</param>
            /// <param name="yOffset">Offset from the character image</param>
            private static void SetQuickStatusIcon(GameObject characterImageObj, SaveData.Heroine heroine, float xOffset, float yOffset)
            {
                var existing = characterImageObj.transform.Find(ICON_NAME);

                if (heroine == null)
                {
                    if (existing != null)
                    {
                        Destroy(existing.gameObject);
                    }
                }
                else
                {
                    if (existing == null)
                    {
                        var newChildIcon = new GameObject();
                        newChildIcon.AddComponent <RectTransform>();
                        newChildIcon.AddComponent <Image>();

                        var copy = Instantiate(newChildIcon, characterImageObj.transform);
                        copy.name = ICON_NAME;
                        copy.SetActive(true);

                        var charRt = characterImageObj.GetComponent <RectTransform>();
                        var rt     = copy.GetComponent <RectTransform>();
                        rt.anchoredPosition = new Vector2(charRt.anchoredPosition.x + xOffset, charRt.anchoredPosition.y + yOffset);
                        rt.sizeDelta        = new Vector2(48, 48);

                        existing = copy.transform;
                    }

                    AddPregIcon(existing, heroine);
                }
            }
Ejemplo n.º 4
0
 public void ProcessDialogAnswered(SaveData.Heroine heroine, DialogInfo dialogInfo)
 {
     if (heroine != null && dialogInfo != null)
     {
         heroine.Remember(dialogInfo.QuestionId, dialogInfo.SelectedAnswerId);
     }
 }
        /// <summary>
        /// Needed to apply new state to the copy of current character used outside of current scene.
        /// Must be called before the current scene exits. Can happen for Talk > Roaming, Talk > H, H > Roaming
        /// </summary>
        private static IEnumerator RefreshOnSceneChangeCo(SaveData.Heroine heroine, bool afterH)
        {
            // Store reference to the character copy used in current scene
            var previousControl = heroine.chaCtrl;

            // Wait until we switch from temporary character copy to the character used in the next scene
            yield return(new WaitUntil(() => heroine.chaCtrl != previousControl && heroine.chaCtrl != null));

            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            // Apply the stored state from h scene
            var controller = heroine.chaCtrl.GetComponent <SkinEffectsController>();

            ApplyPersistData(controller);

            if (afterH)
            {
                // Make the girl want to take a shower after H. Index 2 is shower
                var actCtrl = Game.Instance?.actScene?.actCtrl;
                actCtrl?.SetDesire(2, heroine, 200);

                // Slowly remove sweat effect ("cool down")
                // todo make this universal? add sweating when running for a while or lots of touching in talk mode?
                while (controller.SweatLevel > 0)
                {
                    yield return(new WaitForSeconds(60));

                    controller.SweatLevel--;
                }
            }
        }
Ejemplo n.º 6
0
            public static void GetHExperiencePost(SaveData.Heroine __instance, ref SaveData.Heroine.HExperienceKind __result)
            {
                if (__result == SaveData.Heroine.HExperienceKind.慣れ)
                {
                    float caressBreasts = __instance.hAreaExps[1];
                    float caressVagina  = __instance.hAreaExps[2];
                    float caressAnus    = __instance.hAreaExps[3];
                    float caressButt    = __instance.hAreaExps[4];
                    float caressNipple  = __instance.hAreaExps[5];
                    float service       = __instance.houshiExp;
                    float pistonVagina  = __instance.countKokanH;
                    float pistonAnus    = __instance.countAnalH;

                    if (caressBreasts >= 100f && caressButt >= 100f && caressNipple >= 100f && service >= 100f)
                    {
                        if ((caressVagina >= 100f && pistonVagina >= 100f) || (caressAnus >= 100f && pistonAnus >= 100f))
                        {
                            if (__instance.lewdness >= 100)
                            {
                                __result = SaveData.Heroine.HExperienceKind.淫乱;
                            }
                            else
                            {
                                __result = SaveData.Heroine.HExperienceKind.慣れ;
                            }
                        }
                    }
                }
            }
            /// <summary>
            ///     Enable/disable pregnancy icon
            /// </summary>
            /// <param name="heartObj">The lovers icon object</param>
            /// <param name="heroine">Is the preg icon shown</param>
            /// <param name="xOffset">Offset from the lovers icon</param>
            private static void SetHeart(GameObject heartObj, SaveData.Heroine heroine, float xOffset)
            {
                var owner    = heartObj.transform.parent;
                var existing = owner.Find(ICON_NAME);

                if (heroine == null)
                {
                    if (existing != null)
                    {
                        Destroy(existing.gameObject);
                    }
                }
                else
                {
                    if (existing == null)
                    {
                        var copy = Instantiate(heartObj, owner);
                        copy.name = ICON_NAME;
                        copy.SetActive(true);

                        var rt = copy.GetComponent <RectTransform>();
                        rt.anchoredPosition = new Vector2(rt.anchoredPosition.x + xOffset, rt.anchoredPosition.y);
                        rt.sizeDelta        = new Vector2(48, 48);

                        existing = copy.transform;
                    }

                    AddPregIcon(existing, heroine);
                }
            }
            private static void AddPregIcon(Transform pregIconTransform, SaveData.Heroine heroine)
            {
                var image = pregIconTransform.GetComponent <Image>();

                _currentHeroine.Add(new KeyValuePair <SaveData.Heroine, RectTransform>(heroine, image.GetComponent <RectTransform>()));

                switch (heroine.GetHeroineStatus(heroine.GetPregnancyData()))
                {
                case HeroineStatus.Unknown:
                    image.sprite = _unknownSprite;
                    break;

                case HeroineStatus.OnLeave:
                    image.sprite = _leaveSprite;
                    break;

                case HeroineStatus.Safe:
                    image.sprite = _safeSprite;
                    break;

                case HeroineStatus.Risky:
                    image.sprite = _riskySprite;
                    break;

                case HeroineStatus.Pregnant:
                    image.sprite = _pregSprite;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
Ejemplo n.º 9
0
        public static List <SaveData.Heroine> LoadHeroines(string assetBundlePath)
        {
            var heroines = new Dictionary <int, TextAsset>();

            foreach (var assetBundleName in GetAssetBundleNameListFromPath(assetBundlePath))
            {
                foreach (var assetName in GetAssetNamesFromBundle(assetBundleName).Where(a => a.EndsWith(".bytes")))
                {
                    var textAsset = ManualLoadAsset <TextAsset>(assetBundleName, assetName, null);
                    if (textAsset == null)
                    {
                        continue;
                    }

                    if (int.TryParse(textAsset.name.Replace("c", string.Empty), out var id))
                    {
                        heroines[id] = textAsset;
                    }
                }
            }

            return(heroines.Select(h =>
            {
                var heroine = new SaveData.Heroine(false);
                Game.LoadFromTextAsset(h.Key, heroine, h.Value);
                return heroine;
            }).ToList());
        }
Ejemplo n.º 10
0
 private static void MakeExperienced(SaveData.Heroine currentAdvGirl)
 {
     currentAdvGirl.hCount   = Mathf.Max(1, currentAdvGirl.hCount);
     currentAdvGirl.isVirgin = false;
     SetGirlHExp(currentAdvGirl, 100f);
     currentAdvGirl.lewdness = Mathf.Min(99, currentAdvGirl.lewdness);
 }
Ejemplo n.º 11
0
            internal static void MapSameObjectDisableVR(object __instance)
            {
                HFlag flags = (HFlag)Traverse.Create(__instance).Field("flags").GetValue();

                SaveData.Heroine heroine = flags.lstHeroine[0];
                GetController(heroine.chaCtrl).HSceneStart(heroine.isVirgin && heroine.isAnalVirgin);
            }
Ejemplo n.º 12
0
 private static void MakeInexperienced(SaveData.Heroine currentAdvGirl)
 {
     currentAdvGirl.hCount      = Mathf.Max(1, currentAdvGirl.hCount);
     currentAdvGirl.isVirgin    = false;
     currentAdvGirl.countKokanH = 50;
     SetGirlHExp(currentAdvGirl, 0);
 }
        private static IEnumerator AfterHCo(SaveData.Heroine heroine, ChaControl previousControl)
        {
            // Wait until we switch from h scene to map characters
            yield return(new WaitUntil(() => heroine.chaCtrl != previousControl && heroine.chaCtrl != null));

            yield return(new WaitForEndOfFrame());

            // Make the girl want to take a shower after H. Index 2 is shower
            var actCtrl = Game.Instance?.actScene?.actCtrl;

            actCtrl?.SetDesire(2, heroine, 200);

            // Apply the stored state from h scene
            var controller = heroine.chaCtrl.GetComponent <SkinEffectsController>();

            ApplyPersistData(controller);

            // Slowly remove sweat effect ("cool down")
            while (controller.SweatLevel > 0)
            {
                yield return(new WaitForSeconds(60));

                controller.SweatLevel--;
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Get ChaFiles that are related to this heroine. Warning: It might not return some copies.
        /// </summary>
        public static IEnumerable <ChaFileControl> GetRelatedChaFiles(this SaveData.Heroine heroine)
        {
            if (heroine == null)
            {
                throw new ArgumentNullException(nameof(heroine));
            }

            var results = new HashSet <ChaFileControl>();

            if (heroine.charFile != null)
            {
                results.Add(heroine.charFile);
            }

            if (heroine.chaCtrl != null && heroine.chaCtrl.chaFile != null)
            {
                results.Add(heroine.chaCtrl.chaFile);
            }

            var npc = heroine.GetNPC();

            if (npc != null && npc.chaCtrl != null && npc.chaCtrl.chaFile != null)
            {
                results.Add(npc.chaCtrl.chaFile);
            }

            return(results);
        }
        public static void GetHExperiencePost(SaveData.Heroine __instance, ref SaveData.Heroine.HExperienceKind __result)
        {
            if (__result == SaveData.Heroine.HExperienceKind.慣れ)  // inexperienced
            {
                float caressBreasts = __instance.hAreaExps[1];
                float caressVagina  = __instance.hAreaExps[2];
                float caressAnus    = __instance.hAreaExps[3];
                float caressButt    = __instance.hAreaExps[4];
                float caressNipple  = __instance.hAreaExps[5];
                float service       = __instance.houshiExp;
                float pistonVagina  = __instance.countKokanH;
                float pistonAnus    = __instance.countAnalH;

                const int threshold = 99; // 100 is default
                if (caressBreasts >= threshold && caressButt >= threshold && caressNipple >= threshold && service >= threshold)
                {
                    if ((caressVagina >= threshold && pistonVagina >= threshold) || (caressAnus >= threshold && pistonAnus >= threshold))
                    {
                        __result = __instance.lewdness >= threshold
                            ? SaveData.Heroine.HExperienceKind.淫乱  // lewd
                            : SaveData.Heroine.HExperienceKind.慣れ; // experienced
                    }
                }
            }
        }
Ejemplo n.º 16
0
 public static void ApplyTempPreggers(SaveData.Heroine heroine)
 {
     if (_tempPreggers.Add(heroine))
     {
         LewdCrestXPlugin.Logger.LogInfo("Triggering temporary pregnancy because of breedgasm crest: " + heroine.charFile?.parameter?.fullname);
     }
 }
Ejemplo n.º 17
0
 private float AdvanceAndGetActionCooldown(SaveData.Heroine heroine)
 {
     _actionCooldowns.TryGetValue(heroine, out var timeLeft);
     timeLeft = Mathf.Max(0, timeLeft - Time.deltaTime);
     _actionCooldowns[heroine] = timeLeft;
     return(timeLeft);
 }
Ejemplo n.º 18
0
 private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
 {
     if (_supportedSceneNames.Contains(arg0.name))
     {
         CurrentlyEnabled = true;
         _targetHeroine   = null;
     }
 }
Ejemplo n.º 19
0
        public static float CurrentRecallChance(this SaveData.Heroine heroine, int question, int answer)
        {
            var result = 0f;

            heroine.SafeProc(h => h.chaCtrl.SafeProcObject(cc =>
                                                           result = cc.CurrentRecallChance(question, answer)));
            return(result);
        }
Ejemplo n.º 20
0
        public static ulong TimesAnswerSelected(this SaveData.Heroine heroine, int question, int answer)
        {
            ulong result = 0;

            heroine.SafeProc(h => h.chaCtrl.SafeProcObject(cc =>
                                                           result = cc.TimesAnswerSelected(question, answer)));
            return(result);
        }
Ejemplo n.º 21
0
        public static bool CanRecallAnswer(this SaveData.Heroine heroine, int question, int answer)
        {
            var result = false;

            heroine.SafeProc(h => h.chaCtrl.SafeProcObject(cc =>
                                                           result = cc.CanRecallAnswer(question, answer)));
            return(result);
        }
Ejemplo n.º 22
0
 public void ProcessDialogAnswered(SaveData.Heroine heroine, DialogInfo dialogInfo, bool isCorrect)
 {
     if (heroine == null || dialogInfo == null)
     {
         return;
     }
     heroine.Remember(dialogInfo.QuestionId, dialogInfo.SelectedAnswerId, isCorrect);
 }
Ejemplo n.º 23
0
 private void SceneManager_sceneUnloaded(Scene arg0)
 {
     if (_supportedSceneNames.Contains(arg0.name))
     {
         CurrentlyEnabled = false;
         _targetHeroine   = null;
     }
 }
Ejemplo n.º 24
0
 public HsceneHeroineInfo(SaveData.Heroine heroine)
 {
     Heroine = heroine;
     if (heroine != null)
     {
         Controller = heroine.GetCrestController();
     }
 }
            public HeroineData(SaveData.Heroine heroine)
            {
                Heroine    = heroine;
                Controller = heroine.GetCrestController();

                _heroineName = Heroine.parameter.fullname;
                TranslationHelper.TranslateAsync(_heroineName, s => _heroineName = s);
            }
Ejemplo n.º 26
0
        private float GetRecordedGuessChance(SaveData.Heroine heroine, int questionId, int answerId)
        {
            var key    = new HeroineQuestionKey(heroine, questionId);
            var result = key == _lastGuessKey && _lastGuessChance.TryGetValue(answerId, out var tmp)
                ? tmp
                : float.Epsilon;

            return(result);
        }
Ejemplo n.º 27
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)));
        }
Ejemplo n.º 28
0
        private static void MakeGirlAngry(SaveData.Heroine heroine)
        {
            heroine.anger = Math.Min(100, heroine.anger + 15);
            heroine.favor = Math.Max(0, heroine.favor - 10);

            heroine.chaCtrl.tearsLv = 1;
            heroine.chaCtrl.ChangeEyesShaking(true);
            heroine.chaCtrl.ChangeLookEyesTarget(2);
            heroine.chaCtrl.ChangeTongueState(0);
        }
Ejemplo n.º 29
0
 private void SceneManager_sceneUnloaded(Scene arg0)
 {
     if (!_supportedSceneNames.Contains(arg0.name))
     {
         return;
     }
     _targetHeroine.SafeProc(h => h.PersistData());
     CurrentlyEnabled = false;
     _targetHeroine   = null;
 }
Ejemplo n.º 30
0
        public static int GetCoordinateType(this SaveData.Heroine heroine)
        {
            var result = -1;

            heroine.SafeProc(h => h.chaCtrl.SafeProc(
                                 cc => cc.chaFile.SafeProc(
                                     cf => cf.status.SafeProc(
                                         s => result = s.coordinateType))));
            return(result);
        }