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