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


C# Ability.StoredName方法代码示例

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


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

示例1: 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

示例2: UseItem

 private static async Task UseItem(Ability ability, Unit target, CancellationToken cancellationToken)
 {
     if (ComboSleeper.Sleeping("invisAction"))
         return;
     ComboSleeper.Sleep(150, ability);
     if (ability.StoredName() == "item_armlet")
     {
         if (!Members.MyHero.HasModifier("modifier_item_armlet_unholy_strength"))
         {
             ability.ToggleAbility();
         }
         else
         {
             return;
         }
     }
     else if (ability.IsAbilityBehavior(AbilityBehavior.NoTarget))
     {
         ability.UseAbility();
     }
     else if (ability.IsAbilityBehavior(AbilityBehavior.UnitTarget))
     {
         if (ability.TargetTeamType == TargetTeamType.Enemy || ability.TargetTeamType == TargetTeamType.All ||
             ability.TargetTeamType == TargetTeamType.Custom)
         {
             ability.UseAbility(target);
         }
         else
         {
             ability.UseAbility(Members.MyHero);
         }
     }
     Printer.Print($"[{(int) Game.RawGameTime}] [Item] {ability.Name}: {50}");
     await Task.Delay(5, cancellationToken);
 }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:35,代码来源:Core.cs

示例3: Spell

 public Spell(Ability ab)
 {
     Name = ab.StoredName();
     _cd = ab.Cooldown;
     _texture = Textures.GetItemTexture(Name);
 }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:6,代码来源:Spell.cs

示例4: GetDamageType

        /// <summary>
        ///     Returns DamageType of ability
        /// </summary>
        /// <param name="ability"></param>
        /// <returns></returns>
        public static DamageType GetDamageType(Ability ability)
        {
            var type = ability.DamageType;
            var name = ability.StoredName();
            if (name == "abaddon_aphotic_shield")
            {
                type = DamageType.Magical;
            }
            else if (name == "meepo_poof")
            {
                type = DamageType.Magical;
            }
            else if (name == "axe_culling_blade")
            {
                type = DamageType.Pure;
            }
            else if (name == "invoker_sun_strinke")
            {
                type = DamageType.Pure;
            }
            else if (name == "alchemist_unstable_concoction_throw")
            {
                type = DamageType.Physical;
            }
            else if (name == "centaur_stampede")
            {
                type = DamageType.Physical;
            }
            else if (name == "lina_laguna_blade")
            {
                if ((ability.Owner as Hero).AghanimState())
                {
                    type = DamageType.Pure;
                }
            }
            else if (name == "legion_commander_duel")
            {
                type = DamageType.Physical;
            }
            else if (name.StartsWith("item_dagon"))
            {
                type = DamageType.Magical;
            }
            else if (name == "item_ethereal_blade")
            {
                type = DamageType.Magical;
            }
            else if (name == "tusk_walrus_kick")
            {
                type = DamageType.Magical;
            }
            else if (name == "tusk_walrus_punch")
            {
                type = DamageType.Physical;
            }
            else if (name == "item_shivas_guard")
            {
                type = DamageType.Magical;
            }
            else if (name == "chaos_knight_reality_rift")
            {
                type = DamageType.Physical;
            }
            else if (name == "item_veil_of_discord")
            {
                type = DamageType.Magical;
            }

            // Console.WriteLine(ability.Name.Substring(0, "item_dagon".Length));
            return type;
        }
开发者ID:nbIxMaN,项目名称:Ensage.Common,代码行数:76,代码来源:AbilityDamage.cs

示例5: IsLocked

        private bool IsLocked(Ability ability, IEnumerable<Ability> learnableAbilities)
        {
            var lockLevel = menuManager.AbilityLockLevel(ability.StoredName());

            if (lockLevel <= 0)
            {
                return false;
            }

            var abilityLevel = ability.Level;

            var otherNotLockedAbility =
                learnableAbilities.Any(
                    x =>
                        !x.Equals(ability) && x.AbilityType != AbilityType.Attribute
                        && (menuManager.AbilityLockLevel(x.StoredName()) == 0
                            || menuManager.AbilityLockLevel(x.StoredName()) > x.Level)
                        && !menuManager.AbilityFullyLocked(x.StoredName()));

            return abilityLevel >= lockLevel
                   && (otherNotLockedAbility || menuManager.AbilityFullyLocked(ability.StoredName()));
        }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:22,代码来源:AbilityLeveling.cs

