View/GamePVAIView.java
public void itemActions(){
        witchHat.setOnAction(event -> {
            if(StoreView.getWitchHatNum()>0){
                if(ply1WinCount<3) {
                    ply1WinCount++;
                    AIGamesWon++;
                }
                user1.addCoin();
                StoreView.setWitchHatNum(StoreView.getWitchHatNum()-1);
                displayCurScoresGraphic("You have added one win to yourself and have earned a free coin\nPlayer 1 score: " + ply1WinCount + "\nAI score: " + aiWinCount);
                stage2.close();
                System.out.println("ai "+aiWinCount);
                System.out.println("pl " + ply1WinCount);
                displayTotalScores();
            }
            else{
                createNoItemAlert();
            }
        });
        witchHat.setOnMouseEntered(event -> {
            witchHat.setText("You have " + StoreView.getWitchHatNum() + " item(s) of this type");
        });
        witchHat.setOnMouseExited(event -> {
            witchHat.setText("Witch Hat");
        });

        iceFlame.setOnAction(event -> {
            if(StoreView.getIceFlameNum()>0){
                if(aiWinCount>0) {
                    aiWinCount--;
                    if(i==0){
                        AIGamesWon++;
                        AIGamesLost--;
                        i++;
                    }
                }
                if(ply1WinCount<3) {
                    if(i==0){
                        AIGamesWon++;
                        AIGamesLost--;
                    }
                    ply1WinCount++;
                }
                StoreView.setIceFlameNum(StoreView.getIceFlameNum()-1);
                displayCurScores("You have stolen a win from the AI\nPlayer 1 score: " + ply1WinCount + "\nAI score: " + aiWinCount);
                stage2.close();
                displayTotalScores();
            }
            else{
                createNoItemAlert();
            }
        });
        iceFlame.setOnMouseEntered(event -> {
            iceFlame.setText("You have " + StoreView.getIceFlameNum() + " item(s) of this type");

        });
        iceFlame.setOnMouseExited(event -> {
            iceFlame.setText("Ice Flame");
        });

        candy.setOnAction(event -> {
            if(StoreView.getCandyNum()>0){
                if(aiWinCount<3) {
                    aiWinCount++;
                    AIGamesLost++;
                }
                StoreView.setCandyNum(StoreView.getCandyNum()-1);
                displayCurScores("You have added one win to the AI\nPlayer 1 score: " + ply1WinCount + "\nAI score: " + aiWinCount);
                stage2.close();displayTotalScores();

            }
            else{
                createNoItemAlert();
            }
        });
        candy.setOnMouseEntered(event -> { candy.setText("You have " + StoreView.getCandyNum() + " item(s) of this type");

        });
        candy.setOnMouseExited(event -> {
            candy.setText("Candy");
        });

        pickaxe.setOnAction(event -> {
            if(StoreView.getPickaxeNum()>0 ){
                if(aiWinCount>0) {
                    aiWinCount--;
                    AIGamesLost--;
                }
                StoreView.setPickaxeNum(StoreView.getPickaxeNum()-1);
                displayCurScores("You have decreased the AI's wins by one\nPlayer 1 score: " + ply1WinCount + "\nAI score: " + aiWinCount);
                stage2.close();
                displayTotalScores();
            }
            else{
                createNoItemAlert();
            }

        });
        pickaxe.setOnMouseEntered(event -> {
            pickaxe.setText("You have " + StoreView.getPickaxeNum() + " item(s) of this type");
        });
        pickaxe.setOnMouseExited(event -> {
            pickaxe.setText("Axe");
        });

        cloud.setOnAction(event -> {
            if(StoreView.getCloudNum()>0){
                aiWinCount = 0;
                AIGamesLost = 0;
                StoreView.setCloudNum(StoreView.getCandyNum()-1);
                displayCurScores("You have reset the AI's wins to 0\nPlayer 1 score: " + ply1WinCount + "\nAI score: " + aiWinCount);
                stage2.close();
                displayTotalScores();
            }
            else{
                createNoItemAlert();
            }
        });
        cloud.setOnMouseEntered(event -> {
            cloud.setText("You have " + StoreView.getCloudNum() + " item(s) of this type");
        });
        cloud.setOnMouseExited(event -> {
            cloud.setText("Cloud");
        });

        helpB2.setOnAction(event -> {
            Alert alert = new Alert(Alert.AlertType.NONE, "Use any items that you have, if you wish to buy items head to the store");
            alert.getDialogPane().getStylesheets().add("/View/stylesheet.css");

            ButtonType alertButton1 = new ButtonType("Ok");
            alert.getButtonTypes().setAll(alertButton1);
            alert.showAndWait();
        });
    }
