Search in sources :

Example 41 with Coordinates

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

the class LE_ObjMaster method replace.

public static void replace() {
    ObjType type = ArcaneVault.getSelectedType();
    List<Coordinates> coordinates = LE_MapMaster.pickCoordinates();
    if (!ListMaster.isNotEmpty(coordinates)) {
        return;
    }
    ObjType type2 = ArcaneVault.getSelectedType();
    if (type2 == type) {
        type2 = DataManager.getType(ListChooser.chooseType(type.getOBJ_TYPE_ENUM()), type.getOBJ_TYPE_ENUM());
    }
    replace(type, type2, coordinates);
}
Also used : ObjType(main.entity.type.ObjType) Coordinates(main.game.bf.Coordinates)

Example 42 with Coordinates

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

the class LE_ObjMaster method moveObjects.

private static boolean moveObjects(boolean copy, List<Coordinates> coordinates, boolean mirror) {
    Coordinates destination = LevelEditor.getMouseMaster().pickCoordinate();
    if (destination == null) {
        return false;
    }
    int offsetY = destination.y - CoordinatesMaster.getMinY(coordinates);
    int offsetX = destination.x - CoordinatesMaster.getMinX(coordinates);
    moveObjects(destination, coordinates, offsetX, offsetY, copy, mirror);
    return true;
}
Also used : Coordinates(main.game.bf.Coordinates)

Example 43 with Coordinates

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

the class LE_ObjMaster method moveSelectedObj.

public static void moveSelectedObj() {
    Coordinates c = LE_MapMaster.pickCoordinate();
    Obj selectedObj = LevelEditor.getMouseMaster().getSelectedObj();
    int offsetX = c.x - selectedObj.getX();
    int offsetY = c.y - selectedObj.getY();
    moveObj(selectedObj.getCoordinates(), offsetX, offsetY);
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) Obj(main.entity.obj.Obj) Coordinates(main.game.bf.Coordinates)

Example 44 with Coordinates

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

the class LE_ObjMaster method addObj.

public Unit addObj(ObjType type, boolean stack, Coordinates... coordinates) {
    Unit obj = null;
    for (Coordinates c : coordinates) {
        List<Unit> list = LevelEditor.getSimulation().getObjectsOnCoordinate(c);
        if (!StackingRule.checkCanPlace(c, type, list)) {
            // replace cases? if 1 coordinate, prompt...
            if (LevelEditor.getCurrentLevel().isInitialized()) {
                SoundMaster.playStandardSound(STD_SOUNDS.DIS__BLOCKED);
            // DialogMaster.inform(type +
            // " cannot be placed onto wall - " + c);
            }
            continue;
        }
        obj = getObject(type, c);
        List<Unit> objects = LevelEditor.getSimulation().getUnitMap().get(c);
        if (objects == null) {
            objects = new ArrayList<>();
            LevelEditor.getSimulation().getUnitMap().put(c, objects);
        }
        objects.add(obj);
        LevelEditor.getCurrentLevel().addObj(obj, c, stack);
        if (obj.isOverlaying()) {
            LE_ObjMaster.setDirection(obj, c);
        }
        try {
            if (LE_MapViewComp.isMinimapMode()) {
                LevelEditor.getMainPanel().getMiniGrid().refreshComp(null, c);
            } else {
                SwingUtilities.invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        LevelEditor.getGrid().refresh();
                    }
                });
            }
        // LevelEditor.getGrid().repaintComp(c);
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    }
    // preCheck wall ?
    return obj;
}
Also used : Coordinates(main.game.bf.Coordinates) Unit(eidolons.entity.obj.unit.Unit)

Example 45 with Coordinates

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

the class LE_ObjMaster method replace.

public static void replace(ObjType type, ObjType type2, List<Coordinates> coordinates) {
    cache();
    for (Coordinates coordinate : coordinates) {
        List<Unit> objects = LevelEditor.getSimulation().getUnitMap().get(coordinate);
        // .getObjects();
        if (objects != null) {
            for (Unit obj : new ArrayList<>(objects)) {
                if (obj.getType().equals(type)) {
                    objects.remove(obj);
                    objects.add(getObject(type2, coordinate));
                }
            }
        }
    }
    LevelEditor.getMainPanel().getMapViewComp().getGrid().refresh();
}
Also used : Coordinates(main.game.bf.Coordinates) Unit(eidolons.entity.obj.unit.Unit)

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