Browse Source

Merge branch 'develop' of https://github.com/RedEagle-dh/BitBiome into develop

remotes/origin/develop
Juliakn66 2 years ago
parent
commit
bd38b287c9
  1. 4
      playerconfig.json
  2. 52
      src/main/java/org/bitbiome/classes/TravelEngine.java
  3. 2
      src/main/java/org/bitbiome/commands/CommandListener.java
  4. 23
      src/main/java/org/bitbiome/commands/GoldCommand.java
  5. 9
      src/main/java/org/bitbiome/commands/HelpCommand.java
  6. 94
      src/main/java/org/bitbiome/commands/MapCommand.java
  7. 85
      src/main/java/org/bitbiome/commands/TravelCommand.java
  8. 8
      src/main/java/org/bitbiome/entities/Player.java
  9. 64
      src/main/resources/gameconfig.json
  10. 221
      src/main/resources/items.json
  11. 59
      src/main/resources/mobs.json
  12. 2
      src/main/resources/playerconfig.json
  13. 0
      src/test/java/org/bitbiome/commands/HelpCommandTest.java
  14. 2
      src/test/java/org/bitbiome/commands/LocationCommandTest.java
  15. 172
      src/test/java/org/bitbiome/commands/MapCommandTest.java

4
playerconfig.json

@ -1,6 +1,6 @@
{
"gold": 0,
"name": "Julia",
"name": "null",
"hp": 10,
"inventory": [
{
@ -20,5 +20,5 @@
"doesDamage": true
}
],
"currentLocation": "Wald"
"currentLocation": "Berge"
}

52
src/main/java/org/bitbiome/classes/TravelEngine.java

