mirror of
				https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
				synced 2025-11-04 12:26:18 +01:00 
			
		
		
		
	Compare commits
	
		
			6 Commits
		
	
	
		
			9e88353bd5
			...
			0acb23ab8b
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					0acb23ab8b | ||
| 
						 | 
					831974cb63 | ||
| 
						 | 
					031ac52670 | ||
| 
						 | 
					14ceb9dc67 | ||
| 
						 | 
					aa86c25e7c | ||
| 
						 | 
					cb0788e44c | 
@@ -27,6 +27,7 @@ import pp.monopoly.client.gui.popups.Gulag;
 | 
				
			|||||||
import pp.monopoly.client.gui.popups.GulagInfo;
 | 
					import pp.monopoly.client.gui.popups.GulagInfo;
 | 
				
			||||||
import pp.monopoly.client.gui.popups.LooserPopUp;
 | 
					import pp.monopoly.client.gui.popups.LooserPopUp;
 | 
				
			||||||
import pp.monopoly.client.gui.popups.NoMoneyWarning;
 | 
					import pp.monopoly.client.gui.popups.NoMoneyWarning;
 | 
				
			||||||
 | 
					import pp.monopoly.client.gui.popups.ReceivedRent;
 | 
				
			||||||
import pp.monopoly.client.gui.popups.RejectTrade;
 | 
					import pp.monopoly.client.gui.popups.RejectTrade;
 | 
				
			||||||
import pp.monopoly.client.gui.popups.Rent;
 | 
					import pp.monopoly.client.gui.popups.Rent;
 | 
				
			||||||
import pp.monopoly.client.gui.popups.TimeOut;
 | 
					import pp.monopoly.client.gui.popups.TimeOut;
 | 
				
			||||||