/*Sets the actions for each of the items represented by buttons in the store
    * When an item is clicked the user will be informed on its effect on the game
    * and the scores tracking the game will be updated accordingly.
    * When the item is hovered, the user will be informed how many items of that
    * type he or she owns.
    */
Sets the actions for each of the items represented by buttons in the store
When an item is clicked the user will be informed on its effect on the game
and the scores tracking the game will be updated accordingly.
When the item is hovered, the user will be informed how many items of that
type he or she owns.
Sets the actions for each of the items represented by buttons in the store When an item is clicked the user will be informed on its effect on the game and the scores tracking the game will be updated accordingly . When the item is hovered the user will be informed how many items of that type he or she owns .
public void itemActions(){
        witchHat.setOnAction(event -> {
            if(StoreView.getWitchHatNum()>0){
                if(ply1WinCount<3) {
                    ply1WinCount++;
                    AIGamesWon++;
                }
                user1.addCoin();
                StoreView.setWitchHatNum(StoreView.getWitchHatNum()-1);
                displayCurScoresGraphic("You have added one win to yourself and have earned a free coin\nPlayer 1 score: " + ply1WinCount + "\nAI score: " + aiWinCount);
                stage2.close();
                System.out.println("ai "+aiWinCount);
                System.out.println("pl " + ply1WinCount);
                displayTotalScores();
            }
            else{
                createNoItemAlert();
            }
        });
        witchHat.setOnMouseEntered(event -> {
            witchHat.setText("You have " + StoreView.getWitchHatNum() + " item(s) of this type");
        });
        witchHat.setOnMouseExited(event -> {
            witchHat.setText("Witch Hat");
        });
        iceFlame.setOnAction(event -> {
            if(StoreView.getIceFlameNum()>0){
                if(aiWinCount>0) {
                    aiWinCount--;
                    if(i==0){
                        AIGamesWon++;
                        AIGamesLost--;
                        i++;
                    }
                }
                if(ply1WinCount<3) {
                    if(i==0){
                        AIGamesWon++;
                        AIGamesLost--;
                    }
                    ply1WinCount++;
                }
                StoreView.setIceFlameNum(StoreView.getIceFlameNum()-1);
                displayCurScores("You have stolen a win from the AI\nPlayer 1 score: " + ply1WinCount + "\nAI score: " + aiWinCount);
                stage2.close();
                displayTotalScores();
            }
            else{
                createNoItemAlert();
            }
        });
        iceFlame.setOnMouseEntered(event -> {
            iceFlame.setText("You have " + StoreView.getIceFlameNum() + " item(s) of this type");
        });
        iceFlame.setOnMouseExited(event -> {
            iceFlame.setText("Ice Flame");
        });
        candy.setOnAction(event -> {
            if(StoreView.getCandyNum()>0){
                if(aiWinCount<3) {
                    aiWinCount++;
                    AIGamesLost++;
                }
                StoreView.setCandyNum(StoreView.getCandyNum()-1);
                displayCurScores("You have added one win to the AI\nPlayer 1 score: " + ply1WinCount + "\nAI score: " + aiWinCount);
                stage2.close();displayTotalScores();
            }
            else{
                createNoItemAlert();
            }
        });
        candy.setOnMouseEntered(event -> { candy.setText("You have " + StoreView.getCandyNum() + " item(s) of this type");
        });
        candy.setOnMouseExited(event -> {
            candy.setText("Candy");
        });
        pickaxe.setOnAction(event -> {
            if(StoreView.getPickaxeNum()>0 ){
                if(aiWinCount>0) {
                    aiWinCount--;
                    AIGamesLost--;
                }
                StoreView.setPickaxeNum(StoreView.getPickaxeNum()-1);
                displayCurScores("You have decreased the AI's wins by one\nPlayer 1 score: " + ply1WinCount + "\nAI score: " + aiWinCount);
                stage2.close();
                displayTotalScores();
            }
            else{
                createNoItemAlert();
            }
        });
        pickaxe.setOnMouseEntered(event -> {
            pickaxe.setText("You have " + StoreView.getPickaxeNum() + " item(s) of this type");
        });
        pickaxe.setOnMouseExited(event -> {
            pickaxe.setText("Axe");
        });
        cloud.setOnAction(event -> {
            if(StoreView.getCloudNum()>0){
                aiWinCount = 0;
                AIGamesLost = 0;
                StoreView.setCloudNum(StoreView.getCandyNum()-1);
                displayCurScores("You have reset the AI's wins to 0\nPlayer 1 score: " + ply1WinCount + "\nAI score: " + aiWinCount);
                stage2.close();
                displayTotalScores();
            }
            else{
                createNoItemAlert();
            }
        });
        cloud.setOnMouseEntered(event -> {
            cloud.setText("You have " + StoreView.getCloudNum() + " item(s) of this type");
        });
        cloud.setOnMouseExited(event -> {
            cloud.setText("Cloud");
        });
        helpB2.setOnAction(event -> {
            Alert alert = new Alert(Alert.AlertType.NONE, "Use any items that you have, if you wish to buy items head to the store");
            alert.getDialogPane().getStylesheets().add("/View/stylesheet.css");
            ButtonType alertButton1 = new ButtonType("Ok");
            alert.getButtonTypes().setAll(alertButton1);
            alert.showAndWait();
        });
    }
