diff --git a/README.md b/README.md new file mode 100644 index 0000000..1552c8a --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# Terminal Game + +A multiplayer terminal-based game built with Java, utilizing WebSockets for communication and Lanterna for the text-based user interface. + +## Project Structure + +* **game**: Client application (TUI). +* **server**: WebSocket server. +* **common**: Shared libraries and logic. + +## Requirements + +* Java 25 +* Maven + +## How to Run + +1. Build the project: + ```bash + mvn clean install + ``` + +2. Start the server: + ```bash + mvn compile exec:java -pl server -am + ``` + +3. Start the client (in a new terminal): + ```bash + mvn compile exec:java -pl game -am + ``` \ No newline at end of file diff --git a/game/src/main/java/cz/jzitnik/client/game/items/types/BeastSkin.java b/game/src/main/java/cz/jzitnik/client/game/items/types/BeastSkin.java new file mode 100644 index 0000000..e72b9f5 --- /dev/null +++ b/game/src/main/java/cz/jzitnik/client/game/items/types/BeastSkin.java @@ -0,0 +1,8 @@ +package cz.jzitnik.client.game.items.types; + +public class BeastSkin implements ItemType { + @Override + public Class getItemType() { + return BeastSkin.class; + } +} diff --git a/game/src/main/java/cz/jzitnik/client/game/items/types/ItemType.java b/game/src/main/java/cz/jzitnik/client/game/items/types/ItemType.java index 7bbfcef..a2dfe1f 100644 --- a/game/src/main/java/cz/jzitnik/client/game/items/types/ItemType.java +++ b/game/src/main/java/cz/jzitnik/client/game/items/types/ItemType.java @@ -12,7 +12,9 @@ import cz.jzitnik.client.game.items.types.weapons.Sword; @JsonSubTypes({ @JsonSubTypes.Type(value = Food.class, name = "food"), @JsonSubTypes.Type(value = Sword.class, name = "weapon_sword"), - @JsonSubTypes.Type(value = Junk.class, name = "junk") + @JsonSubTypes.Type(value = Junk.class, name = "junk"), + @JsonSubTypes.Type(value = Key.class, name = "key"), + @JsonSubTypes.Type(value = BeastSkin.class, name = "beast_skin"), }) public interface ItemType { Class getItemType(); diff --git a/game/src/main/java/cz/jzitnik/client/game/items/types/Key.java b/game/src/main/java/cz/jzitnik/client/game/items/types/Key.java new file mode 100644 index 0000000..2f9af47 --- /dev/null +++ b/game/src/main/java/cz/jzitnik/client/game/items/types/Key.java @@ -0,0 +1,8 @@ +package cz.jzitnik.client.game.items.types; + +public class Key implements ItemType { + @Override + public Class getItemType() { + return Key.class; + } +} diff --git a/game/src/main/resources/setup/rooms.yaml b/game/src/main/resources/setup/rooms.yaml index 1a40c1d..20b0c71 100644 --- a/game/src/main/resources/setup/rooms.yaml +++ b/game/src/main/resources/setup/rooms.yaml @@ -75,15 +75,15 @@ answers: - answer: "I have it" requirement: - item: "quest_item_boss_skin" + item: "BeastSkin" dialog: text: "Well done. Here is the key." onEnd: type: "give_item" item: id: 800 - name: "Something" - type: { name: "junk" } + name: "Key" + type: { name: "key" } texture: "APPLE" then: { type: end } - answer: "Not yet" @@ -114,7 +114,7 @@ itemsDrops: - id: 200 name: "Beast Skin" - type: { name: "junk" } + type: { name: "beast_skin" } texture: "BOSS_SKIN" tasks: - type: "following_player" @@ -137,11 +137,8 @@ - id: "final_room" texture: "ROOM6" requirement: - item: "quest_item_final_key" + item: "Key" end: true - #objects: - # - objectType: "exit" - # cords: { x: 140, y: 40 } west: null east: null north: null