コード例 #1
0
        private float CalculateThisDamage(ItemDamageType type, float baseDamage)
        {
            float dmg = 0;

            try {
                AttackTable MHAtkTable = AttackTables[type];
                dmg  = baseDamage;                   // Base Damage
                dmg *= 1f + DamageMultipliers[type]; // Global Damage Bonuses
                dmg *= 1f - DamageResistances[type]; // Global Damage Penalties

                // Work the Attack Table, note: some of these points will always be zero
                float dmgDrop = (1f
                                 - MHAtkTable.Miss                                            // no damage when being missed
                                 - MHAtkTable.Dodge                                           // no damage when being dodged
                                 - MHAtkTable.Parry                                           // no damage when being parried
                                 - MHAtkTable.Glance                                          // glancing handled below
                                 - MHAtkTable.Block                                           // blocked  handled below
                                 - MHAtkTable.Crit);                                          // crits    handled below

                float dmgGlance = dmg * MHAtkTable.Glance * 0.70f;                            // Partial Damage when glancing
                float dmgBlock  = dmg * MHAtkTable.Block * 0.70f;                             // Partial damage when blocked
                float dmgCrit   = dmg * MHAtkTable.Crit * (1f + DamageCritMultipliers[type]); // Bonus Damage when critting

                dmg *= dmgDrop;

                dmg += dmgGlance + dmgBlock + dmgCrit;
            } catch (Exception ex) {
                Rawr.Base.ErrorBox eb = new Rawr.Base.ErrorBox("Error calculating special proc DPS",
                                                               ex.Message, "CalculateThisDamage(...)", "", ex.StackTrace);
            }

            return(dmg);
        }
コード例 #2
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            ItemDamageType dtValue = (ItemDamageType)value;

            if (dtValue == ItemDamageType.Physical)
            {
                return("Physical");
            }
            else if (dtValue == ItemDamageType.Holy)
            {
                return("Holy");
            }
            else if (dtValue == ItemDamageType.Fire)
            {
                return("Fire");
            }
            else if (dtValue == ItemDamageType.Nature)
            {
                return("Nature");
            }
            else if (dtValue == ItemDamageType.Frost)
            {
                return("Frost");
            }
            else if (dtValue == ItemDamageType.Shadow)
            {
                return("Shadow");
            }
            else if (dtValue == ItemDamageType.Arcane)
            {
                return("Arcane");
            }
            return(ItemDamageType.Physical);
        }
コード例 #3
0
ファイル: SpecialDamageProcs.cs プロジェクト: rakot/rawr
        /// <summary>
        /// Performs the meat and potatoes intention of this class.
        /// All the DPS, etc variables will be populated.
        /// Do not run Calculate multiple times for the same ItemDamageType without resetting.
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public float Calculate(ItemDamageType type)
        {
            float retVal = 0f;

            try{
                foreach (SpecialEffect effect in EffectsList)
                {
                    if (effect == null ||
                        effect.Stats == null ||
                        !TriggerChances.ContainsKey(effect.Trigger) ||
                        !TriggerIntervals.ContainsKey(effect.Trigger))
                    {
                    }
                    else if (effect.Stats.PhysicalDamage > 0 && type == ItemDamageType.Physical)
                    {
                        retVal = CalculateTotalDamagePerSecond(effect, effect.Stats.PhysicalDamage, type);
                    }
                    else if (effect.Stats.ArcaneDamage > 0 && type == ItemDamageType.Arcane)
                    {
                        retVal = CalculateTotalDamagePerSecond(effect, effect.Stats.ArcaneDamage, type);
                    }
                    else if (effect.Stats.HolyDamage > 0 && type == ItemDamageType.Holy)
                    {
                        retVal = CalculateTotalDamagePerSecond(effect, effect.Stats.HolyDamage, type);
                    }
                    else if (effect.Stats.NatureDamage > 0 && type == ItemDamageType.Nature)
                    {
                        retVal = CalculateTotalDamagePerSecond(effect, effect.Stats.NatureDamage, type);
                    }
                    else if (effect.Stats.ShadowDamage > 0 && type == ItemDamageType.Shadow)
                    {
                        retVal = CalculateTotalDamagePerSecond(effect, effect.Stats.ShadowDamage, type);
                    }
                    else if (effect.Stats.FireDamage > 0 && type == ItemDamageType.Fire)
                    {
                        retVal = CalculateTotalDamagePerSecond(effect, effect.Stats.FireDamage, type);
                    }
                    else if (effect.Stats.FrostDamage > 0 && type == ItemDamageType.Frost)
                    {
                        retVal = CalculateTotalDamagePerSecond(effect, effect.Stats.FrostDamage, type);
                    }
                }
            }catch (Exception ex) {
                new Base.ErrorBox()
                {
                    Title        = "Error calculating special proc DPS",
                    Function     = "Calculate(...)",
                    TheException = ex,
                }.Show();
            }
            return(retVal);
        }
