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

Class Class, % Method, % Line, %
GodAthena 100% (1/ 1) 100% (3/ 3) 100% (21/ 21)


1 package it.polimi.ingsw.model; 2  3 class GodAthena extends GodDecorator { 4  5  /** 6  * God Athena's class 7  * @param godPower God's power 8  */ 9  public GodAthena(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  22  if (godPower.getName().equals(godPower.getCurrentPlayer())) { 23  if (events[0] == Event.ZERO) { 24  activate(false); 25  } else if (events[0].equals(Event.MOVE) && events[1].equals(Event.UP)) { 26  activate(true); 27  } 28  } else if (godPower.getStatus()) { 29  setAction(map, actions); 30  } 31  } 32  /** 33  * Set god's special move/build action (God Power) if possible 34  * @param map Current board 35  * @param actions List of possible actions 36  */ 37  private void setAction(Cell[][] map, Action[][][] actions) { 38  for (int i = 0; i < 5; i++) { 39  for (int j = 0; j < 5; j++) { 40  if ((map[i][j].getSize() > map[getPositionWorker()[0]][getPositionWorker()[1]].getSize()) 41  || ((map[i][j].getSize() == map[getPositionWorker()[0]][getPositionWorker()[1]].getSize() 42  && !map[i][j].getBlock(map[i][j].getSize()).getTypeBlock().equals(TypeBlock.WORKER)))) { 43  actions[i][j][0].set(false); 44  actions[i][j][0].setGod(God.ATHENA); 45  actions[i][j][0].setBlocked(true); 46  } else { 47  actions[i][j][0].setGod(God.ATHENA); 48  actions[i][j][0].setBlocked(false); 49  } 50  } 51  } 52  } 53  54 }