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


C# Hero.FindSpell方法代码示例

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


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

示例1: Game_OnUpdate

        private static void Game_OnUpdate(EventArgs args)
        {
            if (!loaded)
            {
                me = ObjectMgr.LocalHero;
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Ursa)
                {
                    return;
                }
                earthshock = me.Spellbook.Spell1;
                overpower = me.Spellbook.SpellW;
                enrage = me.FindSpell("ursa_enrage");
                blink = me.FindItem("item_blink");
                abyssalBlade = me.FindItem("item_abyssal_blade");
                scytheOfVyse = me.FindItem("item_sheepstick");
                loaded = true;
            }

            if (!Game.IsInGame || me == null)
            {
                overpowerCastPoint = 0;
                earthshockCastPoint = 0;
                loaded = false;
                me = null;
                target = null;
                earthshock = null;
                overpower = null;
                enrage = null;
                abyssalBlade = null;
                scytheOfVyse = null;
                blink = null;
                return;
            }

            if (Game.IsPaused)
            {
                return;
            }

            if (blink == null)
            {
                blink = me.FindItem("item_blink");
            }

            if (abyssalBlade == null)
            {
                abyssalBlade = me.FindItem("item_abyssal_blade");
            }

            if (abyssalBlade == null)
            {
                abyssalBlade = me.FindItem("item_sheepstick");
            }

            if (earthshock == null)
            {
                earthshock = me.Spellbook.Spell1;
            }
            else if (earthshockCastPoint == 0)
            {
                earthshockCastPoint = 0.3;
            }

            if (overpower == null)
            {
                overpower = me.Spellbook.SpellW;
            }
            else if (overpowerCastPoint == 0)
            {
                overpowerCastPoint = 0.3;
            }

            if (enrage == null)
            {
                enrage = me.FindSpell("ursa_enrage");
            }

            if (!Game.IsKeyDown(Key.Space) || Game.IsChatOpen)
            {
                target = null;
                return;
            }
            if (Utils.SleepCheck("blink"))
            {
                mePosition = me.Position;
            }
            if (earthshock.IsInAbilityPhase && (target == null || !target.IsAlive || target.Distance2D(me) > earthshock.AbilityData.FirstOrDefault(x => x.Name == "shock_radius").GetValue(0)))
            {
                me.Stop();
                if (target != null)
                {
                    me.Attack(target);
                }
            }
            if (overpower.IsInAbilityPhase && (target == null || !target.IsAlive))
            {
                me.Stop();
                if (target != null)
                {
                    me.Attack(target);
//.........这里部分代码省略.........
开发者ID:0Metrix0,项目名称:EnsageSharp,代码行数:101,代码来源:UrsaRage.cs

示例2: InvokeNeededSpells

 private static void InvokeNeededSpells(Hero me)
 {
     var spell1 = _spellForCast = Combos[_combo].GetComboAbilities()[0];
     var spell2 = _spellForCast = Combos[_combo].GetComboAbilities()[1];
     var active1 = me.Spellbook.Spell4;
     var active2 = me.Spellbook.Spell5;
     if ((Equals(spell1, active1) || Equals(spell1, active2)) && (Equals(spell2, active1) || Equals(spell2, active2)))
     {
     }
     else
     {
         SpellStruct s;
         if (Equals(spell1, active2))
         {
             if (!SpellInfo.TryGetValue(spell1.Name, out s)) return;
         }
         else if (Equals(spell2, active2))
         {
             if (!SpellInfo.TryGetValue(spell2.Name, out s)) return;
         }
         else if (Equals(spell1, active1) || Equals(spell1, active2))
         {
             if (!SpellInfo.TryGetValue(spell2.Name, out s)) return;
         }
         else
         {
             if (!SpellInfo.TryGetValue(spell1.Name, out s)) return;
         }
         var invoke = me.FindSpell("invoker_invoke");
         if (!invoke.CanBeCasted()) return;
         var spells = s.GetNeededAbilities();
         spells[0]?.UseAbility();
         spells[1]?.UseAbility();
         spells[2]?.UseAbility();
         invoke.UseAbility();
         Utils.Sleep(Game.Ping + 50, "GettingNeededSpells");
     }
 }
开发者ID:dendimonster,项目名称:EnsageSharp-1,代码行数:38,代码来源:Program.cs

示例3: CalculateDamage


//.........这里部分代码省略.........
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Creep
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Creature
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Invoker_Forged_Spirit
                                    || x.ClassID == ClassID.CDOTA_Unit_Undying_Zombie
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Warlock_Golem
                                    || (x is Hero
                                        && (x.Team == source.Team
                                            || (x.Team == source.GetEnemyTeam() && !x.IsMagicImmune())))) && x.IsAlive
                                && x.IsVisible && x.Distance2D(source) < radius + x.HullRadius);
                    var damagePerUnit = ability.GetAbilityData("damage_per_unit");
                    var maxUnits = ability.GetAbilityData("max_units");
                    outgoingDamage = Math.Min(nearUnits.Count(), maxUnits) * damagePerUnit;
                    outgoingDamage = target.DamageTaken(
                        outgoingDamage, 
                        DamageType.Magical, 
                        source, 
                        data.MagicImmunityPierce, 
                        minusMagicResistancePerc: minusMagicResistancePerc);
                    break;
                default:
                    var damageString = data.DamageString;
                    if (damageString == null)
                    {
                        outgoingDamage = ability.GetDamage(level - 1);

                        // Convert.ToSingle(
                        // Game.FindKeyValues(name + "/AbilityDamage", KeyValueSource.Ability)
                        // .StringValue.Split(' ')[level - 1]);
                    }
                    else
                    {
                        if (ability.AbilityType.HasFlag(AbilityType.Ultimate) && level > 0 && source.AghanimState())
                        {
                            level -= 1;
                        }

                        if (data.SpellLevel != null)
                        {
                            var spellLevel = source.FindSpell(data.SpellLevel);
                            level = spellLevel.Level;
                        }

                        if (source.ClassID == ClassID.CDOTA_Unit_Hero_Invoker && level > 0 && source.AghanimState())
                        {
                            level += 1;
                        }

                        if (data.DamageScepterString != null && source.AghanimState())
                        {
                            outgoingDamage = ability.GetAbilityData(data.DamageScepterString, level);
                        }
                        else
                        {
                            outgoingDamage = ability.GetAbilityData(damageString, level);
                        }

                        if (data.DamageMultiplier > 0)
                        {
                            outgoingDamage = outgoingDamage * data.DamageMultiplier;
                        }

                        // Console.WriteLine(outgoingDamage + " " + ability.Name + " " + GetDamageType(ability));
                    }

                    // Console.WriteLine(outgoingDamage);
                    outgoingDamage = target.DamageTaken(
                        outgoingDamage, 
                        GetDamageType(ability), 
                        source, 
                        data.MagicImmunityPierce, 
                        minusMagicResistancePerc: minusMagicResistancePerc);
                    break;
            }

            var aetherLens = source.FindItem("item_aether_lens");
            if (aetherLens != null && ability.StoredName() != "axe_culling_blade")
            {
                outgoingDamage *= 1 + (aetherLens.GetAbilityData("spell_amp") / 100);
            }

            if (source.ClassID == ClassID.CDOTA_Unit_Hero_Zuus && !(ability is Item)
                && (source.Distance2D(target) <= 1200 || ability.StoredName() != "zuus_thundergods_wrath"))
            {
                var staticField = source.Spellbook.Spell3;
                if (staticField.Level > 0)
                {
                    var bonusDmg = staticField.GetAbilityData("damage_health_pct") / 100 * (target.Health - minusHealth);
                    bonusDmg = target.DamageTaken(
                        bonusDmg, 
                        DamageType.Magical, 
                        source, 
                        minusMagicResistancePerc: minusMagicResistancePerc) * (aetherLens == null ? 1 : 1.08f);
                    outgoingDamage += bonusDmg;
                }
            }

            return outgoingDamage;
        }
