From 9f8a250f71bfe92a1aa063d7e96f811157f3e528 Mon Sep 17 00:00:00 2001 From: Leen Dereu Date: Wed, 23 May 2018 22:22:16 +0200 Subject: [PATCH] Documentatie Rifle --- OGP1718-Worms/src/worms/model/Rifle.java | 29 +++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/OGP1718-Worms/src/worms/model/Rifle.java b/OGP1718-Worms/src/worms/model/Rifle.java index c20cdef..ebde28d 100644 --- a/OGP1718-Worms/src/worms/model/Rifle.java +++ b/OGP1718-Worms/src/worms/model/Rifle.java @@ -9,25 +9,52 @@ import static java.lang.Math.sin; public class Rifle extends Projectile { + /** + * @param worm + * + * @post ... + * |worm == worm + * @post ... + * |new.getMass() == 10 + * @post ... + * |new.getForce() == 1.5 + */ public Rifle(Worm worm) { super(worm, 10, 1.5); } + /** + * @return ... + * |result == ThreadLocalRandom.current().nextInt(1,6) * 2 + */ @Override protected int getRandomHitPoints() { return ThreadLocalRandom.current().nextInt(1,6) * 2; } + /** + * @return ... + * |result == this.hitPoints + */ @Override protected int getImpactHitPoints() { return this.hitPoints; } + /** + * @param value + * + * @post ... + * |if (value > 10) + * | value = 10 + * |else if (value % 2 != 0) + * | value-- + * |super.hitPoints = value + */ @Override protected void setHitPoints(int value) { if (value > 10) value = 10; else if (value % 2 != 0) value--; super.hitPoints = value; } - }