diff --git a/src/main/java/inf112/fiasko/roborally/element_properties/Robot.java b/src/main/java/inf112/fiasko/roborally/element_properties/Robot.java new file mode 100644 index 0000000..377c989 --- /dev/null +++ b/src/main/java/inf112/fiasko/roborally/element_properties/Robot.java @@ -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; + } + +} diff --git a/src/test/java/inf112/fiasko/roborally/RobotTest.java b/src/test/java/inf112/fiasko/roborally/RobotTest.java new file mode 100644 index 0000000..cb7cb7f --- /dev/null +++ b/src/test/java/inf112/fiasko/roborally/RobotTest.java @@ -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()); + } +} diff --git a/src/test/java/inf112/fiasko/roborally/TestWall.java b/src/test/java/inf112/fiasko/roborally/WallTest.java similarity index 98% rename from src/test/java/inf112/fiasko/roborally/TestWall.java rename to src/test/java/inf112/fiasko/roborally/WallTest.java index c94ec6a..b1f1854 100644 --- a/src/test/java/inf112/fiasko/roborally/TestWall.java +++ b/src/test/java/inf112/fiasko/roborally/WallTest.java @@ -6,7 +6,7 @@ import inf112.fiasko.roborally.element_properties.WallType; import static org.junit.Assert.assertEquals; import org.junit.Test; -public class TestWall { +public class WallTest { @Test public void testWallGetWallTypeNormal(){ Wall testGetWall = new Wall(WallType.WALL_NORMAL, Direction.NORTH);