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

Class Class, % Method, % Line, %
GodArtemis 100% (1/ 1) 100% (3/ 3) 100% (15/ 15)


1 package it.polimi.ingsw.model; 2  3 class GodArtemis extends GodDecorator { 4  5  /** 6  * Count god's moves 7  */ 8  private int count = 0; 9  10  /** 11  * Mark god's initial position 12  */ 13  private int[] startPosition = new int[2]; 14  15  /** 16  * God Apollo's class 17  * @param godPower God's power 18  */ 19  public GodArtemis(GodInterface godPower) { 20  super(godPower); 21  } 22  23  /** 24  * Get event 25  * @param events event to be updated 26  * @param map board situation at the moment 27  * @param actions action of the event 28  */ 29  @Override 30  public void getEvent(Event[] events, Cell[][] map, Action[][][] actions) { 31  if (godPower.getName().equals(godPower.getCurrentPlayer())) { 32  if (events[0] == Event.ZERO) { 33  count = 1; 34  startPosition = godPower.getPositionWorker(); 35  } else if (events[0].equals(Event.MOVE) && count == 1) { 36  count = 0; 37  setAction(map, actions); 38  } 39  } 40  } 41  /** 42  * Set god's special move/build action (God Power) if possible 43  * @param map Current board 44  * @param actions List of possible actions 45  */ 46  private void setAction(Cell[][] map, Action[][][] actions) { 47  move(map,actions,godPower.getPositionWorker()); 48  actions[startPosition[0]][startPosition[1]][0].set(false); 49  } 50 }