This commit is contained in:
torlunjen 2020-03-24 12:13:27 +01:00
commit 092a201765
7 changed files with 54 additions and 36 deletions

View File

@ -8,6 +8,20 @@ Alle regler er hentet fra 2005 utgaven av spillguiden fra Wizards of the Coast,
## Spillstatus ## Spillstatus
Ved kjøring av .jar filen blir det kjørt en demo, uten mulighet for bruker å bevege robot. Ved kjøring av .jar filen blir det kjørt en demo, uten mulighet for bruker å bevege robot.
## Manuell testing
Demoen er definert i RoboRallyGame sin metode runGameLoop(). Metodene som kan brukes for testing er:
- makeMove(Robot id, Korthandling) //Utfører en handling på en robot
- fireAllLasers() //Fyrer av alle lasere inkludert robotlasere
- moveAllConveyorBelts() //Flytter alle transportbånd
- checkAllFlags() //Oppdaterer roboter som besøker flagg
- rotateCogwheels() //Roterer tannhjul
Robot id blir representert ved enumen RobotID
Korthandling blir representert ved enumen Action
Ved å bruke metodene over kan alt i en eller flere faser testes og simuleres. Den store forskjellen fra MVP er at all
bruker-input blir hardkodet før programmet kjører.
## Knapper og kontrollmekanismer ## Knapper og kontrollmekanismer
### Knapper ### Knapper
- Q: Tilbakestiller kamera og kamerarotasjon - Q: Tilbakestiller kamera og kamerarotasjon

View File

@ -28,13 +28,15 @@ public class Player {
/** /**
* Gives you the RobotID of a 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 * 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) { public void setPlayerDeck(ProgrammingCardDeck playerDeck) {
this.playerDeck = playerDeck; this.playerDeck = playerDeck;
@ -42,40 +44,42 @@ public class Player {
/** /**
* Gives you the Name of the 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 * 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 * Gives you the player hand/deck
* @return a deck * @return a deck
*/ */
public ProgrammingCardDeck getPlayerDeck() {return playerDeck;} public ProgrammingCardDeck getPlayerDeck() {
return playerDeck;
}
/** /**
* Gives you the players power down status * 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 * Sets the power down status
* @param powerDownStatus the boolean that determines if it goes to a powerdown or not * @param powerDownStatus Whether the player is to take power down next round
*/ */
public void setPowerDownNextRound(boolean powerDownStatus) { this.powerDownNextRound = powerDownStatus;} 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;
} }
/** /**
@ -85,8 +89,7 @@ public class Player {
public void setInProgram(List <ProgrammingCard> cardList) { public void setInProgram(List <ProgrammingCard> cardList) {
if (cardList.size() != 5) { if (cardList.size() != 5) {
throw new IllegalArgumentException("list must contain 5 programing cards"); throw new IllegalArgumentException("list must contain 5 programing cards");
} } else {
else {
program = new ArrayList<>(cardList); program = new ArrayList<>(cardList);
} }
} }

View File

@ -1,6 +1,10 @@
package inf112.fiasko.roborally.objects; package inf112.fiasko.roborally.objects;
import inf112.fiasko.roborally.element_properties.*; import inf112.fiasko.roborally.element_properties.Action;
import inf112.fiasko.roborally.element_properties.Direction;
import inf112.fiasko.roborally.element_properties.Position;
import inf112.fiasko.roborally.element_properties.RobotID;
import inf112.fiasko.roborally.element_properties.TileType;
import inf112.fiasko.roborally.utility.BoardLoaderUtil; import inf112.fiasko.roborally.utility.BoardLoaderUtil;
import java.io.IOException; import java.io.IOException;

View File

@ -126,7 +126,7 @@ public final class IOUtil {
direction = wall.getDirection(); direction = wall.getDirection();
} else if (element.getClass().isAssignableFrom(Particle.class)) { } else if (element.getClass().isAssignableFrom(Particle.class)) {
Particle particle = (Particle) element; Particle particle = (Particle) element;
hasRotatedTexture = true; hasRotatedTexture = TextureConverterUtil.hasRotatedTexture(particle);
direction = particle.getDirection(); direction = particle.getDirection();
} else { } else {
throw new IllegalArgumentException("Unknown element type passed to function."); throw new IllegalArgumentException("Unknown element type passed to function.");

View File

@ -1,6 +1,5 @@
package inf112.fiasko.roborally.element_properties; package inf112.fiasko.roborally.element_properties;
import inf112.fiasko.roborally.objects.Tile;
import org.junit.Test; import org.junit.Test;
import java.util.ArrayList; import java.util.ArrayList;
@ -9,7 +8,6 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class TileTypeTest { public class TileTypeTest {

View File

@ -2,7 +2,6 @@ package inf112.fiasko.roborally.objects;
import inf112.fiasko.roborally.element_properties.Direction; import inf112.fiasko.roborally.element_properties.Direction;
import inf112.fiasko.roborally.element_properties.ParticleType; import inf112.fiasko.roborally.element_properties.ParticleType;
import inf112.fiasko.roborally.element_properties.TileType;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;

View File

@ -42,10 +42,10 @@ public class PlayerTest {
@Test @Test
public void testSetInProgram() { public void testSetInProgram() {
playerTest.setInProgram(cards); playerTest.setInProgram(cards);
assertEquals(Action.MOVE_1, playerTest.getProgramFromPlayer().get(0).getAction()); assertEquals(Action.MOVE_1, playerTest.getProgram().get(0).getAction());
assertEquals(Action.MOVE_2, playerTest.getProgramFromPlayer().get(1).getAction()); assertEquals(Action.MOVE_2, playerTest.getProgram().get(1).getAction());
assertEquals(Action.MOVE_3, playerTest.getProgramFromPlayer().get(2).getAction()); assertEquals(Action.MOVE_3, playerTest.getProgram().get(2).getAction());
assertEquals(Action.BACK_UP, playerTest.getProgramFromPlayer().get(3).getAction()); assertEquals(Action.BACK_UP, playerTest.getProgram().get(3).getAction());
} }
@Test (expected = IllegalArgumentException.class) @Test (expected = IllegalArgumentException.class)