Exemple #1
0
        public void ClearCheck(Run run, RunReport runReport)
        {
            if (run is null)
            {
                return;
            }
            if (runReport is null)
            {
                return;
            }

            if (!runReport.gameEnding)
            {
                return;
            }

            if (runReport.gameEnding.isWin)
            {
                DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(runReport.ruleBook.FindDifficulty());

                if (difficultyDef != null && difficultyDef.countsAsHardMode)
                {
                    if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "limbo")
                    {
                        if (base.meetsBodyRequirement)
                        {
                            Debug.Log("Is this working?");
                            base.Grant();
                        }
                    }
                }
            }
        }
Exemple #2
0
        private static RuleDef InitialiseRuleBookAndFinalizeList(On.RoR2.RuleDef.orig_FromDifficulty orig)
        {
            RuleDef ruleChoices = orig();
            var     vanillaDefs = typeof(DifficultyCatalog).GetFieldValue <DifficultyDef[]>("difficultyDefs");

            if (difficultyAlreadyAdded == false)  //Technically this function we are hooking is only called once, but in the weird case it's called multiple times, we don't want to add the definitions again.
            {
                difficultyAlreadyAdded = true;
                for (int i = 0; i < vanillaDefs.Length; i++)
                {
                    difficultyDefinitions.Insert(i, vanillaDefs[i]);
                }
            }

            for (int i = vanillaDefs.Length; i < difficultyDefinitions.Count; i++)  //This basically replicates what the orig does, but that uses the hardcoded enum.Count to end it's loop, instead of the actual array length.
            {
                DifficultyDef difficultyDef = difficultyDefinitions[i];
                RuleChoiceDef choice        = ruleChoices.AddChoice(Language.GetString(difficultyDef.nameToken), null, false);
                choice.spritePath       = difficultyDef.iconPath;
                choice.tooltipNameToken = difficultyDef.nameToken;
                choice.tooltipNameColor = difficultyDef.color;
                choice.tooltipBodyToken = difficultyDef.descriptionToken;
                choice.difficultyIndex  = (DifficultyIndex)i;
            }

            ruleChoices.choices.Sort(delegate(RuleChoiceDef x, RuleChoiceDef y) {
                var xDiffValue = DifficultyCatalog.GetDifficultyDef(x.difficultyIndex).scalingValue;
                var yDiffValue = DifficultyCatalog.GetDifficultyDef(y.difficultyIndex).scalingValue;
                return(xDiffValue.CompareTo(yDiffValue));
            });

            return(ruleChoices);
        }
Exemple #3
0
        public void ClearCheck(Run run, RunReport runReport)
        {
            if (run is null)
            {
                return;
            }
            if (runReport is null)
            {
                return;
            }

            if (!runReport.gameEnding)
            {
                return;
            }

            if (runReport.gameEnding.isWin)
            {
                DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(runReport.ruleBook.FindDifficulty());

                if (difficultyDef != null && difficultyDef.nameToken == "DIFFICULTY_TYPHOON_NAME")
                {
                    if (base.meetsBodyRequirement)
                    {
                        base.Grant();
                    }
                }
            }
        }
Exemple #4
0
        public void ClearCheck(Run run, RunReport runReport)
        {
            if (run is null)
            {
                return;
            }
            if (runReport is null)
            {
                return;
            }

            if (!runReport.gameEnding)
            {
                return;
            }

            if (runReport.gameEnding.isWin)
            {
                DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(runReport.ruleBook.FindDifficulty());

                if (difficultyDef != null && difficultyDef.countsAsHardMode)
                {
                    if (base.meetsBodyRequirement)
                    {
                        base.Grant();
                    }
                }
            }
        }
        private void InitConfig()
        {
            List <float> configList = new List <float>();

            for (DifficultyIndex i = DifficultyIndex.Easy; i < DifficultyIndex.Count; i++)
            {
                var difficulty = DifficultyCatalog.GetDifficultyDef(i);
                name = Language.GetString(difficulty.nameToken, "EN_US");
                float        multiplier;
                const string catagorie = "DifficultyCoinMultipliers";
                if (i == DifficultyIndex.Easy)
                {
                    configfloat(catagorie, name, 0.5f, out multiplier);
                }
                else if (i == DifficultyIndex.Hard)
                {
                    configfloat(catagorie, name, 2f, out multiplier);
                }
                else
                {
                    configfloat(catagorie, name, 1f, out multiplier);
                }

                configList.Insert((int)i, multiplier);
            }
            difconfigs = configList.ToArray();
        }
            static float GetDifficultyMultiplier(Run run)
            {
                List <float> functionValues = Util.GetDifficultyParabola(easyMultiplier, normalMultiplier, hardMultiplier);
                float        scalingValue   = DifficultyCatalog.GetDifficultyDef(run.selectedDifficulty).scalingValue;

                scalingValue += Data.GetEclipseScalingValueAdd(run);
                return(Mathf.Max(functionValues[4], Mathf.Min(functionValues[3], functionValues[0] * Mathf.Pow(scalingValue, 2) + functionValues[1] * scalingValue + functionValues[2])));
            }
 // Token: 0x06002283 RID: 8835 RVA: 0x0009578C File Offset: 0x0009398C
 private void Start()
 {
     if (Run.instance)
     {
         DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(Run.instance.selectedDifficulty);
         base.GetComponent <Image>().sprite = difficultyDef.GetIconSprite();
     }
 }
