Esempio n. 1
0
        private bool CanShow()
        {
            if (_chaCtrl == null)
            {
                return(false);
            }
            if (!_chaCtrl.visibleAll)
            {
                return(false);
            }

            if (MakerAPI.InsideMaker && !MakerAPI.IsInterfaceVisible())
            {
                return(false);
            }

            if (SceneApi.GetAddSceneName() == "Config")
            {
                return(false);
            }
            if (SceneApi.GetIsOverlap())
            {
                return(false);
            }
            if (SceneApi.GetIsNowLoadingFade())
            {
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        private void Update()
        {
            if (_hSceneHeroines != null)
            {
                if (SceneApi.GetIsNowLoadingFade())
                {
                    return;
                }

                var speed = _hFlag.IsSonyu() && _hFlag.speedCalc > 0.7f
                    ? (_hFlag.speedCalc - 0.7f) * 3.3f
                    : (_hFlag.speedItem > 1.4f ? 0.33f : 0);
                if (speed > 0)
                {
                    var id          = _hFlag.GetLeadingHeroineId();
                    var heroineInfo = _hSceneHeroines[id];
                    heroineInfo.TotalRoughTime += Time.deltaTime;

                    if (heroineInfo.CrestType == CrestType.suffer && !_hFlag.lockGugeFemale)
                    {
                        _hFlag.gaugeFemale += speed * Time.deltaTime * 2;
                    }
                }
            }
            else if (_existingControllers != null)
            {
                for (var i = 0; i < _existingControllers.Count; i++)
                {
                    var controller = _existingControllers[i];
                    if (controller.CurrentCrest == CrestType.mantraction)
                    {
                        if (SceneApi.GetIsNowLoadingFade())
                        {
                            return;
                        }

                        var actScene = GetActionScene();
                        if (actScene == null)
                        {
                            return;
                        }
                        var player = actScene.Player;
                        if (player == null)
                        {
                            continue;
                        }

                        // Stop the crest from activating outsied of when player runs around
                        // needed because if the code below activates during an adv scene or some other inopportune times it will softlock the game
                        if (player.isActionNow)
                        {
                            return;
                        }
#if KKS
                        if (Game.IsRegulate(true))
                        {
                            return;
                        }
                        if (actScene.regulate != 0 || (actScene.AdvScene != null && actScene.AdvScene.gameObject.activeSelf) || TalkScene.isPaly)
                        {
                            return;
                        }
#elif KK
                        if (Game.instance.IsRegulate(true))
                        {
                            return;
                        }
#endif

                        var heroine = controller.Heroine;
                        if (heroine == null)
                        {
                            continue;
                        }

                        var npc = heroine.GetNPC();
                        if (player.mapNo == npc.mapNo)
                        {
                            var cooldownTimeLeft = AdvanceAndGetActionCooldown(heroine);
                            if (cooldownTimeLeft <= 0)
                            {
                                if (Vector3.Distance(player.position, npc.position) > 3)
                                {
                                    LewdCrestXPlugin.Logger.LogInfo("Chasing player because of mantraction crest: " + controller.Heroine.charFile?.parameter?.fullname);
                                    npc.ItemClear();
                                    npc.AI.ChaseAction();
                                    // Need to replace this from the default chase id because that disables the talk to bubble
                                    // This action is triggered when character approaches player
                                    // 28 - wanting to talk to player. If too annoying might want to replace with actions in range 10 - 16, maybe randomized
                                    npc.AI.actResult.value.actionNo = 28;

                                    SetActionCooldown(heroine, 10);
                                }
                            }
                        }
                    }
                }
            }
        }