use of main.game.bf.Coordinates.DIRECTION in project Eidolons by IDemiurge.
the class DrawMaster method drawOverlayingObjects.
private void drawOverlayingObjects(Graphics g, CellComp cellComp) {
for (Unit obj : cellComp.getOverlayingObjects()) {
if (!isEditorMode()) {
if (cellComp.getGame().getVisionMaster().getVisibilityMaster().isZeroVisibility(obj)) {
continue;
}
}
DIRECTION d = obj.getDirection();
// if (CoreEngine.isLevelEditor()) {
if (d == null) {
// Map<Unit, DIRECTION> map = obj.getGame().getDirectionMap().get(
// cellComp.getCoordinates());
// if (map != null) {
// d = map.get(obj);
// }
// }
}
int size = overlayingSize;
int x = MigMaster.getCenteredPosition(getObjCompWidth(), size);
if (d != null) {
if (d.growX == null) {
x = MigMaster.getCenteredPosition(getObjCompWidth(), size);
} else {
x = (d.growX) ? getObjCompWidth() - size : 0;
}
}
int y = MigMaster.getCenteredPosition(getObjCompHeight(), size);
if (d != null) {
if (d.growY == null) {
y = MigMaster.getCenteredPosition(getObjCompHeight(), size);
} else {
y = (d.growY) ? getObjCompHeight() - size : 0;
}
}
drawOverlayingObj(g, cellComp, obj, x, y, size);
// }
// NESW
}
}
use of main.game.bf.Coordinates.DIRECTION in project Eidolons by IDemiurge.
the class DrawMaster method drawWallOverlays.
private void drawWallOverlays(Unit obj, Graphics g, Coordinates coordinates) {
if (cellComp.getGame().getVisionMaster().getVisibilityMaster().isZeroVisibility(obj)) {
if (obj.getActivePlayerVisionStatus() == PLAYER_VISION.UNKNOWN) {
return;
}
}
// .getCoordinates()
List<DIRECTION> list = obj.getGame().getBattleFieldManager().getWallMap().get(coordinates);
boolean hasVertical = false;
boolean hasHorizontal = false;
boolean hasDiagonal = false;
boolean drawCorner = true;
boolean diagonalCorner = false;
boolean round = false;
boolean diamond = false;
boolean mesh = false;
boolean darken = obj.getVisibilityLevel() != VISIBILITY_LEVEL.CLEAR_SIGHT;
String prefix = darken ? "dark" : "";
if (list == null) {
diamond = true;
} else {
for (DIRECTION side : list) {
Image image = getWallImageFromSide(side, prefix);
if (side.isDiagonal()) {
if (list.size() == 1) {
round = true;
}
drawCorner = true;
if (// doens't do anything?
diagonalCorner) {
diagonalCorner = false;
} else if (hasDiagonal) {
diagonalCorner = true;
} else {
hasDiagonal = true;
}
} else {
if (list.size() > 1) {
mesh = true;
}
if (side.isVertical()) {
if (hasVertical) {
drawCorner = false;
}
hasVertical = true;
} else {
if (hasHorizontal) {
drawCorner = false;
}
hasHorizontal = true;
}
}
if (zoom != 100) {
image = ImageManager.getSizedVersion(image, zoom);
}
drawImage(g, image, 0, 0);
}
}
if (hasHorizontal && hasVertical) {
drawCorner = true;
}
if (diagonalCorner) {
drawCorner = false;
Boolean x = null;
Boolean y = null;
boolean vertical = false;
for (DIRECTION side : list) {
if (!side.isDiagonal()) {
drawCorner = true;
mesh = true;
} else {
if (y != null) {
if (y == side.growY) {
vertical = true;
break;
} else {
if (x == side.growX) {
break;
}
return;
}
}
y = side.growY;
x = side.growX;
}
}
// return;
if (!mesh) {
Image image = STD_IMAGES.WALL_CORNER_ALMOND_H.getImage();
if (vertical) {
image = STD_IMAGES.WALL_CORNER_ALMOND_V.getImage();
}
if (zoom != 100) {
image = ImageManager.getSizedVersion(image, zoom);
}
drawImageCentered(g, image);
}
}
if (drawCorner) {
Image image = STD_IMAGES.WALL_CORNER.getPathPrefixedImage(prefix);
if (diamond) {
image = STD_IMAGES.WALL_CORNER_DIAMOND.getPathPrefixedImage(prefix);
} else if (mesh && hasDiagonal) {
image = STD_IMAGES.WALL_CORNER_MESH.getPathPrefixedImage(prefix);
} else if (round) {
image = STD_IMAGES.WALL_CORNER_ROUND.getPathPrefixedImage(prefix);
}
if (zoom != 100) {
image = ImageManager.getSizedVersion(image, zoom);
}
drawImageCentered(g, image);
}
}
use of main.game.bf.Coordinates.DIRECTION in project Eidolons by IDemiurge.
the class PhaseAnimation method initStackedDrawing.
public void initStackedDrawing() {
stackDrawingOn = true;
DIRECTION d1 = DIRECTION.DOWN_RIGHT;
DIRECTION d2 = DIRECTION.UP_LEFT;
// zoom = zoom * factor;
// consider multiple?
Point p1 = GeometryMaster.getFarthestPointInRectangleForImage(w, h, getStackedImageSize(), getStackedImageSize(), d1);
Point p2 = GeometryMaster.getFarthestPointInRectangleForImage(w, h, getStackedImageSize(), getStackedImageSize(), d2);
// int maxDisplacement;
int xOffset = 32;
int yOffset = 32;
offsetSourceX = p1.x + xOffset;
offsetSourceY = p1.y + yOffset;
offsetTargetX = p2.x - xOffset;
offsetTargetY = p2.y - yOffset;
offsetGenericsX = xOffset;
offsetGenericsY = yOffset * 3;
staticPhaseOffsetY += -yOffset * 2;
}
use of main.game.bf.Coordinates.DIRECTION in project Eidolons by IDemiurge.
the class HitAnim method getAction.
@Override
protected Action getAction() {
if (!OptionsMaster.getAnimOptions().getBooleanValue(ANIMATION_OPTION.HIT_ANIM_DISPLACEMENT))
return null;
if (getRef() == null)
return null;
if (getRef().getSourceObj() == null)
return null;
if (getRef().getTargetObj() == null)
return null;
DIRECTION d = DirectionMaster.getRelativeDirection(getRef().getSourceObj(), getRef().getTargetObj());
int dx = d.isVertical() ? 5 : 30;
int dy = !d.isVertical() ? 5 : 30;
if (BooleanMaster.isFalse(d.growX)) {
dx = -dx;
}
if (BooleanMaster.isTrue(d.growY)) {
dy = -dy;
}
originalActorX = getActor().getX();
originalActorY = getActor().getY();
float x = originalActorX;
float y = originalActorY;
MoveByAction move = (MoveByAction) ActorMaster.getAction(MoveByAction.class);
move.setAmount(dx, dy);
move.setDuration(getDuration() / 2);
MoveToAction moveBack = (MoveToAction) ActorMaster.getAction(MoveToAction.class);
if (getRef().getSourceObj() instanceof DC_Obj) {
if (((DC_Obj) getRef().getSourceObj()).isOverlaying()) {
moveBack.setPosition(x, y);
}
}
moveBack.setPosition(x, y);
moveBack.setDuration(getDuration() / 2);
SequenceAction sequence = new SequenceAction(move, moveBack);
if (isDelayed()) {
DelayAction delayed = new DelayAction(getDuration() / 3);
delayed.setAction(sequence);
return delayed;
}
return sequence;
}
use of main.game.bf.Coordinates.DIRECTION in project Eidolons by IDemiurge.
the class CleaveRule method initNextTarget.
private void initNextTarget() {
boolean first = false;
if (clockwise == null) {
// find targets TODO
first = true;
}
// preCheck facing! always try the longest arc first, if
clockwise = true;
// it fails, then short one
DIRECTION direction = DirectionMaster.getRelativeDirection(source, currentTarget);
Obj objectByCoordinate = game.getObjectByCoordinate(source.getCoordinates().getAdjacentCoordinate(DirectionMaster.rotate45(direction, clockwise)), true);
if (objectByCoordinate instanceof Unit) {
currentTarget = (Unit) objectByCoordinate;
} else if (first) {
clockwise = false;
objectByCoordinate = game.getObjectByCoordinate(source.getCoordinates().getAdjacentCoordinate(DirectionMaster.rotate45(direction, clockwise)), true);
if (objectByCoordinate != null) {
currentTarget = (Unit) objectByCoordinate;
}
}
}
Aggregations