Exemple #8
0
        /// <summary>
        /// Calculates the projected increase in RoR2.Run.instance.difficultyCoefficient after a certain amount of passed time and completed stages.
        /// </summary>
        /// <param name="time">The amount of passed time to simulate.</param>
        /// <param name="stages">The number of completed stages to simulate.</param>
        /// <returns>A float representing the increase in difficulty coefficient that the given parameters would cause.</returns>
        public static float GetDifficultyCoeffIncreaseAfter(float time, int stages)
        {
            DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(Run.instance.selectedDifficulty);
            float         num2          = Mathf.Floor((Run.instance.GetRunStopwatch() + time) * 0.0166666675f);
            float         num4          = 0.7f + (float)Run.instance.participatingPlayerCount * 0.3f;
            float         num7          = 0.046f * difficultyDef.scalingValue * Mathf.Pow((float)Run.instance.participatingPlayerCount, 0.2f);
            float         num9          = Mathf.Pow(1.15f, (float)Run.instance.stageClearCount + (float)stages);

            return((num4 + num7 * num2) * num9 - Run.instance.difficultyCoefficient);
        }
Exemple #9
0
        public void CalcDifficultyCoefficient()
        {
            Run           run           = Run.instance;
            float         num           = run.GetRunStopwatch();
            DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(run.selectedDifficulty);
            float         num2          = Mathf.Floor(num * 0.0166666675f);
            float         num3          = (float)run.participatingPlayerCount * 0.3f;
            float         num4          = 0.7f + num3;
            float         num5          = 0.7f + num3;
            float         num6          = Mathf.Pow((float)run.participatingPlayerCount, 0.2f);
            float         num7          = 0.046f * difficultyDef.scalingValue * num6;
            float         num8          = 0.046f * difficultyDef.scalingValue * num6;
            float         num9          = Mathf.Pow(1.15f, (float)run.stageClearCount);

            //this.compensatedDifficultyCoefficient = (num5 + num8 * num2) * num9;
            CurrentDifficultyCoefficient = (num4 + num7 * num2) * num9;
        }
        public void Awake()
        {
            purchaseInteraction = GetComponent <PurchaseInteraction>();
            combatDirector      = GetComponent <CombatDirector>();
            combatSquad         = GetComponent <CombatSquad>();
            instances.Add(this);

            //combatDirector.eliteBias = 10f;
            combatDirector.shouldSpawnOneWave = false;


            if (NetworkServer.active)
            {
                purchaseInteraction.onPurchase.AddListener((interactor) =>
                {
                    AddShrineStack(interactor);
                });
                startTime         = MoreShrines.impShrineTime.Value;
                timeLeftUnrounded = (float)MoreShrines.impShrineTime.Value;

                var difficulty           = Run.instance.difficultyCoefficient;
                var difficultyMultiplier = DifficultyCatalog.GetDifficultyDef(Run.instance.selectedDifficulty).scalingValue - 1;
                monsterCredit = ((baseCredit * (difficultyMultiplier + 1)) + ((baseCredit + 30) * (difficulty - 1)));
                impColor      = UnityEngine.Random.ColorHSV(0f, 1f, 0.5f, 0.7f, 1f, 1f);
                impColorHex   = "#" + ColorUtility.ToHtmlStringRGB(impColor);
                combatDirector.combatSquad.onDefeatedServer += OnDefeatedServer;
                combatDirector.onSpawnedServer.AddListener((gameObject) =>
                {
                    OnSpawnedServer(gameObject);
                    //RpcOnSpawnedClient(gameObject.GetComponent<NetworkBehaviour>().netId);
                });
            }
            gameObject.GetComponent <CustomDirector>().countToSpawn = impCount;

            //On.RoR2.CombatDirector.PrepareNewMonsterWave += CombatDirector_PrepareNewMonsterWave;
            On.RoR2.TeleporterInteraction.AddShrineStack += TeleporterInteraction_AddShrineStack;
        }