@ -1,12 +1,16 @@
package org.bitbiome.classes;
import org.bitbiome.entities.Location;
import org.bitbiome.entities.Player;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
public class TravelEngine {
private JSONArray locations;
@ -42,6 +46,54 @@ public class TravelEngine {
return found;
}
public boolean locationExistsWald(String name) {
boolean found = false;
if (locations.getJSONObject(1).getString("name").equals(name) | locations.getJSONObject(4).getString("name").equals(name) | locations.getJSONObject(3).getString("name").equals(name)) {
found = true;
}
return found;
}
public boolean locationExistsStrand(String name) {
boolean found = false;
if (locations.getJSONObject(5).getString("name").equals(name) | locations.getJSONObject(0).getString("name").equals(name)) {
found = true;
}
return found;
}
public boolean locationExistsGruenland(String name) {
boolean found = false;
if (locations.getJSONObject(5).getString("name").equals(name) | locations.getJSONObject(0).getString("name").equals(name) | locations.getJSONObject(2).getString("name").equals(name)) {
found = true;
}
return found;
}
public boolean locationExistsBerge(String name) {
boolean found = false;
if (locations.getJSONObject(0).getString("name").equals(name) | locations.getJSONObject(2).getString("name").equals(name)) {
found = true;
}
return found;
}
public boolean locationExistsWinterland(String name) {
boolean found = false;
if (locations.getJSONObject(4).getString("name").equals(name) | locations.getJSONObject(3).getString("name").equals(name)) {
found = true;
}
return found;
}
public boolean locationExistsWueste(String name) {
boolean found = false;
if (locations.getJSONObject(1).getString("name").equals(name) | locations.getJSONObject(4).getString("name").equals(name)) {
found = true;
}
return found;
}
public Location getLocationByName(String name) {
JSONObject gameconfig = JsonParser.getJSONObject("src/main/resources/gameconfig.json");
JSONArray locations = gameconfig.getJSONArray("locations");

2
src/main/java/org/bitbiome/commands/CommandListener.java

@ -21,6 +21,8 @@ public class CommandListener {
commands.put("inventory", new InventoryCommand());
commands.put("lookaround", new LookaroundCommand());
commands.put("collect", new CollectCommand());
commands.put("map", new MapCommand());
commands.put("gold", new GoldCommand());
commands.put("shop", new ShopCommand());
}

23
src/main/java/org/bitbiome/commands/GoldCommand.java

@ -0,0 +1,23 @@
package org.bitbiome.commands;
import java.util.Scanner;
import org.bitbiome.classes.TravelEngine;
import org.bitbiome.entities.Player;
public class GoldCommand implements CommandAPI{
public static String getGoldMessage(Player player) {
return "Du hast " + player.getGold() + " Gold";
}
@Override
public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) {
System.out.println(getGoldMessage(travelEngine.getPlayer()));
return;
}
}

9
src/main/java/org/bitbiome/commands/HelpCommand.java

@ -37,15 +37,18 @@ public class HelpCommand implements CommandAPI {
.append("|--------------|-----------------------------|\n")
.append("|" + Colors.ANSI_GREEN + " blackjack" + Colors.ANSI_RESET + " | Startet blackjack im shop |\n")
.append("|--------------|-----------------------------|\n")
.append("|" + Colors.ANSI_GREEN + " location" + Colors.ANSI_RESET + " | Gibt deine Location aus |\n")
.append("|--------------|-----------------------------|\n")
.append("|" + Colors.ANSI_GREEN + " inventory" + Colors.ANSI_RESET + " | Gibt dein Inventar aus |\n")
.append("|--------------|-------------------------------|\n")
.append("|" + Colors.ANSI_GREEN + " collect " + Colors.ANSI_RESET + " | Gibt deine Location aus |\n")
.append("|--------------|-------------------------------|\n")
.append("|" + Colors.ANSI_GREEN + " lookaround" + Colors.ANSI_RESET + " | Zeigt dir deine Umgebung, |\n")
.append("|" + Colors.ANSI_GREEN + " " + Colors.ANSI_RESET + " | Items und Mobs in der Nähe |\n")
.append("|______________|_______________________________|\n");
.append("|--------------|-----------------------------|\n")
.append("|" + Colors.ANSI_GREEN + " map" + Colors.ANSI_RESET + " | Zeigt dir deinen Karte |\n")
.append("|--------------|-----------------------------|\n")
.append("|" + Colors.ANSI_GREEN + " gold" + Colors.ANSI_RESET + " | Gibt dein Gold an |\n")
.append("|______________|_____________________________|\n");
return outputMessage.toString();
}

94
src/main/java/org/bitbiome/commands/MapCommand.java

@ -0,0 +1,94 @@
package org.bitbiome.commands;
import org.bitbiome.classes.TravelEngine;
import org.json.JSONArray;
import java.util.Scanner;
import org.bitbiome.classes.Colors;
public class MapCommand implements CommandAPI{
@Override
public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) {
System.out.println(getMapMessage(travelEngine));
}
public static String getLocationMessage(TravelEngine travelEngine) {
return "Du befindest dich gerade hier: " + Colors.ANSI_GREEN + travelEngine.getPlayer().getLocation().getName() + "\n" + Colors.ANSI_RESET;
}
private static String textColor(String text, String color) {
return color + text + Colors.ANSI_RESET;
}
private static String textBlack(String text) {
return textColor(text,Colors.ANSI_BRIGHT_BLACK);
}
private static String textBlue(String text) {
return textColor(text,Colors.ANSI_BLUE);
}
private static String textGreen(String text) {
return textColor(text,Colors.ANSI_GREEN);
}
private static String signup() {
return (" __________________________________________________________________________________________________\n");
}
private static String signdown() {
return ("|________________________________|________________________________|________________________________|\n");
}
private static String signmiddle() {
return ("| | | |\n");
}
private static String mapup(TravelEngine travelEngine) {
return getLocationMessage(travelEngine) + "Zu den " + textBlue("blau ") + "markierten Standorten kannst du reisen\n\nDeine Karte:\n\n" + signup() + signmiddle() + signmiddle();
}
private static String mapmiddle() {
return signmiddle() + signdown() + signmiddle() + signmiddle();
}
private static String mapdown() {
return signmiddle() + signdown();
}
public static String getMapMessage(TravelEngine travelEngine) {
StringBuilder outputMessage = new StringBuilder();
JSONArray locations = travelEngine.getLocationList();
String locationWueste = locations.getJSONObject(5).getString("name");
String locationGruenland = locations.getJSONObject(4).getString("name");
String locationWinterland = locations.getJSONObject(2).getString("name");
String locationStrand = locations.getJSONObject(1).getString("name");
String locationWald = locations.getJSONObject(0).getString("name");
String locationBerge = locations.getJSONObject(3).getString("name");
if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) {
outputMessage
.append(mapup(travelEngine)).append("| ").append(textBlack(locationWueste)).append(" | ").append(textBlue(locationGruenland)).append(" | ").append(textBlack(locationWinterland)).append(" |").append("\n")
.append(mapmiddle()).append("| ").append(textBlue(locationStrand)).append(" | ").append(textGreen(locationWald)).append(" | ").append(textBlue(locationBerge)).append(" |").append("\n")
.append(mapdown());
} else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) {
outputMessage
.append(mapup(travelEngine)).append("| ").append(textBlue(locationWueste)).append(" | ").append(textBlack(locationGruenland)).append(" | ").append(textBlack(locationWinterland)).append(" |").append("\n")
.append(mapmiddle()).append("| ").append(textGreen(locationStrand)).append(" | ").append(textBlue(locationWald)).append(" | ").append(textBlack(locationBerge)).append(" |").append("\n")
.append(mapdown());
} else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Berge")) {
outputMessage
.append(mapup(travelEngine)).append("| ").append(textBlack(locationWueste)).append(" | ").append(textBlack(locationGruenland)).append(" | ").append(textBlue(locationWinterland)).append(" |").append("\n")
.append(mapmiddle()).append("| ").append(textBlack(locationStrand)).append(" | ").append(textBlue(locationWald)).append(" | ").append(textGreen(locationBerge)).append(" |").append("\n")
.append(mapdown());
} else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wueste")) {
outputMessage
.append(mapup(travelEngine)).append("| ").append(textGreen(locationWueste)).append(" | ").append(textBlue(locationGruenland)).append(" | ").append(textBlack(locationWinterland)).append(" |").append("\n")
.append(mapmiddle()).append("| ").append(textBlue(locationStrand)).append(" | ").append(textBlack(locationWald)).append(" | ").append(textBlack(locationBerge)).append(" |").append("\n")
.append(mapdown());
} else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Gruenland")) {
outputMessage
.append(mapup(travelEngine)).append("| ").append(textBlue(locationWueste)).append(" | ").append(textGreen(locationGruenland)).append(" | ").append(textBlue(locationWinterland)).append(" |").append("\n")
.append(mapmiddle()).append("| ").append(textBlack(locationStrand)).append(" | ").append(textBlue(locationWald)).append(" | ").append(textBlack(locationBerge)).append(" |").append("\n")
.append(mapdown());
} else {
outputMessage
.append(mapup(travelEngine)).append("| ").append(textBlack(locationWueste)).append(" | ").append(textBlue(locationGruenland)).append(" | ").append(textGreen(locationWinterland)).append(" |").append("\n")
.append(mapmiddle()).append("| ").append(textBlack(locationStrand)).append(" | ").append(textBlack(locationWald)).append(" | ").append(textBlue(locationBerge)).append(" |").append("\n")
.append(mapdown());
}
return outputMessage.toString();
}
}

