Package monopoly.model.events

Examples of monopoly.model.events.GameModelEvent


        _bank.doBankrupt(p);

        _field.removePlayer(p);
        _playersQueue.remove(p);

        GameModelEvent event = new GameModelEvent(this, p);
        firePlayerFinishedGame(event);
    }
View Full Code Here


    /**
     * Проверить на возможность окончания игры.
     */
    private void identifyGameOver() {
        if (_playersQueue.size() <= 1) {
            GameModelEvent event = new GameModelEvent(this, _playersQueue.peek());
            fireGameFinished(event);
        }
    }
View Full Code Here

                    new Player("Игрок " + (i + 1),
                    _availableColors.get(i), 150000));
        }
        _playersQueue = new ArrayDeque(_field.players());
       
        GameModelEvent event = new GameModelEvent(this);
        this.fireGameStarted(event);
    }
View Full Code Here

        if (p == null) {
            return;
        }

        DiceScore diceScore = p.dropDice(_dice);
        GameModelEvent event = new GameModelEvent(this, p, diceScore);
        firePlayerDroppedDice(event);

        GameFieldCellBase oldPosition = p.position();
        p.shiftOnField(diceScore.score());
        GameFieldCellBase newPosition = p.position();
        event = new GameModelEvent(this, p, oldPosition, newPosition);
        firePlayerShiftedOnField(event);

        event = new GameModelEvent(this, p);
        firePlayerStartedDoAction(event);
    }
View Full Code Here

     * @param p игрок.
     * @param gift подарок в виде денежной суммы.
     */
    public void makePlayerGift(Player p, int gift) {
        if (_bank.giveMoney(p, gift)) {
            GameModelEvent event = new GameModelEvent(this, p, gift);
            firePlayerReceivedGift(event);
        }
    }
View Full Code Here

        if (_bank.takeAwayMoney(p, penalty) == false) {
            List<ILand> confiscated = new ArrayList<ILand>();

            ILand lastLand = _bank.confiscateLand(p);
            while (lastLand != null) {
                GameModelEvent event = new GameModelEvent(this, lastLand,
                        p, _bank);
                fireLandChangedOwner(event);

                confiscated.add(lastLand);

                if (_bank.takeAwayMoney(p, penalty)) {
                    break;
                }

                lastLand = _bank.confiscateLand(p);
            }

            if (confiscated.isEmpty() == false) {
                GameModelEvent event = new GameModelEvent(this, p, confiscated);
                firePlayerLandsConfiscated(event);
            }

            if (lastLand == null) {
                finishGamePlayer(p);
            } else {
                GameModelEvent event = new GameModelEvent(this, p, penalty);
                firePlayerReceivedPenalty(event);
            }

        } else {
            GameModelEvent event = new GameModelEvent(this, p, penalty);
            firePlayerReceivedPenalty(event);
        }

        identifyGameOver();
    }
View Full Code Here

        if (p.payRent(land) == false) {
            List<ILand> confiscated = new ArrayList<ILand>();

            ILand lastLand = _bank.confiscateLand(p);
            while (lastLand != null) {
                GameModelEvent event = new GameModelEvent(this, lastLand,
                        p, _bank);
                fireLandChangedOwner(event);

                confiscated.add(lastLand);

                if (p.payRent(land)) {
                    break;
                }

                lastLand = _bank.confiscateLand(p);
            }

            if (confiscated.isEmpty() == false) {
                GameModelEvent event = new GameModelEvent(this, p, confiscated);
                firePlayerLandsConfiscated(event);
            }

            if (lastLand == null) {
                finishGamePlayer(p);
            } else {
                GameModelEvent event = new GameModelEvent(this, p, land);
                firePlayerPaidRent(event);
            }

        } else {
            GameModelEvent event = new GameModelEvent(this, p, land);
            firePlayerPaidRent(event);
        }

        identifyGameOver();
    }
View Full Code Here

        ILandOwner owner = land.owner();
        if (owner instanceof ILandSeller) {
            ILandSeller seller = (ILandSeller) owner;
            if (p.buyLand(seller, amount, land)) {

                GameModelEvent event = new GameModelEvent(this, land, seller, p);
                fireLandChangedOwner(event);

                event = new GameModelEvent(this, p, land, amount);
                firePlayerBoughtLand(event);
            }
        }
    }
View Full Code Here

TOP

Related Classes of monopoly.model.events.GameModelEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.