mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-18 22:56:15 +01:00
fixed player movement and go money
This commit is contained in:
parent
a6b7ea4ce8
commit
b8e1645eb8
@ -161,10 +161,10 @@ public class Player implements FieldVisitor<Void>{
|
||||
* @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<Void>{
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user