85
src/main/java/org/bitbiome/commands/TravelCommand.java

@ -13,26 +13,79 @@ import java.util.Scanner;
public class TravelCommand implements CommandAPI {
public void exittravelCommand() {
System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET);
}
public void travelCommand() {
}
@Override
public void performCommand(Scanner scanner, boolean isRunning, String message, TravelEngine travelEngine) {
print(Colors.ANSI_BLUE + "Du hast dein Travel-Pad gezückt. Wohin möchtest du reisen?" + Colors.ANSI_RESET);
System.out.println(Colors.ANSI_BLUE + "Du hast dein Travel-Pad gezückt. Wohin möchtest du reisen?" + Colors.ANSI_RESET);
JSONArray locations = travelEngine.getLocationList();
for (int i = 0; i < locations.length(); i++) {
print("- " + locations.getJSONObject(i).getString("name"));
}
String locationName = scanner.nextLine();
if (travelEngine.locationExists(locationName)) {
travelEngine.travelTo(new Location(locationName, new ArrayList<Mob>(), new ArrayList<Item>()));
print(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET);
} else {
print(Colors.ANSI_BLUE + "Du hast dein Travel-Pad weggesteckt." + Colors.ANSI_RESET);
}
}
String locationName = "";
String locationWueste = locations.getJSONObject(5).getString("name");
String locationGruenland = locations.getJSONObject(4).getString("name");
String locationWinterland = locations.getJSONObject(2).getString("name");
String locationStrand = locations.getJSONObject(1).getString("name");
String locationWald = locations.getJSONObject(0).getString("name");
String locationBerge = locations.getJSONObject(3).getString("name");
if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wald")) {
System.out.println("- " + locationStrand + "\n" + "- " + locationGruenland + "\n" + "- " + locationBerge);
locationName = scanner.nextLine();
if (!travelEngine.locationExistsWald(locationName)) {
exittravelCommand();
return;
}
} else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Strand")) {
System.out.println("- " + locationWueste + "\n" + "- " + locationWald);
locationName = scanner.nextLine();
if (!travelEngine.locationExistsStrand(locationName)) {
exittravelCommand();
return;
}
} else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Gruenland")) {
System.out.println("- " + locationWueste + "\n" + "- " + locationWald + "\n" + "- " + locationWinterland);
locationName = scanner.nextLine();
if (!travelEngine.locationExistsGruenland(locationName)) {
exittravelCommand();
return;
}
} else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Berge")) {
System.out.println("- " + locationWald + "\n" + "- " + locationWinterland);
locationName = scanner.nextLine();
if (!travelEngine.locationExistsBerge(locationName)) {
exittravelCommand();
return;
}
} else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Winterland")) {
System.out.println("- " + locationGruenland + "\n" + "- " + locationBerge);
locationName = scanner.nextLine();
if (!travelEngine.locationExistsWinterland(locationName)) {
exittravelCommand();
return;
}
} else if (travelEngine.getPlayer().getLocation().getName().equalsIgnoreCase("Wueste")) {
System.out.println("- " + locationStrand + "\n" + "- " + locationGruenland);
public String print(String message) {
System.out.println(message);
return message;
locationName = scanner.nextLine();
if (!travelEngine.locationExistsWueste(locationName)) {
exittravelCommand();
return;
}
} travelEngine.travelTo(new Location(locationName, new ArrayList<Mob>(), new ArrayList<Item>()));
System.out.println(Colors.ANSI_BLUE + "Du bist nun hierhin gereist: " + locationName + "\n" + Colors.ANSI_RESET);
}
}

