/// <summary>
 /// Check's if the player has enough resources to build the Building
 /// </summary>
 /// <param name="b">Building to be built</param>
 /// <param name="p">Player that is building</param>
 /// <returns>True if the player has enough resources, false if else</returns>
 public bool checkResources(Building b, ZRTSModel.Player.Player p)
 {
     if (b.stats.waterCost > p.player_resources[0])
     {
         return(false);
     }
     if (b.stats.lumberCost > p.player_resources[1])
     {
         return(false);
     }
     if (b.stats.foodCost > p.player_resources[2])
     {
         return(false);
     }
     if (b.stats.metalCost > p.player_resources[3])
     {
         return(false);
     }
     return(true);
 }
 /// <summary>
 /// This function will determine if a Player meets the requirements to produce a Building.
 /// </summary>
 /// <param name="player">Playe being tested.</param>
 /// <param name="bstats">BuildingStats defining the Building.</param>
 /// <returns>true if the player meets the requirements, false if the player does not.</returns>
 public bool playerMeetsRequirements(Player.Player player, BuildingStats bstats)
 {
     ReqList reqList = buildingReqs[bstats];
     return reqList.playerMeetsReqs(player);
 }
 /// <summary>
 /// This function will deterimine if a Player meets the requirements to produce a Unit.
 /// </summary>
 /// <param name="player">Player being tested</param>
 /// <param name="ustats">UnitStats defining the Unit</param>
 /// <returns>true if the player meets the requirements, false if the player does not.</returns>
 public bool playerMeetsRequirements(Player.Player player, UnitStats ustats)
 {
     ReqList reqList = unitReqs[ustats];
     return reqList.playerMeetsReqs(player);
 }
 public VisibilityMapLogic(GameWorld gw, Player humanPlayer)
 {
     this.gw = gw;
     this.map = gw.map;
     this.humanPlayer = humanPlayer;
 }
        private bool playerHasUnit(Player.Player player, UnitStats ustats)
        {
            List<Entity> entities = player.getEntities();
            foreach (Entity e in entities)
            {
                if (e.entityType == Entity.EntityType.Unit)
                {
                    Unit u = (Unit)e;
                    if (u.stats.type == ustats.type)
                    {
                        return true;
                    }
                }
            }

            return false;
        }
 private bool playerHasBuilding(Player.Player player, BuildingStats bstats)
 {
     List<Entity> entities = player.getEntities();
     foreach (Entity e in entities)
     {
         if (e.entityType == Entity.EntityType.Building)
         {
             Building b = (Building)e;
             if (b.stats.buildingType == bstats.buildingType)
             {
                 return true;
             }
         }
     }
     return false;
 }
        /// <summary>
        /// Given a Player, this function will check if that player meets the requirements to produce the Unit or Building.
        /// </summary>
        /// <param name="player"></param>
        /// <returns></returns>
        public bool playerMeetsReqs(Player.Player player)
        {
            foreach (UnitStats ustats in unitReqs)
            {
                if(!playerHasUnit(player, ustats))
                {
                    return false;
                }
            }

            foreach(BuildingStats bstats in buildingReqs)
            {
                if (!playerHasBuilding(player, bstats))
                {
                    return false;
                }
            }

            return true;
        }
 public void removeEnemy(Player enemy)
 {
     enemies.Remove(enemy);
 }
 public bool isEnemy(Player enemy)
 {
     return enemies.Contains(enemy);
 }
 public void addEnemy(Player enemy)
 {
     enemies.Add(enemy);
 }