Documentatie Bazooka
This commit is contained in:
@@ -8,10 +8,26 @@ import static java.lang.Math.cos;
|
||||
import static java.lang.Math.sin;
|
||||
|
||||
public class Bazooka extends Projectile {
|
||||
/**
|
||||
* @param worm
|
||||
*
|
||||
* @post ...
|
||||
* |worm == worm
|
||||
* @post ...
|
||||
* |new.getMass() == 300
|
||||
* @post ...
|
||||
* |new.getForce() == calcForce(worm.getActionPoints())
|
||||
*/
|
||||
protected Bazooka(Worm worm) {
|
||||
super(worm, 300, calcForce(worm.getActionPoints()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ...
|
||||
* |int nb =ThreadLocalRandom.current().nextInt(15) / 2
|
||||
* |nb += (nb % 2 == 0 ? 1:0)
|
||||
* |result == nb
|
||||
*/
|
||||
@Override
|
||||
protected int getRandomHitPoints() {
|
||||
int nb =ThreadLocalRandom.current().nextInt(15) / 2;
|
||||
@@ -19,11 +35,29 @@ public class Bazooka extends Projectile {
|
||||
return nb;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ...
|
||||
* |result == this.hitPoints * (int) this.force
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected int getImpactHitPoints() {
|
||||
return this.hitPoints * (int) this.force;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value
|
||||
*
|
||||
* @post ...
|
||||
* |if (value > 7)
|
||||
* | value = 7
|
||||
* |else if (value % 2 != 1)
|
||||
* | if (value == 0)
|
||||
* | value++
|
||||
* | else
|
||||
* | value--
|
||||
* |super.hitPoints = value
|
||||
*/
|
||||
@Override
|
||||
protected void setHitPoints(int value) {
|
||||
if (value > 7) value = 7;
|
||||
@@ -34,9 +68,17 @@ public class Bazooka extends Projectile {
|
||||
super.hitPoints = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param actionPoints
|
||||
*
|
||||
* @return ...
|
||||
* |double hp = 2.5 + actionPoints % 8.0
|
||||
* |if (hp > 9.5
|
||||
* | result == 9.5
|
||||
* |result == hp
|
||||
*/
|
||||
public static double calcForce(double actionPoints) {
|
||||
double hp = 2.5 +
|
||||
actionPoints % 8.0;
|
||||
double hp = 2.5 + actionPoints % 8.0;
|
||||
if (hp > 9.5) return 9.5;
|
||||
return hp;
|
||||
}
|
||||
|
Reference in New Issue
Block a user