update
This commit is contained in:
@@ -33,6 +33,19 @@ public class Program {
|
|||||||
proc.forEach(p -> procMap.put(p.getName(), p.getBody()));
|
proc.forEach(p -> procMap.put(p.getName(), p.getBody()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Worm getWorm() {
|
||||||
|
return this.worm;
|
||||||
|
}
|
||||||
|
public Map<String, Object> getVariables() {
|
||||||
|
return this.varMap;
|
||||||
|
}
|
||||||
|
protected void setWorm(Worm worm) {
|
||||||
|
this.worm = worm;
|
||||||
|
}
|
||||||
|
protected void setActionHandler(IActionHandler actionHandler) {
|
||||||
|
this.actionHandler = actionHandler;
|
||||||
|
}
|
||||||
|
|
||||||
protected void execute() {
|
protected void execute() {
|
||||||
|
|
||||||
enoughAP = true;
|
enoughAP = true;
|
||||||
@@ -226,21 +239,10 @@ public class Program {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setActionHandler(IActionHandler actionHandler) {
|
|
||||||
this.actionHandler = actionHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Worm getWorm() {
|
|
||||||
return this.worm;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setWorm(Worm worm) {
|
|
||||||
this.worm = worm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Object> getVariables() {
|
|
||||||
return this.varMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class CallStackNode {
|
private class CallStackNode {
|
||||||
private Iterator<Statement> statementIterator;
|
private Iterator<Statement> statementIterator;
|
||||||
|
@@ -59,7 +59,7 @@ public abstract class Projectile extends GameObject implements IJumpable {
|
|||||||
* |result == orientation
|
* |result == orientation
|
||||||
*/
|
*/
|
||||||
public double getOrientation() {
|
public double getOrientation() {
|
||||||
return orientation;
|
return this.orientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final double orientation;
|
private final double orientation;
|
||||||
@@ -159,7 +159,6 @@ public abstract class Projectile extends GameObject implements IJumpable {
|
|||||||
* | List<Worm> worms = getWorld().getGameObjectsByClass(Worm.class)
|
* | List<Worm> worms = getWorld().getGameObjectsByClass(Worm.class)
|
||||||
* |for (Worm worm: worms)
|
* |for (Worm worm: worms)
|
||||||
* | if (this.getDistance(worm) < 0)
|
* | if (this.getDistance(worm) < 0)
|
||||||
* | setLocation(newLocation)
|
|
||||||
* | hit(worm)
|
* | hit(worm)
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException ...
|
* @throws IllegalStateException ...
|
||||||
@@ -189,7 +188,6 @@ public abstract class Projectile extends GameObject implements IJumpable {
|
|||||||
|
|
||||||
for (Worm worm: worms) {
|
for (Worm worm: worms) {
|
||||||
if (this.getDistance(worm) < 0) {
|
if (this.getDistance(worm) < 0) {
|
||||||
setLocation(newLocation);
|
|
||||||
hit(worm);
|
hit(worm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,7 +271,7 @@ public abstract class Projectile extends GameObject implements IJumpable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ...
|
* @return ...
|
||||||
* result == getOrientation() < PI
|
* |result == getOrientation() < PI
|
||||||
*/
|
*/
|
||||||
private boolean canJump() {
|
private boolean canJump() {
|
||||||
return getOrientation() < PI;
|
return getOrientation() < PI;
|
||||||
|
@@ -497,7 +497,6 @@ public class World {
|
|||||||
* @return ...
|
* @return ...
|
||||||
* |result == getGameObjectsByClass(Worm.class)
|
* |result == getGameObjectsByClass(Worm.class)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public List<Worm> getWormList() {
|
public List<Worm> getWormList() {
|
||||||
|
|
||||||
return getGameObjectsByClass(Worm.class);
|
return getGameObjectsByClass(Worm.class);
|
||||||
@@ -507,7 +506,6 @@ public class World {
|
|||||||
* @return ...
|
* @return ...
|
||||||
* |result == getGameObjectsByClass(Food.class)
|
* |result == getGameObjectsByClass(Food.class)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public List<Food> getFoodList() {
|
public List<Food> getFoodList() {
|
||||||
|
|
||||||
return getGameObjectsByClass(Food.class);
|
return getGameObjectsByClass(Food.class);
|
||||||
|
@@ -804,6 +804,7 @@ public class Worm extends GameObject implements IJumpable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* TODO FIXME
|
||||||
* Decreases the hit points of the attacked worm (chosen by a coin).
|
* Decreases the hit points of the attacked worm (chosen by a coin).
|
||||||
*
|
*
|
||||||
* @param newLocation The new location of the jumped worm.
|
* @param newLocation The new location of the jumped worm.
|
||||||
|
@@ -24,19 +24,6 @@ public class ProgramFactory implements IProgramFactory<Expression, Statement, Pr
|
|||||||
return new Program(procs, main);
|
return new Program(procs, main);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO checken of dit moet
|
|
||||||
// /**
|
|
||||||
// * Create a program from the given argument.
|
|
||||||
// *
|
|
||||||
// * @param main The main statement of the program. Most likely this is a
|
|
||||||
// * sequence statement.
|
|
||||||
// * @return A new program without procedure definitions.
|
|
||||||
// */
|
|
||||||
// @Override
|
|
||||||
// public Object createProgram(Object main) throws ModelException {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a procedure definition with the given name and body.
|
* Create a procedure definition with the given name and body.
|
||||||
*
|
*
|
||||||
|
@@ -35,7 +35,7 @@ public class Tuple<T1, T2> {
|
|||||||
* @throws IllegalArgumentException ...
|
* @throws IllegalArgumentException ...
|
||||||
* |
|
* |
|
||||||
*/
|
*/
|
||||||
public Tuple(T1 item1, T2 item2) throws IllegalArgumentException {
|
public Tuple(T1 item1, T2 item2) {
|
||||||
|
|
||||||
this.item1 = item1;
|
this.item1 = item1;
|
||||||
this.item2 = item2;
|
this.item2 = item2;
|
||||||
|
Reference in New Issue
Block a user