Ejemplo n.º 1
0
        public static float CalculateMyDamage(Hero globalTarget)
        {
            var mana      = Members.MyHero.MaximumMana;
            var rearm     = Abilities.FindAbility("tinker_rearm");
            var laser     = Abilities.FindAbility("tinker_laser");
            var rocked    = Abilities.FindAbility("tinker_heat_seeking_missile");
            var allItems  = new List <Ability>();
            var allItems2 = new List <Ability>(Members.MyHero.Inventory.Items.Where(x =>
                                                                                    IsItemEnable(x.StoredName()) && (x.ManaCost > 0 || x.StoredName() == "item_soul_ring"))
                                               .OrderByDescending(PriorityHelper)
                                               .ToList());

            allItems.AddRange(allItems2);

            if (rocked.Level > 0 && IsAbilityEnable(rocked.StoredName()))
            {
                allItems.Add(rocked);
            }
            if (laser.Level > 0 && IsAbilityEnable(laser.StoredName()))
            {
                allItems.Add(laser);
            }
            if (rearm.Level > 0)
            {
                allItems.Add(rearm);
            }
            var haveEb      = allItems.Any(x => x.StoredName() == "item_ethereal_blade" && x.CanBeCasted());
            var haveVeil    = allItems.Any(x => x.StoredName() == "item_veil_of_discord" && x.CanBeCasted());
            var myDmg       = 0f;
            var extraDamage = haveEb && !globalTarget.HasModifier("modifier_item_ethereal_blade_ethereal") ? 40 : 0;

            extraDamage += haveVeil && !globalTarget.HasModifier("modifier_item_veil_of_discord_debuff") ? 25 : 0;
            if (allItems.Count == 0 || (rearm.Level == 0))
            {
                myDmg = allItems.Sum(
                    x =>
                    AbilityDamage.CalculateDamage(x, Members.MyHero, globalTarget,
                                                  minusMagicResistancePerc: extraDamage));
                return((int)(globalTarget.Health - myDmg));
            }

            //Printer.Print($"[mana]: init");
            Printer.ConsolePrint($"[mana]: Init. [count]: {allItems.Count}. [possible]: {allItems.Count(x => mana > x.ManaCost)}");
            var wasRearmed    = true;
            var templarStacks = globalTarget.FindModifier("modifier_templar_assassin_refraction_absorb_stacks");
            var stacks        = templarStacks?.StackCount ?? 0;
            var hasRainDrop   = globalTarget.FindItem("item_infused_raindrop", true)?.Cooldown <= 0;
            var wasNama       = mana;

            while (mana > 5 && allItems.Count(x => mana > x.ManaCost) > 0 && wasRearmed && wasNama >= mana)
            {
                wasRearmed = false;
                foreach (var x in allItems)
                {
                    if (mana > x.ManaCost)
                    {
                        //Printer.ConsolePrint($"[mana]: {x.StoredName()} -> {x.ManaCost}/{mana}");
                        if (x.StoredName() == "item_soul_ring")
                        {
                            mana += 150;
                            Printer.ConsolePrint($"[mana]: {mana} (+150) soul ring");
                            continue;
                        }

                        var mCost = x.ManaCost;
                        if (!(mana - mCost > 0))
                        {
                            break;
                        }
                        mana -= mCost;

                        var dmgFromSpell = AbilityDamage.CalculateDamage(x, Members.MyHero, globalTarget,
                                                                         minusMagicResistancePerc: extraDamage);

                        if (stacks > 0)
                        {
                            stacks--;
                            myDmg += 0;
                        }
                        else
                        {
                            if (AbilityDamage.GetDamageType(x) == DamageType.Magical && hasRainDrop && dmgFromSpell > 120)
                            {
                                hasRainDrop  = false;
                                dmgFromSpell = -120;
                                dmgFromSpell = Math.Max(dmgFromSpell, 0);
                            }
                            myDmg += dmgFromSpell;
                        }
                        //Printer.Print($"[mana]: {mana} (-{mCost}) {x.StoredName()} -> damage: {myDmg}");

                        if (x.StoredName() == rearm.StoredName())
                        {
                            Printer.ConsolePrint($"[mana]: {mana} (-{mCost}) {x.StoredName()}");
                            wasRearmed = true;
                            continue;
                        }
                        Printer.ConsolePrint($"[mana]: {mana} (-{mCost}) {x.StoredName()} -> damage: {dmgFromSpell} || total:{myDmg}");
                    }
                    else
                    {
                        Printer.ConsolePrint($"[mana]: {x.StoredName()} -> {x.ManaCost}/{mana} cant cast this!");
                    }
                }

                /*Printer.ConsolePrint($"[mana]: {rearm.StoredName()} -> {rearm.ManaCost}/{mana}");
                 * mana -= rearm.ManaCost;*/
            }
            var healthAfterShit = (int)(globalTarget.Health - myDmg);

            return(healthAfterShit);
        }
Ejemplo n.º 2
0
        private static async Task Action(CancellationToken cancellationToken)
        {
            if (IsComboHero)
            {
                if (!IsComboHero)
                {
                    if (_globalTarget != null)
                    {
                        Helper.UnHandleEffect(_globalTarget);
                    }
                    _globalTarget = null;
                    return;
                }
                if (_globalTarget == null || !_globalTarget.IsValid)
                {
                    _globalTarget = Helper.ClosestToMouse(Members.MyHero);
                    return;
                }

                if (Members.MyHero.IsChanneling())
                {
                    return;
                }

                await DoTrash(_globalTarget, cancellationToken);

                await Task.Delay(50, cancellationToken);

                Printer.Print("rdy for rearm!");
                var rearm = Abilities.FindAbility("tinker_rearm");
                if (rearm.CanBeCasted())
                {
                    rearm?.UseAbility();
                    var time = (int)(GetRearmTime(rearm) + Game.Ping + rearm.FindCastPoint() * 1000);
                    Printer.Print("rearm!");
                    Log.Debug("Rearm: " + time);
                    await Task.Delay(time, cancellationToken);

                    return;
                }
                if (AutoAttack)
                {
                    if (UseOrbWalkker)
                    {
                        Orbwalking.Orbwalk(_globalTarget, followTarget: true);
                    }
                    else if (!Members.MyHero.IsAttacking() && !_attacker.Sleeping && !_globalTarget.IsAttackImmune())
                    {
                        Members.MyHero.Attack(_globalTarget);
                        _attacker.Sleep(250);
                    }
                }
            }
            else
            {
                if (_globalTarget != null)
                {
                    Helper.UnHandleEffect(_globalTarget);
                }
                _globalTarget = null;
            }


            await Task.Delay(100, cancellationToken);
        }