当前位置: 首页>>代码示例>>C#>>正文


C# Ability.GetAbilityData方法代码示例

本文整理汇总了C#中Ability.GetAbilityData方法的典型用法代码示例。如果您正苦于以下问题:C# Ability.GetAbilityData方法的具体用法?C# Ability.GetAbilityData怎么用?C# Ability.GetAbilityData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ability的用法示例。


在下文中一共展示了Ability.GetAbilityData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: All

 public static bool All(string name, Unit hero, List<Modifier> modifiers, Ability ability = null)
 {
     if ((name == "item_diffusal_blade" || name == "item_diffusal_blade_2")
         && modifiers.Any(x => x.Name == "modifier_item_diffusal_blade_slow"))
     {
         return false;
     }
     if (name == "slardar_amplify_damage" && modifiers.Any(x => x.Name == "modifier_slardar_amplify_damage"))
     {
         return false;
     }
     if (name == "bloodseeker_bloodrage" && modifiers.Any(x => x.Name == "modifier_bloodseeker_bloodrage"))
     {
         return false;
     }
     if (name == "axe_battle_hunger" && modifiers.Any(x => x.Name == "modifier_axe_battle_hunger"))
     {
         return false;
     }
     if (name == "bounty_hunter_track" && modifiers.Any(x => x.Name == "modifier_bounty_hunter_track"))
     {
         return false;
     }
     if (name == "visage_soul_assumption" && ability != null)
     {
         var modif = AbilityMain.Me.Modifiers.FirstOrDefault(x => x.Name == "modifier_visage_soul_assumption");
         if (modif == null || modif.StackCount < ability.GetAbilityData("stack_limit"))
         {
             return false;
         }
     }
     return true;
 }
开发者ID:dendimonster,项目名称:EnsageSharp,代码行数:33,代码来源:CastingChecks.cs

