mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Rydder opp i Player klassen
This commit is contained in:
parent
adf2747bba
commit
29bf09dd7d
@ -28,13 +28,15 @@ public class Player {
|
||||
|
||||
/**
|
||||
* Gives you the RobotID of a player
|
||||
* @return An RobotID
|
||||
* @return A RobotID
|
||||
*/
|
||||
public RobotID getRobotID(){return robotID;}
|
||||
public RobotID getRobotID() {
|
||||
return robotID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the players deck to the given deck
|
||||
* @param playerDeck a deck of cards given to the player
|
||||
* @param playerDeck A deck of cards given to the player
|
||||
*/
|
||||
public void setPlayerDeck(ProgrammingCardDeck playerDeck) {
|
||||
this.playerDeck = playerDeck;
|
||||
@ -42,40 +44,42 @@ public class Player {
|
||||
|
||||
/**
|
||||
* Gives you the Name of the player
|
||||
* @return a player Name
|
||||
* @return A player Name
|
||||
*/
|
||||
public String getName() {return name;}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives you the players program
|
||||
* @return a list<ProgrammingCard>
|
||||
* @return A list of programming cards
|
||||
*/
|
||||
public List<ProgrammingCard> getProgram() {return program;}
|
||||
public List<ProgrammingCard> getProgram() {
|
||||
return program;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives you the player hand/deck
|
||||
* @return a deck
|
||||
*/
|
||||
public ProgrammingCardDeck getPlayerDeck() {return playerDeck;}
|
||||
public ProgrammingCardDeck getPlayerDeck() {
|
||||
return playerDeck;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives you the players power down status
|
||||
* @return a boolean
|
||||
* @return Whether the player is to power down
|
||||
*/
|
||||
public boolean getPowerDownNextRound() { return powerDownNextRound;}
|
||||
public boolean getPowerDownNextRound() {
|
||||
return powerDownNextRound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the prowerdown status
|
||||
* @param powerDownStatus the boolean that determines if it goes to a powerdown or not
|
||||
* Sets the power down status
|
||||
* @param powerDownStatus Whether the player is to take power down next round
|
||||
*/
|
||||
public void setPowerDownNextRound(boolean powerDownStatus) { this.powerDownNextRound = powerDownStatus;}
|
||||
|
||||
/**
|
||||
* Gets the program from the player
|
||||
* @return List of programing cards
|
||||
*/
|
||||
public List <ProgrammingCard> getProgramFromPlayer(){
|
||||
return program;
|
||||
public void setPowerDownNextRound(boolean powerDownStatus) {
|
||||
this.powerDownNextRound = powerDownStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -85,8 +89,7 @@ public class Player {
|
||||
public void setInProgram(List <ProgrammingCard> cardList) {
|
||||
if (cardList.size() != 5) {
|
||||
throw new IllegalArgumentException("list must contain 5 programing cards");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
program = new ArrayList<>(cardList);
|
||||
}
|
||||
}
|
||||
|
@ -42,10 +42,10 @@ public class PlayerTest {
|
||||
@Test
|
||||
public void testSetInProgram() {
|
||||
playerTest.setInProgram(cards);
|
||||
assertEquals(Action.MOVE_1, playerTest.getProgramFromPlayer().get(0).getAction());
|
||||
assertEquals(Action.MOVE_2, playerTest.getProgramFromPlayer().get(1).getAction());
|
||||
assertEquals(Action.MOVE_3, playerTest.getProgramFromPlayer().get(2).getAction());
|
||||
assertEquals(Action.BACK_UP, playerTest.getProgramFromPlayer().get(3).getAction());
|
||||
assertEquals(Action.MOVE_1, playerTest.getProgram().get(0).getAction());
|
||||
assertEquals(Action.MOVE_2, playerTest.getProgram().get(1).getAction());
|
||||
assertEquals(Action.MOVE_3, playerTest.getProgram().get(2).getAction());
|
||||
assertEquals(Action.BACK_UP, playerTest.getProgram().get(3).getAction());
|
||||
}
|
||||
|
||||
@Test (expected = IllegalArgumentException.class)
|
||||
|
Loading…
x
Reference in New Issue
Block a user