8
src/main/java/org/bitbiome/entities/Player.java

@ -11,6 +11,10 @@ import java.util.ArrayList;
public class Player {
private String name;
private float hp;
private int gold;
private Location location;
private ArrayList<Item> inventory;
@ -72,6 +76,10 @@ public class Player {
this.name = name;
}
public int getGold() { return (int) gold; }
public int setGold(int gold) { this.gold = gold; return gold; }
public void setInventory(ArrayList<Item> inventory) {
this.inventory = inventory;
}

64
src/main/resources/gameconfig.json

@ -6,25 +6,19 @@
"name": "Holz"
},
{
"gold": 1000,
"amount": 1,
"name": "Heiliges Schwert der Engel"
"gold": 3,
"amount": 400,
"name": "Loewenkralle"
},
{
"gold": 2,
"amount": 1500,
"name": "Stein"
"gold": 3,
"amount": 200,
"name": "Drachenhaut"
}
],
"locations": [
{
"mobs": [{
"isFriendly": true,
"damage": "15",
"name": "Big Foot",
"hp": 50,
"items": ["Fell"]
}],
"mobs": ["Big Foot"],
"name": "Wald",
"items": [
"Holz",
@ -32,17 +26,43 @@
]
},
{
"mobs": [{
"isFriendly": true,
"damage": "15",
"name": "Big Foot",
"hp": 50,
"items": ["Fell"]
}],
"mobs": ["Riesenkrabbe"],
"name": "Strand",
"items": [
"Holz",
"Stein"
"Sand",
"Treibholz"
]
},
{
"mobs": ["Yeti"],
"name": "Winterland",
"items": [
"Eiszapfen",
"Schnee"
]
},
{
"mobs": ["Loewe"],
"name": "Berge",
"items": [
"Quellwasser",
"Feuerstein"
]
},
{
"mobs": ["Drache"],
"name": "Gruenland",
"items": [
"Lehm",
"Giftblume"
]
},
{
"mobs": ["Mumie"],
"name": "Wueste",
"items": [
"Sand",
"Kaktus"
]
}
]

