Beispiel #1
0
		public static List<NavyUnitCM> GetUselesShips(MapCM map, int playerID)
		{
			List<NavyUnitCM> uselesNavy = new List<NavyUnitCM>();
			List<NavyUnitCM> playersNavy = map.Navy.Where(e => e.OwnerID == playerID && !map.IsWhereSeaHornByPoint(e.Cell)).ToList();
			for (int i = 0; i < playersNavy.Count; ++i)
			{
				NavyUnitCM navy = playersNavy[i];
				if (map.GetNeiborIslandsByMapPos(navy.Cell).Count < 2)
					uselesNavy.Add(navy);
			}
			return uselesNavy;
		}
Beispiel #2
0
		public static List<Hex> GetAccessibleSeaHorns(MapCM map, int playerID, bool onlyForReadyShips, bool is_possible_to_attack_enemy)
		{
			List<Hex> horns = new List<Hex>();
			List<Hex> fromCells;
			if (onlyForReadyShips)
				fromCells = map.Navy.Where(e => e.OwnerID == playerID && !map.IsWhereSeaHornByPoint(e.Cell)).Select(e => e.Cell).Distinct().ToList();
			else
				fromCells = map.GetAllPlayerCoast(playerID);

			for (int i = 0; i < fromCells.Count; ++i)
			{
				List<Hex> cells = MapCM.GetConnectedSeas(map, playerID, fromCells[i], Constants.navyMove, false);
				List<Hex> _horns = cells.Where(e => map.IsWhereSeaHornByPoint(e)).ToList();
				horns.AddRange(_horns);
			}
			return horns.Distinct().ToList();
		}