Search in sources :

Example 71 with Coordinates

use of main.game.bf.Coordinates in project Eidolons by IDemiurge.

the class GridCellContainer method init.

@Override
public GridCellContainer init() {
    super.init();
    graveyard = new GraveyardView();
    addActor(graveyard);
    graveyard.setWidth(getWidth());
    graveyard.setHeight(getHeight());
    setUserObject(new GridCellDataSource(new Coordinates(getGridX(), getGridY())));
    return this;
}
Also used : GridCellDataSource(eidolons.libgdx.bf.datasource.GridCellDataSource) Coordinates(main.game.bf.Coordinates)

Example 72 with Coordinates

use of main.game.bf.Coordinates in project Eidolons by IDemiurge.

the class PositionMaster method getClosestCoordinate.

public static Coordinates getClosestCoordinate(Coordinates source_coordinates, List<Obj> objects) {
    int distance = Integer.MAX_VALUE;
    Coordinates coordinates = null;
    for (Obj obj : objects) {
        if (distance > getDistance(source_coordinates, obj.getCoordinates())) {
            distance = getDistance(source_coordinates, obj.getCoordinates());
            coordinates = obj.getCoordinates();
        }
    }
    return coordinates;
}
Also used : MicroObj(main.entity.obj.MicroObj) Obj(main.entity.obj.Obj) Coordinates(main.game.bf.Coordinates)

Example 73 with Coordinates

use of main.game.bf.Coordinates in project Eidolons by IDemiurge.

the class DefaultActionHandler method leftClickCell.

public static boolean leftClickCell(boolean turn, boolean moveTo, int gridX, int gridY) {
    Unit source = null;
    try {
        source = Eidolons.getGame().getManager().getActiveObj();
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    if (source == null)
        return false;
    if (source.isAiControlled())
        return false;
    Coordinates c = new Coordinates(gridX, gridY);
    if (turn) {
        return turnToMotion(source, c);
    }
    if (moveTo) {
        return moveToMotion(source, c);
    }
    if (source.getGame().isDebugMode()) {
        return doDebugStuffCell(source, c);
    }
    if (c.x - source.getX() > 1) {
        return false;
    }
    if (c.y - source.getY() > 1) {
        return false;
    }
    DC_UnitAction action = getMoveToCellAction(source, c);
    if (action == null) {
        return false;
    }
    Obj target = action.getTargeting() instanceof SelectiveTargeting ? Eidolons.getGame().getCellByCoordinate(c) : null;
    Context context = new Context(source, target);
    return activate(context, action);
}
Also used : SelectiveTargeting(main.elements.targeting.SelectiveTargeting) Context(main.game.logic.action.context.Context) DungeonObj(eidolons.game.module.dungeoncrawl.objects.DungeonObj) DC_Obj(eidolons.entity.obj.DC_Obj) Obj(main.entity.obj.Obj) Coordinates(main.game.bf.Coordinates) Unit(eidolons.entity.obj.unit.Unit)

Example 74 with Coordinates

use of main.game.bf.Coordinates in project Eidolons by IDemiurge.

the class MiniGrid method getCompByPoint.

public MiniObjComp getCompByPoint(Point p) {
    int x = p.x / getCellWidth();
    int y = p.y / getCellWidth();
    Coordinates coordinates = new Coordinates(true, x, y);
    // preCheck overlaying!
    for (MiniObjComp o : overlayingObjComps) {
        // if (!o.getCoordinates().eq)
        // continue; TODO
        ((Unit) o.getObj()).getDirection();
        o.getCellSize();
        getOverlayingObjWidth();
    }
    return compMap.get(coordinates);
}
Also used : Coordinates(main.game.bf.Coordinates) Unit(eidolons.entity.obj.unit.Unit)

Example 75 with Coordinates

use of main.game.bf.Coordinates in project Eidolons by IDemiurge.

the class MiniGrid method refresh.

@Override
public void refresh() {
    Chronos.mark("minigrid refresh");
    Set<Coordinates> set = compMap.keySet();
    int index = 0;
    for (MiniObjComp comp : overlayingObjComps) {
        comp.refresh();
        this.comp.setComponentZOrder(comp.getComp(), index);
        index++;
    }
    for (Coordinates c : set) {
        refreshComp(index, c);
        index++;
    }
    comp.revalidate();
// Chronos.logTimeElapsedForMark("minigrid refresh");
}
Also used : Coordinates(main.game.bf.Coordinates)

Aggregations

Coordinates (main.game.bf.Coordinates)226 Unit (eidolons.entity.obj.unit.Unit)49 ObjType (main.entity.type.ObjType)30 ArrayList (java.util.ArrayList)29 Obj (main.entity.obj.Obj)28 DC_Obj (eidolons.entity.obj.DC_Obj)22 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)21 FACING_DIRECTION (main.game.bf.Coordinates.FACING_DIRECTION)21 DIRECTION (main.game.bf.Coordinates.DIRECTION)20 Ref (main.entity.Ref)15 MapBlock (eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)13 DC_Cell (eidolons.entity.obj.DC_Cell)12 Action (eidolons.game.battlecraft.ai.elements.actions.Action)11 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)9 BufferedImage (java.awt.image.BufferedImage)8 DequeImpl (main.system.datatypes.DequeImpl)8 Vector2 (com.badlogic.gdx.math.Vector2)7 DC_UnitAction (eidolons.entity.active.DC_UnitAction)7 ZCoordinates (main.game.bf.ZCoordinates)6 ObjAtCoordinate (main.entity.type.ObjAtCoordinate)5