View/StoreView.java
public void buttonActions(){
        backB.setOnAction(event -> {
            StartView sv = new StartView();
            stage.close();
        });
        witchHat.setOnAction(event -> {
            if(user1.getCoins()-3>=0) {
                user1.removeCoin(3);
                coinsL.setText("Player 1 you have: " + user1.getCoins() + " coins");
                witchHatNum++;
            }
            else{
                createNotEnoughAlert();
            }

        });
        witchHat.setOnMouseEntered(event -> {
            witchHat.setText("Add 1 win to yourself and get a free coin\nCoins needed: 3 Coins\nYou currently own " + getWitchHatNum() + " item(s) of this type");
        });
        witchHat.setOnMouseExited(event -> {
            witchHat.setText("Witch Hat");
        });
        iceFlame.setOnAction(event -> {
            if(user1.getCoins()-12>=0) {
                user1.removeCoin(12);
                coinsL.setText("Player 1 you have: " + user1.getCoins() + " coins");
                iceFlameNum++;
            }
            else{
                createNotEnoughAlert();
            }

        });
        iceFlame.setOnMouseEntered(event -> {
            iceFlame.setText("Steal one point from your opponent\nCoins needed: 12 Coins\nYou currently own " + getIceFlameNum() + " item(s) of this type");
        });
        iceFlame.setOnMouseExited(event -> {
            iceFlame.setText("Ice Flame");
        });
        candy.setOnAction(event -> {
            if(user1.getCoins()-2>=0) {
                user1.removeCoin(2);
                coinsL.setText("Player 1 you have: " + user1.getCoins() + " coins");
                candyNum++;
            }
            else{
                createNotEnoughAlert();
            }

        });
        candy.setOnMouseEntered(event -> {
            candy.setText("Add 1 win to your opponent\nCoins needed: 2 Coins\nYou currently own " + getCandyNum() + " item(s) of this type");
        });
        candy.setOnMouseExited(event -> {
            candy.setText("Candy");
        });
        pickaxe.setOnAction(event -> {
            if(user1.getCoins()-5>=0) {
                user1.removeCoin(5);
                coinsL.setText("Player 1 you have: " + user1.getCoins() + " coins");
                pickaxeNum++;
            }
            else{
                createNotEnoughAlert();
            }

        });
        pickaxe.setOnMouseEntered(event -> {
            pickaxe.setText("Decrease your opponents win count by 1\nCoins needed: 5 Coins\nYou currently own " + getPickaxeNum() + " item(s) of this type");
        });
        pickaxe.setOnMouseExited(event -> {
            pickaxe.setText("Axe");
        });
        cloud.setOnAction(event -> {
            if(user1.getCoins()-15>=0) {
                user1.removeCoin(15);
                coinsL.setText("Player 1 you have: " + user1.getCoins() + " coins");
                cloudNum++;
            }
            else{
                createNotEnoughAlert();
            }

        });
        cloud.setOnMouseEntered(event -> {
            cloud.setText("Reset your opponents win count to 0\nCoins needed: 15 Coins\nYou currently own " + getCloudNum() + " item(s) of this type");
        });
        cloud.setOnMouseExited(event -> {
            cloud.setText("Cloud");
        });
    }
/*Sets the actions for the back button and for all the items in the store,
     *so that the scores and the number of coins owned are updated accordingly.
     *On hover over an item, the user can see the description for each item
     *and how many the own
     */
Sets the actions for the back button and for all the items in the store,
so that the scores and the number of coins owned are updated accordingly.
On hover over an item, the user can see the description for each item
and how many the own
Sets the actions for the back button and for all the items in the store so that the scores and the number of coins owned are updated accordingly . On hover over an item the user can see the description for each item and how many the own
public void buttonActions(){
        backB.setOnAction(event -> {
            StartView sv = new StartView();
            stage.close();
        });
        witchHat.setOnAction(event -> {
            if(user1.getCoins()-3>=0) {
                user1.removeCoin(3);
                coinsL.setText("Player 1 you have: " + user1.getCoins() + " coins");
                witchHatNum++;
            }
            else{
                createNotEnoughAlert();
            }
        });
        witchHat.setOnMouseEntered(event -> {
            witchHat.setText("Add 1 win to yourself and get a free coin\nCoins needed: 3 Coins\nYou currently own " + getWitchHatNum() + " item(s) of this type");
        });
        witchHat.setOnMouseExited(event -> {
            witchHat.setText("Witch Hat");
        });
        iceFlame.setOnAction(event -> {
            if(user1.getCoins()-12>=0) {
                user1.removeCoin(12);
                coinsL.setText("Player 1 you have: " + user1.getCoins() + " coins");
                iceFlameNum++;
            }
            else{
                createNotEnoughAlert();
            }
        });
        iceFlame.setOnMouseEntered(event -> {
            iceFlame.setText("Steal one point from your opponent\nCoins needed: 12 Coins\nYou currently own " + getIceFlameNum() + " item(s) of this type");
        });
        iceFlame.setOnMouseExited(event -> {
            iceFlame.setText("Ice Flame");
        });
        candy.setOnAction(event -> {
            if(user1.getCoins()-2>=0) {
                user1.removeCoin(2);
                coinsL.setText("Player 1 you have: " + user1.getCoins() + " coins");
                candyNum++;
            }
            else{
                createNotEnoughAlert();
            }
        });
        candy.setOnMouseEntered(event -> {
            candy.setText("Add 1 win to your opponent\nCoins needed: 2 Coins\nYou currently own " + getCandyNum() + " item(s) of this type");
        });
        candy.setOnMouseExited(event -> {
            candy.setText("Candy");
        });
        pickaxe.setOnAction(event -> {
            if(user1.getCoins()-5>=0) {
                user1.removeCoin(5);
                coinsL.setText("Player 1 you have: " + user1.getCoins() + " coins");
                pickaxeNum++;
            }
            else{
                createNotEnoughAlert();
            }
        });
        pickaxe.setOnMouseEntered(event -> {
            pickaxe.setText("Decrease your opponents win count by 1\nCoins needed: 5 Coins\nYou currently own " + getPickaxeNum() + " item(s) of this type");
        });
        pickaxe.setOnMouseExited(event -> {
            pickaxe.setText("Axe");
        });
        cloud.setOnAction(event -> {
            if(user1.getCoins()-15>=0) {
                user1.removeCoin(15);
                coinsL.setText("Player 1 you have: " + user1.getCoins() + " coins");
                cloudNum++;
            }
            else{
                createNotEnoughAlert();
            }
        });
        cloud.setOnMouseEntered(event -> {
            cloud.setText("Reset your opponents win count to 0\nCoins needed: 15 Coins\nYou currently own " + getCloudNum() + " item(s) of this type");
        });
        cloud.setOnMouseExited(event -> {
            cloud.setText("Cloud");
        });
    }
