private double calculateDamage(CharacterInstance c, bool canCrit, bool forceCrit, out bool critted)
        {
            double num  = c.DamagePerHit(true);
            float  num2 = UnityEngine.Random.Range(-ConfigGameplay.GLOBAL_MELEE_DAMAGE_VARIATION_PCT, ConfigGameplay.GLOBAL_MELEE_DAMAGE_VARIATION_PCT);
            double num3 = MathUtil.Clamp(num + (num * num2), 1.0, double.MaxValue);

            if (canCrit || forceCrit)
            {
                critted = (UnityEngine.Random.Range((float)0f, (float)1f) <= c.CriticalHitChancePct(true)) || forceCrit;
                if (critted)
                {
                    num3 *= c.CriticalHitMultiplier(true);
                }
                return(num3);
            }
            critted = false;
            return(num3);
        }
Exemple #2
0
        public static string CalculateBossDifficulty(Player player, int floor, bool isEliteBoss, Character referenceBoss, double progressDifficultyExponent)
        {
            CharacterInstance activeCharacter = player.ActiveCharacter;
            double            num             = activeCharacter.DamagePerHit(false) * activeCharacter.AttacksPerSecond(false);
            double            num2            = activeCharacter.MaxLife(false);
            double            num3            = activeCharacter.SkillDamage(false);
            double            num4            = App.Binder.ConfigMeta.DIFFICULTY_AVERAGE_SKILL_DAMAGE_MULTIPLIER;
            double            num5            = (num3 * activeCharacter.ActiveSkillTypes.Count) * num4;
            float             num6            = activeCharacter.getTotalNumberOfRandomPerksInEquippedItems() * 0.02f;
            float             num7            = activeCharacter.getTotalNumberOfFixedPerksInEquippedItems() * 0.15f;

            num  *= 1.0 + ((num6 + num7) * 0.5);
            num2 *= 1.0 + ((num6 + num7) * 0.5);
            double num8  = App.Binder.ConfigMeta.BossDamagePerHitCurve(floor, progressDifficultyExponent, false) * referenceBoss.getBaseStatFloat(BaseStatProperty.AttacksPerSecond);
            double num9  = App.Binder.ConfigMeta.BossLifeCurve(floor, progressDifficultyExponent, false);
            double num10 = !isEliteBoss ? 1.0 : 1.4;

            num8 *= num10;
            num9 *= num10;
            num9 -= num5;
            double num11 = (num9 / num) / (num2 / num8);
            double num12 = App.Binder.ConfigMeta.ITEM_DAMAGE_MULTIPLIER * 3.0;
            double num13 = App.Binder.ConfigMeta.ITEM_HEALTH_MULTIPLIER;
            double num14 = App.Binder.ConfigMeta.BOSS_DAMAGE_MULTIPLIER * 1.0;
            double num16 = (App.Binder.ConfigMeta.BOSS_HEALTH_MULTIPLIER / num12) / (num13 / num14);
            double num17 = num11 / num16;

            if (num17 >= 4.5)
            {
                return("impossible");
            }
            if (num17 >= 2.0)
            {
                return("very_hard");
            }
            if (num17 >= 1.33)
            {
                return("hard");
            }
            return("ready");
        }
        protected override void onRefresh()
        {
            Player            player          = GameLogic.Binder.GameState.Player;
            CharacterInstance activeCharacter = player.ActiveCharacter;

            base.m_contentMenu.refreshTitle(StringExtensions.ToUpperLoca(_.L(ConfigLoca.HEROVIEW_TITLE, null, false)), string.Empty, string.Empty);
            if (!string.IsNullOrEmpty(player.SocialData.Name))
            {
                this.HeaderTitle.text = StringExtensions.ToUpperLoca(player.SocialData.Name);
            }
            else
            {
                this.HeaderTitle.text = StringExtensions.ToUpperLoca(player.ActiveCharacter.Name);
            }
            this.HeroAvatarImage.texture = PlayerView.Binder.MenuSystem.CharacterMenuCamera.RenderTexture;
            this.HeroAvatarImage.enabled = true;
            this.AtkText.text            = MenuHelpers.BigValueToString(activeCharacter.DamagePerHit(false));
            this.DefText.text            = MenuHelpers.BigValueToString(activeCharacter.MaxLife(false));
            this.SklText.text            = MenuHelpers.BigValueToString(activeCharacter.SkillDamage(false));
            this.refreshHeroStats();
        }