Documentatie Rifle
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user