Ejemplo n.º 1
0
        public void CalculateGeneralInfo(bool calculateEhp, bool calculateDps, ArmorCalcType armorCalcType)
        {
            if (calculateEhp)
            {
                hpFactor = 1.0 / (1.0 + Current.unit.hpFactor);

                /////////////////////////////
                // normal damage reduction
                /////////////////////////////

                double original_damage = (double)armorDamage;

                // calculating average damage received after it was blocked by Shield Block abilities
                DBDAMAGE reduced_damage = onNormalDefenseStats.GetDbDamage("DAMAGE");

                // use original damage for cases that do not trigger damage reducing abilities
                reduced_damage += original_damage * (1 - onNormalDefenseStats.GetKeyProbability("DAMAGE"));

                int bonus_ehp = (int)(unit.armor * (unit.max_hp * 0.06));

                if (original_damage != reduced_damage)
                {
                    // total ehp

                    total_ehp_normal    = ((unit.max_hp + bonus_ehp) * hpFactor) * (original_damage / reduced_damage);
                    total_ehp_normal    = Math.Round(total_ehp_normal);
                    ehp_increase_normal = total_ehp_normal - (unit.max_hp * hpFactor);

                    // ehp bonuses from items

                    bonus_ehp = (int)(unit.get_naked_armor() * (unit.max_hp * 0.06));
                    double total_ehp_naked = ((unit.max_hp + bonus_ehp) * hpFactor);
                    ehp_increase_normal_items = total_ehp_normal - total_ehp_naked;

                    // damage reduction

                    damage_reduction_normal = ((0.06 * unit.armor) / (1 + (0.06 * unit.armor))) * hpFactor;
                    damage_reduction_normal = (1 - (reduced_damage / original_damage) * (1 - damage_reduction_normal)) * 100;
                }
                else
                {
                    // total ehp

                    total_ehp_normal    = ((unit.max_hp + bonus_ehp) * hpFactor);
                    ehp_increase_normal = bonus_ehp * hpFactor;

                    // ehp bonuses from items

                    ehp_increase_normal_items = (int)((unit.armor - unit.get_naked_armor()) * (unit.max_hp * 0.06));

                    // damage reduction

                    damage_reduction_normal = ((6 * unit.armor) / (1 + (0.06 * unit.armor))) * hpFactor;
                }

                // recalculate ehp considering opponent's damage
                // if required "Armor:" switch is set
                // Formula: EHP = damage * ceiling(HP/damage)

                if ((armorCalcType & ArmorCalcType.SurvivabilityMeasure) != 0)
                {
                    total_ehp_normal = original_damage * Math.Ceiling(total_ehp_normal / original_damage);
                }

                // calculate evasion-to-ehp if required "Armor:" switch is set

                if ((armorCalcType & ArmorCalcType.Evasion) != 0)
                {
                    DBEVASIONABILITY evasion = unit.onDefenceAbilities.GetByType <DBEVASIONABILITY>();
                    if (evasion != null && evasion.Chance != 0)
                    {
                        total_ehp_normal = Math.Round(total_ehp_normal / (1 - evasion.Chance));
                    }
                }

                ///////////////////////////
                // spell damage reduction
                ///////////////////////////

                DBDAMAGE       spellDamage = new DBDAMAGE(100, AttackType.Spell, DamageType.Magic);
                AbilityResults ar          = new AbilityResults();
                ar.SetDbDamage("DAMAGE", spellDamage);
                foreach (DBABILITY a in unit.onDefenceAbilities)
                {
                    a.Apply(ar);
                }
                ar.Rename("RESISTED_DAMAGE", "DAMAGE");
                double resisted_damage = (double)(ar.GetDbDamage("DAMAGE").convert_to_double() * (1.0 - unit.spell_resistance));
                spell_resistance = 100 - resisted_damage;

                ehp_increase_spell = (int)(unit.max_hp * (spell_resistance / resisted_damage));
                total_ehp_spell    = (unit.max_hp + ehp_increase_spell) * hpFactor;

                double baseSpellResistance = (double)unit.baseSpellResistance;
                ehp_increase_spell_items = ehp_increase_spell - (int)((double)((double)baseSpellResistance / (1.0 - baseSpellResistance)) * (double)(int)unit.max_hp);

                spell_resistance         *= hpFactor;
                ehp_increase_spell       *= hpFactor;
                ehp_increase_spell_items *= hpFactor;
            }

            if (calculateDps)
            {
                ////////////////////////////////
                // normal dps
                ////////////////////////////////

                dps_normal = unit.get_dps(this.additional_damage);

                ////////////////////////////////
                // spell dps
                ////////////////////////////////

                dps_spell  = (double)onAttackStats.GetDamage("DAMAGE_SPELL") / unit.cooldown;
                dps_spell += onEnemyStats.GetDouble("DPS_SPELL");
            }
        }
