mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-02-08 02:59:36 +01:00
Merge branch 'master' of https://github.com/inf112-v20/Fiasko
This commit is contained in:
commit
092a201765
14
README.md
14
README.md
@ -8,6 +8,20 @@ Alle regler er hentet fra 2005 utgaven av spillguiden fra Wizards of the Coast,
|
||||
## Spillstatus
|
||||
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
|
||||
- Q: Tilbakestiller kamera og kamerarotasjon
|
||||
|
@ -28,65 +28,68 @@ 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;
|
||||
public void setPlayerDeck(ProgrammingCardDeck playerDeck) {
|
||||
this.playerDeck = playerDeck;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 powerdown status
|
||||
* @return a boolean
|
||||
* Gives you the players power down status
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Players program to the given list of programing cards
|
||||
* @param cardList list the size of 5 with programing cards
|
||||
*/
|
||||
public void setInProgram(List <ProgrammingCard> cardList){
|
||||
if(cardList.size() != 5){
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
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 java.io.IOException;
|
||||
|
@ -126,7 +126,7 @@ public final class IOUtil {
|
||||
direction = wall.getDirection();
|
||||
} else if (element.getClass().isAssignableFrom(Particle.class)) {
|
||||
Particle particle = (Particle) element;
|
||||
hasRotatedTexture = true;
|
||||
hasRotatedTexture = TextureConverterUtil.hasRotatedTexture(particle);
|
||||
direction = particle.getDirection();
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown element type passed to function.");
|
||||
|
@ -1,6 +1,5 @@
|
||||
package inf112.fiasko.roborally.element_properties;
|
||||
|
||||
import inf112.fiasko.roborally.objects.Tile;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -9,7 +8,6 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
public class TileTypeTest {
|
||||
|
||||
|
@ -2,7 +2,6 @@ package inf112.fiasko.roborally.objects;
|
||||
|
||||
import inf112.fiasko.roborally.element_properties.Direction;
|
||||
import inf112.fiasko.roborally.element_properties.ParticleType;
|
||||
import inf112.fiasko.roborally.element_properties.TileType;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -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