[ all classes ]
[ it.polimi.ingsw.model ]
Coverage Summary for Class: GodPower (it.polimi.ingsw.model)
Class | Class, % | Method, % | Line, % |
---|---|---|---|
GodPower | 100% (1/ 1) | 100% (14/ 14) | 100% (24/ 24) |
1 package it.polimi.ingsw.model;
2
3 class GodPower implements GodInterface {
4
5 /**
6 * God enumeration
7 */
8 public final God god;
9
10 /**
11 * Player that owns the current god power
12 */
13 public final String owner;
14
15 /**
16 * If the god power is activated
17 */
18 private Boolean trigged;
19
20 /**
21 * Current Player's information
22 */
23 private CurrentPlayer currentPlayerInfo;
24
25
26 /**
27 * Set the god's power
28 * @param god Current god
29 * @param name Player's username
30 */
31 public GodPower(God god, String name) {
32 this.god = god;
33 owner = name;
34 trigged = false;
35 }
36
37 /**
38 * Add information to the current player
39 * @param currentPlayerInfo Player's information needs to be updated
40 */
41 @Override
42 public void addInfo(CurrentPlayer currentPlayerInfo) {
43 this.currentPlayerInfo = currentPlayerInfo;
44 }
45
46
47 /**
48 * Set the last god that changed his own status
49 * @param lastGod last god that changed his own status
50 */
51 public void setLastGod(God lastGod) {
52 currentPlayerInfo.setLastGod(lastGod);
53 }
54
55 /**
56 * Get the last god that changed his own status
57 * @return last god that changed his own status
58 */
59 public God getLastGod() {
60 return currentPlayerInfo.getLastGod();
61 }
62
63 /**
64 * Set the current player
65 * @param name player's username
66 */
67 @Override
68 public void setCurrentPlayer(String name) {
69 currentPlayerInfo.setCurrentPlayer(name);
70 }
71
72 /**
73 * Get the current player
74 * @return current player
75 */
76 @Override
77 public String getCurrentPlayer() {
78 return currentPlayerInfo.getCurrentPlayer();
79 }
80
81 /**
82 * Set the worker's position
83 * @param positionWorker worker's position
84 */
85 @Override
86 public void setWorker(int[] positionWorker) {
87 currentPlayerInfo.setPositionWorker(positionWorker);
88 }
89
90 /**
91 * Get the worker's position
92 * @return worker's position
93 */
94 @Override
95 public int[] getPositionWorker() {
96 return currentPlayerInfo.getPositionWorker();
97 }
98
99 /**
100 * Set player's status
101 * @param statusPlayer player's status to be set
102 */
103 @Override
104 public void setStatusPlayer(StatusPlayer statusPlayer) {
105 currentPlayerInfo.setStatusPlayer(statusPlayer);
106 }
107
108 /**
109 * Get player's status
110 * @return player's status
111 */
112 @Override
113 public StatusPlayer getPlayerStatus() {
114 return currentPlayerInfo.getStatusPlayer();
115 }
116
117
118 /**
119 * Activate God Power's status
120 * @param status God's status that needs to be activated
121 */
122 @Override
123 public void activate(boolean status) {
124 trigged = status;
125
126 }
127 /**
128 * Get god's status
129 * @return God's stauts
130 */
131 public boolean getStatus() {
132 return Boolean.TRUE.equals(trigged);
133 }
134
135 /**
136 * Get event
137 * @param events event to be updated
138 * @param map board situation at the moment
139 * @param actions action of the event
140 */
141 @Override
142 public void getEvent(Event[] events, Cell[][] map, Action[][][] actions) {
143
144 }
145
146 /**
147 * Get player's username
148 * @return player's username
149 */
150 @Override
151 public String getName() {
152 return owner;
153 }
154 }