221
src/main/resources/items.json

@ -1,39 +1,182 @@
[
{
"name": "Holz",
"damage": "1-3",
"crafting": true,
"doesDamage": true,
"durability": 1000,
"amountShop": 10,
"gold": 10
},
{
"name": "Heiliges Schwert der Engel",
"damage": "1000",
"crafting": false,
"doesDamage": true,
"durability": 1000,
"amountShop": 1,
"gold": 1000
},
{
"name": "Stein",
"damage": "5-10",
"crafting": true,
"doesDamage": true,
"durability": 1000,
"amountShop": 1500,
"gold": 2
},
{
"name": "Fell",
"damage": "0",
"crafting": true,
"doesDamage": false,
"durability": 1000,
"amountShop": 500,
"gold": 100
}
]
[
{
"name": "Holz",
"damage": "2",
"crafting": true,
"durability": 1000,
"doesDamage": true,
"amountShop": 10,
"gold": 10
},
{
"name": "Heiliges Schwert der Engel",
"damage": "1000",
"crafting": false,
"durability": 1000,
"doesDamage": true,
"amountShop": 1,
"gold": 1000
},
{
"name": "Stein",
"damage": "7",
"crafting": true,
"durability": 1000,
"doesDamage": true,
"amountShop": 1500,
"gold": 2
},
{
"name": "Fell",
"damage": "0",
"crafting": true,
"durability": 1000,
"doesDamage": false,
"amountShop": 500,
"gold": 100
},
{
"name": "Sand",
"damage": "2",
"crafting": true,
"durability": 1000,
"doesDamage": true,
"amountShop": 1500,
"gold": 1
},
{
"name": "Treibholz",
"damage": "1",
"crafting": true,
"durability": 1000,
"doesDamage": true,
"amountShop": 1000,
"gold": 1
},
{
"name": "Krabbenschere",
"damage": "4",
"crafting": true,
"durability": 1000,
"doesDamage": true,
"amountShop": 750,
"gold": 1
},
{
"name": "Eiszapfen",
"damage": "5",
"crafting": true,
"durability": 1000,
"doesDamage": true,
"amountShop": 1000,
"gold": 1
},
{
"name": "Schnee",
"damage": "1",
"crafting": true,
"durability": 10,
"doesDamage": true,
"amountShop": 100,
"gold": 1
},
{
"name": "Yetikralle",
"damage": "20",
"crafting": true,
"durability": 1000,
"doesDamage": true,
"amountShop": 250,
"gold": 5
},
{
"name": "Loewenkralle",
"damage": "10",
"crafting": true,
"durability": 1000,
"doesDamage": true,
"amountShop": 400,
"gold": 3
},
{
"name": "Feuerstein",
"damage": "0",
"crafting": true,
"durability": 1000,
"doesDamage": false,
"amountShop": 1500,
"gold": 2
},
{
"name": "Quellwasser",
"damage": "0",
"crafting": true,
"durability": 5,
"doesDamage": false,
"amountShop": 1500,
"gold": 1
},
{
"name": "Lehm",
"damage": "0",
"crafting": true,
"durability": 1000,
"doesDamage": false,
"amountShop": 3000,
"gold": 1
},
{
"name": "Giftblume",
"damage": "15-20",
"crafting": true,
"durability": 1000,
"doesDamage": true,
"amountShop": 300,
"gold": 1
},
{
"name": "Drachenzahn",
"damage": "5",
"crafting": true,
"durability": 1000,
"doesDamage": true,
"amountShop": 300,
"gold": 3
},
{
"name": "Drachenhaut",
"damage": "0",
"crafting": true,
"durability": 1000,
"doesDamage": false,
"amountShop": 200,
"gold": 3
},
{
"name": "Sand",
"damage": "1",
"crafting": true,
"durability": 1000,
"doesDamage": true,
"amountShop": 1500,
"gold": 1
},
{
"name": "Knochen",
"damage": "6",
"crafting": true,
"durability": 1000,
"doesDamage": true,
"amountShop": 450,
"gold": 2
},
{
"name": "Kaktus",
"damage": "5",
"crafting": true,
"durability": 1000,
"doesDamage": true,
"amountShop": 700,
"gold": 2
}
]

