From 6d56d86e743dee867e112f2b9591a0a35da06d09 Mon Sep 17 00:00:00 2001 From: Leen Dereu Date: Sun, 8 Apr 2018 14:30:41 +0200 Subject: [PATCH] Documentatie nieuwe methodes --- OGP1718-Worms/src/worms/model/Worm.java | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/OGP1718-Worms/src/worms/model/Worm.java b/OGP1718-Worms/src/worms/model/Worm.java index 277c276..9cdee2e 100644 --- a/OGP1718-Worms/src/worms/model/Worm.java +++ b/OGP1718-Worms/src/worms/model/Worm.java @@ -86,6 +86,7 @@ public class Worm extends GameObject { * |new.getRadius() == radius * @post the new minimum radius of the worm is equal to the given minimum radius * |new.getMinRadius() == minRadius + * @post actionpoints en hitpoints * @throws IllegalArgumentException * the given location is not a valid location for a worm * |!isValidLocation(location) @@ -521,6 +522,10 @@ public class Worm extends GameObject { subtractActionPoints(cost); } + /** + * + * @return + */ public Coordinate getFurthestLocationInDirection() { return null; } @@ -737,11 +742,27 @@ public class Worm extends GameObject { // region hitPoints //=================================================================================== + /** + * Return the current hit points of the worm + * the hit points identifies the strength of the worm + */ @Basic @Raw public long getHitPoints() { return this.hitPoints; } + /** + * set the current hit points of the worm to the given points + * + * @param hitPoints + * the new points for the worm + * @post if the given points are equal or lower then zero, the worm should be dead. + * Otherwise the current hit points are set to the given points. + * |if (hitpoints <= 0) + * | terminate(); + * |else + * | new.getHitPoints() == hitpoints + */ @Raw private void setHitPoints(long hitPoints) { if (hitPoints <= 0) @@ -749,8 +770,19 @@ public class Worm extends GameObject { this.hitPoints = hitPoints; } + /** + * this variable contains the current hitpoints of the worm + */ private long hitPoints; + /** + * increment the hit points with the given value + * + * @param value + * the value that should be substracted + * @post the current hit points should be substracted with the given value. + * |new.getHitPoints() == old.getHitPoints() - value + */ public void incrementHitPoints(long value) { setHitPoints(getHitPoints() - value); }