Documentatie Food

This commit is contained in:
Leen Dereu
2018-05-23 15:33:36 +02:00
parent 38446cabb6
commit 0fbf371d79

View File

@@ -5,7 +5,6 @@ import worms.util.Coordinate;
public class Food extends GameObject {
/**
*
* @param world
* @param location
*
@@ -26,21 +25,40 @@ public class Food extends GameObject {
}
/**
* @return ...
* |result == this.poisonous
*/
public boolean isPoisonous() {
return this.poisonous;
}
/**
* @post ...
* |poisonous == true
*/
public void poison() {
this.poisonous = true;
}
/**
* @post ...
* |poisonous == false
*/
public void heal() {
this.poisonous = false;
}
private boolean poisonous = false;
/**
* @param location
*
* @return ...
* |if (getWorld() != null
* | result == super.isValidLocation(location) && getWorld().isAdjacent(location, getRadius())
* |result == super.isValidLocation(location)
*/
@Override
protected boolean isValidLocation(Coordinate location) {
if (getWorld() != null) return super.isValidLocation(location) && getWorld().isAdjacent(location, getRadius());