Coverage Summary for Class: AssistantCard (it.polimi.ingsw.Model)
| Class | Class, % | Method, % | Line, % |
|---|---|---|---|
| AssistantCard | 100% (1/1) | 100% (5/5) | 100% (7/7) |
1 package it.polimi.ingsw.Model; 2 3 import java.io.Serial; 4 import java.io.Serializable; 5 6 /** 7 * This class represents one of the 10 player owned assistant cards 8 */ 9 public class AssistantCard implements Serializable { 10 @Serial 11 private static final long serialVersionUID = 102L; // convention: 1 for model, (01 -> 99) for objects 12 private final int priority; 13 private boolean used; 14 15 /** 16 * Constructs an Assistant card based on its priority. 17 * 18 * @param priority the priority of the card 19 */ 20 public AssistantCard(int priority) { 21 this.priority = priority; 22 this.used = false; 23 } 24 25 /** 26 * Every card has a maximum value for the movement to use in {@link it.polimi.ingsw.Controller.Actions.MoveMotherNature} 27 * 28 * @return an integer value representing max mother nature movement 29 */ 30 public int getMaxMovement() { 31 return (int) Math.ceil((double) priority / 2); 32 } 33 34 /** 35 * Returns the priority of turn linked to the use of the card. 36 * 37 * @return an integer value representing priority 38 */ 39 public int getPriority() { 40 return priority; 41 } 42 43 /** 44 * If a card is used in a turn by the player, this flag must be set to true. 45 * 46 * @return the used flag of the card 47 */ 48 public boolean getUsed() { 49 return used; 50 } 51 52 /** 53 * If a card is used in a turn by the player, this flag must be set to true. <br> 54 * Use this function to set the value to true. Keep in mind there is no way to revert this flag once set. 55 */ 56 public void setUsed() { 57 this.used = true; 58 } 59 60 } 61 62 63