initial commit
This commit is contained in:
38
.gitignore
vendored
Normal file
38
.gitignore
vendored
Normal file
@@ -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
|
||||||
10
.idea/.gitignore
generated
vendored
Normal file
10
.idea/.gitignore
generated
vendored
Normal file
@@ -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
|
||||||
7
.idea/encodings.xml
generated
Normal file
7
.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
14
.idea/misc.xml
generated
Normal file
14
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_24" default="true" project-jdk-name="openjdk-24" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
26
pom.xml
Normal file
26
pom.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>cz.jull</groupId>
|
||||||
|
<artifactId>medieval_village_simulator</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>24</maven.compiler.source>
|
||||||
|
<maven.compiler.target>24</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.38</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
23
src/main/java/cz/jull/Game.java
Normal file
23
src/main/java/cz/jull/Game.java
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
32
src/main/java/cz/jull/Item.java
Normal file
32
src/main/java/cz/jull/Item.java
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
7
src/main/java/cz/jull/Main.java
Normal file
7
src/main/java/cz/jull/Main.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package cz.jull;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/main/java/cz/jull/Player.java
Normal file
15
src/main/java/cz/jull/Player.java
Normal file
@@ -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<Item> inventory = new ArrayList<>();
|
||||||
|
}
|
||||||
29
src/main/java/cz/jull/market/Market.java
Normal file
29
src/main/java/cz/jull/market/Market.java
Normal file
@@ -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<Item> 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
src/main/java/cz/jull/surroundings/ForestType.java
Normal file
16
src/main/java/cz/jull/surroundings/ForestType.java
Normal file
@@ -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)];
|
||||||
|
}
|
||||||
|
}
|
||||||
16
src/main/java/cz/jull/surroundings/PathType.java
Normal file
16
src/main/java/cz/jull/surroundings/PathType.java
Normal file
@@ -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)];
|
||||||
|
}
|
||||||
|
}
|
||||||
16
src/main/java/cz/jull/surroundings/SoilType.java
Normal file
16
src/main/java/cz/jull/surroundings/SoilType.java
Normal file
@@ -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)];
|
||||||
|
}
|
||||||
|
}
|
||||||
16
src/main/java/cz/jull/surroundings/WaterType.java
Normal file
16
src/main/java/cz/jull/surroundings/WaterType.java
Normal file
@@ -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)];
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user