示例2: CalculateDamage

        /// <summary>
        ///     Calculates damage from given ability on given target
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="source"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static float CalculateDamage(Ability ability, Hero source, Unit target)
        {
            var name = ability.Name;
            var level = ability.Level;
            AbilityInfo data;
            if (!dataDictionary.TryGetValue(ability, out data))
            {
                data = AbilityDatabase.Find(name);
                if (data != null && data.IsNuke)
                {
                    dataDictionary.Add(ability, data);
                }
            }

            //var data = AbilityDatabase.Find(name);
            if (data == null || !data.IsNuke)
            {
                return 0;
            }

            var outgoingDamage = 0f;
            float bonusDamage;
            switch (name)
            {
                case "ember_spirit_sleight_of_fist":
                    outgoingDamage = source.MinimumDamage + source.BonusDamage;
                    if (!damageDictionary.TryGetValue(ability, out bonusDamage))
                    {
                        bonusDamage = ability.GetAbilityData(data.BonusDamageString);
                        outgoingDamage += bonusDamage;
                        damageDictionary.Add(ability, bonusDamage);
                        levelDictionary.Add(ability, ability.Level);
                    }
                    else if (levelDictionary[ability] != ability.Level)
                    {
                        levelDictionary[ability] = ability.Level;
                        bonusDamage = ability.GetAbilityData(data.BonusDamageString);
                        damageDictionary[ability] = bonusDamage;
                        outgoingDamage += bonusDamage;
                    }
                    else
                    {
                        outgoingDamage += bonusDamage;
                    }
                    outgoingDamage = target.DamageTaken(
                        outgoingDamage,
                        DamageType.Physical,
                        source,
                        data.MagicImmunityPierce);
                    break;
                case "doom_bringer_lvl_death":
                    float tempDmg;
                    if (!damageDictionary.TryGetValue(ability, out tempDmg))
                    {
                        tempDmg = ability.GetAbilityData(data.DamageString);
                        damageDictionary.Add(ability, tempDmg);
                        levelDictionary.Add(ability, ability.Level);
                    }
                    else if (levelDictionary[ability] != ability.Level)
                    {
                        levelDictionary[ability] = ability.Level;
                        tempDmg = ability.GetAbilityData(data.DamageString);
                        damageDictionary[ability] = tempDmg;
                    }
                    var multiplier = ability.GetAbilityData("lvl_bonus_multiple");
                    bonusDamage = ability.GetAbilityData("lvl_bonus_damage");
                    var levelc = target.Level / multiplier;
                    if (levelc == Math.Floor(levelc) || target.Level == 25)
                    {
                        tempDmg += target.MaximumHealth * (bonusDamage / 100);
                    }
                    outgoingDamage = target.DamageTaken(tempDmg, DamageType.Magical, source, data.MagicImmunityPierce);
                    break;
                case "phantom_assassin_phantom_strike":
                    var crit = source.Spellbook.SpellR;
                    if (crit.Level > 0)
                    {
                        float critMulti;
                        if (!damageDictionary.TryGetValue(crit, out critMulti))
                        {
                            critMulti = crit.GetAbilityData("crit_bonus");
                            damageDictionary.Add(crit, critMulti);
                            levelDictionary.Add(crit, crit.Level);
                        }
                        else if (levelDictionary[crit] != crit.Level)
                        {
                            levelDictionary[crit] = crit.Level;
                            critMulti = crit.GetAbilityData("crit_bonus");
                            damageDictionary[crit] = critMulti;
                        }
                        outgoingDamage = (source.MinimumDamage + source.BonusDamage) * (critMulti / 100);
                    }
                    outgoingDamage = target.DamageTaken(
//.........这里部分代码省略.........
开发者ID:MarkHC,项目名称:Ensage.Common,代码行数:101,代码来源:AbilityDamage.cs

示例3: CalculateDamage

        /// <summary>
        ///     Calculates damage from given ability on given target
        /// </summary>
        /// <param name="ability"></param>
        /// <param name="source"></param>
        /// <param name="target"></param>
        /// <param name="minusArmor"></param>
        /// <param name="minusDamageResistancePerc"></param>
        /// <param name="minusMagicResistancePerc"></param>
        /// <param name="minusHealth"></param>
        /// <returns></returns>
        public static float CalculateDamage(
            Ability ability, 
            Hero source, 
            Unit target, 
            double minusArmor = 0d, 
            double minusDamageResistancePerc = 0d, 
            double minusMagicResistancePerc = 0d, 
            float minusHealth = 0f)
        {
            var name = ability.StoredName();
            var level = ability.Level;
            if (ability.AbilityType.HasFlag(AbilityType.Ultimate) && level > 0 && source.AghanimState())
            {
                level += 1;
            }

            AbilityInfo data;
            if (!DataDictionary.TryGetValue(ability, out data))
            {
                data = AbilityDatabase.Find(name);
                if (data != null && data.IsNuke)
                {
                    DataDictionary.Add(ability, data);
                }
            }

            // var data = AbilityDatabase.Find(name);
            if (data == null || !data.IsNuke)
            {
                return 0;
            }

            var outgoingDamage = 0f;
            float bonusDamage = 0;
            Hero hero;
            double multi;
            float tempDmg;
            switch (name)
            {
                case "ember_spirit_sleight_of_fist":
                    outgoingDamage = source.MinimumDamage + source.BonusDamage;
                    if (!DamageDictionary.TryGetValue(ability, out bonusDamage))
                    {
                        bonusDamage = ability.GetAbilityData(data.BonusDamageString);
                        outgoingDamage += bonusDamage;
                        DamageDictionary.Add(ability, bonusDamage);
                        LevelDictionary.Add(ability, level);
                    }
                    else if (LevelDictionary[ability] != level)
                    {
                        LevelDictionary[ability] = level;
                        bonusDamage = ability.GetAbilityData(data.BonusDamageString);
                        DamageDictionary[ability] = bonusDamage;
                        outgoingDamage += bonusDamage;
                    }
                    else
                    {
                        outgoingDamage += bonusDamage;
                    }

                    outgoingDamage = target.DamageTaken(
                        outgoingDamage, 
                        DamageType.Physical, 
                        source, 
                        true, 
                        minusMagicResistancePerc: minusMagicResistancePerc);
                    break;
                case "doom_bringer_lvl_death":
                    if (!DamageDictionary.TryGetValue(ability, out tempDmg))
                    {
                        tempDmg = ability.GetAbilityData(data.DamageString);
                        DamageDictionary.Add(ability, tempDmg);
                        LevelDictionary.Add(ability, level);
                    }
                    else if (LevelDictionary[ability] != level)
                    {
                        LevelDictionary[ability] = level;
                        tempDmg = ability.GetAbilityData(data.DamageString);
                        DamageDictionary[ability] = tempDmg;
                    }

                    var multiplier = ability.GetAbilityData("lvl_bonus_multiple");
                    bonusDamage = ability.GetAbilityData("lvl_bonus_damage");
                    var levelc = target.Level / multiplier;
                    if (levelc == Math.Floor(levelc) || target.Level == 25)
                    {
                        tempDmg += target.MaximumHealth * (bonusDamage / 100);
                    }

//.........这里部分代码省略.........
开发者ID:nbIxMaN,项目名称:Ensage.Common,代码行数:101,代码来源:AbilityDamage.cs


注:本文中的Ability.GetAbilityData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。