Coverage Summary for Class: GodZeus (it.polimi.ingsw.model)

Class Class, % Method, % Line, %
GodZeus 100% (1/ 1) 100% (3/ 3) 100% (28/ 28)


1 package it.polimi.ingsw.model; 2  3 class GodZeus extends GodDecorator { 4  5  /** 6  * God Zeus's class 7  * @param godPower God's power 8  */ 9  public GodZeus(GodInterface godPower) { 10  super(godPower); 11  } 12  13  /** 14  * Get event 15  * @param events event to be updated 16  * @param map board situation at the moment 17  * @param actions action of the event 18  */ 19  @Override 20  public void getEvent(Event[] events, Cell[][] map, Action[][][] actions) { 21  if (godPower.getCurrentPlayer().equals(godPower.getName()) && (events[0] == Event.MOVE)) { 22  setAction(map, actions); 23  } 24  } 25  26  /** 27  * Set god's special move/build action (God Power) if possible 28  * @param map Current board 29  * @param actions List of possible actions 30  */ 31  private void setAction(Cell[][] map, Action[][][] actions) { 32  int[] position = godPower.getPositionWorker(); 33  if (map[position[0]][position[1]].getSize() < 4) { 34  int i = position[0]; 35  int j = position[1]; 36  TypeBlock typeBlock = null; 37  int[] destination = new int[2]; 38  switch (map[i][j].getSize()) { 39  case 1: 40  typeBlock = TypeBlock.LEVEL1; 41  destination[0] = i; 42  destination[1] = j; 43  ((Build) actions[i][j][1]).set(true, typeBlock, destination); 44  break; 45  case 2: 46  typeBlock = TypeBlock.LEVEL2; 47  destination[0] = i; 48  destination[1] = j; 49  ((Build) actions[i][j][1]).set(true, typeBlock, destination); 50  break; 51  case 3: 52  typeBlock = TypeBlock.LEVEL3; 53  destination[0] = i; 54  destination[1] = j; 55  ((Build) actions[i][j][1]).set(true, typeBlock, destination); 56  break; 57  default: 58  break; 59  } 60  } 61  } 62 }