@@ -438,7 +439,9 @@ public class TestWorld implements GameEventListener {
 | 
				
			|||||||
            new AcceptTrade(app, (TradeReply) event.message()).open();
 | 
					            new AcceptTrade(app, (TradeReply) event.message()).open();
 | 
				
			||||||
        } else if (event.msg().equals("tradeneg")) {
 | 
					        } else if (event.msg().equals("tradeneg")) {
 | 
				
			||||||
            new RejectTrade(app, (TradeReply) event.message()).open();
 | 
					            new RejectTrade(app, (TradeReply) event.message()).open();
 | 
				
			||||||
        } 
 | 
					        } else if (event.msg().equals("ReceivedRent")) {
 | 
				
			||||||
 | 
					            new ReceivedRent(app, ( (NotificationMessage) event.message()).getRentOwner(), ( (NotificationMessage) event.message()).getRentAmount() ).open();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private Vector3f calculateBuildingPosition(int fieldID) {
 | 
					    private Vector3f calculateBuildingPosition(int fieldID) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -192,6 +192,7 @@ public class Toolbar extends Dialog implements GameEventListener {
 | 
				
			|||||||
        diceButton.setPreferredSize(new Vector3f(200, 50, 0));
 | 
					        diceButton.setPreferredSize(new Vector3f(200, 50, 0));
 | 
				
			||||||
        diceButton.addClickCommands(s -> ifTopDialog(() -> {
 | 
					        diceButton.addClickCommands(s -> ifTopDialog(() -> {
 | 
				
			||||||
            diceButton.setEnabled(false);
 | 
					            diceButton.setEnabled(false);
 | 
				
			||||||
 | 
					            endTurnButton.setEnabled(true);
 | 
				
			||||||
            startDiceAnimation();
 | 
					            startDiceAnimation();
 | 
				
			||||||
            app.getGameLogic().send(new RollDice());
 | 
					            app.getGameLogic().send(new RollDice());
 | 
				
			||||||
            app.getGameLogic().playSound(Sound.BUTTON);
 | 
					            app.getGameLogic().playSound(Sound.BUTTON);
 | 
				
			||||||
@@ -409,7 +410,7 @@ public class Toolbar extends Dialog implements GameEventListener {
 | 
				
			|||||||
        diceButton.setEnabled(enabled);
 | 
					        diceButton.setEnabled(enabled);
 | 
				
			||||||
        tradeButton.setEnabled(enabled);
 | 
					        tradeButton.setEnabled(enabled);
 | 
				
			||||||
        propertyMenuButton.setEnabled(enabled);
 | 
					        propertyMenuButton.setEnabled(enabled);
 | 
				
			||||||
        endTurnButton.setEnabled(enabled);
 | 
					        endTurnButton.setEnabled(false);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,167 @@
 | 
				
			|||||||
 | 
					package pp.monopoly.client.gui.popups;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.jme3.material.Material;
 | 
				
			||||||
 | 
					import com.jme3.material.RenderState.BlendMode;
 | 
				
			||||||
 | 
					import com.jme3.math.ColorRGBA;
 | 
				
			||||||
 | 
					import com.jme3.math.Vector3f;
 | 
				
			||||||
 | 
					import com.jme3.scene.Geometry;
 | 
				
			||||||
 | 
					import com.jme3.scene.shape.Quad;
 | 
				
			||||||
 | 
					import com.simsilica.lemur.Button;
 | 
				
			||||||
 | 
					import com.simsilica.lemur.Container;
 | 
				
			||||||
 | 
					import com.simsilica.lemur.Label;
 | 
				
			||||||
 | 
					import com.simsilica.lemur.component.QuadBackgroundComponent;
 | 
				
			||||||
 | 
					import com.simsilica.lemur.style.ElementId;
 | 
				
			||||||
 | 
					import pp.dialog.Dialog;
 | 
				
			||||||
 | 
					import pp.monopoly.client.MonopolyApp;
 | 
				
			||||||
 | 
					import pp.monopoly.notification.Sound;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Rent is a popup that is triggered when a player lands on a property owned by another player
 | 
				
			||||||
 | 
					 * and needs to pay rent in the Monopoly application.
 | 
				
			||||||
 | 
					 * <p>
 | 
				
			||||||
 | 
					 * Displays the rent amount and the recipient player's name, with an option to confirm the payment.
 | 
				
			||||||
 | 
					 * </p>
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public class ReceivedRent extends Dialog {
 | 
				
			||||||
 | 
					    /** Reference to the Monopoly application instance. */
 | 
				
			||||||
 | 
					    private final MonopolyApp app;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** Semi-transparent overlay background for the popup. */
 | 
				
			||||||
 | 
					    private final Geometry overlayBackground;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** Main container for the rent information and action. */
 | 
				
			||||||
 | 
					    private final Container rentContainer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** Background container providing a border for the rent popup. */
 | 
				
			||||||
 | 
					    private final Container backgroundContainer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Constructs the Rent popup displaying the rent amount and recipient player.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param app        the Monopoly application instance
 | 
				
			||||||
 | 
					     * @param playerName the name of the player to whom the rent is owed
 | 
				
			||||||
 | 
					     * @param amount     the amount of rent to be paid
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public ReceivedRent(MonopolyApp app, String playerName, int amount) {
 | 
				
			||||||
 | 
					        super(app.getDialogManager());
 | 
				
			||||||
 | 
					        this.app = app;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Create the overlay
 | 
				
			||||||
 | 
					        overlayBackground = createOverlayBackground();
 | 
				
			||||||
 | 
					        app.getGuiNode().attachChild(overlayBackground);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Create and position the background container
 | 
				
			||||||
 | 
					        backgroundContainer = createBackgroundContainer();
 | 
				
			||||||
 | 
					        app.getGuiNode().attachChild(backgroundContainer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Create and position the rent container
 | 
				
			||||||
 | 
					        rentContainer = createRentContainer(playerName, amount);
 | 
				
			||||||
 | 
					        app.getGuiNode().attachChild(rentContainer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        centerContainers();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Creates a semi-transparent overlay background.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return the overlay geometry
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Geometry createOverlayBackground() {
 | 
				
			||||||
 | 
					        Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
 | 
				
			||||||
 | 
					        Geometry overlay = new Geometry("Overlay", quad);
 | 
				
			||||||
 | 
					        Material material = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
 | 
				
			||||||
 | 
					        material.setColor("Color", new ColorRGBA(0, 0, 0, 0.5f)); // Semi-transparent black
 | 
				
			||||||
 | 
					        material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
 | 
				
			||||||
 | 
					        overlay.setMaterial(material);
 | 
				
			||||||
 | 
					        overlay.setLocalTranslation(0, 0, 0);
 | 
				
			||||||
 | 
					        return overlay;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Creates the background container with styling.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return the styled background container
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Container createBackgroundContainer() {
 | 
				
			||||||
 | 
					        Container container = new Container();
 | 
				
			||||||
 | 
					        container.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Light gray background
 | 
				
			||||||
 | 
					        return container;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Creates the main rent container with title, text, and button.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param playerName the name of the player to whom the rent is owed
 | 
				
			||||||
 | 
					     * @param amount     the rent amount
 | 
				
			||||||
 | 
					     * @return the rent container
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Container createRentContainer(String playerName, int amount) {
 | 
				
			||||||
 | 
					        Container container = new Container();
 | 
				
			||||||
 | 
					        container.setBackground(new QuadBackgroundComponent(ColorRGBA.Gray));
 | 
				
			||||||
 | 
					        container.setPreferredSize(new Vector3f(550, 250, 10));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Title
 | 
				
			||||||
 | 
					        Label title = container.addChild(new Label("Miete!", new ElementId("warning-title")));
 | 
				
			||||||
 | 
					        title.setFontSize(48);
 | 
				
			||||||
 | 
					        title.setColor(ColorRGBA.Black);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Rent message
 | 
				
			||||||
 | 
					        Container textContainer = container.addChild(new Container());
 | 
				
			||||||
 | 
					        textContainer.addChild(new Label("Du bekommst von Spieler " + playerName + " " + amount + " EUR Miete",
 | 
				
			||||||
 | 
					                new ElementId("label-Text")));
 | 
				
			||||||
 | 
					        textContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
 | 
				
			||||||
 | 
					        textContainer.setPreferredSize(container.getPreferredSize().addLocal(-250, -200, 0));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Payment button
 | 
				
			||||||
 | 
					        Button payButton = container.addChild(new Button("Bestätigen", new ElementId("button")));
 | 
				
			||||||
 | 
					        payButton.setFontSize(32);
 | 
				
			||||||
 | 
					        payButton.addClickCommands(s -> ifTopDialog( () -> {
 | 
				
			||||||
 | 
					                app.getGameLogic().playSound(Sound.BUTTON);
 | 
				
			||||||
 | 
					                close();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return container;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Centers the rent and background containers on the screen.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private void centerContainers() {
 | 
				
			||||||
 | 
					        float padding = 10;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Center rent container
 | 
				
			||||||
 | 
					        rentContainer.setLocalTranslation(
 | 
				
			||||||
 | 
					                (app.getCamera().getWidth() - rentContainer.getPreferredSize().x) / 2,
 | 
				
			||||||
 | 
					                (app.getCamera().getHeight() + rentContainer.getPreferredSize().y) / 2,
 | 
				
			||||||
 | 
					                8
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Center background container with padding
 | 
				
			||||||
 | 
					        backgroundContainer.setPreferredSize(rentContainer.getPreferredSize().addLocal(padding, padding, 0));
 | 
				
			||||||
 | 
					        backgroundContainer.setLocalTranslation(
 | 
				
			||||||
 | 
					                (app.getCamera().getWidth() - backgroundContainer.getPreferredSize().x) / 2,
 | 
				
			||||||
 | 
					                (app.getCamera().getHeight() + backgroundContainer.getPreferredSize().y) / 2,
 | 
				
			||||||
 | 
					                7
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Closes the popup and removes GUI elements.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void close() {
 | 
				
			||||||
 | 
					        app.getGuiNode().detachChild(rentContainer);
 | 
				
			||||||
 | 
					        app.getGuiNode().detachChild(backgroundContainer);
 | 
				
			||||||
 | 
					        app.getGuiNode().detachChild(overlayBackground);
 | 
				
			||||||
 | 
					        super.close();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Handles the escape action to close the dialog.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void escape() {
 | 
				
			||||||
 | 
					        close();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -231,7 +231,7 @@ public class SellHouse extends Dialog {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        int cost = 0;
 | 
					        int cost = 0;
 | 
				
			||||||
        for (String s : selectedProperties) {
 | 
					        for (String s : selectedProperties) {
 | 
				
			||||||
            cost += ((BuildingProperty) app.getGameLogic().getBoardManager().getFieldByName(s)).getHousePrice();
 | 
					            cost += ((BuildingProperty) app.getGameLogic().getBoardManager().getFieldByName(s)).getHousePrice() / 2;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String display = String.join(" | ", selectedProperties);
 | 
					        String display = String.join(" | ", selectedProperties);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -333,7 +333,6 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void received(NextPlayerTurn msg) {
 | 
					    public void received(NextPlayerTurn msg) {
 | 
				
			||||||
        notifyListeners(new ButtonStatusEvent(true));
 | 
					        notifyListeners(new ButtonStatusEvent(true));
 | 
				
			||||||
        setState(new ActiveState(this));
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
@@ -353,6 +352,8 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
 | 
				
			|||||||
            notifyListeners(new PopUpEvent("jailpay", msg));
 | 
					            notifyListeners(new PopUpEvent("jailpay", msg));
 | 
				
			||||||
        } else if (msg.getKeyWord().equals("jailtryagain")) {
 | 
					        } else if (msg.getKeyWord().equals("jailtryagain")) {
 | 
				
			||||||
            notifyListeners(new PopUpEvent("jailtryagain", msg));
 | 
					            notifyListeners(new PopUpEvent("jailtryagain", msg));
 | 
				
			||||||
 | 
					        } else if(msg.getKeyWord().equals("ReceivedRent")) {
 | 
				
			||||||
 | 
					            notifyListeners(new PopUpEvent("ReceivedRent", msg));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -331,6 +331,13 @@ public class Player implements FieldVisitor<Void>{
 | 
				
			|||||||
        state.useJailCard();
 | 
					        state.useJailCard();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private void sendRentNotification(String keyword, Player player, int amount) {
 | 
				
			||||||
 | 
					        NotificationMessage msg = new NotificationMessage(keyword);
 | 
				
			||||||
 | 
					        msg.setRentAmount(amount);
 | 
				
			||||||
 | 
					        msg.setRentOwnerId(player.getName());
 | 
				
			||||||
 | 
					        getHandler().getLogic().send(player, msg);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public Void visit(BuildingProperty field) {
 | 
					    public Void visit(BuildingProperty field) {
 | 
				
			||||||
        if(field.getOwner() == null) {
 | 
					        if(field.getOwner() == null) {
 | 
				
			||||||
@@ -340,10 +347,8 @@ public class Player implements FieldVisitor<Void>{
 | 
				
			|||||||
            int rent = field.calcRent();
 | 
					            int rent = field.calcRent();
 | 
				
			||||||
            field.getOwner().earnMoney(rent);
 | 
					            field.getOwner().earnMoney(rent);
 | 
				
			||||||
            pay(rent);
 | 
					            pay(rent);
 | 
				
			||||||
            NotificationMessage msg = new NotificationMessage("rent");
 | 
					            sendRentNotification("rent", field.getOwner(), rent);
 | 
				
			||||||
            msg.setRentAmount(rent);
 | 
					            sendRentNotification("ReceivedRent", this, rent);
 | 
				
			||||||
            msg.setRentOwnerId(field.getOwner().getName());
 | 
					 | 
				
			||||||
            getHandler().getLogic().send(this, msg);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -352,18 +357,16 @@ public class Player implements FieldVisitor<Void>{
 | 
				
			|||||||
    public Void visit(FoodField field) {
 | 
					    public Void visit(FoodField field) {
 | 
				
			||||||
        if(field.getOwner() == null) {
 | 
					        if(field.getOwner() == null) {
 | 
				
			||||||
            if (field.getPrice() <= accountBalance) getHandler().getLogic().send(this, new BuyPropertyRequest());
 | 
					            if (field.getPrice() <= accountBalance) getHandler().getLogic().send(this, new BuyPropertyRequest());
 | 
				
			||||||
        } else {
 | 
					        } else if (field.getOwner() != this){
 | 
				
			||||||
            int factor = 4;
 | 
					            int factor = 40;
 | 
				
			||||||
            if (field.getOwner().getNumProp(field) == 2) {
 | 
					            if (field.getOwner().getNumProp(field) == 2) {
 | 
				
			||||||
                factor = 10;
 | 
					                factor = 100;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            int rent = rollResult.calcTotal()*factor;
 | 
					            int rent = rollResult.calcTotal()*factor;
 | 
				
			||||||
            field.getOwner().earnMoney(rent);
 | 
					            field.getOwner().earnMoney(rent);
 | 
				
			||||||
            pay(rent);
 | 
					            pay(rent);
 | 
				
			||||||
            NotificationMessage msg = new NotificationMessage("rent");
 | 
					            sendRentNotification("rent", field.getOwner(), rent);
 | 
				
			||||||
            msg.setRentAmount(rent);
 | 
					            sendRentNotification("ReceivedRent", this, rent);
 | 
				
			||||||
            msg.setRentOwnerId(field.getOwner().getName());
 | 
					 | 
				
			||||||
            getHandler().getLogic().send(this, msg);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -372,15 +375,13 @@ public class Player implements FieldVisitor<Void>{
 | 
				
			|||||||
    public Void visit(GateField field) {
 | 
					    public Void visit(GateField field) {
 | 
				
			||||||
        if(field.getOwner() == null) {
 | 
					        if(field.getOwner() == null) {
 | 
				
			||||||
            if (field.getPrice() <= accountBalance) getHandler().getLogic().send(this, new BuyPropertyRequest());
 | 
					            if (field.getPrice() <= accountBalance) getHandler().getLogic().send(this, new BuyPropertyRequest());
 | 
				
			||||||
        } else {
 | 
					        } else if (field.getOwner() != this){
 | 
				
			||||||
            int rent = field.calcRent() * field.getOwner().getNumProp(field);
 | 
					            int rent = field.calcRent() * field.getOwner().getNumProp(field);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            field.getOwner().earnMoney(rent);
 | 
					            field.getOwner().earnMoney(rent);
 | 
				
			||||||
            pay(rent);
 | 
					            pay(rent);
 | 
				
			||||||
            NotificationMessage msg = new NotificationMessage("rent");
 | 
					            sendRentNotification("rent", field.getOwner(), rent);
 | 
				
			||||||
            msg.setRentAmount(rent);
 | 
					            sendRentNotification("ReceivedRent", this, rent);
 | 
				
			||||||
            msg.setRentOwnerId(field.getOwner().getName());
 | 
					 | 
				
			||||||
            getHandler().getLogic().send(this, msg);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -487,8 +488,8 @@ public class Player implements FieldVisitor<Void>{
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        return total;
 | 
					        return total;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    // private static int c = 0;
 | 
					    // private static int c = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Inner class for dice functionality in the game.
 | 
					     * Inner class for dice functionality in the game.
 | 
				
			||||||
     * Rolls random dice values.
 | 
					     * Rolls random dice values.
 | 
				
			||||||
@@ -503,8 +504,8 @@ public class Player implements FieldVisitor<Void>{
 | 
				
			|||||||
         */
 | 
					         */
 | 
				
			||||||
        private static int rollDice() {
 | 
					        private static int rollDice() {
 | 
				
			||||||
            return random.nextInt(6) + 1;
 | 
					            return random.nextInt(6) + 1;
 | 
				
			||||||
            
 | 
					 | 
				
			||||||
            // c++;
 | 
					            // c++;
 | 
				
			||||||
 | 
					            // return (c%2 == 0)? 3: 2;           
 | 
				
			||||||
            // if(c < 7) {
 | 
					            // if(c < 7) {
 | 
				
			||||||
            //     return 3;
 | 
					            //     return 3;
 | 
				
			||||||
            // } else {
 | 
					            // } else {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -412,7 +412,7 @@ public class ServerGameLogic implements ClientInterpreter {
 | 
				
			|||||||
            for (BuildingProperty field : properties.stream().map(p -> (BuildingProperty) p).collect(Collectors.toList())) {
 | 
					            for (BuildingProperty field : properties.stream().map(p -> (BuildingProperty) p).collect(Collectors.toList())) {
 | 
				
			||||||
                if (boardManager.canSell(field)) {
 | 
					                if (boardManager.canSell(field)) {
 | 
				
			||||||
                    field.sell();
 | 
					                    field.sell();
 | 
				
			||||||
                    sender.earnMoney(field.getHousePrice());
 | 
					                    sender.earnMoney(field.getHousePrice() / 2);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@ public class GateField extends PropertyField{
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    GateField(String name, int id) {
 | 
					    GateField(String name, int id) {
 | 
				
			||||||
        super(name, id, 2000, 25);
 | 
					        super(name, id, 2000, 250);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user