Fredagsoppdatering

This commit is contained in:
2018-03-09 21:29:56 +01:00
parent 0b143037de
commit 5ec539fda2
3 changed files with 44 additions and 15 deletions

View File

@@ -376,7 +376,21 @@ public class Game implements IGame {
@Override
public List<ILocation> getVisible() {
return map.getNeighbourhood(currentLocation, currentActor.getVision());
List<ILocation> neighbours = map.getNeighbourhood(currentLocation, currentActor.getVision());
List<ILocation> valid = new ArrayList<>();
for (ILocation neighbour : neighbours) {
boolean blocked = false;
for (ILocation tile : currentLocation.gridLineTo(neighbour)) {
if (map.hasWall(tile)) {
blocked = true;
break;
}
}
if (!blocked) {
valid.add(neighbour);
}
}
return valid;
}
@Override