mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Merge branch 'master' of https://github.com/inf112-v20/Fiasko
This commit is contained in:
commit
2eac95fef9
@ -0,0 +1,41 @@
|
|||||||
|
package inf112.fiasko.roborally.element_properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this class represtents a robot
|
||||||
|
*/
|
||||||
|
public class Robot {
|
||||||
|
private int robotDamageTaken = 0;
|
||||||
|
private int playerId; //might not be needed
|
||||||
|
private boolean inPowerDown = false;
|
||||||
|
private int lastFlagVisited = 0;
|
||||||
|
private Position backupPosition;
|
||||||
|
private Position currentPosition;
|
||||||
|
|
||||||
|
|
||||||
|
public Robot (int playerId, Position spawnPosition){
|
||||||
|
this.playerId=playerId;
|
||||||
|
this.backupPosition = spawnPosition;
|
||||||
|
this.currentPosition = spawnPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getDamage(){
|
||||||
|
return robotDamageTaken;
|
||||||
|
}
|
||||||
|
public void setDamage (int damage){
|
||||||
|
this.robotDamageTaken = damage;
|
||||||
|
}
|
||||||
|
public Position getPosition(){
|
||||||
|
return currentPosition;
|
||||||
|
}
|
||||||
|
public void setPosition( Position newPosition ){
|
||||||
|
this.currentPosition = newPosition;
|
||||||
|
}
|
||||||
|
public void setPowerDown(Boolean powerDownStatus){
|
||||||
|
this.inPowerDown = powerDownStatus;
|
||||||
|
}
|
||||||
|
public Boolean isInPowerDown(){
|
||||||
|
return inPowerDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
22
src/test/java/inf112/fiasko/roborally/RobotTest.java
Normal file
22
src/test/java/inf112/fiasko/roborally/RobotTest.java
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package inf112.fiasko.roborally;
|
||||||
|
|
||||||
|
import inf112.fiasko.roborally.element_properties.Position;
|
||||||
|
import inf112.fiasko.roborally.element_properties.Robot;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class RobotTest {
|
||||||
|
@Test
|
||||||
|
public void testRobotGetDamageOnInitializedRobot(){
|
||||||
|
Position robotPosition = new Position(3,6);
|
||||||
|
Robot testRobotGetDamage = new Robot(6, robotPosition);
|
||||||
|
assertEquals(0, testRobotGetDamage.getDamage());
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testRobotSetDamage(){
|
||||||
|
Position robotPosition = new Position(3,6);
|
||||||
|
Robot testRobotSetDamage = new Robot(6, robotPosition);
|
||||||
|
testRobotSetDamage.setDamage(2);
|
||||||
|
assertEquals(2, testRobotSetDamage.getDamage());
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,7 @@ import inf112.fiasko.roborally.element_properties.WallType;
|
|||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestWall {
|
public class WallTest {
|
||||||
@Test
|
@Test
|
||||||
public void testWallGetWallTypeNormal(){
|
public void testWallGetWallTypeNormal(){
|
||||||
Wall testGetWall = new Wall(WallType.WALL_NORMAL, Direction.NORTH);
|
Wall testGetWall = new Wall(WallType.WALL_NORMAL, Direction.NORTH);
|
Loading…
x
Reference in New Issue
Block a user