diff --git a/src/main/java/cz/jull/Game.java b/src/main/java/cz/jull/Game.java index e52dff9..450c3f1 100644 --- a/src/main/java/cz/jull/Game.java +++ b/src/main/java/cz/jull/Game.java @@ -68,6 +68,7 @@ public class Game { player.setCoins(1000); strings.print("coins", player.getCoins()); + System.out.println(); market = new Market(this); diff --git a/src/main/java/cz/jull/Item.java b/src/main/java/cz/jull/Item.java index 021e7b6..cdf8690 100644 --- a/src/main/java/cz/jull/Item.java +++ b/src/main/java/cz/jull/Item.java @@ -52,54 +52,6 @@ public enum Item implements Buildable { static { - WHEAT_SEEDS.canBeBuiltFunction = game -> { - if (game.getBuildings().stream().filter(building -> building == Item.WHEAT_FARMLAND).count() >= game.getBuildings().stream().filter(building -> building == Item.WHEAT_SEEDS).count() + 1) { - return true; - } - System.out.println(" "); //TODO - return false; - }; - - HOPS_SEEDS.canBeBuiltFunction = game -> { - if (game.getBuildings().stream().filter(building -> building == Item.WHEAT_FARMLAND).count() >= game.getBuildings().stream().filter(building -> building == Item.HOPS_SEEDS).count() + 1) { - return true; - } - System.out.println(" "); //TODO - return false; - }; - - GRAPEVINE_SEEDS.canBeBuiltFunction = game -> { - if (game.getBuildings().stream().filter(building -> building == Item.VINEYARD).count() >= game.getBuildings().stream().filter(building -> building == Item.GRAPEVINE_SEEDS).count() + 1) { - return true; - } - System.out.println(" "); //TODO - return false; - }; - - WHEAT_FARMLAND.canBeBuiltFunction = game -> { - if (game.getBuildings().stream().filter(building -> building == Item.WHEAT_FARMLAND).count() >= game.getWaterType().getFarmlandAndVineyardCount()) { - System.out.println(" "); // TODO - return false; - } - return true; - }; - - VINEYARD.canBeBuiltFunction = game -> { - if (game.getBuildings().stream().filter(building -> building == Item.VINEYARD).count() >= game.getWaterType().getFarmlandAndVineyardCount()) { - return true; - } - System.out.println(" "); //TODO - return false; - }; - - HOPS_FARMLAND.canBeBuiltFunction = game -> { - if (game.getBuildings().stream().filter(building -> building == Item.HOPS_FARMLAND).count() >= game.getWaterType().getFarmlandAndVineyardCount()) { - return true; - } - System.out.println(" "); //TODO - return false; - }; - FENCE_WITH_COWS.canBeBuiltFunction = game -> { if (game.getBuildings().stream().filter(building -> building == Item.VILLAGER_HOUSE).count() >= (game.getBuildings().stream().filter(building -> building == Item.FENCE_WITH_COWS).count() + 1) * 3) { return true; @@ -157,37 +109,6 @@ public enum Item implements Buildable { }; } - static { - VILLAGER_HOUSE.canBeBoughtFunction = game -> { - if (!game.getBuildings().contains(Item.CHURCH)) { - game.getStrings().print("cantBeBoughtVillagerHouse"); - return false; - } - return true; - }; - - Function func = game -> { - if (!game.getBuildings().contains(Item.VILLAGER_HOUSE)) { - game.getStrings().print("cantBeBoughtAll"); - return false; - } - return true; - }; - - WHEAT_FARMLAND.canBeBoughtFunction = func; - HOPS_FARMLAND.canBeBoughtFunction = func; - VINEYARD.canBeBoughtFunction = func; - - FENCE_WITH_COWS.canBeBoughtFunction = func; - - BAKERY.canBeBoughtFunction = func; - PUB.canBeBoughtFunction = func; - WINERY.canBeBoughtFunction = func; - - COAL_FACTORY.canBeBoughtFunction = func; - CHEESE_FACTORY.canBeBoughtFunction = func; - } - /** * Human-readable name */ @@ -210,18 +131,11 @@ public enum Item implements Buildable { */ private Function canBeBuiltFunction; - /** - * Function that determines if the item can be bought or not - */ - @Getter - private Function canBeBoughtFunction; - Item(String name, boolean isPlaceable, int price, List actions) { this.name = name; this.isPlaceable = isPlaceable; this.canBeBuiltFunction = ignored -> isPlaceable; this.price = price; - this.canBeBoughtFunction = ignored -> true; this.actions = actions; } @@ -230,7 +144,6 @@ public enum Item implements Buildable { this.isPlaceable = isPlaceable; this.canBeBuiltFunction = ignored -> isPlaceable; this.price = price; - this.canBeBoughtFunction = ignored -> true; this.actions = actions; this.buildActions = buildActions; } diff --git a/src/main/java/cz/jull/market/Market.java b/src/main/java/cz/jull/market/Market.java index 0e463c4..e848d45 100644 --- a/src/main/java/cz/jull/market/Market.java +++ b/src/main/java/cz/jull/market/Market.java @@ -34,10 +34,6 @@ public class Market { throw new NotSufficientsCoinsException("Not enough coins"); } - if (!item.getCanBeBoughtFunction().apply(game)) { - game.getStrings().print("cantBuy"); - return; - } if (availableItems.contains(item)) { game.getPlayer().getInventory().add(item); game.getPlayer().setCoins(game.getPlayer().getCoins() - item.getPrice()); diff --git a/src/main/java/cz/jull/tui/Cli.java b/src/main/java/cz/jull/tui/Cli.java index f7e0a98..92e4b72 100644 --- a/src/main/java/cz/jull/tui/Cli.java +++ b/src/main/java/cz/jull/tui/Cli.java @@ -46,16 +46,20 @@ public class Cli { } while (true) { - System.out.print("Vlož číslo možnosti: "); + System.out.println(); + System.out.print("Enter option number: "); + System.out.println(); if (scanner.hasNextInt()) { choice = scanner.nextInt(); if (choice >= 1 && choice <= options.size()) { return choice - 1; } else { - System.out.println("Neplatná možnost, vyber si číslo mezi 1 a " + options.size()); + System.out.println("Invalid option, choose a number between 1 and" + options.size()); + System.out.println(); } } else { - System.out.println("Neplatný vstup, vlož číslo."); + System.out.println("Invalid entry, please enter a number."); + System.out.println(); scanner.next(); } } diff --git a/src/main/java/cz/jull/tui/Menu.java b/src/main/java/cz/jull/tui/Menu.java index 1fc7940..bdb1e05 100644 --- a/src/main/java/cz/jull/tui/Menu.java +++ b/src/main/java/cz/jull/tui/Menu.java @@ -3,6 +3,10 @@ package cz.jull.tui; import cz.jull.Game; import cz.jull.Item; import cz.jull.actions.Action; +import cz.jull.stats.surroundings.ForestType; +import cz.jull.stats.surroundings.PathType; +import cz.jull.stats.surroundings.SoilType; +import cz.jull.stats.surroundings.WaterType; import lombok.RequiredArgsConstructor; import java.io.IOException; @@ -95,6 +99,15 @@ public class Menu { case 2 -> start(); } } + case 3 -> { + game.getStrings().print("forestType", game.getForestType()); + game.getStrings().print("soilType", game.getSoilType()); + game.getStrings().print("pathType", game.getPathType()); + game.getStrings().print("waterType", game.getWaterType()); + System.out.println(); + game.getStrings().print("coins", game.getPlayer().getCoins()); + System.out.println(); + } } } diff --git a/src/main/resources/item_art/BAKERY.txt b/src/main/resources/item_art/BAKERY.txt index 7af6607..112a5a9 100644 --- a/src/main/resources/item_art/BAKERY.txt +++ b/src/main/resources/item_art/BAKERY.txt @@ -1,13 +1,13 @@ - ▄▄▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄▄▄ - ▄▄▀▀▀▀▀▀ ▄▄████▀▀ ▄▄▄▄████ ▀▀▀▀▀▀▀▀▄▄▄▄ - ▄▄▀▀ ▄▄████▀▀ ▄▄██████▀▀ ▄▄████ ▀▀▄▄▄▄▄▄ -▄▄██ ████ ██████▀▀ ▄▄████▀▀ ▀▀▄▄ -██ ▄▄██ ▄▄████▀▀ ▄▄████ ▄▄▄▄██▀▀ ▀▀▄▄ -██ ▀▀ ████▀▀ ████▀▀ ▄▄██▀▀ ▀▀▄▄ -██ ██ ▄▄██▀▀ ██ ██▄▄ - ██▄▄ ▀▀▀▀ ██ - ▀▀▄▄ ▄▄▀▀ - ▀▀▄▄▄▄ ▄▄▀▀ - ▀▀▀▀▄▄▄▄ ▄▄▄▄▀▀ - ▀▀▀▀▀▀▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▀▀▀▀ - ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ + ▄▄▀▀▀▀▀▀▀▀▀▀▀▀▄▄ + ▄▀▀▀ ▄██▀ ▄▄██ ▀▀▀▀▄▄ + ▄▀ ▄██▀ ▄███▀ ▄██ ▀▄▄▄ +▄█ ██ ███▀ ▄██▀ ▀▄ +█ ▄█ ▄██▀ ▄██ ▄▄█▀ ▀▄ +█ ▀ ██▀ ██▀ ▄█▀ ▀▄ +█ █ ▄█▀ █ █▄ + █▄ ▀▀ █ + ▀▄ ▄▀ + ▀▄▄ ▄▀ + ▀▀▄▄ ▄▄▀ + ▀▀▀▄▄▄▄ ▄▄▄▄▀▀ + ▀▀▀▀▀▀▀▀▀▀▀ diff --git a/src/main/resources/item_art/CHEESE_FACTORY.txt b/src/main/resources/item_art/CHEESE_FACTORY.txt new file mode 100644 index 0000000..25b858e --- /dev/null +++ b/src/main/resources/item_art/CHEESE_FACTORY.txt @@ -0,0 +1,10 @@ + ▄▄██▄▄▄ + ▄▄█▀▀ ▀█▄▄ + ▄▄█▀▀ ▄▄▄██ + ▄▄███▀▀▀█▄▄▄██▀▀▀▀▀ █ + ██▄▄▄█▄ ▄█▀ █ + █ ▀▀▀ ▄█▀█▄ █ + █ █ █ █ + █ █▀█ ▀▀█▀▀ █ + █ ▀▀▀ ▄▄▄▄▄▄▄▄▄▄▄▄▄█ + ▀▀▀▀▀▀▀▀▀ diff --git a/src/main/resources/item_art/COAL_FACTORY.txt b/src/main/resources/item_art/COAL_FACTORY.txt index a5c7921..dcbbaf6 100644 --- a/src/main/resources/item_art/COAL_FACTORY.txt +++ b/src/main/resources/item_art/COAL_FACTORY.txt @@ -1,13 +1,13 @@ - ██████████████ - ██████████████████████ - ██████████████████████████████ - ██████████████████████████████████ - ██████████████████████████████████████ -██████████████████████████████████████████████ -██████████████████████████████████████████████ -██████████████████████████████████████████████████ -██████████████████████████████████████████████████ - ▀▀██████████████████████████████████████████▀▀▀▀ - ▀▀▀▀██████████████████████████████████▀▀▀▀ - ▀▀▀▀██████████████▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ - ▀▀▀▀▀▀▀▀▀▀▀▀▀▀ + ███████ + ███████████ + ███████████████ + █████████████████ + ███████████████████ +███████████████████████ +███████████████████████ +█████████████████████████ +█████████████████████████ + ▀█████████████████████▀▀ + ▀▀█████████████████▀▀ + ▀▀███████▀▀▀▀▀▀▀▀ + ▀▀▀▀▀▀▀ diff --git a/src/main/resources/item_art/HOPS.txt b/src/main/resources/item_art/HOPS.txt index c69cee6..535e0fc 100644 --- a/src/main/resources/item_art/HOPS.txt +++ b/src/main/resources/item_art/HOPS.txt @@ -1,28 +1,14 @@ - ██ - ██ ██ - ██ ██ - ██████ ██████ - ██████ ██████ ██████ - ████ ██ ████ - ████ ████ - ████ ████ - ██ ██ - ██ ██ - ██ ██ -████ ██ ██ ████ -██ ████ ████ ██ -██ ██ ██ ██ ██ ██ -██ ████ ██ ██ ████ ██ -████████ ██ ██ ████████ - ██ ██ ██ ██ - ██ ████ ████ ██ - ██ ██████████ ██ - ██ ██ ██ ██ - ████ ██ ██ ████ - ████ ██ ██ ████ - ██████ ██████ - ██ ██ - ██ ██ - ██ ██ - ████ ████ - ██ + ▄▀▄ + ▄▄█ █▄▄ + ▄▄▀▀▀ ▀█▀ ▀▀▀▄▄ + ▄█▀ ▀█▄ + ▄▀ ▀▄ +▄█ ▄ ▄ █▄ +█ ▄▀█ █▀▄ █ +█▄▄▄▀▀ █ █ ▀▀▄▄▄█ + █ █▄ ▄█ █ + ▀▄ █▀▀▀█ ▄▀ + ▀█▄ ▄▀ ▀▄ ▄█▀ + ▀▀█ █▀▀ + ▀▄ ▄▀ + ▀▀▄▀▀ diff --git a/src/main/resources/item_art/VILLAGER_HOUSE.txt b/src/main/resources/item_art/VILLAGER_HOUSE.txt index 1d1e5b8..65feb94 100644 --- a/src/main/resources/item_art/VILLAGER_HOUSE.txt +++ b/src/main/resources/item_art/VILLAGER_HOUSE.txt @@ -1,13 +1,13 @@ - ▄▄▄▄▄▄▄▄▄▄ ▄▄▀▀▄▄ - ██ ██▄▄▀▀ ▀▀▄▄ - ██ ▄▄▀▀ ▄▄▀▀▀▀▀▀▄▄ ▀▀▄▄ - ██▄▄▀▀ ▄▄▀▀ ▀▀▄▄ ▀▀▄▄ - ▄▄▀▀ ▄▄▀▀ ▀▀▄▄ ▀▀▄▄ - ▄▄▀▀ ▄▄▀▀ ▀▀▄▄ ▀▀▄▄ -▀▀▄▄▄▄██ ▄▄▄▄▄▄▄▄▄▄▄▄ ██▄▄▄▄▀▀ - ██ ██ ██ ██▀▀▀▀▀▀▀▀▀▀██ ██ - ██ ██ ██ ██ ██ ██ - ██ ██ ▄▄██ ██ ██ ██ - ██ ██ ██ ██▄▄▄▄▄▄▄▄▄▄██ ██ - ██ ██ ██ ██ - ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ + ▄▄▄▄▄ ▄▀▄ + █ █▄▀ ▀▄ + █ ▄▀ ▄▀▀▀▄ ▀▄ + █▄▀ ▄▀ ▀▄ ▀▄ + ▄▀ ▄▀ ▀▄ ▀▄ + ▄▀ ▄▀ ▀▄ ▀▄ +▀▄▄█ ▄▄▄▄▄▄ █▄▄▀ + █ █ █ █▀▀▀▀▀█ █ + █ █ █ █ █ █ + █ █ ▄█ █ █ █ + █ █ █ █▄▄▄▄▄█ █ + █ █ █ █ + ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ diff --git a/src/main/resources/item_art/WELL.txt b/src/main/resources/item_art/WELL.txt new file mode 100644 index 0000000..1e340dd --- /dev/null +++ b/src/main/resources/item_art/WELL.txt @@ -0,0 +1,12 @@ + ▄█▀▀▀▀▀▀▀▀▀▀▀▀▀█▄ + ▄█▀ ▀█▄ + ▄██▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄██▄ + ▀▀▀▀█▀▀▀▀▀▀▀▀▀▀▀█▀▀▀▀ +▄▄█▀▀▀▀▀█▀▀▀▀▀▀█▀▀▀▀█▀ +▀▀▀ █ █ █ + █ █ █ + █▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█ + █ █ + █ █ + █ █ + █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ diff --git a/src/main/resources/item_art/WHEAT.txt b/src/main/resources/item_art/WHEAT.txt index 50517cc..3c3cd58 100644 --- a/src/main/resources/item_art/WHEAT.txt +++ b/src/main/resources/item_art/WHEAT.txt @@ -1,22 +1,11 @@ - ██ - ██ - ██ ██ - ██ ████ - ██ ████ - ██ ████ ██ - ██ ██████████ - ██ ██ ████ - ██ ██ ████ ██ - ██ ██ ████████ - ██ ██ ████ - ██ ██ ██ ██████████ - ██ ██ ████ ██ - ██ ██ ██████████████ - ██ ████ - ██ ████████████ - ████ ██ - ██████████████ - ██ - ██ - ██ -██ + ▄▀ + ▄▀▄▄▀ + ▄ █▄▀▀▄ + ▄ █ ██▀▀▀ + █ █ ██▄▄▀ + ▄▀▄ █ ██▄▄▄ + █ █ ██▄▄▄▄▄▀ + █ ██▄▄▄▄ + ██▄▄▄▄▄▀ + ▄▀ +▄▀ diff --git a/src/main/resources/item_art/WINERY.txt b/src/main/resources/item_art/WINERY.txt new file mode 100644 index 0000000..963f82b --- /dev/null +++ b/src/main/resources/item_art/WINERY.txt @@ -0,0 +1,18 @@ + ▄▀▀▀▀▀▀▀▄ + █▄ ▄█ + █ ▀▀▀▀▀▀▀ █ + █ █ + █ █ +█ █ +█ █ +█ █ + █ █ + ▀▄▄ ▄▄▀ + ▀███▀ + ███ + ███ + ███ + ███ + ▄▄▄▄█████▄▄▄ +██ ██ + ▀▀▀▄▄▄▄▄▄▄▀▀▀ \ No newline at end of file diff --git a/src/main/resources/item_art/WOOD.txt b/src/main/resources/item_art/WOOD.txt new file mode 100644 index 0000000..57a2222 --- /dev/null +++ b/src/main/resources/item_art/WOOD.txt @@ -0,0 +1,13 @@ + ▄▄█▀▀▀██▄▄ + ▄▄█▀ ▄ ▀█▄ + ▄▄█▀ ▄▀▀ █ + ▄█▀ ▄▄▀ ▄▀ + ▄█▀▀ ▄▀ ▄▀ ▄▄█▀ + ▄█▀▀ ▄▀▀ ▄▀▀ ▄█▀▀ + ▄█▀▀▀█▄▄ ▄▄▀ ▄██▀ +▄█▀▀ ▄▄▄▄ ▀█▄ ▄█▀ +█ █▀ ▀ █▄ ▄█▀▀ +█ █ ▀▀█ █▄▄█▀ +█▄ ▀█▄█▀ ██▀ + ▀█▄▄ ▄█▀▀ + ▀▀▀▀▀▀ diff --git a/strings.json b/strings.json index b9cb196..f98102b 100644 --- a/strings.json +++ b/strings.json @@ -23,6 +23,5 @@ "cantCutTrees": "You need {0} axes to cut trees!", "cantMilkCows": "You don`t own any cows!", "cantProduce": "You can`t produce when you dont have {0}", - "cantSell": "You can`t sell this item! You don`t have it!", - "cantBuy": "You can`t buy this item!" + "cantSell": "You can`t sell this item! You don`t have it!" } \ No newline at end of file