コード例 #4
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="id"></param>
        /// <param name="value"></param>
        /// <param name="uses"></param>
        /// <param name="reusability"></param>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="onUseMessage"></param>
        public ItemArmor(int id, int value, int uses, ItemUsability reusability, string name, string description, string onUseMessage, bool canBeSold, ItemDamageType damageResist, double resistanceModifier)
            : base(id, value, uses, reusability, name, description, onUseMessage, canBeSold)
        {
            ItemId           = id;
            ItemValue        = value;
            ItemNumberOfUses = uses;
            ItemReusability  = reusability;
            ItemName         = name;
            ItemDescription  = description;
            ItemOnUseMessage = onUseMessage;
            CanBeSold        = canBeSold;

            ArmorResistanceType = damageResist;
            ArmorResistModifier = resistanceModifier;
        }
コード例 #5
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="id"></param>
        /// <param name="value"></param>
        /// <param name="uses"></param>
        /// <param name="reusability"></param>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="onUseMessage"></param>
        public ItemWeapon(int id, int value, int uses, int weaponDamageAmount, ItemUsability reusability, ItemDamageType weaponDamageType, string name, string description, string onUseMessage, bool canBeSold)
            : base(id, value, uses, reusability, name, description, onUseMessage, canBeSold)
        {
            ItemId           = id;
            ItemValue        = value;
            ItemNumberOfUses = uses;
            ItemReusability  = reusability;
            ItemName         = name;
            ItemDescription  = description;
            ItemOnUseMessage = onUseMessage;
            CanBeSold        = canBeSold;

            WeaponDamageType   = weaponDamageType;
            WeaponDamageAmount = weaponDamageAmount;
        }
コード例 #6
0
ファイル: Item.cs プロジェクト: say1981/Rawr
 public Item(string name, ItemQuality quality, ItemType type, int id, string iconPath, ItemSlot slot, string setName, bool unique, Stats stats, Sockets sockets, int gem1Id, int gem2Id, int gem3Id, int minDamage, int maxDamage, ItemDamageType damageType, float speed, string requiredClasses)
 {
     _name            = name;
     _id              = id;
     _iconPath        = iconPath;
     _slot            = slot;
     _stats           = stats;
     _sockets         = sockets;
     _gem1Id          = gem1Id;
     _gem2Id          = gem2Id;
     _gem3Id          = gem3Id;
     _setName         = setName;
     _quality         = quality;
     _type            = type;
     _minDamage       = minDamage;
     _maxDamage       = maxDamage;
     _damageType      = damageType;
     _speed           = speed;
     _requiredClasses = requiredClasses;
     _unique          = unique;
 }
コード例 #7
0
        private float CalculateTotalDamagePerSecond(SpecialEffect effect, float baseDamage, ItemDamageType type)
        {
            float totalDamage         = 0f;
            float totalDamagePerSec   = 0f;
            float totalNumProcs       = 0f;
            float totalNumProcsPerSec = 0f;

            try {
                float triggerInterval = TriggerIntervals[effect.Trigger];
                float triggerChance   = TriggerChances[effect.Trigger];
                if (TriggerChances.ContainsKey(Trigger.MainHandHit) && MainHandEffects.Contains(effect) && (!OffHandEffects.Contains(effect) || !dualWieldProcs))
                {
                    triggerInterval = TriggerIntervals[Trigger.MainHandHit];
                    triggerChance   = TriggerChances[Trigger.MainHandHit];
                    if (OffHandEffects.Contains(effect))
                    {
                        dualWieldProcs = true;
                    }
                }
                else if (TriggerChances.ContainsKey(Trigger.OffHandHit) && OffHandEffects.Contains(effect))
                {
                    triggerInterval = TriggerIntervals[Trigger.OffHandHit];
                    triggerChance   = TriggerChances[Trigger.OffHandHit];
                }
                // Process the Effects
                totalNumProcsPerSec = effect.GetAverageProcsPerSecond(triggerInterval, triggerChance, Char.MainHand.Speed, FightDuration);
                totalNumProcs       = totalNumProcsPerSec * FightDuration;
                totalDamage         = totalNumProcs * CalculateThisDamage(type, baseDamage);
                totalDamagePerSec   = totalDamage / FightDuration;

                // Set our Results into the Dictionaries
                TotalDamage[type]         += totalDamage;
                TotalDamagePerSec[type]   += totalDamagePerSec;
                TotalNumProcs[type]       += totalNumProcs;
                TotalNumProcsPerSec[type] += totalNumProcsPerSec;
            } catch (Exception ex) {
                Rawr.Base.ErrorBox eb = new Rawr.Base.ErrorBox("Error calculating special proc DPS",
                                                               ex.Message, "CalculateTotalDamagePerSecond(...)", "", ex.StackTrace);
            }

            return(totalDamagePerSec);
        }