示例6: IsAbilityEnable

 public static bool IsAbilityEnable(Ability name)
 {
     return Members.Menu.Item("abilityEnable").GetValue<AbilityToggler>().IsEnabled(name.StoredName());
 }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:4,代码来源:Helper.cs

示例7: ForceLearn

        private bool ForceLearn(Ability ability)
        {
            var forceHeroLevel = menuManager.ForceAbilityLearnHeroLevel(ability.StoredName());

            if (forceHeroLevel <= 0 || ability.Level >= 1)
            {
                return false;
            }

            return hero.Level >= forceHeroLevel;
        }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:11,代码来源:AbilityLeveling.cs

示例8: CastCombo

        private static void CastCombo(Hero globalTarget, Ability laser, Ability rockets, bool singleCombo = false)
        {
            var myInventory = Members.MyHero.Inventory.Items.ToList();
            var allItems = myInventory.Where(x =>
                Helper.IsItemEnable(x.StoredName()) && x.CanBeCasted()).ToList();
            var distance = Members.MyHero.Distance2D(globalTarget);
            var daggerCastRange = 1150 + (myInventory.Any(x => x.StoredName() == "item_aether_lens") ? 200 : 0);
            var inventory =
                allItems.Where(
                    x =>
                         ((x.StoredName() == "item_blink" && distance <= daggerCastRange + CloseRange) ||
                         (x.GetCastRange() > 0 && x.CanHit(globalTarget) /* && distance <= x.GetCastRange() + 150*/) ||
                         (x.GetCastRange() <= 0)) && Utils.SleepCheck($"{x.Handle}+item_usages"))
                    .ToList();

            if (laser != null && Helper.IsAbilityEnable(laser.StoredName()) && laser.CanBeCasted() &&
                laser.CanHit(globalTarget) && !_spellSleeper.Sleeping(laser))
            {
                laser.UseAbility(globalTarget);
                _spellSleeper.Sleep(1000, laser);
            }
            var slarkMod = globalTarget.HasModifiers(new[] { "modifier_slark_dark_pact", "modifier_slark_dark_pact_pulses" }, false);
            foreach (var item in inventory.OrderByDescending(Helper.PriorityHelper))
            {
                var name = item.StoredName();
                if (name == "item_ethereal_blade")
                    _ethereal.Sleep(1000);
                if (name.Contains("dagon"))
                    if (_ethereal.Sleeping && !globalTarget.HasModifier("modifier_item_ethereal_blade_ethereal"))
                        continue;
                if (item.IsAbilityBehavior(AbilityBehavior.NoTarget))
                {
                    item.UseAbility();
                }
                else if (item.IsAbilityBehavior(AbilityBehavior.UnitTarget))
                    if (item.TargetTeamType == TargetTeamType.Enemy || item.TargetTeamType == TargetTeamType.All ||
                        item.TargetTeamType == TargetTeamType.Custom)
                    {
                        if (item.IsDisable())
                        {
                            if (!slarkMod && !globalTarget.IsLinkensProtected())
                                item.UseAbility(globalTarget);
                                /*if (item.CastStun(globalTarget))
                                {
                                    Utils.Sleep(250, $"{item.Handle}+item_usages");
                                    continue;
                                }*/
                        }
                        else if (item.IsSilence())
                        {
                            if (!slarkMod)
                                if (!globalTarget.IsSilenced())
                                {
                                    item.UseAbility(globalTarget);
                                }
                        }
                        else if ((item.StoredName().Contains("dagon") || item.StoredName() == "item_ethereal_blade") &&
                                 globalTarget.HasModifiers(
                                     new[]
                                     {
                                         /*"modifier_templar_assassin_refraction_absorb",
                                         "modifier_templar_assassin_refraction_absorb_stacks",*/
                                         "modifier_oracle_fates_edict",
                                         "modifier_abaddon_borrowed_time"
                                     }, false))
                        {
                            continue;
                        }
                        else
                        {
                            item.UseAbility(globalTarget);
                        }

                        /*item.UseAbility(target);
                        Print($"[Using]: {item.Name} (3)", print: false);*/
                    }
                    else
                    {
                        item.UseAbility(Members.MyHero);
                    }
                else
                {
                    if (name == "item_blink")
                    {
                        if (singleCombo || _spellSleeper.Sleeping("blink_fix"))
                            continue;
                        if (distance > daggerCastRange+CloseRange)
                        {
                            var angle = Members.MyHero.FindAngleBetween(globalTarget.Position, true);
                            var point = new Vector3(
                                (float)
                                    (globalTarget.Position.X -
                                     daggerCastRange *
                                     Math.Cos(angle)),
                                (float)
                                    (globalTarget.Position.Y -
                                     daggerCastRange *
                                     Math.Sin(angle)),
                                globalTarget.Position.Z);
                            var dist = Members.MyHero.Distance2D(point);
//.........这里部分代码省略.........
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:101,代码来源:ComboAction.cs

示例9: UseAbility

        private static async Task UseAbility(Ability ability, Unit target, CancellationToken cancellationToken,
            int extraDelay = 0)
        {
            if (ability.CanBeCasted() && ability.CanHit(target) && Helper.IsAbilityEnable(ability.StoredName()))
            {
                var cPont = ability.GetCastDelay(Members.MyHero, target, true)*1000 + 250;

                switch (ability.StoredName())
                {
                    case "riki_smoke_screen":
                        ability.UseAbility(Prediction.PredictedXYZ(target, (float) cPont));
                        break;
                    default:
                        ability.UseAbility(target);
                        break;

                }
                Printer.Print($"[{(int) Game.RawGameTime}] [Ability] {ability.Name}: {cPont}");
                await Task.Delay((int) cPont, cancellationToken);
            }
            else
            {
                //Printer.Print($"[CANT]: ({ability.Name})");
            }
        }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:25,代码来源:Core.cs

示例10: ComboInAction

        private static void ComboInAction(Hero me, Hero target)
        {
            #region Init
            /*
            var q = me.Spellbook.SpellQ;
            var w = me.Spellbook.SpellW;
            var e = me.Spellbook.SpellE;
            var active1 = me.Spellbook.Spell4;
            var active2 = me.Spellbook.Spell5;
            */
            var items = me.Inventory.Items.ToList();
            var invoke = Abilities.FindAbility("invoker_invoke");

            var eul = items.FirstOrDefault(x=>x.StoredName()=="item_cyclone");
            var dagger = items.FirstOrDefault(x=>x.StoredName()=="item_blink");
            var refresher = items.FirstOrDefault(x=>x.StoredName()=="item_refresher");
            var hex = items.FirstOrDefault(x=>x.StoredName()=="item_sheepstick");
            var urn = items.FirstOrDefault(x=>x.StoredName()=="item_urn_of_shadows");
            var orchid = items.FirstOrDefault(x=>x.StoredName()=="item_orchid");
            var bloodthorn = items.FirstOrDefault(x=>x.StoredName()=="item_bloodthorn");

            var meteor = Abilities.FindAbility("invoker_chaos_meteor");
            var ss = Abilities.FindAbility("invoker_sun_strike");
            var icewall = Abilities.FindAbility("invoker_ice_wall");
            var deafblast = Abilities.FindAbility("invoker_deafening_blast");
            //var emp = me.FindSpell("invoker_emp");
            /*

            var coldsnap = me.FindSpell("invoker_cold_snap");
            var ghostwalk = me.FindSpell("invoker_ghost_walk");

            var tornado = me.FindSpell("invoker_tornado");

            var forge = me.FindSpell("invoker_forge_spirit");

            var alacrity = me.FindSpell("invoker_alacrity");

            */
            if (!_initNewCombo)
            {
                _initNewCombo = true;
                _stage = 1;
                if (ComboSwitcher)
                    _startComboPosition = _combo;
                //PrintInfo("Starting new combo! " + $"[{_combo + 1}] target: {target.StoredName()}");
            }
            if (!Utils.SleepCheck("StageCheck")) return;
            #endregion

            /*var modif = target.Modifiers.Where(x=>x.IsDebuff);
            PrintInfo("===========================");
            foreach (var s in modif)
            {
                PrintInfo(s.StoredName());
            }*/
            var myBoys = ObjectManager.GetEntities<Unit>().Where(x => x.Team == me.Team && x.IsControllable && x.IsAlive && Utils.SleepCheck(x.Handle.ToString()));
            if (!target.IsInvul())
                foreach (var myBoy in myBoys)
                {
                    if (myBoy is Hero)
                    {
                        //Orbwalking.Orbwalk(target, 0, 0, false, true);
                    }
                    else
                    {
                        Orbwalker orb;
                        if (!OrbDictinary.TryGetValue(myBoy, out orb))
                        {
                            OrbDictinary.Add(myBoy, new Orbwalker(myBoy));
                        }
                        orb = null;
                        if (orb != null)
                        {
                            orb.Attack(target, true);
                        }
                        else
                        {
                            myBoy.Attack(target);
                            Utils.Sleep(300, myBoy.Handle.ToString());
                        }

                    }

                }
            if (me.CanUseItems())
            {
                if (urn != null && urn.CanBeCasted(target))
                {
                    var urnMod = target.HasModifier("modifier_item_urn_damage") &&
                                 Utils.SleepCheck(urn.StoredName());
                    if (!urnMod)
                    {
                        urn.UseAbility(target);
                        Utils.Sleep(300, urn.StoredName());
                    }
                }
                if (_stage > 0 && !target.IsHexed())
                {
                    if (hex != null && hex.CanBeCasted(target) &&
                        Menu.Item("items").GetValue<AbilityToggler>().IsEnabled(hex.StoredName()) &&
//.........这里部分代码省略.........
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:101,代码来源:Program.cs

示例11: LetsTryCastSpell

        private static void LetsTryCastSpell(Hero me, Hero target, Ability spellForCast, bool nextSpell=false)
        {
            var ss = Abilities.FindAbility("invoker_sun_strike");
            var icewall = Abilities.FindAbility("invoker_ice_wall");
            var blast = Abilities.FindAbility("invoker_deafening_blast");
            var tornado = Abilities.FindAbility("invoker_tornado");
            var emp = Abilities.FindAbility("invoker_emp");
            /*
            var coldsnap = me.FindSpell("invoker_cold_snap");
            var ghostwalk = me.FindSpell("invoker_ghost_walk");

            var forge = me.FindSpell("invoker_forge_spirit");
            var emp = me.FindSpell("invoker_emp");
            var alacrity = me.FindSpell("invoker_alacrity");
            */
            var meteor = Abilities.FindAbility("invoker_chaos_meteor");
            var eulmodif = target.FindModifier("modifier_eul_cyclone") ??
                           target.FindModifier("modifier_invoker_tornado");
            /*foreach (var source in target.Modifiers.ToList())
            {
                PrintInfo(source.StoredName()+": "+source.RemainingTime);
            }*/
            var timing = Equals(spellForCast, ss)
                ? 1.7
                : Equals(spellForCast, meteor)
                    ? 1.3
                    : Equals(spellForCast, blast)
                        ? me.Distance2D(target)/1100 + Game.Ping/1000
                        : (Equals(spellForCast, icewall))
                            ? 2.5
                            : Equals(spellForCast, emp) ? 2.9 : 0;

            if (eulmodif!=null && eulmodif.RemainingTime<=timing)
            {
                if (icewall != null && Equals(spellForCast, icewall))
                {
                    CastIceWall(me, target, me.Distance2D(target) <= 250,icewall);
                }
                else
                {
                    UseSpell(spellForCast, target,me);
                    //Game.PrintMessage(spellForCast.StoredName()+" (2)", MessageType.ChatMessage);
                    //PrintInfo("caster "+spellForCast.StoredName()+" with timing "+timing);
                    Utils.Sleep(250, "StageCheck");
                    _stage++;
                }
            }
            else if (eulmodif == null /*&& !Equals(spellForCast, ss)*/)
            {
                if (icewall != null && Equals(spellForCast, icewall))
                {
                    CastIceWall(me, target, me.Distance2D(target) <= 300, icewall);
                }
                else
                {
                    if (me.Distance2D(target) <= 800)
                    {
                        var time = 250f;
                        if (Equals(spellForCast, tornado))
                        {
                            if (nextSpell)
                                time += me.Distance2D(target)/spellForCast.GetProjectileSpeed()*1000 + Game.Ping + 150;

                            spellForCast.CastSkillShot(target, me.Position, spellForCast.StoredName());
                            //Game.PrintMessage("CastSkillShot "+spellForCast.CastSkillShot(target, me.Position,spellForCast.StoredName()),MessageType.ChatMessage);
                        }
                        else
                        {
                            //Game.PrintMessage("suka: " + spellForCast.StoredName(),MessageType.ChatMessage);
                            UseSpell(spellForCast, target, me);
                        }
                        Utils.Sleep(time, "StageCheck");
                        _stage++;
                    }
                    else if (Utils.SleepCheck("range_moving"))
                    {
                        Utils.Sleep(200, "range_moving");
                        me.Move(target.Position);
                    }
                }
            }
        }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:82,代码来源:Program.cs


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