Exemplo n.º 1
0
        void _rushTo(AWizard self, AWizard opp)
        {
            // TODO: check angle

            if (self.CanUseFrostBolt() &&
                self.GetDistanceTo(opp) <= Game.WizardCastRange + opp.Radius)
            {
                opp.ApplyMagicalDamage(self.FrostBoltDamage);
                opp.RemainingFrozen = Game.FrozenDurationTicks;
                self.RemainingFrostBoltCooldownTicks = Game.FrostBoltCooldownTicks;
                self.RemainingActionCooldownTicks    = Game.WizardActionCooldownTicks;
            }

            if (self.CanUseStaff() &&
                self.GetDistanceTo(opp) <= Game.StaffRange + opp.Radius)
            {
                opp.ApplyDamage(self.StaffDamage);
                self.RemainingStaffCooldownTicks  = Game.StaffCooldownTicks;
                self.RemainingActionCooldownTicks = Game.WizardActionCooldownTicks;
            }

            if (self.CanUseMagicMissile() &&
                self.GetDistanceTo(opp) <= Game.WizardCastRange + opp.Radius)
            {
                opp.ApplyMagicalDamage(self.MagicMissileDamage);
                self.RemainingMagicMissileCooldownTicks = self.MmSkillLevel == 5 ? 0 : Game.MagicMissileCooldownTicks;
                self.RemainingActionCooldownTicks       = Game.WizardActionCooldownTicks;
            }

            if (self.GetDistanceTo(opp) > Game.StaffRange + opp.Radius)
            {
                self.MoveTo(opp, opp);
            }
            self.SkipTick();
        }
Exemplo n.º 2
0
        double _emulateRush(AWizard self, AWizard opp)
        {
            var nearest = Combats.Where(x => x.GetDistanceTo(ASelf) < ASelf.VisionRange * 1.4).Select(Utility.CloneCombat).ToArray();

            self = nearest.FirstOrDefault(x => x.Id == self.Id) as AWizard;
            opp  = nearest.FirstOrDefault(x => x.Id == opp.Id) as AWizard;

            if (self == null || opp == null)
            {
                return(int.MinValue);
            }

            var tergetsSelector = new TargetsSelector(nearest);

            if (opp.Id == _LastMmTarget && World.Projectiles.Any(x => x.OwnerUnitId == self.Id))
            {
                opp.ApplyMagicalDamage(self.MagicMissileDamage);
            }

            while (true)
            {
                _rushTo(self, opp);
                foreach (var unit in nearest)
                {
                    if (unit.Id == self.Id)
                    {
                        continue;
                    }
                    if (unit is AWizard)
                    {
                        if (unit.IsOpponent)
                        {
                            _rushTo(unit as AWizard, self);
                        }
                        else
                        {
                            if (Const.IsFinal)
                            {
                                _rushTo(unit as AWizard, opp);
                            }
                            else
                            {
                                unit.SkipTick();
                            }
                        }
                    }
                    else if (unit is AMinion)
                    {
                        var tar = tergetsSelector.Select(unit);
                        unit.EthalonMove(tar);
                        if (tar != null && unit.EthalonCanHit(tar))
                        {
                            if (unit is AFetish)
                            {
                                unit.RemainingActionCooldownTicks = Game.FetishBlowdartActionCooldownTicks - 1;
                                tar.ApplyDamage(Game.DartDirectDamage);
                            }
                            else
                            {
                                unit.RemainingActionCooldownTicks = Game.OrcWoodcutterActionCooldownTicks - 1;
                                tar.ApplyDamage(Game.OrcWoodcutterDamage);
                            }
                        }
                    }
                }

                if (!self.IsAlive)
                {
                    return(-opp.Life);
                }
                if (!opp.IsAlive)
                {
                    var mines = nearest.Where(x => x.IsTeammate && x is AWizard).ToArray();
                    if (mines.Length >= 2 && Const.IsFinal)
                    {
                        if (!mines.All(x => x.Life > 10))
                        {
                            return(int.MinValue);
                        }
                        return(50.0);//hack
                    }
                    else
                    {
                        if (nearest.Where(x => x.IsOpponent && x is AWizard).Sum(x => x.Life) > self.Life)
                        {
                            return(int.MinValue);
                        }
                        return(self.Life);
                    }
                }
            }
        }