Coverage Summary for Class: DrawUpperTribeCard (it.polimi.ingsw.gc14.Network.NetworkEvents)

Class Class, % Method, % Branch, % Line, %
DrawUpperTribeCard 0% (0/1) 0% (0/3) 0% (0/2) 0% (0/13)


 package it.polimi.ingsw.gc14.Network.NetworkEvents;
 
 import it.polimi.ingsw.gc14.Controller.GameController;
 import it.polimi.ingsw.gc14.ErrorType;
 import it.polimi.ingsw.gc14.Model.MiniModel;
 import it.polimi.ingsw.gc14.Network.EventType;
 import it.polimi.ingsw.gc14.Network.NetworkEvent;
 
 
 /**
  * NetworkEvent to draw a tribe card from the upper card list.
  */
 public class DrawUpperTribeCard extends NetworkEvent{
 
     /** Index of the card to draw */
     private final int pos;
 
     /**
      * Class constructor.
      * Initializes all the attributes.
      * @param username the name of the player requesting the event
      * @param pos the index of the card to draw
      */
     public DrawUpperTribeCard(String username, int pos){
         super(username, EventType.DRAW_UPPER_TRIBE, false, ErrorType.WRONG_ACTION);
         this.pos = pos;
     }
 
     /**
      * @param gameController the Game Controller on which to apply the event
      * @return true if the player could draw the card, false otherwise
      */
     @Override
     public boolean apply(GameController gameController){
         return gameController.drawUpperTribeCard(username, pos);
     }
     /**
      * Applies this event to the client-side mini model, removing the drawn card
      * from the upper tribe list and updating players, turn order, game state, and slot map.
      *
      * @param miniModel the client-side model to update.
      */
     @Override
     public void apply(MiniModel miniModel){
         synchronized (miniModel) {
             if (isError)
                 return;
             miniModel.removeUpperTribeCard(pos);
             miniModel.setPlayers(playerList);
             miniModel.setOrderLogicCard(orderLogicCard);
             miniModel.setCurrentState(currentState);
             miniModel.setSlotPlayerMap(slotPlayerMap);
             miniModel.setLastEvent(this);
         }
     }
 
 
 }