Beispiel #1
0
        public void OnlyBearLastHitExecute()
        {
            this.Update();
            this.setAutoAttackMode();
            if (!Variable.OnlyBearLastHitActive)
            {
                return;
            }
            if (!this.anyCreepsAround(this.Bear))
            {
                return;
            }
            //Hero Control

            if (this.Bear.Distance2D(this.Me) > 1100)
            {
                if (Utils.SleepCheck("Move"))
                {
                    this.Me.Move(this.Bear.Position);
                    Utils.Sleep(100, "Move");
                }
            }
            else
            {
                if (Utils.SleepCheck("Hold"))
                {
                    this.Me.Hold();
                    Utils.Sleep(100, "Hold");
                }
            }
            //Bear Control
            this.getLowestHpCreep(Bear, 1000);
            if (this._LowestHpCreep == null)
            {
                return;
            }
            this.getKillableCreep(this._LowestHpCreep, true);
            if (this._creepTarget == null)
            {
                return;
            }


            if (this._creepTarget.IsValid && this._creepTarget.IsVisible && this._creepTarget.IsAlive)
            {
                var damageThreshold       = GetDamangeOnUnit(this.Bear, _creepTarget, 0);
                var numOfMeleeOnKillable  = MeleeCreepsAttackKillableTarget(_creepTarget);
                var numOfRangedOnKillable = RangedCreepsAttackKillableTarget(_creepTarget);
                if (numOfMeleeOnKillable + numOfRangedOnKillable != 0)
                {
                    if (_creepTarget.Distance2D(Bear) <= Bear.AttackRange)
                    {     //bear can attack
                        if (_creepTarget.Health < damageThreshold)
                        { // if attack below killable dmg, instant attack it
                            if (Bear.CanAttack())
                            {
                                Bear.Attack(_creepTarget);
                            }
                        }
                        else if (_creepTarget.Health < damageThreshold * 2.5 && _creepTarget.Health > damageThreshold && Utils.SleepCheck("A-Stop"))
                        {  // Attack-Hold
                            Bear.Attack(_creepTarget);
                            Bear.Hold();
                            Utils.Sleep(100, "A-Stop");
                        }
                    }
                    else
                    {
                        if (Utils.SleepCheck("Follow"))
                        {
                            Bear.Follow(_LowestHpCreep);
                            Utils.Sleep(100, "Follow");
                        }
                    }
                }
                else
                {
                    Console.WriteLine("no one is attacking");
                    //no one is hitting that creeps, go ahead and kill it
                    if (Bear.CanAttack() && _creepTarget.Health <= 1.5 * damageThreshold)
                    {
                        Bear.Attack(_creepTarget);
                        this.bearAttackSleeper.Sleep(100);
                    }
                }
            }
        }