开发者ID:nbIxMaN,项目名称:Ensage.Common,代码行数:101,代码来源:AbilityDamage.cs

示例4: CalculateDamage


//.........这里部分代码省略.........
                        damageDictionary[ability] = bonusDamage;
                    }
                    outgoingDamage = target.DamageTaken(
                        bonusDamage,
                        DamageType.Magical,
                        source,
                        data.MagicImmunityPierce);
                    if (source.Distance2D(target) < radiusMax)
                    {
                        outgoingDamage *= 2;
                    }
                    break;
                case "nyx_assassin_mana_burn":
                    var intMultiplier = ability.GetAbilityData("float_multiplier");
                    var hero = target as Hero;
                    outgoingDamage = target.ManaBurnDamageTaken(
                        hero.TotalIntelligence * intMultiplier,
                        1,
                        DamageType.Magical,
                        source);
                    break;
                case "riki_blink_strike":
                    var damage = ability.GetAbilityData(data.DamageString);
                    var backstab = source.Spellbook.SpellE;
                    var agiMultiplier = backstab.GetAbilityData("damage_multiplier");
                    var blinkdamage = target.DamageTaken(damage, DamageType.Magical, source, data.MagicImmunityPierce);
                    outgoingDamage = blinkdamage
                                     + target.DamageTaken(
                                         agiMultiplier * source.TotalAgility
                                         + (source.MinimumDamage + source.BonusDamage),
                                         DamageType.Physical,
                                         source,
                                         data.MagicImmunityPierce);
                    break;
                case "undying_soul_rip":
                    var radius = ability.GetAbilityData("radius");
                    var nearUnits =
                        ObjectMgr.GetEntities<Unit>()
                            .Where(
                                x =>
                                (x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane
                                 || x.ClassID == ClassID.CDOTA_BaseNPC_Creep
                                 || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral
                                 || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege
                                 || x.ClassID == ClassID.CDOTA_BaseNPC_Creature
                                 || x.ClassID == ClassID.CDOTA_BaseNPC_Invoker_Forged_Spirit
                                 || x.ClassID == ClassID.CDOTA_Unit_Undying_Zombie
                                 || x.ClassID == ClassID.CDOTA_BaseNPC_Warlock_Golem
                                 || (x is Hero
                                     && (x.Team == source.Team
                                         || (x.Team == source.GetEnemyTeam() && !x.IsMagicImmune())))) && x.IsAlive
                                && x.IsVisible && x.Distance2D(source) < (radius + x.HullRadius));
                    var damagePerUnit = ability.GetAbilityData("damage_per_unit");
                    var maxUnits = ability.GetAbilityData("max_units");
                    outgoingDamage = Math.Min(nearUnits.Count(), maxUnits) * damagePerUnit;
                    outgoingDamage = target.DamageTaken(
                        outgoingDamage,
                        DamageType.Magical,
                        source,
                        data.MagicImmunityPierce);
                    break;
                default:
                    var damageString = data.DamageString;
                    if (damageString == null)
                    {
                        outgoingDamage =
                            Convert.ToSingle(
                                Game.FindKeyValues(name + "/AbilityDamage", KeyValueSource.Ability)
                                    .StringValue.Split(' ')[level - 1]);
                    }
                    else
                    {
                        if (data.SpellLevel != null)
                        {
                            var spellLevel = source.FindSpell(data.SpellLevel);
                            level = spellLevel.Level;
                        }
                        if (source.AghanimState() && data.DamageScepterString != null)
                        {
                            outgoingDamage = ability.GetAbilityData(data.DamageScepterString, level);
                        }
                        else
                        {
                            outgoingDamage = ability.GetAbilityData(damageString, level);
                        }

                        if (data.DamageMultiplier > 0)
                        {
                            outgoingDamage = outgoingDamage * data.DamageMultiplier;
                        }
                        outgoingDamage = target.DamageTaken(
                            outgoingDamage,
                            GetDamageType(ability),
                            source,
                            data.MagicImmunityPierce);
                    }
                    break;
            }
            return outgoingDamage;
        }
