earnMoney with event card movement

This commit is contained in:
Johannes Schmelz 2024-12-01 16:05:57 +01:00
parent 0f6205fbc7
commit 6bd1ed6e3a
2 changed files with 24 additions and 6 deletions

View File

@ -188,6 +188,24 @@ public class Player implements FieldVisitor<Void>{
return fieldID;
}
/**
* Sets the player to the specified Position on the board
* @param position the position to move to
* @return the new position
*/
public int setPositionWithMoney(int position){
if(position < 40 && position >= 0) {
if(position < fieldID) {
earnMoney(2000);
}
fieldID = position;
figure.moveTo(fieldID);
handler.getLogic().send(this, new PlayerStatusUpdate(handler));
handler.getLogic().getBoardManager().getFieldAtIndex(fieldID).accept(this);
}
return fieldID;
}
/**
* Gets all the properties owned by this player
* @return List of all properties owned by this player

View File

@ -189,7 +189,7 @@ public class DeckHelper{
}
private void spoparty(Player player) {
player.setPosition(14);
player.setPositionWithMoney(14);
}
private void gulakFrei(Player player) {
@ -197,11 +197,11 @@ public class DeckHelper{
}
private void dienstfuehrerschein(Player player) {
player.setPosition(20);
player.setPositionWithMoney(20);
}
private void pubquiz(Player player) {
player.setPosition(39);
player.setPositionWithMoney(39);
}
private void namensschildTruppenkueche(Player player) {
@ -221,7 +221,7 @@ public class DeckHelper{
}
private void naechstesMonatsgehalt(Player player) {
player.setPosition(0);
player.setPositionWithMoney(0);
}
private void antretenVerschlafen(Player player) {
@ -237,7 +237,7 @@ public class DeckHelper{
}
private void dienstsportGym(Player player) {
player.setPosition(1);
player.setPositionWithMoney(1);
}
private void schimmelGulak(Player player) {
@ -249,7 +249,7 @@ public class DeckHelper{
}
private void jahresabschlussantreten(Player player) {
player.setPosition(17);
player.setPositionWithMoney(17);
}
private void verkaufenVersicherungen(Player player) {