59
src/main/resources/mobs.json

@ -0,0 +1,59 @@
[
{
"name": "Big Foot",
"hp": 50,
"damage": "15",
"isFriendly": true,
"items": [
"Fell"
]
},
{
"name": "Riesenkrabbe",
"hp": 50,
"damage": "9",
"isFriendly": false,
"items": [
"Krabbenschere"
]
},
{
"name": "Yeti",
"hp": 55,
"damage": "17",
"isFriendly": true,
"items": [
"Fell",
"Yetikralle"
]
},
{
"name": "Loewe",
"hp": 30,
"damage": "15",
"isFriendly": false,
"items": [
"Fell",
"Loewenkralle"
]
},
{
"name": "Drache",
"hp": 55,
"damage": "20",
"isFriendly": false,
"items": [
"Drachenzahn",
"Drachenhaut"
]
},
{
"name": "Mumie",
"hp": 40,
"damage": "12",
"isFriendly": false,
"items": [
"Knochen"
]
}
]

2
src/main/resources/playerconfig.json

@ -20,5 +20,5 @@
"doesDamage": true
}
],
"currentLocation": "Wald"
"currentLocation": "Berge"
}

0
src/test/java/org/bitbiome/commands/HelpCommandTest.java

2
src/test/java/org/bitbiome/commands/LocationCommandTest.java

