private Coordinate MatchFreeBase(List<Coordinate> coords, WeewarMap wmap, Game g, Faction myFaction) { //Console.WriteLine("Coords:"+coords ); foreach (Coordinate c in coords) { Terrain t = wmap.get(c); //Console.WriteLine("type :"+t.Type ); Faction owner = g.getTerrainOwner(c); if (t.Type == TerrainType.Base && (owner == null || owner != myFaction) && g.getUnit(c) == null) return c; } return null; }
private List<Coordinate> getEnemyCities(Game game, WeewarMap wmap, Faction myFaction) { List<Coordinate> targets = new List<Coordinate>(); List<Terrain> bases = wmap.getTerrainsByType(TerrainType.Base); foreach (Terrain ter in bases) if (game.getTerrainOwner(ter.Coordinate) != myFaction) targets.Add(ter.Coordinate); return targets; }