feat: nevim uz

This commit is contained in:
2025-05-25 14:16:50 +02:00
parent c24422e80a
commit e429fcf26c
15 changed files with 139 additions and 185 deletions

View File

@@ -68,6 +68,7 @@ public class Game {
player.setCoins(1000); player.setCoins(1000);
strings.print("coins", player.getCoins()); strings.print("coins", player.getCoins());
System.out.println();
market = new Market(this); market = new Market(this);

View File

@@ -52,54 +52,6 @@ public enum Item implements Buildable {
static { 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 -> { 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) { 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; 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<Game, Boolean> 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 * Human-readable name
*/ */
@@ -210,18 +131,11 @@ public enum Item implements Buildable {
*/ */
private Function<Game, Boolean> canBeBuiltFunction; private Function<Game, Boolean> canBeBuiltFunction;
/**
* Function that determines if the item can be bought or not
*/
@Getter
private Function<Game, Boolean> canBeBoughtFunction;
Item(String name, boolean isPlaceable, int price, List<Action> actions) { Item(String name, boolean isPlaceable, int price, List<Action> actions) {
this.name = name; this.name = name;
this.isPlaceable = isPlaceable; this.isPlaceable = isPlaceable;
this.canBeBuiltFunction = ignored -> isPlaceable; this.canBeBuiltFunction = ignored -> isPlaceable;
this.price = price; this.price = price;
this.canBeBoughtFunction = ignored -> true;
this.actions = actions; this.actions = actions;
} }
@@ -230,7 +144,6 @@ public enum Item implements Buildable {
this.isPlaceable = isPlaceable; this.isPlaceable = isPlaceable;
this.canBeBuiltFunction = ignored -> isPlaceable; this.canBeBuiltFunction = ignored -> isPlaceable;
this.price = price; this.price = price;
this.canBeBoughtFunction = ignored -> true;
this.actions = actions; this.actions = actions;
this.buildActions = buildActions; this.buildActions = buildActions;
} }

View File

@@ -34,10 +34,6 @@ public class Market {
throw new NotSufficientsCoinsException("Not enough coins"); throw new NotSufficientsCoinsException("Not enough coins");
} }
if (!item.getCanBeBoughtFunction().apply(game)) {
game.getStrings().print("cantBuy");
return;
}
if (availableItems.contains(item)) { if (availableItems.contains(item)) {
game.getPlayer().getInventory().add(item); game.getPlayer().getInventory().add(item);
game.getPlayer().setCoins(game.getPlayer().getCoins() - item.getPrice()); game.getPlayer().setCoins(game.getPlayer().getCoins() - item.getPrice());

View File

@@ -46,16 +46,20 @@ public class Cli {
} }
while (true) { while (true) {
System.out.print("Vlož číslo možnosti: "); System.out.println();
System.out.print("Enter option number: ");
System.out.println();
if (scanner.hasNextInt()) { if (scanner.hasNextInt()) {
choice = scanner.nextInt(); choice = scanner.nextInt();
if (choice >= 1 && choice <= options.size()) { if (choice >= 1 && choice <= options.size()) {
return choice - 1; return choice - 1;
} else { } 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 { } else {
System.out.println("Neplatný vstup, vlož číslo."); System.out.println("Invalid entry, please enter a number.");
System.out.println();
scanner.next(); scanner.next();
} }
} }

View File

@@ -3,6 +3,10 @@ package cz.jull.tui;
import cz.jull.Game; import cz.jull.Game;
import cz.jull.Item; import cz.jull.Item;
import cz.jull.actions.Action; 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 lombok.RequiredArgsConstructor;
import java.io.IOException; import java.io.IOException;
@@ -95,6 +99,15 @@ public class Menu {
case 2 -> start(); 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();
}
} }
} }

View File

@@ -1,13 +1,13 @@
▄▄▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄▄▄ ▄▄▀▀▀▀▀▀▀▀▀▀▀▀▄▄
▄▄▀▀▀▀▀▀ ▄▄████▀ ▄▄▄▄████ ▀▀▀▀▀▀▀▀▄▄▄▄ ▄▀▀▀ ▄██▀ ▄▄██ ▀▀▀▀▄▄
▄▄▀▀ ▄▄████▀▀ ▄▄██████▀▀ ▄████ ▀▄▄▄▄▄▄ ▄▀ ▄██▀ ▄███▀ ▄██ ▀▄▄▄
▄█ ████ ██████▀ ▄▄████▀▀ ▀▀▄▄ ▄█ ██ ███▀ ▄██▀ ▀▄
▄▄██ ▄▄████▀▀ ▄████ ▄▄▄▄██▀▀ ▀▀▄▄ ▄█ ▄██▀ ▄██ ▄▄█▀ ▀▄
████▀▀ ████▀▀ ▄▄██▀▀ ▀▀▄▄ █ ▀ ██▀ ██▀ ▄█▀ ▀▄
▄▄██▀▀ ██ ██▄ █ █ ▄█▀ █ █
██▄▄ ▀▀ █▄ ▀▀ █
▀▀▄▄ ▄▄▀ ▀▄
▀▀▄▄▄▄ ▄▄▀▀ ▀▄▄ ▄▀
▀▀▀▀▄▄▄▄ ▄▄▄▄▀▀ ▀▀▄▄ ▄▄▀
▀▀▀▀▀▀▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▀▀▀▀ ▀▀▀▄▄▄▄ ▄▄▄▄▀▀
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀

View File

@@ -0,0 +1,10 @@
▄▄██▄▄▄
▄▄█▀▀ ▀█▄▄
▄▄█▀▀ ▄▄▄██
▄▄███▀▀▀█▄▄▄██▀▀▀▀▀ █
██▄▄▄█▄ ▄█▀ █
█ ▀▀▀ ▄█▀█▄ █
█ █ █ █
█ █▀█ ▀▀█▀▀ █
█ ▀▀▀ ▄▄▄▄▄▄▄▄▄▄▄▄▄█
▀▀▀▀▀▀▀▀▀

View File

@@ -1,13 +1,13 @@
██████████████ ███████
██████████████████████ ███████████
██████████████████████████████ ███████████████
██████████████████████████████████ █████████████████
██████████████████████████████████████ ███████████████████
██████████████████████████████████████████████ ███████████████████████
██████████████████████████████████████████████ ███████████████████████
██████████████████████████████████████████████████ █████████████████████████
██████████████████████████████████████████████████ █████████████████████████
▀██████████████████████████████████████████▀▀▀▀ ▀█████████████████████▀▀
▀▀▀▀██████████████████████████████████▀▀▀▀ ▀▀█████████████████▀▀
▀▀▀▀██████████████▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀███████▀▀▀▀▀▀▀▀
▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀

View File

@@ -1,28 +1,14 @@
██ ▄▀▄
██ ██ ▄▄█ █▄▄
██ ██ ▄▄▀▀▀ ▀█▀ ▀▀▀▄▄
██████ ██████ ▄█▀ ▀█▄
██████ ██████ ██████ ▄▀ ▀▄
████ ██ ████ ▄█ █▄
███ ████ ▄▀█▀▄ █
███ ████ █▄▄▄▀▀ ▀▀▄▄▄█
█▄ ▄█
██ ██ ▀▄ █▀▀▀█ ▄▀
██ ██ ▀█▄ ▄▀ ▀▄ ▄█▀
████ ██ ██ ████ ▀▀█ █▀▀
██ ████ ████ ██ ▀▄ ▄▀
██ ██ ██ ██ ██ ██ ▀▀▄▀▀
██ ████ ██ ██ ████ ██
████████ ██ ██ ████████
██ ██ ██ ██
██ ████ ████ ██
██ ██████████ ██
██ ██ ██ ██
████ ██ ██ ████
████ ██ ██ ████
██████ ██████
██ ██
██ ██
██ ██
████ ████
██

View File

@@ -1,13 +1,13 @@
▄▄▄▄▄▄▄▄▄▄ ▄▄▀▀▄▄ ▄▄▄▄▄ ▄▀▄
█ ██▄▄▀▀ ▀▀▄▄ █▄▀ ▀▄
█ ▄▄▀▀ ▄▄▀▀▀▀▀▀▄▄ ▀▀▄▄ ▄▀ ▄▀▀▀▄ ▀▄
██▄▄▀▀ ▄▄▀▀ ▀▀▄▄ ▀▀▄▄ █▄▀ ▄▀ ▀▄ ▀▄
▄▄▀▀ ▄▄▀▀ ▀▀▄▄ ▀▀▄▄ ▄▀ ▄▀ ▀▄ ▀▄
▄▄▀▀ ▄▄▀▀ ▀▀▄▄ ▀▀▄▄ ▄▀ ▄▀ ▀▄ ▀▄
▀▄▄▄▄██ ▄▄▄▄▄▄▄▄▄▄▄▄ ██▄▄▄▄▀ ▀▄▄█ ▄▄▄▄▄▄ █▄▄
██ ██ ██ ██▀▀▀▀▀▀▀▀▀▀██ ██ █ █ █ █▀▀▀▀▀█ █
██ ██ ██ ██ ██ ██ █ █ █ █ █ █
██ ██ ▄▄██ ██ ██ ██ █ █ ▄█ █ █ █
██ ██ ██ ██▄▄▄▄▄▄▄▄▄▄██ ██ █ █ █ █▄▄▄▄▄█ █
██ ██ ██ ██ █ █ █ █
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

View File

@@ -0,0 +1,12 @@
▄█▀▀▀▀▀▀▀▀▀▀▀▀▀█▄
▄█▀ ▀█▄
▄██▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄██▄
▀▀▀▀█▀▀▀▀▀▀▀▀▀▀▀█▀▀▀▀
▄▄█▀▀▀▀▀█▀▀▀▀▀▀█▀▀▀▀█▀
▀▀▀ █ █ █
█ █ █
█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
█ █
█ █
█ █
█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█

View File

@@ -1,22 +1,11 @@
██ ▄▀
██ ▄▀▄▄▀
██ ██ ▄ █▄▀▀▄
████ █ ██▀▀▀
██ ████ █ ██▄▄▀
██ ████ ██ ▄▀▄ █ ██▄▄▄
██ ██████████ █ █ ██▄▄▄▄▄▀
██ ██ ████ █ ██▄▄▄▄
██ ██ ████ ██ ██▄▄▄▄▄▀
██ ██ ████████ ▄▀
██ ██ ████ ▄▀
██ ██ ██ ██████████
██ ██ ████ ██
██ ██ ██████████████
██ ████
██ ████████████
████ ██
██████████████
██
██
██
██

View File

@@ -0,0 +1,18 @@
▄▀▀▀▀▀▀▀▄
█▄ ▄█
█ ▀▀▀▀▀▀▀ █
█ █
█ █
█ █
█ █
█ █
█ █
▀▄▄ ▄▄▀
▀███▀
███
███
███
███
▄▄▄▄█████▄▄▄
██ ██
▀▀▀▄▄▄▄▄▄▄▀▀▀

View File

@@ -0,0 +1,13 @@
▄▄█▀▀▀██▄▄
▄▄█▀ ▄ ▀█▄
▄▄█▀ ▄▀▀ █
▄█▀ ▄▄▀ ▄▀
▄█▀▀ ▄▀ ▄▀ ▄▄█▀
▄█▀▀ ▄▀▀ ▄▀▀ ▄█▀▀
▄█▀▀▀█▄▄ ▄▄▀ ▄██▀
▄█▀▀ ▄▄▄▄ ▀█▄ ▄█▀
█ █▀ ▀ █▄ ▄█▀▀
█ █ ▀▀█ █▄▄█▀
█▄ ▀█▄█▀ ██▀
▀█▄▄ ▄█▀▀
▀▀▀▀▀▀

View File

@@ -23,6 +23,5 @@
"cantCutTrees": "You need {0} axes to cut trees!", "cantCutTrees": "You need {0} axes to cut trees!",
"cantMilkCows": "You don`t own any cows!", "cantMilkCows": "You don`t own any cows!",
"cantProduce": "You can`t produce when you dont have {0}", "cantProduce": "You can`t produce when you dont have {0}",
"cantSell": "You can`t sell this item! You don`t have it!", "cantSell": "You can`t sell this item! You don`t have it!"
"cantBuy": "You can`t buy this item!"
} }