commit e02582cba5ac59416015db3b09a22569793767e3 Author: jull Date: Sat May 3 16:25:52 2025 +0200 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..7bc07ec --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Environment-dependent path to Maven home directory +/mavenHomeManager.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..f88aef9 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..b4cd863 --- /dev/null +++ b/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + + cz.jull + medieval_village_simulator + 1.0-SNAPSHOT + + + 24 + 24 + UTF-8 + + + + + org.projectlombok + lombok + 1.18.38 + provided + + + + \ No newline at end of file diff --git a/src/main/java/cz/jull/Game.java b/src/main/java/cz/jull/Game.java new file mode 100644 index 0000000..b011f3b --- /dev/null +++ b/src/main/java/cz/jull/Game.java @@ -0,0 +1,23 @@ +package cz.jull; + +import cz.jull.surroundings.ForestType; +import cz.jull.surroundings.PathType; +import cz.jull.surroundings.SoilType; +import cz.jull.surroundings.WaterType; + +public class Game { + private Player player = new Player(); + private ForestType forestType; + private WaterType waterType; + private SoilType soilType; + private PathType pathType; + + public void generateStats() { + forestType = ForestType.getRandom(); + waterType = WaterType.getRandom(); + soilType = SoilType.getRandom(); + pathType = PathType.getRandom(); + + player.setCoins(10000); + } +} diff --git a/src/main/java/cz/jull/Item.java b/src/main/java/cz/jull/Item.java new file mode 100644 index 0000000..8714933 --- /dev/null +++ b/src/main/java/cz/jull/Item.java @@ -0,0 +1,32 @@ +package cz.jull; + +import lombok.Getter; + +@Getter +public enum Item { + AXE("Axe"), + SCYTHE("Scythe"), + + WOOD("Wood"), + + WHEAT("Wheat"), + GRAPES("Grapes"), + HOPS("Hops"), + + MILK("Milk"), + + VINEYARD("Vineyard"), + FARMLAND("Farmland"), + + FENCE_WITH_COWS("Fence with cows"), + + VILLAGER_HOUSE("Villager house"), + CHURCH("Church"), + PUB("Pub"); + + private final String name; + + Item(String name) { + this.name = name; + } +} diff --git a/src/main/java/cz/jull/Main.java b/src/main/java/cz/jull/Main.java new file mode 100644 index 0000000..d419f6a --- /dev/null +++ b/src/main/java/cz/jull/Main.java @@ -0,0 +1,7 @@ +package cz.jull; + +public class Main { + public static void main(String[] args) { + + } +} \ No newline at end of file diff --git a/src/main/java/cz/jull/Player.java b/src/main/java/cz/jull/Player.java new file mode 100644 index 0000000..32b873a --- /dev/null +++ b/src/main/java/cz/jull/Player.java @@ -0,0 +1,15 @@ +package cz.jull; + +import lombok.Getter; +import lombok.Setter; + +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +public class Player { + private int coins; + + private List inventory = new ArrayList<>(); +} diff --git a/src/main/java/cz/jull/market/Market.java b/src/main/java/cz/jull/market/Market.java new file mode 100644 index 0000000..6cc036f --- /dev/null +++ b/src/main/java/cz/jull/market/Market.java @@ -0,0 +1,29 @@ +package cz.jull.market; + +import cz.jull.Item; +import cz.jull.Player; + +import java.util.ArrayList; +import java.util.List; + +public class Market { + private final List availableItems = new ArrayList<>(List.of( + Item.AXE, Item.SCYTHE, + Item.VINEYARD, Item.FARMLAND, + Item.VILLAGER_HOUSE, Item.CHURCH, Item.FENCE_WITH_COWS, + Item.PUB + )); + + public void sellItem(Player player, Item item) { + player.getInventory().remove(item); + } + + public void buyItem(Player player, Item item) throws Exception { + if (availableItems.contains(item)) { + player.getInventory().add(item); + availableItems.remove(item); + } else { + throw new Exception("Item is not available"); + } + } +} diff --git a/src/main/java/cz/jull/surroundings/ForestType.java b/src/main/java/cz/jull/surroundings/ForestType.java new file mode 100644 index 0000000..e470fae --- /dev/null +++ b/src/main/java/cz/jull/surroundings/ForestType.java @@ -0,0 +1,16 @@ +package cz.jull.surroundings; + +import java.util.Random; + +public enum ForestType { + SMALL, + MEDIUM, + LARGE; + + public static ForestType getRandom() { + Random random = new Random(); + ForestType[] types = values(); + + return types[random.nextInt(types.length)]; + } +} diff --git a/src/main/java/cz/jull/surroundings/PathType.java b/src/main/java/cz/jull/surroundings/PathType.java new file mode 100644 index 0000000..23d3d72 --- /dev/null +++ b/src/main/java/cz/jull/surroundings/PathType.java @@ -0,0 +1,16 @@ +package cz.jull.surroundings; + +import java.util.Random; + +public enum PathType { + DEAD_END, + SIDE_PATH, + MAIN_PATH; + + public static PathType getRandom() { + Random random = new Random(); + PathType[] types = values(); + + return types[random.nextInt(types.length)]; + } +} diff --git a/src/main/java/cz/jull/surroundings/SoilType.java b/src/main/java/cz/jull/surroundings/SoilType.java new file mode 100644 index 0000000..78c7127 --- /dev/null +++ b/src/main/java/cz/jull/surroundings/SoilType.java @@ -0,0 +1,16 @@ +package cz.jull.surroundings; + +import java.util.Random; + +public enum SoilType { + STONY, + LESS_FERTILE, + FERTILE; + + public static SoilType getRandom() { + Random random = new Random(); + SoilType[] types = values(); + + return types[random.nextInt(types.length)]; + } +} diff --git a/src/main/java/cz/jull/surroundings/WaterType.java b/src/main/java/cz/jull/surroundings/WaterType.java new file mode 100644 index 0000000..ad768ce --- /dev/null +++ b/src/main/java/cz/jull/surroundings/WaterType.java @@ -0,0 +1,16 @@ +package cz.jull.surroundings; + +import java.util.Random; + +public enum WaterType { + WELL, + POND, + RIVER; + + public static WaterType getRandom() { + Random random = new Random(); + WaterType[] types = values(); + + return types[random.nextInt(types.length)]; + } +}