[ all classes ]
[ it.polimi.ingsw.model ]
Coverage Summary for Class: GodTriton (it.polimi.ingsw.model)
Class | Class, % | Method, % | Line, % |
---|---|---|---|
GodTriton | 100% (1/ 1) | 100% (3/ 3) | 100% (9/ 9) |
1 package it.polimi.ingsw.model;
2
3 class GodTriton extends GodDecorator {
4
5 /**
6 * God Triton's class
7 * @param godPower God's power
8 */
9 public GodTriton(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 ((events[0].equals(Event.MOVE) && godPower.getName().equals(godPower.getCurrentPlayer()))
22 && (godPower.getPositionWorker()[0] == 0 || godPower.getPositionWorker()[0] == 4
23 || godPower.getPositionWorker()[1] == 0 || godPower.getPositionWorker()[1] == 4)) {
24 setAction(map,actions);
25 }
26 }
27
28 /**
29 * Set god's special move/build action (God Power) if possible
30 * @param map Current board
31 * @param actions List of possible actions
32 */
33 private void setAction(Cell[][] map, Action[][][] actions){
34 move(map,actions,godPower.getPositionWorker());
35 }
36
37 }