From b8e1645eb831901b6b0877a1932acf138c573a41 Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Sun, 1 Dec 2024 02:14:09 +0100 Subject: [PATCH] fixed player movement and go money --- .../model/src/main/java/pp/monopoly/game/server/Player.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 c69e655..d935b40 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 @@ -161,10 +161,10 @@ public class Player implements FieldVisitor{ * @return the new position */ public int move(int steps) { - fieldID = (fieldID + steps) % 40; if (fieldID + steps >= 40) { earnMoney(2000); // Passing GO gives money } + fieldID = (fieldID + steps) % 40; figure.moveTo(fieldID); handler.getLogic().send(this, new PlayerStatusUpdate(handler)); handler.getLogic().getBoardManager().getFieldAtIndex(fieldID).accept(this); @@ -180,6 +180,7 @@ public class Player implements FieldVisitor{ if(position < 40 && position > 0) { fieldID = position; figure.moveTo(fieldID); + handler.getLogic().send(this, new PlayerStatusUpdate(handler)); handler.getLogic().getBoardManager().getFieldAtIndex(fieldID).accept(this); } return fieldID;