diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CameraController.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CameraController.java index 722169b..4d4fb0e 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CameraController.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CameraController.java @@ -17,8 +17,12 @@ public class CameraController implements GameEventListener{ * Enum representing the camera mode for the CameraController. */ public enum CameraMode { + + /** Mode to focus on the current player */ FOCUS_CURRENT_PLAYER, + /** Mode to focus on the own player */ FOCUS_SELF, + /** Mode for free camera movement */ FREECAM } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientGameLogic.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientGameLogic.java index db09560..763e169 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientGameLogic.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientGameLogic.java @@ -117,6 +117,11 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker { state.entry(); } + /** + * Returns the player handler containing information about all players in the game. + * + * @return the player handler + */ public PlayerHandler getPlayerHandler() { return playerHandler; } @@ -130,6 +135,11 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker { return board; } + /** + * Returns the trade handler containing information about trades in the game. + * + * @return the trade handler + */ public TradeHandler getTradeHandler() { return tradeHandler; } @@ -208,6 +218,11 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker { state.update(delta); } + /** + * Returns if it is the player's turn. + * + * @return true if it is the player's turn, false otherwise + */ public boolean isTurn() { return state.isTurn(); } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java index c42f952..a79215b 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java @@ -111,6 +111,8 @@ public class Player implements FieldVisitor { /** * Returns the color of the player + * + * @param id the id of the player * @return the color of the player */ public static PlayerColor getColor(int id) { @@ -472,6 +474,10 @@ public class Player implements FieldVisitor { return null; } + /** + * Returns the properties owned by the player + * @return the properties owned by the player + */ public List getPropertyFields() { List properties = new ArrayList<>(); diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/PlayerColor.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/PlayerColor.java index d9bd94d..1131be6 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/PlayerColor.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/PlayerColor.java @@ -6,16 +6,39 @@ import com.jme3.math.ColorRGBA; * Enum representing six distinct colors for players in the game. */ public enum PlayerColor { + /** + * Representing the color cyan. + */ CYAN(new ColorRGBA(69 / 255f, 205 / 255f, 205 / 255f, 1), "Cyan"), + + /** + * Representing the color yellow. + */ YELLOW(new ColorRGBA(225 / 255f, 201 / 255f, 44 / 255f, 1), "Yellow"), + + /** + * Representing the color red. + */ RED(new ColorRGBA(255 / 255f, 33 / 255f, 33 / 255f, 1), "Red"), + + /** + * Representing the color pink. + */ PINK(new ColorRGBA(196 / 255f, 73 / 255f, 240 / 255f, 1), "Pink"), + + /** + * Representing the color green. + */ GREEN(new ColorRGBA(61 / 255f, 227 / 255f, 58 / 255f, 1), "Green"), + + /** + * Representing the color purple. + */ PURPLE(new ColorRGBA(60 / 255f, 74 / 255f, 223 / 255f, 1), "Purple"); - - + /** The corresponding ColorRGBA color */ private final ColorRGBA color; + /** The name of the color */ private final String colorName; /** diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/BuyPropertyRequest.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/BuyPropertyRequest.java index 9e8968d..12ea379 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/BuyPropertyRequest.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/BuyPropertyRequest.java @@ -8,6 +8,9 @@ import com.jme3.network.serializing.Serializable; @Serializable public class BuyPropertyRequest extends ServerMessage{ + /** + * Constructor for the BuyPropertyRequest. + */ public BuyPropertyRequest(){} @Override diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/EventDrawCard.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/EventDrawCard.java index fa7c162..7cbe933 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/EventDrawCard.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/EventDrawCard.java @@ -2,6 +2,9 @@ package pp.monopoly.message.server; import com.jme3.network.serializing.Serializable; +/** + * Message for drawing a card from the chance or community chest deck. + */ @Serializable public class EventDrawCard extends ServerMessage{ private String cardDescription; @@ -11,6 +14,11 @@ public class EventDrawCard extends ServerMessage{ */ private EventDrawCard() { /* empty */ } + /** + * Creates a new EventDrawCard message. + * + * @param cardDescription the description of the card that was drawn + */ public EventDrawCard(String cardDescription) { this.cardDescription = cardDescription; } @@ -20,6 +28,11 @@ public class EventDrawCard extends ServerMessage{ interpreter.received(this); } + /** + * Returns the description of the card that was drawn. + * + * @return the description of the card that was drawn + */ public String getCardDescription() { return cardDescription; } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/GameStart.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/GameStart.java index 842b87c..442951c 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/GameStart.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/GameStart.java @@ -4,6 +4,9 @@ import com.jme3.network.serializing.Serializable; import pp.monopoly.game.server.PlayerHandler; +/** + * Message that is sent from the server to the client to signal the start of the game. + */ @Serializable public class GameStart extends ServerMessage{ diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Figure.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Figure.java index 0d38efc..b0b9d12 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Figure.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Figure.java @@ -29,12 +29,12 @@ public class Figure implements Item{ } /** - * Constructs a new Figure with the specified length, position, and rotation. + * Creates a new Figure with the specified position and rotation. * - * @param length the length of the Figure - * @param x the x-coordinate of the Figure's initial position - * @param z the z-coordinate of the Figure's initial position - * @param rot the rotation of the Figure + * @param position the position of the Figure + * @param rot the rotation of the Figure + * @param type the type of the figure + * @param id the id of the figure */ public Figure(Vector3f position, Rotation rot, String type, int id) { this.position = calculateFieldPosition(0); diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Hotel.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Hotel.java index 052483f..b37b114 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Hotel.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Hotel.java @@ -2,6 +2,9 @@ package pp.monopoly.model; import com.jme3.math.Vector3f; +/** + * A class representing a hotel in the Monopoly game. + */ public class Hotel implements Item{ /** * The ID of the field the hotel is on. diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/House.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/House.java index c7ad981..4ab05f1 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/House.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/House.java @@ -37,6 +37,7 @@ public class House implements Item{ * Creates a new house with the given stage. * * @param stage the stage of the house + * @param fieldID the field ID of the house */ public House(int stage, int fieldID) { this.stage = stage; @@ -124,6 +125,11 @@ public class House implements Item{ return Rotation.NORTH; } + /** + * Returns the alignment of the building on the field. + * + * @return the alignment of the building on the field + */ public Quaternion getAlignment() { Quaternion rotation = new Quaternion(); if (fieldID >= 1 && fieldID <= 10) { diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/LimitedLinkedList.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/LimitedLinkedList.java index 34990f6..e85217d 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/LimitedLinkedList.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/LimitedLinkedList.java @@ -12,6 +12,9 @@ import com.jme3.network.serializing.Serializable; @Serializable public class LimitedLinkedList extends LinkedList { + /** + * The maximum number of elements this list can hold. + */ private int maxSize; /** diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Visitor.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Visitor.java index c088605..ad84b81 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Visitor.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Visitor.java @@ -29,6 +29,6 @@ public interface Visitor { * @param house the House element to visit * @return the result of visiting the house element */ - T visit(House figure); + T visit(House house); } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BoardManager.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BoardManager.java index b50cfdd..11b45e1 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BoardManager.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BoardManager.java @@ -73,6 +73,11 @@ public class BoardManager { return fields; } + /** + * Method to find the Field by its name + * @param name the name of the Field to find + * @return the Field with the given name + */ public Field getFieldByName(String name) { for (Field field : board) { if (field.getName().equals(name)) { @@ -102,10 +107,19 @@ public class BoardManager { else throw new NoSuchElementException(); } + /** + * Returns the Monopoly board with its fields in a list + * @return the Monopoly board + */ public List getBoard() { return board; } + /** + * Returns a list of the PropertyFields in the source list + * @param source the list of indices of fields + * @return the list of PropertyFields + */ public List getPropertyFields(List source) { List properties = new ArrayList<>(); for (Integer i : source) { @@ -114,6 +128,12 @@ public class BoardManager { return properties; } + /** + * Checks if a House or Hotel can be built on the given Property. + * + * @param field the Property to check + * @return true if a house or hotel can be built on the property, false otherwise + */ public boolean canBuild(BuildingProperty field) { if (field == null) { return false; // Null check for safety @@ -200,10 +220,3 @@ public class BoardManager { } } - -/* TODO: -- Häuser beim bau eines Hotels entfernen -- Alle texturen schwarz - - * - */ diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BuildingProperty.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BuildingProperty.java index 3fc9839..d8773f7 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BuildingProperty.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BuildingProperty.java @@ -7,24 +7,47 @@ import com.jme3.network.serializing.Serializable; import pp.monopoly.game.server.Player; +/** + * Represents a building property field in the Monopoly game. + * Contains attributes related to ownership, price, rent, and mortgage status. + */ @Serializable public class BuildingProperty extends PropertyField { + /** Number of houses on the field 1-4 for houses and 5 for a hotel */ private int houses; + /** Price for building a house on the field */ private final int housePrice; + /** Color of the field */ private final FieldColor color; + /** The factor rent increses by with one house */ private final int rentFactor1 = 5; + /** The factor rent increses by with two houses */ private final int rentFactor2 = 15; + /** The factor rent increses by with three houses */ private final int rentFactor3 = 40; + /** The factor rent increses by with four houses */ private final int rentFactor4 = 55; + /** The factor rent increses by with a hotel */ private final int rentFactorHotel = 70; + /** No-arg constructor for serialization */ private BuildingProperty(){ super("", 0, 0, 0); this.housePrice = 0; this.color = null; } + /** + * Constructs a BuildingProperty with the specified name, ID, price, rent, house price, and color. + * + * @param name the name of the property + * @param id the unique identifier for the property + * @param price the purchase price of the property + * @param rent the base rent for the property + * @param housePrice the price for building a house on the field + * @param color the color of the field + */ BuildingProperty(String name, int id, int price, int rent, int housePrice, FieldColor color) { super(name, id, price, rent); this.housePrice = housePrice; @@ -49,6 +72,12 @@ public class BuildingProperty extends PropertyField { } } + /** + * Builds a house on the field. + * If the field already has 4 houses, the method returns false. + * + * @return true if the house was built, false if the field already has 4 houses + */ public boolean build() { if (houses < 5) { houses++; @@ -57,6 +86,12 @@ public class BuildingProperty extends PropertyField { return false; } + /** + * Sells a house on the field. + * If the field has no houses, the method returns false. + * + * @return true if the house was sold, false if the field has no houses + */ public boolean sell() { if (houses == 0) { return false; @@ -70,6 +105,10 @@ public class BuildingProperty extends PropertyField { player.visit(this); } + /** + * Returns the rent for the field with 0-5 houses. + * @return a list of the rent for the field with 0-5 houses + */ public List getAllRent() { List list = new ArrayList<>(); list.add(rent); @@ -81,18 +120,38 @@ public class BuildingProperty extends PropertyField { return list; } + /** + * Returns the color of the field. + * + * @return the color of the field + */ public FieldColor getColor() { return color; } + /** + * Returns the number of houses on the field. + * + * @return the number of houses on the field + */ public int getHousePrice() { return housePrice; } + /** + * Returns the number of houses on the field. + * + * @return the number of houses on the field + */ public int getHouses() { return houses; } + /** + * Returns the number of hotels on the field. + * + * @return the number of hotels on the field + */ public int getHotel() { return (houses == 5)? 1:0; } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/EventField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/EventField.java index 9d9075a..966466d 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/EventField.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/EventField.java @@ -5,13 +5,24 @@ import com.jme3.network.serializing.Serializable; import pp.monopoly.game.server.Player; +/** + * EventField class is a subclass of Field and represents a field that triggers an event when a player lands on it. + */ @Serializable public class EventField extends Field{ - + + /** + * Empty constructor for serialization. + */ private EventField() { super("", 0); } + /** + * Constructor for EventField. + * @param name The name of the field. + * @param id The id of the field. + */ EventField(String name, int id) { super(name, id); } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/Field.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/Field.java index 28eec0c..cadc4be 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/Field.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/Field.java @@ -4,27 +4,52 @@ import com.jme3.network.serializing.Serializable; import pp.monopoly.game.server.Player; +/** + * Abstract class for all fields on the board. + */ @Serializable public abstract class Field { + /** Name of the field */ protected final String name; + /** ID of the field */ protected final int id; + /** + * Empty constructor for serialization. + */ private Field() { this.name = ""; this.id = 0; } + /** + * Constructor for the field. + * @param name Name of the field. + * @param id ID of the field. + */ protected Field(String name, int id) { this.name = name; this.id= id; } + /** + * Abstract method for the field. Supports the visitor pattern. + * @param player Player that lands on the field. + */ public abstract void accept(Player player); - + + /** + * Returns the id of the field. + * @return id of the field. + */ public int getId() { return id; } + /** + * Returns the name of the field. + * @return name of the field. + */ public String getName() { return name; } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FieldColor.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FieldColor.java index 2dd476b..9a3c0fd 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FieldColor.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FieldColor.java @@ -6,17 +6,55 @@ import com.jme3.math.ColorRGBA; * Enum representing eight distinct colors for properties in the game. */ public enum FieldColor { + + /** + * Representing the FieldColor BROWN. + */ BROWN(new ColorRGBA(148 / 255f, 86 / 255f, 57 / 255f, 1)), + + /** + * Representing the FieldColor GREEN. + */ GREEN(new ColorRGBA(30 / 255f, 179 / 255f, 90 / 255f, 1)), + + /** + * Representing the FieldColor YELLOW. + */ YELLOW(new ColorRGBA(252 / 255f, 241 / 255f, 1 / 255f, 1)), + + /** + * Representing the FieldColor BLUE_LIGHT. + */ BLUE_LIGHT(new ColorRGBA(170 / 255f, 223 / 255f, 246 / 255f, 1)), + + /** + * Representing the FieldColor PINK. + */ PINK(new ColorRGBA(214 / 255f, 60 / 255f, 153 / 255f, 1)), + + /** + * Representing the FieldColor ORANGE. + */ ORANGE(new ColorRGBA(244 / 255f, 147 / 255f, 32 / 255f, 1)), + + /** + * Representing the FieldColor RED. + */ RED(new ColorRGBA(232 / 255f, 27 / 255f, 30 / 255f, 1)), + + /** + * Representing the FieldColor BLUE_DARK. + */ BLUE_DARK(new ColorRGBA(2 / 255f, 112 / 255f, 191 / 255f, 1)); + /** + * The ColorRGBA value associated with the field color. + */ private final ColorRGBA color; + /** + * Constructs a FieldColor with a null ColorRGBA value for serialization. + */ private FieldColor() { this.color = null; } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FineField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FineField.java index db98a29..5a78c1e 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FineField.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FineField.java @@ -4,21 +4,35 @@ import com.jme3.network.serializing.Serializable; import pp.monopoly.game.server.Player; +/** + * Represents a field where the player has to pay a fine. + */ @Serializable public class FineField extends Field{ - + /** The fine the player has to pay. */ private final int fine; + /** Empty constructor for deserialization. */ private FineField() { super("", 0); this.fine = 0; } + /** + * Creates a new fine field. + * @param name the name of the field + * @param id the id of the field + * @param fine the fine the player has to pay + */ FineField(String name, int id, int fine) { super(name, id); this.fine = fine; } + /** + * Returns the fine the player has to pay. + * @return the fine the player has to pay + */ public int getFine() { return fine; } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FoodField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FoodField.java index 4d23a89..4787388 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FoodField.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FoodField.java @@ -4,13 +4,25 @@ import com.jme3.network.serializing.Serializable; import pp.monopoly.game.server.Player; +/** + * Represents a food field on the board. + */ @Serializable public class FoodField extends PropertyField { + /** + * Empty constructor used for serialization. + */ private FoodField() { super("", 0, 0, 0); } + /** + * Constructor for the FoodField. + * + * @param name The name of the field. + * @param id The id of the field. + */ FoodField(String name, int id) { super(name, id, 1500,0); } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GateField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GateField.java index cd0d80d..60a6502 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GateField.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GateField.java @@ -3,13 +3,26 @@ package pp.monopoly.model.fields; import com.jme3.network.serializing.Serializable; import pp.monopoly.game.server.Player; + +/** + * GateField class is a subclass of PropertyField class and represents a field + * on the board that is a gate. It has a name, id, rent and price. + */ @Serializable public class GateField extends PropertyField{ + /** + * No-argument constructor for serialization. + */ private GateField() { super("", 0, 0, 0); } + /** + * Constructor for the GateField class. + * @param name the name of the field + * @param id the id of the field + */ GateField(String name, int id) { super(name, id, 2000, 250); } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GoField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GoField.java index 785e6b2..8f7886d 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GoField.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GoField.java @@ -3,9 +3,17 @@ package pp.monopoly.model.fields; import com.jme3.network.serializing.Serializable; import pp.monopoly.game.server.Player; +/** + * GoField class extends Field class and represents the Go field on the board. + * It is the first field on the board and the player receives a monthly salary when he passes it. + */ @Serializable public class GoField extends Field{ + /** + * Constructor for the GoField class. + * It sets the name of the field to "Monatsgehalt" and the index to 0. + */ GoField() { super("Monatsgehalt", 0); } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GulagField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GulagField.java index 278d9e1..4b658a5 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GulagField.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GulagField.java @@ -3,11 +3,18 @@ package pp.monopoly.model.fields; import com.jme3.network.serializing.Serializable; import pp.monopoly.game.server.Player; +/* + * Represents the Gulag field on the board. This is the place a player goes to when they are sent to jail. + */ @Serializable public class GulagField extends Field{ + /** Cost to bail out of jail */ private int bailCost = 500; + /** + * Constructor for the Gulag field. + */ GulagField() { super("Gulag", 10); } @@ -17,6 +24,11 @@ public class GulagField extends Field{ player.visit(this); } + /** + * Gets the cost to bail out of jail. + * + * @return the cost to bail out of jail + */ public int getBailCost() { return bailCost; } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/PropertyField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/PropertyField.java index c9d1a3c..b48ff2e 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/PropertyField.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/PropertyField.java @@ -11,11 +11,16 @@ import pp.monopoly.game.server.Player; @Serializable public abstract class PropertyField extends Field { + /** Prive of the property */ private final int price; + /** Base rent of the property */ protected final int rent; + /** Owner of the property */ private Player owner; + /** Mortgage status of the property */ private boolean mortgaged = false; + /** No-argument constructor required for serialization. */ private PropertyField() { super("", 0); this.price = 0; diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/TestStreckeField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/TestStreckeField.java index d446f10..30ea92e 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/TestStreckeField.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/TestStreckeField.java @@ -4,10 +4,19 @@ import com.jme3.network.serializing.Serializable; import pp.monopoly.game.server.Player; +/** + * A field that represents the Teststrecke field on the board. + */ @Serializable public class TestStreckeField extends Field{ + /** + * The amount of money on the field. + */ private int money; + /** + * Creates a new TestStreckeField. + */ TestStreckeField() { super("Teststrecke", 20); } @@ -17,10 +26,20 @@ public class TestStreckeField extends Field{ player.visit(this); } + /** + * Adds money to the field. + * + * @param amount the amount of money to add + */ public void addMoney(int amount) { money += amount; } + /** + * Collects the money from the field and resets the money to 0. + * + * @return the amount of money collected + */ public int collectMoney() { int tmp = money; money = 0; diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/WacheField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/WacheField.java index 02f3511..7a53933 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/WacheField.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/WacheField.java @@ -4,9 +4,16 @@ import com.jme3.network.serializing.Serializable; import pp.monopoly.game.server.Player; +/** + * Field representing the police station. If a player lands on this field, he + * has to move to the jail. + */ @Serializable public class WacheField extends Field{ + /** + * Constructor for the WacheField. + */ WacheField() { super("Wache", 30); } diff --git a/Projekte/monopoly/server/src/main/java/pp/monopoly/server/MonopolyServer.java b/Projekte/monopoly/server/src/main/java/pp/monopoly/server/MonopolyServer.java index ef2b4f1..1411296 100644 --- a/Projekte/monopoly/server/src/main/java/pp/monopoly/server/MonopolyServer.java +++ b/Projekte/monopoly/server/src/main/java/pp/monopoly/server/MonopolyServer.java @@ -96,6 +96,8 @@ public class MonopolyServer implements MessageListener, Connec /** * Starts the Monopolys server. + * + * @param args the command line arguments */ public static void main(String[] args) { new MonopolyServer().run();