Ejemplo n.º 2
0
        public void CalculateGeneralInfo(bool calculateEhp, bool calculateDps, ArmorCalcType armorCalcType)
        {
            if (calculateEhp)
            {
                hpFactor = 1.0 / (1.0 + Current.unit.hpFactor);

                /////////////////////////////
                // normal damage reduction
                /////////////////////////////

                double original_damage = (double)armorDamage;

                // calculating average damage received after it was blocked by Shield Block abilities
                DBDAMAGE reduced_damage = onNormalDefenseStats.GetDbDamage("DAMAGE");

                // use original damage for cases that do not trigger damage reducing abilities
                reduced_damage += original_damage * (1 - onNormalDefenseStats.GetKeyProbability("DAMAGE"));

                int bonus_ehp = (int)(unit.armor * (unit.max_hp * 0.06));

                if (original_damage != reduced_damage)
                {
                    // total ehp

                    total_ehp_normal = ((unit.max_hp + bonus_ehp) * hpFactor) * (original_damage / reduced_damage);
                    total_ehp_normal = Math.Round(total_ehp_normal);
                    ehp_increase_normal = total_ehp_normal - (unit.max_hp * hpFactor);

                    // ehp bonuses from items

                    bonus_ehp = (int)(unit.get_naked_armor() * (unit.max_hp * 0.06));
                    double total_ehp_naked = ((unit.max_hp + bonus_ehp) * hpFactor);
                    ehp_increase_normal_items = total_ehp_normal - total_ehp_naked;

                    // damage reduction

                    damage_reduction_normal = ((0.06 * unit.armor) / (1 + (0.06 * unit.armor))) * hpFactor;
                    damage_reduction_normal = (1 - (reduced_damage / original_damage) * (1 - damage_reduction_normal)) * 100;
                }
                else
                {
                    // total ehp

                    total_ehp_normal = ((unit.max_hp + bonus_ehp) * hpFactor);
                    ehp_increase_normal = bonus_ehp * hpFactor;

                    // ehp bonuses from items

                    ehp_increase_normal_items = (int)((unit.armor - unit.get_naked_armor()) * (unit.max_hp * 0.06));

                    // damage reduction

                    damage_reduction_normal = ((6 * unit.armor) / (1 + (0.06 * unit.armor))) * hpFactor;
                }

                // recalculate ehp considering opponent's damage
                // if required "Armor:" switch is set
                // Formula: EHP = damage * ceiling(HP/damage)

                if ((armorCalcType & ArmorCalcType.SurvivabilityMeasure) != 0)
                    total_ehp_normal = original_damage * Math.Ceiling(total_ehp_normal / original_damage);

                // calculate evasion-to-ehp if required "Armor:" switch is set

                if ((armorCalcType & ArmorCalcType.Evasion) != 0)
                {
                    DBEVASIONABILITY evasion = unit.onDefenceAbilities.GetByType<DBEVASIONABILITY>();
                    if (evasion != null && evasion.Chance != 0)
                        total_ehp_normal = Math.Round(total_ehp_normal / (1 - evasion.Chance));
                }

                ///////////////////////////
                // spell damage reduction
                ///////////////////////////

                DBDAMAGE spellDamage = new DBDAMAGE(100, AttackType.Spell, DamageType.Magic);
                AbilityResults ar = new AbilityResults();
                ar.SetDbDamage("DAMAGE", spellDamage);
                foreach (DBABILITY a in unit.onDefenceAbilities)
                    a.Apply(ar);
                ar.Rename("RESISTED_DAMAGE", "DAMAGE");
                double resisted_damage = (double)(ar.GetDbDamage("DAMAGE").convert_to_double() * (1.0 - unit.spell_resistance));
                spell_resistance = 100 - resisted_damage;

                ehp_increase_spell = (int)(unit.max_hp * (spell_resistance / resisted_damage));
                total_ehp_spell = (unit.max_hp + ehp_increase_spell) * hpFactor;

                double baseSpellResistance = (double)unit.baseSpellResistance;
                ehp_increase_spell_items = ehp_increase_spell - (int)((double)((double)baseSpellResistance / (1.0 - baseSpellResistance)) * (double)(int)unit.max_hp);

                spell_resistance *= hpFactor;
                ehp_increase_spell *= hpFactor;
                ehp_increase_spell_items *= hpFactor;
            }

            if (calculateDps)
            {
                ////////////////////////////////
                // normal dps
                ////////////////////////////////

                dps_normal = unit.get_dps(this.additional_damage);

                ////////////////////////////////
                // spell dps
                ////////////////////////////////

                dps_spell = (double)onAttackStats.GetDamage("DAMAGE_SPELL") / unit.cooldown;
                dps_spell += onEnemyStats.GetDouble("DPS_SPELL");
            }
        }
Ejemplo n.º 3
0
 public void CalculateGeneralInfo(ArmorCalcType armorCalcType)
 {
     CalculateGeneralInfo(true, true, armorCalcType);
 }
Ejemplo n.º 4
0
 public void CalculateGeneralInfo(ArmorCalcType armorCalcType)
 {
     CalculateGeneralInfo(true, true, armorCalcType);
 }