More work on vaults

This commit is contained in:
simon
2018-03-01 10:42:24 -05:00
parent 039088ac00
commit 0ada6c29d4
9 changed files with 154 additions and 28 deletions

View File

@@ -72,18 +72,22 @@ public class CubotLaser extends CpuHardware {
// TODO
} else if (a == LASER_ATTACK) {
if (cubot.spendEnergy(70)) {
//Get object directly in front of the Cubot
Point frontTile = cubot.getFrontTile();
ArrayList<GameObject> objects = cubot.getWorld().getGameObjectsAt(frontTile.x, frontTile.y);
if (cubot.getCurrentAction() == Action.IDLE) {
if (cubot.spendEnergy(70)) {
//Get object directly in front of the Cubot
Point frontTile = cubot.getFrontTile();
ArrayList<GameObject> objects = cubot.getWorld().getGameObjectsAt(frontTile.x, frontTile.y);
//todo: Add option in config to allow PvP
if (objects.size() > 0 && objects.get(0) instanceof Attackable && !(objects.get(0) instanceof Cubot)) {
((Attackable) objects.get(0)).damage(LASER_DAMAGE);
}
if (objects.size() > 0 && objects.get(0) instanceof Attackable) {
((Attackable) objects.get(0)).damage(LASER_DAMAGE);
}
cubot.setCurrentAction(Action.ATTACKING);
}
}
}