private List <ServerMob> GetMobsInDistance(ServerMob serverMob, int towerDataSplashRange)
 {
     try
     {
         return(_session.GameMobs.Where(m => MobInDistance(m, towerDataSplashRange)).ToList());
     }
     catch { return(new List <ServerMob>()); }
 }
        private void AttackTarget(ServerMob target)
        {
            //effect by chance
            var effect = _random.Next(0, 100) <= TowerData.EffectChance;
            var hit    = new MobHit
            {
                Damage       = DamageCalculator.GetTowerDamageForMob(TowerData, target.MobData, target.StatusEffect),
                SendingTower = this,
                Status       = effect?TowerData.Effect:null
            };

            target.Hit(hit);
        }
 private static bool IsMobNearPoint(ServerMob m)
 {
     return(((int)Math.Floor(m.TilePosY + GConfig.D.TileDistanceDefaultTollerance) == m.CurrentGoal.Y) && ((int)Math.Floor(m.TilePosX + GConfig.D.TileDistanceDefaultTollerance) == m.CurrentGoal.X));
 }
 public double GetDistance(ServerMob mob)
 {
     return(GetDistance(mob.X, mob.Y));
 }
 public bool MobInDistance(ServerMob mob, int distance)
 {
     return(GetDistance(mob) <= distance);
 }
 public void DestroyTower(ServerMob serverMob, int nextBlockX, int nextBlockY)
 {
     _session.GameTower.SingleOrDefault(a => a.X == nextBlockX && a.Y == nextBlockY)?.RemoveTower();
     //TODO: Notify user
 }