Coverage Summary for Class: SkipTurn (it.polimi.ingsw.gc14.Network.NetworkEvents)
| Class |
Class, %
|
Method, %
|
Branch, %
|
Line, %
|
| SkipTurn |
0%
(0/1)
|
0%
(0/3)
|
0%
(0/2)
|
0%
(0/11)
|
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;
/**
* Network event used to skip the current player's optional card action.
*/
public class SkipTurn extends NetworkEvent {
/**
* Class constructor.
* Initializes all the attributes.
* @param username the name of the player requesting the event
*/
public SkipTurn(String username){
super(username, EventType.SKIP_TURN, false, ErrorType.WRONG_ACTION);
}
/**
* @param gameController the Game Controller on which to apply the event
* @return true if the player could skipTheTurn, false otherwise
*/
@Override
public boolean apply(GameController gameController){
return gameController.skipTurn(username);
}
/**
* Applies this event to the client-side mini model, updating players,
* turn order, game state, and slot map after a skip turn action.
*
* @param miniModel the client-side model to update.
*/
@Override
public void apply(MiniModel miniModel){
synchronized (miniModel) {
if (isError)
return;
miniModel.setPlayers(playerList);
miniModel.setOrderLogicCard(orderLogicCard);
miniModel.setCurrentState(currentState);
miniModel.setSlotPlayerMap(slotPlayerMap);
miniModel.setLastEvent(this);
}
}
}