开发者ID:MarkHC,项目名称:Ensage.Common,代码行数:101,代码来源:AbilityDamage.cs

示例5: LetsTryCastSpell

 private static void LetsTryCastSpell(Hero me, Hero target, Ability spellForCast)
 {
     var ss = me.FindSpell("invoker_sun_strike");
     var icewall = me.FindSpell("invoker_ice_wall");
     var blast = me.FindSpell("invoker_deafening_blast");
     /*
     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 emp = me.FindSpell("invoker_emp");
     var alacrity = me.FindSpell("invoker_alacrity");
     */
     var meteor = me.FindSpell("invoker_chaos_meteor");
     var eulmodif = target.Modifiers.FirstOrDefault(x => x.Name == "modifier_eul_cyclone" || x.Name == "modifier_invoker_tornado");
     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: 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);
             //PrintInfo("caster "+spellForCast.Name+" 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
         {
             UseSpell(spellForCast, target);
             //PrintInfo(spellForCast.Name);
             Utils.Sleep(250, "StageCheck");
             _stage++;
         }
     }
 }
开发者ID:popopxD,项目名称:JumpAttacker_EnsageSharp_fork,代码行数:51,代码来源:Program.cs

示例6: Game_OnUpdate

        private static void Game_OnUpdate(EventArgs args)
        {
            if (!loaded)
            {
                me = ObjectMgr.LocalHero;
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Ursa)
                {
                    return;
                }
                arcQ = me.Spellbook.Spell1;
                lightningW = me.Spellbook.SpellW;
                WrathR = me.FindSpell("zuus_thundergods_wrath");
                blink = me.FindItem("item_blink");
                orchid = me.FindItem("item_orchid");
                scytheOfVyse = me.FindItem("item_sheepstick");
                arcane = me.FindItem("item_arcane_boots");
                shiva = me.FindItem("item_shivas_guard");
                soulring = me.FindItem("item_soul_ring");
                dagon = me.FindItem("item_dagon");
                veil = me.FindItem("item_veil_of_discord");
                loaded = true;
            }

            if (!Game.IsInGame || me == null)
            {
                lightningWcastpoint = 1000;
                arcQcastpoint = 1000;
                loaded = false;
                me = null;
                target = null;
                arcQ = null;
                lightningW = null;
                WrathR = null;
                dagon = null;
                scytheOfVyse = null;
                blink = null;
                arcane = null;
                shiva = null;
                soulring = null;
                orchid = null;
                veil = null;

                return;
            }

            if (Game.IsPaused)
            {
                return;
            }

            if (blink == null)
            {
                blink = me.FindItem("item_blink");
            }

            if (orchid == null)
            {
                orchid = me.FindItem("item_orchid");
            }

            if (shiva == null)
            {
                shiva = me.FindItem("item_shivas_guard");
            }

            if (dagon == null)
            {
                dagon = me.FindItem("item_dagon");
            }

            if (scytheOfVyse == null)
            {
                scytheOfVyse = me.FindItem("item_sheepstick");
            }

            if (veil == null)
            {
                veil = me.FindItem("item_veil_of_discord");
            }

            if (soulring == null)
            {
                soulring = me.FindItem("item_soul_ring");
            }

            if (arcQ == null)
            {
                arcQ = me.Spellbook.Spell1;
            }
            else if (arcQcastpoint == 1000)
            {
                arcQcastpoint = 0.3;
            }

            if (lightningW == null)
            {
                lightningW = me.Spellbook.SpellW;
            }
            else if (lightningWcastpoint == 1000)
            {
//.........这里部分代码省略.........
开发者ID:luigiguido45,项目名称:goldilocks,代码行数:101,代码来源:GodofThunder.cs

示例7: Game_OnUpdate

        private static void Game_OnUpdate(EventArgs args)
        {
            me = ObjectManager.LocalHero;
            if (!Game.IsInGame || Game.IsWatchingGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Tusk) return;

            Active = Game.IsKeyDown(Menu.Item("keyBind").GetValue<KeyBind>().Key) && !Game.IsChatOpen;
            e = me.ClosestToMouseTarget(2000);

            if (!Menu.Item("enabled").IsActive())
                return;
            if (e == null) return;
            if (Active && e.IsAlive && !e.IsInvul() && !e.IsIllusion)
            {
                Q = me.Spellbook.SpellQ;

                W = me.Spellbook.SpellW ?? me.FindSpell("tusk_launch_snowball");

                E = me.Spellbook.SpellE;

                R = me.Spellbook.SpellR;

                urn = me.FindItem("item_urn_of_shadows");

                blink = me.FindItem("item_blink");

                satanic = me.FindItem("item_satanic");

                dagon = me.Inventory.Items.FirstOrDefault(item => item.Name.Contains("item_dagon"));

                halberd = me.FindItem("item_heavens_halberd");

                medall = me.FindItem("item_medallion_of_courage") ?? me.FindItem("item_solar_crest");

                abyssal = me.FindItem("item_abyssal_blade");

                mjollnir = me.FindItem("item_mjollnir");

                soul = me.FindItem("item_soul_ring");

                arcane = me.FindItem("item_arcane_boots");

                mom = me.FindItem("item_mask_of_madness");

                shiva = me.FindItem("item_shivas_guard");

                mail = me.FindItem("item_blade_mail");

                bkb = me.FindItem("item_black_king_bar");

                var v =
                    ObjectManager.GetEntities<Hero>()
                        .Where(x => x.Team != me.Team && x.IsAlive && x.IsVisible && !x.IsIllusion)
                        .ToList();

                var linkens = e.IsLinkensProtected();
                var ModifW = me.HasModifier("modifier_tusk_snowball_movement");
                var medallModiff =
                    e.HasModifier("modifier_item_medallion_of_courage_armor_reduction") ||
                    e.HasModifier("modifier_item_solar_crest_armor_reduction");

                if (Menu.Item("orbwalk").GetValue<bool>() && me.Distance2D(e) <= 1900)
                {
                    Orbwalking.Orbwalk(e, 0, 1600, true, true);
                }

                if (me.IsInvisible())
                    return;
                if ( // Q Skill
                    Q != null
                    && Q.CanBeCasted()
                    && me.CanCast()
                    && Menu.Item("Skills").GetValue<AbilityToggler>().IsEnabled(Q.Name)
                    && ModifW
                    && !e.IsMagicImmune()
                    && me.Distance2D(e) <= 300
                    && Utils.SleepCheck("Q")
                    )
                {
                    Q.UseAbility(e.Predict(400));
                    Utils.Sleep(200, "Q");
                } // Q Skill end

                if ( //R Skill
                    R != null
                    && (medallModiff
                        || e.IsMagicImmune()
                        || medall == null)
                    && R.CanBeCasted()
                    && me.CanCast()
                    && !linkens
                    && Menu.Item("Skills").GetValue<AbilityToggler>().IsEnabled(R.Name)
                    && me.Distance2D(e) <= 350
                    && Utils.SleepCheck("R")
                    )
                {
                    R.UseAbility(e);
                    Utils.Sleep(150, "R");
                } // R Skill end

                if (urn != null && urn.CanBeCasted() && urn.CurrentCharges > 0 && me.Distance2D(e) <= 800 &&
//.........这里部分代码省略.........
开发者ID:VickTheRock,项目名称:ReworkAllScripts,代码行数:101,代码来源:Program.cs

示例8: SefcastAbility

 public SefcastAbility(Hero owner, string ability)
     : base(owner, owner.FindSpell(ability))
 {
 }
开发者ID:EnsageSharp,项目名称:Ensage.Common,代码行数:4,代码来源:SefcastAbility.cs

示例9: SkillshotAbility

 public SkillshotAbility(Hero owner, string ability, IPredictionInput prediction = null)
     : this(owner, (Ability)owner.FindSpell(ability), prediction)
 {
 }
开发者ID:EnsageSharp,项目名称:Ensage.Common,代码行数:4,代码来源:SkillshotAbility.cs

示例10: Game_OnUpdate

        private static void Game_OnUpdate(EventArgs args)
        {
            if (!loaded)
            {
                me = ObjectMgr.LocalHero;
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Ursa)
                {
                    return;
                }
                earthshock = me.Spellbook.Spell1;
                overpower = me.Spellbook.SpellW;
                enrage = me.FindSpell("ursa_enrage");
                blink = me.FindItem("item_blink");
                abyssalBlade = me.FindItem("item_abyssal_blade");
                scytheOfVyse = me.FindItem("item_sheepstick");
                loaded = true;
                Game.PrintMessage(
                    "<font color='#3377ff'></font><font face='Tahoma' size='9'><font color='#ff9900'></font></font>",
                    MessageType.ChatMessage);
            }

            if (!Game.IsInGame || me == null)
            {
                overpowerCastPoint = 0;
                earthshockCastPoint = 0;
                loaded = false;
                me = null;
                target = null;
                earthshock = null;
                overpower = null;
                enrage = null;
                abyssalBlade = null;
                scytheOfVyse = null;
                blink = null;
                return;
            }

            if (!menuvalueSet)
            {
                menuValue = Menu.Item("enabledAbilities").GetValue<AbilityToggler>();
                menuvalueSet = true;
                //Utils.Sleep(100000, "updateMenuValue");
            }

            if (Game.IsPaused)
            {
                return;
            }

            if (blink == null)
            {
                blink = me.FindItem("item_blink");
            }

            if (abyssalBlade == null)
            {
                abyssalBlade = me.FindItem("item_abyssal_blade");
            }

            if (abyssalBlade == null)
            {
                abyssalBlade = me.FindItem("item_sheepstick");
            }

            if (earthshock == null)
            {
                earthshock = me.Spellbook.Spell1;
            }
            else if (earthshockCastPoint == 0)
            {
                earthshockCastPoint = 0.3;
            }

            if (overpower == null)
            {
                overpower = me.Spellbook.SpellW;
            }
            else if (overpowerCastPoint == 0)
            {
                overpowerCastPoint = 0.3;
            }

            if (enrage == null)
            {
                enrage = me.FindSpell("ursa_enrage");
            }

            if (!Menu.Item("comboKey").GetValue<KeyBind>().Active || Game.IsChatOpen)
            {
                target = null;
                return;
            }
            if (Utils.SleepCheck("blink"))
            {
                mePosition = me.Position;
            }
            if (earthshock.IsInAbilityPhase
                && (target == null || !target.IsAlive
                    || target.Distance2D(me) > earthshock.GetAbilityData("shock_radius")))
            {
//.........这里部分代码省略.........
开发者ID:dabest1111,项目名称:EnsageSharp,代码行数:101,代码来源:UrsaRage.cs

示例11: AutoUsage

        public static bool AutoUsage(
            Hero enemyHero, 
            Hero[] enemyHeroes, 
            float meMissingHp,
            float ping, 
            Hero me, 
            float mana)
        {
            var hero = enemyHero;
            var heroName = NameManager.Name(hero);
            var heroDistance = MyHeroInfo.Position.Distance2D(hero);
            if (Utils.SleepCheck("GlobalCasting") && Utils.SleepCheck("casting"))
            {
                if (me.ClassID == ClassID.CDOTA_Unit_Hero_Tusk
                    && Dictionaries.InDamageDictionary.ContainsKey(hero.Handle)
                    && (Dictionaries.OutDamageDictionary[hero.Handle] + Dictionaries.InDamageDictionary[hero.Handle])
                    >= enemyHero.Health && Utils.SleepCheck("tusk_snowball") && heroDistance <= 1350
                    && me.FindSpell("tusk_snowball").CanBeCasted())
                {
                    if (!Nuke.Cast(me.FindSpell("tusk_snowball"), hero, "tusk_snowball"))
                    {
                        return false;
                    }

                    DelayAction.Add(
                        new DelayActionItem(300, () => { AbilityMain.LaunchSnowball(); }, CancellationToken.None));
                    Utils.Sleep(100 + me.GetTurnTime(hero) * 1000 + ping, "tusk_snowball");
                    Utils.Sleep(me.GetTurnTime(hero) * 1000 + (heroDistance / 675) * 1000 + 100, "GlobalCasting");
                    Utils.Sleep(me.GetTurnTime(hero) * 1000 + (heroDistance / 675) * 1000 + 100, "calculate");
                    Utils.Sleep(me.GetTurnTime(hero) * 1000 + (heroDistance / 675) * 1000, "cancelorder");

                    return true;
                }

                foreach (var data in
                    MyAbilities.OffensiveAbilities.Where(
                        x =>
                        x.Value.IsValid
                        && (x.Value.CanBeCasted()
                            || (x.Value.CanBeCasted(SoulRing.ManaGained) && SoulRing.Check(x.Value)))
                        && ((x.Value is Item && me.CanUseItems()) || (!(x.Value is Item) && me.CanCast()))
                        && (Utils.SleepCheck(x.Value.Handle.ToString())
                            || (!x.Value.IsInAbilityPhase && x.Value.FindCastPoint() > 0)))
                        .OrderBy(x => ComboOrder.GetAbilityOrder(x.Value)))
                {
                    var ability = data.Value;
                    var name = NameManager.Name(ability);
                    var category = data.Key.Substring(name.Length);
                    var handleString = ability.Handle.ToString();
                    if (category != "buff" && hero.IsMagicImmune() && ability.ImmunityType != (ImmunityType)3)
                    {
                        continue;
                    }

                    if (!CastingChecks.All(name, hero))
                    {
                        continue;
                    }

                    var delay = ability.GetCastDelay(me, hero, useCastPoint: false, abilityName: name) * 1000;
                    var canHit = ability.CanHit(hero, MyHeroInfo.Position, name);
                    if (name == "omniknight_purification")
                    {
                        if (Nukes.NukesMenuDictionary[name].Item(name + "minManaCheck").GetValue<Slider>().Value < mana
                            && MainMenu.Menu.Item("nukesToggler").GetValue<AbilityToggler>().IsEnabled(name)
                            && Nukes.NukesMenuDictionary[name].Item(name + "herotoggler")
                                   .GetValue<HeroToggler>()
                                   .IsEnabled(heroName)
                            && (etherealHitTime < (Environment.TickCount + ability.GetHitDelay(hero, name) * 1000))
                            && hero.Health
                            > Nukes.NukesMenuDictionary[name].Item(NameManager.Name(ability) + "minhealthslider")
                                  .GetValue<Slider>()
                                  .Value && CastingChecks.Killsteal(ability, hero, name))
                        {
                            var target = FindPurificationTarget(hero);
                            if (target != null && ability.CanHit(target, MyHeroInfo.Position, name)
                                && target.PredictedPosition().Distance2D(hero.PredictedPosition())
                                < ability.GetRadius(name)
                                && target.PredictedPosition()
                                       .Distance2D(
                                           hero.PredictedPosition(ability.FindCastPoint(NameManager.Name(ability))))
                                < ability.GetRadius(name))
                            {
                                if (Nuke.Cast(ability, target, name))
                                {
                                    Utils.Sleep(
                                        ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, 
                                        handleString);
                                    Utils.Sleep(delay, "GlobalCasting");
                                    Utils.Sleep(delay, "cancelorder");

                                    // Utils.Sleep(ping, "killsteal");
                                    return true;
                                }
                            }
                        }

                        return false;
                    }

//.........这里部分代码省略.........
开发者ID:Ray0fHope,项目名称:EnsageSharp,代码行数:101,代码来源:FullCombo.cs

示例12: Game_OnUpdate

        private static void Game_OnUpdate(EventArgs args)
        {
            #region Init
            me = ObjectMgr.LocalHero;

            if (!_loaded)
            {
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Invoker)
                {
                    return;
                }
                _loaded = true;

            }

            if (!Game.IsInGame || me == null)
            {
                _loaded = false;
                PrintInfo("> Invorker unLoaded");
                return;
            }

            if (Game.IsPaused)
            {
                return;
            }

            #endregion

            if (startspell < 10)
            {

                if (!skilltrue)
                {
                    skilltrue = true;
                    q = me.Spellbook.SpellQ;
                    w = me.Spellbook.SpellW;
                    e = me.Spellbook.SpellE;

                    ss = me.FindSpell("invoker_sun_strike");
                    coldsnap = me.FindSpell("invoker_cold_snap");
                    ghostwalk = me.FindSpell("invoker_ghost_walk");
                    icewall = me.FindSpell("invoker_ice_wall");
                    tornado = me.FindSpell("invoker_tornado");
                    deafblast = me.FindSpell("invoker_deafening_blast");
                    forge = me.FindSpell("invoker_forge_spirit");
                    emp = me.FindSpell("invoker_emp");
                    alacrity = me.FindSpell("invoker_alacrity");
                    chaosmeteor = me.FindSpell("invoker_chaos_meteor");

                    SpellInfo.Add(ss.Name, new SpellStruct(e, e, e));
                    SpellInfo.Add(coldsnap.Name, new SpellStruct(q, q, q));
                    SpellInfo.Add(ghostwalk.Name, new SpellStruct(q, q, w));
                    SpellInfo.Add(icewall.Name, new SpellStruct(q, q, e));
                    SpellInfo.Add(tornado.Name, new SpellStruct(w, w, q));
                    SpellInfo.Add(deafblast.Name, new SpellStruct(q, w, e));
                    SpellInfo.Add(forge.Name, new SpellStruct(e, e, q));
                    SpellInfo.Add(emp.Name, new SpellStruct(w, w, w));
                    SpellInfo.Add(alacrity.Name, new SpellStruct(w, w, e));
                    SpellInfo.Add(chaosmeteor.Name, new SpellStruct(e, e, w));
                    spell[1] = tornado;
                    spell[2] = emp;
                    spell[3] = coldsnap;
                    spell[4] = ghostwalk;
                    spell[5] = chaosmeteor;
                    spell[6] = deafblast;
                    spell[7] = forge;
                    spell[8] = icewall;
                    spell[9] = alacrity;
                    spell[0] = ss;
                    spell[10] = chaosmeteor; //extra one just for checking condition, will not be used
                }

                SpellStruct s;
                var active1 = me.Spellbook.Spell4;
                var active2 = me.Spellbook.Spell5;
                if (Equals(spell[startspell], active1)) //If the skill inside D
                {
                    spell[startspell].UseAbility();
                    if (Utils.SleepCheck("spell1sleep"))
                    {
                        Game.ExecuteCommand("dota_ability_execute 3");
                        Utils.Sleep(150, "spell1sleep");
                    }

                }
                else if (Equals(spell[startspell], active2)) //If the skill inside F
                {
                    spell[startspell].UseAbility();
                    if (Utils.SleepCheck("spell2sleep"))
                    {
                        Game.ExecuteCommand("dota_ability_execute 4");
                        Utils.Sleep(150, "spell2sleep");
                    }
                }
                else //If not inside D and F, invoke the skill
                {
                    if (SpellInfo.TryGetValue(spell[startspell].Name, out s))
                    {
                        var invoke = me.FindSpell("invoker_invoke");
//.........这里部分代码省略.........
开发者ID:punchtiger,项目名称:Ensage,代码行数:101,代码来源:Program.cs

示例13: 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 invoke = me.FindSpell("invoker_invoke");

            var eul = me.FindItem("item_cyclone");
            var dagger = me.FindSpell("item_blink");
            var refresher = me.FindItem("item_refresher");

            var ss = me.FindSpell("invoker_sun_strike");
            var coldsnap = me.FindSpell("invoker_cold_snap");
            var ghostwalk = me.FindSpell("invoker_ghost_walk");
            var icewall = me.FindSpell("invoker_ice_wall");
            var tornado = me.FindSpell("invoker_tornado");
            var deafblast = me.FindSpell("invoker_deafening_blast");
            var forge = me.FindSpell("invoker_forge_spirit");
            var emp = me.FindSpell("invoker_emp");
            var alacrity = me.FindSpell("invoker_alacrity");
            var chaosmeteor = me.FindSpell("invoker_chaos_meteor");

            if (!_initNewCombo)
            {
                _initNewCombo = true;
                _stage = 1;
                PrintInfo("Starting new combo! " + string.Format("[{0}] target: {1}", _combo + 1, target.Name));
            }
            if (!Utils.SleepCheck("StageCheck")) return;
            #endregion

            /*var modif = target.Modifiers.Where(x=>x.IsDebuff);
            PrintInfo("===========================");
            foreach (var s in modif)
            {
                PrintInfo(s.Name);
            }*/

            switch (_stage)
            {
                case 1:
                    if (Combos[_combo].CheckEul())
                    {
                        if (eul == null || eul.AbilityState != AbilityState.Ready) return;
                        eul.UseAbility(target);
                        _stage++;
                        Utils.Sleep(250, "StageCheck");
                    }
                    else
                    {
                        _stage++;
                    }
                    break;
                default:
                    if (Combos[_combo].GetComboAbilities().Length < _stage - 1) return;
                    _spellForCast = Combos[_combo].GetComboAbilities()[_stage - 2];
                    if (_spellForCast != null)
                    {
                        if (_spellForCast.AbilityState != AbilityState.Ready)
                        {
                            PrintInfo(string.Format("spell {0} cant be casted, go next [{1}]", _spellForCast.Name, _stage));
                            _stage++;
                            return;
                        }
                        if (_spellForCast.CanBeCasted())
                        {
                            if (Combos[_combo].CheckEul())
                            {
                                var eulmodif = target.Modifiers.FirstOrDefault(x => x.Name == "modifier_eul_cyclone" || x.Name == "modifier_invoker_tornado");
                                if (Equals(_spellForCast, deafblast))
                                {
                                    if (eulmodif != null && eulmodif.RemainingTime <= me.Distance2D(target) / 1100  + Game.Ping / 1000)
                                    {
                                        UseSpell(_spellForCast, target);
                                        _stage++;
                                        Utils.Sleep(250, "StageCheck");
                                    }
                                    else if (eulmodif == null)
                                    {
                                        UseSpell(_spellForCast, target);
                                        _stage++;
                                        Utils.Sleep(250, "StageCheck");
                                    }
                                }
                                else if (!Equals(_spellForCast, ss) && !Equals(_spellForCast, chaosmeteor))
                                {
                                    UseSpell(_spellForCast, target);
                                    _stage++;
                                    Utils.Sleep(250, "StageCheck");
                                }

                                var timing = (Equals(_spellForCast, ss))
                                    ? 1.7
                                    : (Equals(_spellForCast, chaosmeteor)) ? 1.3 : 0;
                                timing += Game.Ping / 1000 - 0.005;
//.........这里部分代码省略.........
开发者ID:MikeTeok,项目名称:EnsageSharp-1,代码行数:101,代码来源:Program.cs

示例14: 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 invoke = me.FindSpell("invoker_invoke");
            
            var eul = me.FindItem("item_cyclone");
            var dagger = me.FindItem("item_blink");
            var refresher = me.FindItem("item_refresher");
            var icewall = me.FindSpell("invoker_ice_wall");
            var deafblast = me.FindSpell("invoker_deafening_blast");
            var hex = me.FindItem("item_sheepstick");
            var urn = me.FindItem("item_urn_of_shadows");
            var orchid = me.FindItem("item_orchid");
            var meteor = me.FindSpell("invoker_chaos_meteor");
            var ss = me.FindSpell("invoker_sun_strike");
            //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;
                //PrintInfo("Starting new combo! " + $"[{_combo + 1}] target: {target.Name}");
            }
            if (!Utils.SleepCheck("StageCheck")) return;
            #endregion

            /*var modif = target.Modifiers.Where(x=>x.IsDebuff);
            PrintInfo("===========================");
            foreach (var s in modif)
            {
                PrintInfo(s.Name);
            }*/
            var myBoys = ObjectMgr.GetEntities<Unit>().Where(x => x.Team == me.Team && x.IsControllable && x.IsAlive && Utils.SleepCheck(x.Handle.ToString()));
            foreach (var myBoy in myBoys)
            {
                myBoy.Attack(target);
                Utils.Sleep(300, myBoy.Handle.ToString());
            }
            if (me.CanUseItems())
            {
                if (urn != null && urn.CanBeCasted(target))
                {
                    var urnMod = target.Modifiers.Any(x => x.Name == "modifier_item_urn_damage") &&
                                 Utils.SleepCheck(urn.Name);
                    if (!urnMod)
                    {
                        urn.UseAbility(target);
                        Utils.Sleep(300, urn.Name);
                    }
                }
                if (_stage > 2 && !target.IsHexed() && !target.IsStunned())
                {
                    if (hex != null && hex.CanBeCasted(target) &&
                        Menu.Item("items").GetValue<AbilityToggler>().IsEnabled(hex.Name) &&
                        Utils.SleepCheck("items"))
                    {
                        hex.UseAbility(target);
                        Utils.Sleep(300, "items");
                    }
                    if (orchid != null && orchid.CanBeCasted(target) &&
                        Menu.Item("items").GetValue<AbilityToggler>().IsEnabled(orchid.Name) &&
                        Utils.SleepCheck("items"))
                    {
                        orchid.UseAbility(target);
                        Utils.Sleep(300, "items");
                    }
                }
                if (dagger != null && Menu.Item("items").GetValue<AbilityToggler>().IsEnabled(dagger.Name) &&
                    dagger.CanBeCasted() && Utils.SleepCheck("blinker") && me.Distance2D(target) >= 700)
                {
                    var dist = 300;
                    var angle = me.FindAngleBetween(target.Position, true);
                    var point =
                        new Vector3(
                            (float) (target.Position.X -
                                     dist*
                                     Math.Cos(angle)),
                            (float) (target.Position.Y -
                                     dist*
                                     Math.Sin(angle)), 0);
                    if (me.Distance2D(target) <= 1150 + 700)
                        dagger.UseAbility(point);
//.........这里部分代码省略.........
开发者ID:dendimonster,项目名称:EnsageSharp-1,代码行数:101,代码来源:Program.cs

示例15: Game_OnUpdate

        private static void Game_OnUpdate(EventArgs args)
        {
            if (!loaded)
            {
                me = ObjectMgr.LocalHero;
                if (!Game.IsInGame || me == null)
                {
                    return;
                }
                hoofStomp = me.Spellbook.Spell1;
                doubleEdge = me.Spellbook.SpellW;
                Stampede = me.FindSpell("centaur_stampede");
                blink = me.FindItem("item_blink");
                abyssalBlade = me.FindItem("item_abyssal_blade");
                lastStack = 0;
                loaded = true;
                lastActivity = 0;
            }

            if (!Game.IsInGame || me == null)
            {
                loaded = false;
                return;
            }

            if (Game.IsPaused)
            {
                return;
            }

            var tick = Environment.TickCount;
            if (me.NetworkActivity != (NetworkActivity)lastActivity && target != null)
            {
                lastActivity = (float)me.NetworkActivity;
                if (lastActivity == 1503)
                {
                    nextAttack = (tick + me.SecondsPerAttack * 1000 - Game.Ping);
                }
            }

            if (blink == null)
            {
                blink = me.FindItem("item_blink");
            }

            if (abyssalBlade == null)
            {
                abyssalBlade = me.FindItem("item_abyssal_blade");
            }

            if (!Game.IsKeyDown(Key.Space) || (Game.IsChatOpen))
            {
                target = null;
                lastStack = 0;
                return;
            }
            if (Utils.SleepCheck("blink"))
            {
                mePosition = me.Position;
            }
            var range = 1000f;
            var mousePosition = Game.MousePosition;
            if (blink != null)
            {
                blinkRange = blink.AbilityData.FirstOrDefault(x => x.Name == "blink_range").GetValue(0);
                range = blinkRange + me.HullRadius + 200;
            }
            var lastTarget = target;
            target = me.ClosestToMouseTarget(range);
            if (!Equals(target, lastTarget))
            {
                lastStack = 0;
            }
            if (target == null || !target.IsAlive || !target.IsVisible
                || target.Distance2D(mousePosition) > target.Distance2D(me) + 1000)
            {
                if (!Utils.SleepCheck("move"))
                {
                    return;
                }
                me.Move(mousePosition);
                Utils.Sleep(100, "move");
                return;
            }
            targetDistance = mePosition.Distance2D(target);
            hullsum = (me.HullRadius + target.HullRadius) * 2;
            turnTime = me.GetTurnTime(target);
            var casting = CastCombo();
            if (casting)
            {
                return;
            }
            OrbWalk(tick);
        }
开发者ID:TheGreatFratsby,项目名称:TheGreatFratsbyScripts,代码行数:94,代码来源:CentaurWarrunner.cs


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