@ -14,7 +14,7 @@ public class LocationCommandTest {
public void testLocationCommand() {
Player p = new Player("Unit");
TravelEngine tE = new TravelEngine(p);
String[] standorte = {"Wald", "Strand"};
String[] standorte = {"Wald", "Strand", "Berge", "Wueste", "Winterland", "Gruenland"};
String locationMessage = LocationCommand.getLocationMessage(tE).split(": ")[1];
assertTrue(Arrays.asList(standorte).contains(locationMessage));
}

172
src/test/java/org/bitbiome/commands/MapCommandTest.java

@ -0,0 +1,172 @@
package org.bitbiome.commands;
import org.bitbiome.classes.Colors;
import org.bitbiome.classes.TravelEngine;
import org.bitbiome.entities.Location;
import org.bitbiome.entities.Mob;
import org.bitbiome.entities.Player;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class MapCommandTest {
@Test
public void testWaldMapCommand() {
Player Test = new Player("name");
TravelEngine outputtest = new TravelEngine(Test);
Location Wald = outputtest.getLocationByName("Wald");
outputtest.travelTo(Wald);
String mapMessage = MapCommand.getMapMessage(outputtest);
StringBuilder outputMessage = new StringBuilder();
outputMessage
.append("Du befindest dich gerade hier: " + Colors.ANSI_GREEN + "Wald" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n")
.append("Deine Karte:\n\n")
.append(" __________________________________________________________________________________________________\n")
.append("| | | |\n")
.append("| | | |\n")
.append("| " + Colors.ANSI_BRIGHT_BLACK + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Winterland" + Colors.ANSI_RESET + " |" + "\n")
.append("| | | |\n")
.append("|________________________________|________________________________|________________________________|\n")
.append("| | | |\n")
.append("| | | |\n")
.append("| " + Colors.ANSI_BLUE + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Berge" + Colors.ANSI_RESET + " |" + "\n")
.append("| | | |\n")
.append("|________________________________|________________________________|________________________________|\n");
assertEquals(outputMessage.toString(), mapMessage);
}
@Test
public void testStrandMapCommand() {
Player Test = new Player("name");
TravelEngine outputtest = new TravelEngine(Test);
Location Strand = outputtest.getLocationByName("Strand");
outputtest.travelTo(Strand);
String mapMessage = MapCommand.getMapMessage(outputtest);
StringBuilder outputMessage = new StringBuilder();
outputMessage
.append("Du befindest dich gerade hier: " + Colors.ANSI_GREEN + "Strand" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n")
.append("Deine Karte:\n\n")
.append(" __________________________________________________________________________________________________\n")
.append("| | | |\n")
.append("| | | |\n")
.append("| " + Colors.ANSI_BLUE + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Winterland" + Colors.ANSI_RESET + " |" + "\n")
.append("| | | |\n")
.append("|________________________________|________________________________|________________________________|\n")
.append("| | | |\n")
.append("| | | |\n")
.append("| " + Colors.ANSI_GREEN + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Berge" + Colors.ANSI_RESET + " |" + "\n")
.append("| | | |\n")
.append("|________________________________|________________________________|________________________________|\n");
assertEquals(outputMessage.toString(), mapMessage);
}
@Test
public void testBergeMapCommand() {
Player Test = new Player("name");
TravelEngine outputtest = new TravelEngine(Test);
Location Berge = outputtest.getLocationByName("Berge");
outputtest.travelTo(Berge);
String mapMessage = MapCommand.getMapMessage(outputtest);
StringBuilder outputMessage = new StringBuilder();
outputMessage
.append("Du befindest dich gerade hier: " + Colors.ANSI_GREEN + "Berge" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n")
.append("Deine Karte:\n\n")
.append(" __________________________________________________________________________________________________\n")
.append("| | | |\n")
.append("| | | |\n")
.append("| " + Colors.ANSI_BRIGHT_BLACK + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Winterland" + Colors.ANSI_RESET + " |" + "\n")
.append("| | | |\n")
.append("|________________________________|________________________________|________________________________|\n")
.append("| | | |\n")
.append("| | | |\n")
.append("| " + Colors.ANSI_BRIGHT_BLACK + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + "Berge" + Colors.ANSI_RESET + " |" + "\n")
.append("| | | |\n")
.append("|________________________________|________________________________|________________________________|\n");
assertEquals(outputMessage.toString(), mapMessage);
}
@Test
public void testWuesteMapCommand() {
Player Test = new Player("name");
TravelEngine outputtest = new TravelEngine(Test);
Location Wueste = outputtest.getLocationByName("Wueste");
outputtest.travelTo(Wueste);
String mapMessage = MapCommand.getMapMessage(outputtest);
StringBuilder outputMessage = new StringBuilder();
outputMessage
.append("Du befindest dich gerade hier: " + Colors.ANSI_GREEN + "Wueste" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n")
.append("Deine Karte:\n\n")
.append(" __________________________________________________________________________________________________\n")
.append("| | | |\n")
.append("| | | |\n")
.append("| " + Colors.ANSI_GREEN + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Winterland" + Colors.ANSI_RESET + " |" + "\n")
.append("| | | |\n")
.append("|________________________________|________________________________|________________________________|\n")
.append("| | | |\n")
.append("| | | |\n")
.append("| " + Colors.ANSI_BLUE + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Berge" + Colors.ANSI_RESET + " |" + "\n")
.append("| | | |\n")
.append("|________________________________|________________________________|________________________________|\n");
assertEquals(outputMessage.toString(), mapMessage);
}
@Test
public void testGruenlandMapCommand() {
Player Test = new Player("name");
TravelEngine outputtest = new TravelEngine(Test);
Location Gruenland = outputtest.getLocationByName("Gruenland");
outputtest.travelTo(Gruenland);
String mapMessage = MapCommand.getMapMessage(outputtest);
StringBuilder outputMessage = new StringBuilder();
outputMessage
.append("Du befindest dich gerade hier: " + Colors.ANSI_GREEN + "Gruenland" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n")
.append("Deine Karte:\n\n")
.append(" __________________________________________________________________________________________________\n")
.append("| | | |\n")
.append("| | | |\n")
.append("| " + Colors.ANSI_BLUE + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Winterland" + Colors.ANSI_RESET + " |" + "\n")
.append("| | | |\n")
.append("|________________________________|________________________________|________________________________|\n")
.append("| | | |\n")
.append("| | | |\n")
.append("| " + Colors.ANSI_BRIGHT_BLACK + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Berge" + Colors.ANSI_RESET + " |" + "\n")
.append("| | | |\n")
.append("|________________________________|________________________________|________________________________|\n");
assertEquals(outputMessage.toString(), mapMessage);
}
@Test
public void testWinterlandMapCommand() {
Player Test = new Player("name");
TravelEngine outputtest = new TravelEngine(Test);
Location Winterland = outputtest.getLocationByName("Winterland");
outputtest.travelTo(Winterland);
String mapMessage = MapCommand.getMapMessage(outputtest);
StringBuilder outputMessage = new StringBuilder();
outputMessage
.append("Du befindest dich gerade hier: " + Colors.ANSI_GREEN + "Winterland" + "\n" + Colors.ANSI_RESET + "Zu den " + Colors.ANSI_BLUE + "blau " + Colors.ANSI_RESET + "markierten Standorten kannst du reisen\n\n")
.append("Deine Karte:\n\n")
.append(" __________________________________________________________________________________________________\n")
.append("| | | |\n")
.append("| | | |\n")
.append("| " + Colors.ANSI_BRIGHT_BLACK + "Wueste" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Gruenland" + Colors.ANSI_RESET + " | " + Colors.ANSI_GREEN + "Winterland" + Colors.ANSI_RESET + " |" + "\n")
.append("| | | |\n")
.append("|________________________________|________________________________|________________________________|\n")
.append("| | | |\n")
.append("| | | |\n")
.append("| " + Colors.ANSI_BRIGHT_BLACK + "Strand" + Colors.ANSI_RESET + " | " + Colors.ANSI_BRIGHT_BLACK + "Wald" + Colors.ANSI_RESET + " | " + Colors.ANSI_BLUE + "Berge" + Colors.ANSI_RESET + " |" + "\n")
.append("| | | |\n")
.append("|________________________________|________________________________|________________________________|\n");
assertEquals(outputMessage.toString(), mapMessage);
}
}
Loading…
Cancel
Save