コード例 #8
0
        /// <summary>
        /// Generates the necessary Damage Multipliers and Attack Tables.
        /// This function is automatically called by the constructor.
        /// </summary>
        public void CreateDictionaries()
        {
            Reset();
            // Partial Spell Resists
            float averageResist = (LevelDelta) * 0.02f;
            float resist10      = 5.0f * averageResist;
            float resist20      = 2.5f * averageResist;
            float partialResist = (resist10 * 0.1f + resist20 * 0.2f);

            { // Physical
                ItemDamageType type           = ItemDamageType.Physical;
                AttackTable    a              = new AttackTable(Char, StatS, false, false, LevelDelta);
                float          DamageMult     = StatS.BonusPhysicalDamageMultiplier;
                float          DamageCritMult = StatS.BonusCritMultiplier;
                DamageMultipliers.Add(type, DamageMult);
                DamageCritMultipliers.Add(type, DamageCritMult);
                DamageResistances.Add(type, 1f - ArmorDmgReduc);
                AttackTables.Add(type, a);
                TotalDamage.Add(type, 0f);
                TotalDamagePerSec.Add(type, 0f);
                TotalNumProcs.Add(type, 0f);
                TotalNumProcsPerSec.Add(type, 0f);
            }
            { // Arcane
                ItemDamageType type           = ItemDamageType.Arcane;
                AttackTable    a              = new AttackTable(Char, StatS, true, false, LevelDelta);
                float          DamageMult     = StatS.BonusArcaneDamageMultiplier;
                float          DamageCritMult = StatS.BonusSpellCritMultiplier;
                DamageMultipliers.Add(type, DamageMult);
                DamageCritMultipliers.Add(type, DamageCritMult);
                DamageResistances.Add(type, partialResist);
                AttackTables.Add(type, a);
                TotalDamage.Add(type, 0f);
                TotalDamagePerSec.Add(type, 0f);
                TotalNumProcs.Add(type, 0f);
                TotalNumProcsPerSec.Add(type, 0f);
            }
            { // Holy
                ItemDamageType type           = ItemDamageType.Holy;
                AttackTable    a              = new AttackTable(Char, StatS, true, false, LevelDelta);
                float          DamageMult     = StatS.BonusHolyDamageMultiplier;
                float          DamageCritMult = StatS.BonusSpellCritMultiplier;
                DamageMultipliers.Add(type, DamageMult);
                DamageCritMultipliers.Add(type, DamageCritMult);
                DamageResistances.Add(type, partialResist);
                AttackTables.Add(type, a);
                TotalDamage.Add(type, 0f);
                TotalDamagePerSec.Add(type, 0f);
                TotalNumProcs.Add(type, 0f);
                TotalNumProcsPerSec.Add(type, 0f);
            }
            { // Nature
                ItemDamageType type           = ItemDamageType.Nature;
                AttackTable    a              = new AttackTable(Char, StatS, true, false, LevelDelta);
                float          DamageMult     = StatS.BonusNatureDamageMultiplier;
                float          DamageCritMult = StatS.BonusSpellCritMultiplier;
                DamageMultipliers.Add(type, DamageMult);
                DamageCritMultipliers.Add(type, DamageCritMult);
                DamageResistances.Add(type, partialResist);
                AttackTables.Add(type, a);
                TotalDamage.Add(type, 0f);
                TotalDamagePerSec.Add(type, 0f);
                TotalNumProcs.Add(type, 0f);
                TotalNumProcsPerSec.Add(type, 0f);
            }
            { // Shadow
                ItemDamageType type           = ItemDamageType.Shadow;
                AttackTable    a              = new AttackTable(Char, StatS, true, false, LevelDelta);
                float          DamageMult     = StatS.BonusShadowDamageMultiplier;
                float          DamageCritMult = StatS.BonusSpellCritMultiplier;
                DamageMultipliers.Add(type, DamageMult);
                DamageCritMultipliers.Add(type, DamageCritMult);
                DamageResistances.Add(type, partialResist);
                AttackTables.Add(type, a);
                TotalDamage.Add(type, 0f);
                TotalDamagePerSec.Add(type, 0f);
                TotalNumProcs.Add(type, 0f);
                TotalNumProcsPerSec.Add(type, 0f);
            }
            { // Fire
                ItemDamageType type           = ItemDamageType.Fire;
                AttackTable    a              = new AttackTable(Char, StatS, true, false, LevelDelta);
                float          DamageMult     = StatS.BonusFireDamageMultiplier;
                float          DamageCritMult = StatS.BonusSpellCritMultiplier;
                DamageMultipliers.Add(type, DamageMult);
                DamageCritMultipliers.Add(type, DamageCritMult);
                DamageResistances.Add(type, partialResist);
                AttackTables.Add(type, a);
                TotalDamage.Add(type, 0f);
                TotalDamagePerSec.Add(type, 0f);
                TotalNumProcs.Add(type, 0f);
                TotalNumProcsPerSec.Add(type, 0f);
            }
            { // Frost
                ItemDamageType type           = ItemDamageType.Frost;
                AttackTable    a              = new AttackTable(Char, StatS, true, false, LevelDelta);
                float          DamageMult     = StatS.BonusFrostDamageMultiplier;
                float          DamageCritMult = StatS.BonusSpellCritMultiplier;
                DamageMultipliers.Add(type, DamageMult);
                DamageCritMultipliers.Add(type, DamageCritMult);
                DamageResistances.Add(type, partialResist);
                AttackTables.Add(type, a);
                TotalDamage.Add(type, 0f);
                TotalDamagePerSec.Add(type, 0f);
                TotalNumProcs.Add(type, 0f);
                TotalNumProcsPerSec.Add(type, 0f);
            }
        }