public void itemActions ( ) { witchHat . setOnAction ( event -> { if ( StoreView . getWitchHatNum ( ) > 0 ) { if ( ply1WinCount < 3 ) { ply1WinCount ++ ; AIGamesWon ++ ; } user1 . addCoin ( ) ; StoreView . setWitchHatNum ( StoreView . getWitchHatNum ( ) - 1 ) ; displayCurScoresGraphic ( "You have added one win to yourself and have earned a free coin\nPlayer 1 score: " + ply1WinCount + "\nAI score: " + aiWinCount ) ; stage2 . close ( ) ; System . out . println ( "ai " + aiWinCount ) ; System . out . println ( "pl " + ply1WinCount ) ; displayTotalScores ( ) ; } else { createNoItemAlert ( ) ; } } ) ; witchHat . setOnMouseEntered ( event -> { witchHat . setText ( "You have " + StoreView . getWitchHatNum ( ) + " item(s) of this type" ) ; } ) ; witchHat . setOnMouseExited ( event -> { witchHat . setText ( "Witch Hat" ) ; } ) ; iceFlame . setOnAction ( event -> { if ( StoreView . getIceFlameNum ( ) > 0 ) { if ( aiWinCount > 0 ) { aiWinCount -- ; if ( i == 0 ) { AIGamesWon ++ ; AIGamesLost -- ; i ++ ; } } if ( ply1WinCount < 3 ) { if ( i == 0 ) { AIGamesWon ++ ; AIGamesLost -- ; } ply1WinCount ++ ; } StoreView . setIceFlameNum ( StoreView . getIceFlameNum ( ) - 1 ) ; displayCurScores ( "You have stolen a win from the AI\nPlayer 1 score: " + ply1WinCount + "\nAI score: " + aiWinCount ) ; stage2 . close ( ) ; displayTotalScores ( ) ; } else { createNoItemAlert ( ) ; } } ) ; iceFlame . setOnMouseEntered ( event -> { iceFlame . setText ( "You have " + StoreView . getIceFlameNum ( ) + " item(s) of this type" ) ; } ) ; iceFlame . setOnMouseExited ( event -> { iceFlame . setText ( "Ice Flame" ) ; } ) ; candy . setOnAction ( event -> { if ( StoreView . getCandyNum ( ) > 0 ) { if ( aiWinCount < 3 ) { aiWinCount ++ ; AIGamesLost ++ ; } StoreView . setCandyNum ( StoreView . getCandyNum ( ) - 1 ) ; displayCurScores ( "You have added one win to the AI\nPlayer 1 score: " + ply1WinCount + "\nAI score: " + aiWinCount ) ; stage2 . close ( ) ; displayTotalScores ( ) ; } else { createNoItemAlert ( ) ; } } ) ; candy . setOnMouseEntered ( event -> { candy . setText ( "You have " + StoreView . getCandyNum ( ) + " item(s) of this type" ) ; } ) ; candy . setOnMouseExited ( event -> { candy . setText ( "Candy" ) ; } ) ; pickaxe . setOnAction ( event -> { if ( StoreView . getPickaxeNum ( ) > 0 ) { if ( aiWinCount > 0 ) { aiWinCount -- ; AIGamesLost -- ; } StoreView . setPickaxeNum ( StoreView . getPickaxeNum ( ) - 1 ) ; displayCurScores ( "You have decreased the AI's wins by one\nPlayer 1 score: " + ply1WinCount + "\nAI score: " + aiWinCount ) ; stage2 . close ( ) ; displayTotalScores ( ) ; } else { createNoItemAlert ( ) ; } } ) ; pickaxe . setOnMouseEntered ( event -> { pickaxe . setText ( "You have " + StoreView . getPickaxeNum ( ) + " item(s) of this type" ) ; } ) ; pickaxe . setOnMouseExited ( event -> { pickaxe . setText ( "Axe" ) ; } ) ; cloud . setOnAction ( event -> { if ( StoreView . getCloudNum ( ) > 0 ) { aiWinCount = 0 ; AIGamesLost = 0 ; StoreView . setCloudNum ( StoreView . getCandyNum ( ) - 1 ) ; displayCurScores ( "You have reset the AI's wins to 0\nPlayer 1 score: " + ply1WinCount + "\nAI score: " + aiWinCount ) ; stage2 . close ( ) ; displayTotalScores ( ) ; } else { createNoItemAlert ( ) ; } } ) ; cloud . setOnMouseEntered ( event -> { cloud . setText ( "You have " + StoreView . getCloudNum ( ) + " item(s) of this type" ) ; } ) ; cloud . setOnMouseExited ( event -> { cloud . setText ( "Cloud" ) ; } ) ; helpB2 . setOnAction ( event -> { Alert alert = new Alert ( Alert . AlertType . NONE , "Use any items that you have, if you wish to buy items head to the store" ) ; alert . getDialogPane ( ) . getStylesheets ( ) . add ( "/View/stylesheet.css" ) ; ButtonType alertButton1 = new ButtonType ( "Ok" ) ; alert . getButtonTypes ( ) . setAll ( alertButton1 ) ; alert . showAndWait ( ) ; } ) ; }
Sets the actions for each of the items represented by buttons in the store
 When an item is clicked the user will be informed on its effect on the game
 and the scores tracking the game will be updated accordingly.
Sets the actions for each of the items represented by buttons in the store When an item is clicked the user will be informed on its effect on the game and the scores tracking the game will be updated accordingly .