Fredagsoppdatering
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user