use of main.game.bf.Coordinates.DIRECTION in project Eidolons by IDemiurge.
the class CoordinateTargeting method select.
public boolean select(Ref ref) {
DC_Obj obj = (DC_Obj) ref.getObj(key);
DIRECTION used_direction = direction;
if (unitDirection != null) {
Unit unit = (Unit) obj;
used_direction = DirectionMaster.getDirectionByFacing(unit.getFacing(), unitDirection);
}
Coordinates coordinate = obj.getCoordinates().getAdjacentCoordinate(used_direction);
List<BattleFieldObject> objects = obj.getGame().getMaster().getObjectsOnCoordinate(coordinate, false);
if (objects.size() == 0) {
ref.setTarget(obj.getGame().getCellByCoordinate(coordinate).getId());
} else if (objects.size() == 1) {
ref.setTarget(objects.get(0).getId());
} else {
ref.setGroup(new GroupImpl(new ArrayList<>(objects)));
}
return true;
}
use of main.game.bf.Coordinates.DIRECTION in project Eidolons by IDemiurge.
the class ShadeLightCell method adjustPosition.
public void adjustPosition(int x, int y) {
float offsetX = 0;
float offsetY = 0;
setScale(1f, 1f);
setVisible(true);
for (Obj sub : DC_Game.game.getRules().getIlluminationRule().getEffectCache().keySet()) {
if (sub instanceof Unit)
// TODO illuminate some other way for units...
continue;
if (sub instanceof Structure) {
if (sub.getCoordinates().x == x)
if (sub.getCoordinates().y == y)
if (((Structure) sub).isOverlaying()) {
DIRECTION d = ((Structure) sub).getDirection();
if (d == null) {
setScale(0.7f, 0.7f);
continue;
}
setScale(d.growX == null ? 1 : 0.8f, d.growY == null ? 1 : 0.8f);
Dimension dim = GridMaster.getOffsetsForOverlaying(d, (int) getWidth() - 64, (int) getHeight() - 64);
offsetX += dim.width;
offsetY += dim.height;
// so if 2+ overlays, will be centered between them...
} else {
BaseView view = DungeonScreen.getInstance().getGridPanel().getViewMap().get(sub);
offsetX += view.getX() * 3;
offsetY += view.getY() * 3;
if (view.getParent() instanceof GridCellContainer) {
if ((((GridCellContainer) view.getParent()).getUnitViews(true).size() > 1)) {
if (!view.isHovered())
setVisible(false);
}
}
}
}
}
setPosition(originalX + offsetX / 3, originalY + offsetY / 3);
}
Aggregations