use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class CoordinatesMaster method getZoneCoordinates.
public static Set<Coordinates> getZoneCoordinates(DC_ActiveObj entity) {
Effect effect = EffectFinder.getFirstEffectOfClass(entity, SpecialTargetingEffect.class);
Set<Coordinates> coordinates = null;
if (effect != null) {
SpecialTargetingEffect targetEffect = (SpecialTargetingEffect) effect;
coordinates = targetEffect.getCoordinates();
}
return coordinates;
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class CoordinatesMaster method getAdjacentToSquare.
public static List<Coordinates> getAdjacentToSquare(List<Coordinates> coordinates) {
List<Coordinates> list = new ArrayList<>();
int x1 = getMinX(coordinates);
int x2 = getMaxX(coordinates);
int y1 = getMinY(coordinates);
int y2 = getMaxY(coordinates);
for (int x = x1 - 1; x < x2 + 1; x++) {
Coordinates c = new Coordinates(x, y1 - 1);
if (!c.isInvalid()) {
list.add(c);
}
Coordinates e = new Coordinates(x, y2 + 1);
if (!e.isInvalid()) {
list.add(e);
}
}
for (int y = y1 - 2; y < y2; y++) {
Coordinates e = new Coordinates(x1 - 1, y);
if (!e.isInvalid()) {
list.add(e);
}
Coordinates e2 = new Coordinates(x2 + 1, y);
if (!e2.isInvalid()) {
list.add(e2);
}
}
return list;
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class CoordinatesMaster method getCoordinatesStringData.
public static String getCoordinatesStringData(Collection<Coordinates> coordinates) {
int x1 = getMinX(coordinates);
int x2 = getMaxX(coordinates);
int y1 = getMinY(coordinates);
int y2 = getMaxY(coordinates);
List<Coordinates> exceptions = new ArrayList<>();
for (Coordinates c : getCoordinatesWithin(x1, x2, y1, y2)) {
exceptions.add(c);
}
return getBoundsString(x1, x2, y1, y2) + " " + exceptions.toString();
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class CoordinatesMaster method getAdjacentToBothGroups.
public static List<Coordinates> getAdjacentToBothGroups(Collection<Coordinates> coordinatesPool, Collection<Coordinates> coordinates, Collection<Coordinates> coordinates2) {
List<Coordinates> list = new ArrayList<>();
Set<Coordinates> adjacent1 = new HashSet<>();
for (Coordinates c : coordinatesPool) {
for (Coordinates c1 : coordinates) {
if (c.isAdjacent(c1)) {
adjacent1.add(c1);
}
}
}
loop: for (Coordinates c : adjacent1) {
for (Coordinates c2 : coordinates2) {
if (c.isAdjacent(c2)) {
list.add(c);
continue loop;
}
}
}
return list;
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class DC_BattleFieldManager method resetWalls.
public void resetWalls() {
doorMap.clear();
Map<Coordinates, BattleFieldObject> wallObjects = new HashMap<>();
for (Obj obj : game.getObjects(DC_TYPE.BF_OBJ)) {
BattleFieldObject bfObj = (BattleFieldObject) obj;
if (bfObj.getZ() == game.getDungeon().getZ()) {
if (bfObj.isWall()) {
wallObjects.put(obj.getCoordinates(), bfObj);
}
if (bfObj instanceof Door) {
doorMap.put(obj.getCoordinates(), ((Door) bfObj).getState());
}
}
}
if (wallMap == null) {
wallMap = new HashMap<>();
}
wallMap.clear();
ArrayList<Coordinates> coordinates = new ArrayList<>(wallObjects.keySet());
for (Coordinates coordinate : coordinates) {
BattleFieldObject wall = wallObjects.get(coordinate);
if (wall.isDead()) {
continue;
}
List<DIRECTION> list = new ArrayList<>();
for (Coordinates c : coordinate.getAdjacent(false)) {
BattleFieldObject adjWall = wallObjects.get(c);
if (adjWall != null) {
if (adjWall.isWall() && !adjWall.isDead()) {
DIRECTION side = DirectionMaster.getRelativeDirection(coordinate, c);
list.add(side);
}
}
}
adjacent: for (Coordinates c : coordinate.getAdjacent(true)) {
BattleFieldObject adjWall = wallObjects.get(c);
if (adjWall != null) {
if (adjWall.isWall() && !adjWall.isDead()) {
DIRECTION side = DirectionMaster.getRelativeDirection(coordinate, c);
if (!side.isDiagonal()) {
continue;
}
for (DIRECTION s : list) {
if (s.isDiagonal()) {
continue;
}
if (side.getXDirection() == s) {
continue adjacent;
}
if (side.getYDirection() == s) {
continue adjacent;
}
}
list.add(side);
}
}
}
if (!list.isEmpty()) {
if (coordinate == null)
continue;
wallMap.put(coordinate, list);
}
}
if (diagonalJoints == null) {
diagonalJoints = new HashMap<>();
}
diagonalJoints.clear();
loop: for (Coordinates c : wallMap.keySet()) {
for (DIRECTION s : wallMap.get(c)) {
if (s.isDiagonal()) {
// for (Coordinates c :
// o.getCoordinates().getAdjacentCoordinates(null)) {
// if (wallObjects.get(c) != null) {
// if (containsAdjacentDiagonal in X direction
// }
// }
List<DIRECTION> list = diagonalJoints.get(c);
if (list == null) {
list = new ArrayList<>();
}
diagonalJoints.put(c, list);
if (list.size() == 1) {
DIRECTION d = list.get(0);
if (s.growX)
if (!d.growX)
continue;
else if (d.growX)
continue;
if (s.growY)
if (!d.growY)
continue;
else if (d.growY)
continue;
}
list.add(s);
continue loop;
}
}
}
wallResetRequired = false;
}
Aggregations