Exemple #11
0
        // Token: 0x060022D8 RID: 8920 RVA: 0x000975E4 File Offset: 0x000957E4
        public void SetDisplayData(GameEndReportPanelController.DisplayData newDisplayData)
        {
            if (this.displayData.Equals(newDisplayData))
            {
                return;
            }
            this.displayData = newDisplayData;
            if (this.resultLabel)
            {
                GameResultType gameResultType = GameResultType.Unknown;
                if (this.displayData.runReport != null)
                {
                    gameResultType = this.displayData.runReport.gameResultType;
                }
                string token;
                if (gameResultType != GameResultType.Lost)
                {
                    if (gameResultType != GameResultType.Won)
                    {
                        token = "GAME_RESULT_UNKNOWN";
                    }
                    else
                    {
                        token = "GAME_RESULT_WON";
                    }
                }
                else
                {
                    token = "GAME_RESULT_LOST";
                }
                this.resultLabel.text = Language.GetString(token);
            }
            DifficultyIndex difficultyIndex = DifficultyIndex.Invalid;

            if (this.displayData.runReport != null)
            {
                difficultyIndex = this.displayData.runReport.ruleBook.FindDifficulty();
            }
            DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(difficultyIndex);

            if (this.selectedDifficultyImage)
            {
                this.selectedDifficultyImage.sprite = ((difficultyDef != null) ? difficultyDef.GetIconSprite() : null);
            }
            if (this.selectedDifficultyLabel)
            {
                this.selectedDifficultyLabel.token = ((difficultyDef != null) ? difficultyDef.nameToken : null);
            }
            RunReport runReport = this.displayData.runReport;

            RunReport.PlayerInfo playerInfo = (runReport != null) ? runReport.GetPlayerInfoSafe(this.displayData.playerIndex) : null;
            this.SetPlayerInfo(playerInfo);
            RunReport runReport2 = this.displayData.runReport;
            int       num        = (runReport2 != null) ? runReport2.playerInfoCount : 0;

            this.playerNavigationController.gameObject.SetActive(num > 1);
            this.playerNavigationController.SetDisplayData(new CarouselNavigationController.DisplayData(num, this.displayData.playerIndex));
            ReadOnlyCollection <MPButton> elements = this.playerNavigationController.buttonAllocator.elements;

            for (int i = 0; i < elements.Count; i++)
            {
                MPButton             mpbutton                = elements[i];
                RunReport.PlayerInfo playerInfo2             = this.displayData.runReport.GetPlayerInfo(i);
                CharacterBody        bodyPrefabBodyComponent = BodyCatalog.GetBodyPrefabBodyComponent(playerInfo2.bodyIndex);
                Texture texture = bodyPrefabBodyComponent ? bodyPrefabBodyComponent.portraitIcon : null;
                mpbutton.GetComponentInChildren <RawImage>().texture = texture;
                mpbutton.GetComponent <TooltipProvider>().SetContent(TooltipProvider.GetPlayerNameTooltipContent(playerInfo2.name));
            }
            this.selectedPlayerEffectRoot.transform.SetParent(this.playerNavigationController.buttonAllocator.elements[this.displayData.playerIndex].transform);
            this.selectedPlayerEffectRoot.gameObject.SetActive(false);
            this.selectedPlayerEffectRoot.gameObject.SetActive(true);
            this.selectedPlayerEffectRoot.offsetMin  = Vector2.zero;
            this.selectedPlayerEffectRoot.offsetMax  = Vector2.zero;
            this.selectedPlayerEffectRoot.localScale = Vector3.one;
        }