コード例 #9
0
        private float CalculateThisDamage(ItemDamageType type, float baseDamage) {
            float dmg = 0;
            try {
                AttackTable MHAtkTable = AttackTables[type];
                dmg  = baseDamage; // Base Damage
                dmg *= 1f + DamageMultipliers[type];     // Global Damage Bonuses
                dmg *= 1f - DamageResistances[type];     // Global Damage Penalties

                // Work the Attack Table, note: some of these points will always be zero
                float dmgDrop = (1f
                    - MHAtkTable.Miss   // no damage when being missed
                    - MHAtkTable.Dodge  // no damage when being dodged
                    - MHAtkTable.Parry  // no damage when being parried
                    - MHAtkTable.Glance // glancing handled below
                    - MHAtkTable.Block  // blocked  handled below
                    - MHAtkTable.Crit); // crits    handled below

                float dmgGlance = dmg * MHAtkTable.Glance * 0.70f; // Partial Damage when glancing
                float dmgBlock  = dmg * MHAtkTable.Block  * 0.70f; // Partial damage when blocked
                float dmgCrit   = dmg * MHAtkTable.Crit   * (1f + DamageCritMultipliers[type]); // Bonus Damage when critting

                dmg *= dmgDrop;

                dmg += dmgGlance + dmgBlock + dmgCrit;
            } catch (Exception ex) {
                new Base.ErrorBox()
                {
                    Title = "Error calculating special proc DPS",
                    Function = "CalculateThisDamage(...)",
                    TheException = ex,
                }.Show();
            }

            return dmg;
        }