public void buttonActions ( ) { backB . setOnAction ( event -> { StartView sv = new StartView ( ) ; stage . close ( ) ; } ) ; witchHat . setOnAction ( event -> { if ( user1 . getCoins ( ) - 3 >= 0 ) { user1 . removeCoin ( 3 ) ; coinsL . setText ( "Player 1 you have: " + user1 . getCoins ( ) + " coins" ) ; witchHatNum ++ ; } else { createNotEnoughAlert ( ) ; } } ) ; witchHat . setOnMouseEntered ( event -> { witchHat . setText ( "Add 1 win to yourself and get a free coin\nCoins needed: 3 Coins\nYou currently own " + getWitchHatNum ( ) + " item(s) of this type" ) ; } ) ; witchHat . setOnMouseExited ( event -> { witchHat . setText ( "Witch Hat" ) ; } ) ; iceFlame . setOnAction ( event -> { if ( user1 . getCoins ( ) - 12 >= 0 ) { user1 . removeCoin ( 12 ) ; coinsL . setText ( "Player 1 you have: " + user1 . getCoins ( ) + " coins" ) ; iceFlameNum ++ ; } else { createNotEnoughAlert ( ) ; } } ) ; iceFlame . setOnMouseEntered ( event -> { iceFlame . setText ( "Steal one point from your opponent\nCoins needed: 12 Coins\nYou currently own " + getIceFlameNum ( ) + " item(s) of this type" ) ; } ) ; iceFlame . setOnMouseExited ( event -> { iceFlame . setText ( "Ice Flame" ) ; } ) ; candy . setOnAction ( event -> { if ( user1 . getCoins ( ) - 2 >= 0 ) { user1 . removeCoin ( 2 ) ; coinsL . setText ( "Player 1 you have: " + user1 . getCoins ( ) + " coins" ) ; candyNum ++ ; } else { createNotEnoughAlert ( ) ; } } ) ; candy . setOnMouseEntered ( event -> { candy . setText ( "Add 1 win to your opponent\nCoins needed: 2 Coins\nYou currently own " + getCandyNum ( ) + " item(s) of this type" ) ; } ) ; candy . setOnMouseExited ( event -> { candy . setText ( "Candy" ) ; } ) ; pickaxe . setOnAction ( event -> { if ( user1 . getCoins ( ) - 5 >= 0 ) { user1 . removeCoin ( 5 ) ; coinsL . setText ( "Player 1 you have: " + user1 . getCoins ( ) + " coins" ) ; pickaxeNum ++ ; } else { createNotEnoughAlert ( ) ; } } ) ; pickaxe . setOnMouseEntered ( event -> { pickaxe . setText ( "Decrease your opponents win count by 1\nCoins needed: 5 Coins\nYou currently own " + getPickaxeNum ( ) + " item(s) of this type" ) ; } ) ; pickaxe . setOnMouseExited ( event -> { pickaxe . setText ( "Axe" ) ; } ) ; cloud . setOnAction ( event -> { if ( user1 . getCoins ( ) - 15 >= 0 ) { user1 . removeCoin ( 15 ) ; coinsL . setText ( "Player 1 you have: " + user1 . getCoins ( ) + " coins" ) ; cloudNum ++ ; } else { createNotEnoughAlert ( ) ; } } ) ; cloud . setOnMouseEntered ( event -> { cloud . setText ( "Reset your opponents win count to 0\nCoins needed: 15 Coins\nYou currently own " + getCloudNum ( ) + " item(s) of this type" ) ; } ) ; cloud . setOnMouseExited ( event -> { cloud . setText ( "Cloud" ) ; } ) ; }
Sets the actions for the back button and for all the items in the store,
so that the scores and the number of coins owned are updated accordingly.
Sets the actions for the back button and for all the items in the store so that the scores and the number of coins owned are updated accordingly .