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