コード例 #10
0
        private float CalculateTotalDamagePerSecond(SpecialEffect effect, float baseDamage, ItemDamageType type) {
            float totalDamage = 0f;
            float totalDamagePerSec = 0f;
            float totalNumProcs = 0f;
            float totalNumProcsPerSec = 0f;
            try {
                float triggerInterval = TriggerIntervals[effect.Trigger];
                float triggerChance = TriggerChances[effect.Trigger];
                if (TriggerChances.ContainsKey(Trigger.MainHandHit) && MainHandEffects.Contains(effect) && (!OffHandEffects.Contains(effect) || !dualWieldProcs))
                {
                    triggerInterval = TriggerIntervals[Trigger.MainHandHit];
                    triggerChance = TriggerChances[Trigger.MainHandHit];
                    if (OffHandEffects.Contains(effect)) dualWieldProcs = true;
                }
                else if (TriggerChances.ContainsKey(Trigger.OffHandHit) && OffHandEffects.Contains(effect))
                {
                    triggerInterval = TriggerIntervals[Trigger.OffHandHit];
                    triggerChance = TriggerChances[Trigger.OffHandHit];
                }
                // Process the Effects
                totalNumProcsPerSec = effect.GetAverageProcsPerSecond(triggerInterval, triggerChance, Char.MainHand.Speed, FightDuration);
                totalNumProcs = totalNumProcsPerSec * FightDuration;
                totalDamage = totalNumProcs * CalculateThisDamage(type, baseDamage);
                totalDamagePerSec = totalDamage / FightDuration;

                // Set our Results into the Dictionaries
                TotalDamage[type] += totalDamage;
                TotalDamagePerSec[type] += totalDamagePerSec;
                TotalNumProcs[type] += totalNumProcs;
                TotalNumProcsPerSec[type] += totalNumProcsPerSec;
            } catch (Exception ex) {
                new Base.ErrorBox()
                {
                    Title = "Error calculating special proc DPS",
                    Function = "CalculateTotalDamagePerSecond(...)",
                    TheException = ex,
                }.Show();
            }

            return totalDamagePerSec;
        }
コード例 #11
0
 /// <summary>
 /// Performs the meat and potatoes intention of this class.
 /// All the DPS, etc variables will be populated.
 /// Do not run Calculate multiple times for the same ItemDamageType without resetting.
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public float Calculate(ItemDamageType type) {
     float retVal = 0f;
     try{
         foreach (SpecialEffect effect in EffectsList) {
             if (effect == null
                 || effect.Stats == null
                 || !TriggerChances.ContainsKey(effect.Trigger)
                 || !TriggerIntervals.ContainsKey(effect.Trigger))
             {
             }else if(effect.Stats.PhysicalDamage > 0 && type == ItemDamageType.Physical) { retVal = CalculateTotalDamagePerSecond(effect, effect.Stats.PhysicalDamage, type);
             }else if(effect.Stats.ArcaneDamage   > 0 && type == ItemDamageType.Arcane  ) { retVal = CalculateTotalDamagePerSecond(effect, effect.Stats.ArcaneDamage, type);
             }else if(effect.Stats.HolyDamage     > 0 && type == ItemDamageType.Holy    ) { retVal = CalculateTotalDamagePerSecond(effect, effect.Stats.HolyDamage, type);
             }else if(effect.Stats.NatureDamage   > 0 && type == ItemDamageType.Nature  ) { retVal = CalculateTotalDamagePerSecond(effect, effect.Stats.NatureDamage, type);
             }else if(effect.Stats.ShadowDamage   > 0 && type == ItemDamageType.Shadow  ) { retVal = CalculateTotalDamagePerSecond(effect, effect.Stats.ShadowDamage, type);
             }else if(effect.Stats.FireDamage     > 0 && type == ItemDamageType.Fire    ) { retVal = CalculateTotalDamagePerSecond(effect, effect.Stats.FireDamage, type);
             }else if(effect.Stats.FrostDamage    > 0 && type == ItemDamageType.Frost   ) { retVal = CalculateTotalDamagePerSecond(effect, effect.Stats.FrostDamage, type);}
         }
     }catch(Exception ex){
         new Base.ErrorBox()
         {
             Title = "Error calculating special proc DPS",
             Function = "Calculate(...)",
             TheException = ex,
         }.Show();
     }
     return retVal;
 }
コード例 #12
0
ファイル: Rotation.cs プロジェクト: LucasPeacecraft/rawr
 private uint getAbilityCountofType(ItemDamageType i)
 {
     uint S = 0;
     if (null != ml_Rot)
     {
         foreach (AbilityDK_Base ability in ml_Rot)
         {
             if (ability.tDamageType == i)
                 S++;
         }
     }
     return S;
 }
コード例 #13
0
ファイル: Damage.cs プロジェクト: Fr0sTy7u7/ProDragon
        public double GetItemDamage(AIHeroClient source, AIBaseClient target, DamageItems item, ItemDamageType type = ItemDamageType.Default)
        {
            double      num        = 0.0;
            IDamageItem itemDamage = this.GetItemDamage(item);

            if (itemDamage != null)
            {
                if (type.HasFlag(ItemDamageType.Default))
                {
                    num += itemDamage.GetDamage(source, target);
                }
                if (type.HasFlag(ItemDamageType.Dot))
                {
                    num += itemDamage.GetDotDamage(source, target);
                }
                if (type.HasFlag(ItemDamageType.Passive))
                {
                    num += itemDamage.GetPassiveDamage(source, target);
                }
            }
            return(num);
        }