Merge branch 'master' of gitlab.principis.be:OGP/worms
This commit is contained in:
@@ -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());
|
||||||
|
Reference in New Issue
Block a user