Search in sources :

Example 36 with Coordinates

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

the class LE_MapMaster method moveZone.

public void moveZone(MapZone zone) {
    SoundMaster.playStandardSound(STD_SOUNDS.FAIL);
    Coordinates c = pickCoordinate();
    int offsetX = c.x - zone.getX1();
    int offsetY = c.y - zone.getY1();
    for (MapBlock b : zone.getBlocks()) {
        moveBlock(b, offsetX, offsetY);
    }
}
Also used : Coordinates(main.game.bf.Coordinates) MapBlock(eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)

Example 37 with Coordinates

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

the class LE_MapMaster method replace.

public void replace(String prevFiller, String filler, List<Coordinates> coordinates) {
    LevelEditor.getCurrentLevel().removeObj(prevFiller, coordinates.toArray(new Coordinates[coordinates.size()]));
    ObjType type = DataManager.getType(filler);
    for (Coordinates c : coordinates) {
        // LevelEditor.getObjMaster().removeObj(c);
        LevelEditor.getObjMaster().addObj(type, c);
    }
}
Also used : ObjType(main.entity.type.ObjType) Coordinates(main.game.bf.Coordinates)

Example 38 with Coordinates

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

the class LE_MapMaster method loadBlock.

public void loadBlock(MapBlock block) {
    if (block == null) {
        return;
    }
    Coordinates c = pickCoordinate();
    int offsetX = -CoordinatesMaster.getMinX(block.getCoordinates()) + c.x;
    int offsetY = -CoordinatesMaster.getMinY(block.getCoordinates()) + c.y;
    List<Coordinates> coordinates = CoordinatesMaster.getCoordinatesWithOffset(block.getCoordinates(), offsetX, offsetY);
    // coordinates=CoordinatesMaster.getCoordinatesWithin(c.x, , c.y, y1);
    this.block = new MapBlock(getPlan().getBlocks().size(), block.getType(), getPlan().getZones().get(0), getPlan(), coordinates);
    // should add to this.block
    clearArea(coordinates);
    for (Obj obj : block.getObjects()) {
        // beware deadlock
        LevelEditor.getCurrentLevel().setInitialized(false);
        try {
            Coordinates newCoordinates = new Coordinates(obj.getCoordinates().x + offsetX, obj.getCoordinates().y + offsetY);
            obj.setCoordinates(newCoordinates);
            LevelEditor.getObjMaster().addObj(obj.getType(), obj.getCoordinates());
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        } finally {
            LevelEditor.getCurrentLevel().setInitialized(true);
        }
    }
}
Also used : Obj(main.entity.obj.Obj) Coordinates(main.game.bf.Coordinates) MapBlock(eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)

Example 39 with Coordinates

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

the class LE_MapMaster method clearArea.

public void clearArea(List<Coordinates> coordinates, boolean ignoreBlockChoice) {
    if (!ignoreBlockChoice) {
        ArrayList<MapBlock> blocks = new ArrayList<>();
        for (Coordinates c : CoordinatesMaster.getCornerCoordinates(coordinates)) {
            MapBlock b = getLevel().getBlockForCoordinate(c, true, blocks);
            if (b != null) {
                if (!blocks.contains(b)) {
                    blocks.add(b);
                }
            }
        }
        if (blocks.size() > 1) {
            XList<Object> list = new XList<>(blocks.toArray());
            list.add(0, "New");
            list.add("Fit for each");
            int i = DialogMaster.optionChoice(list.toArray(), "Which block to add coordinates to?");
            if (i > 0 && i != list.size() - 1) {
                setBlock(blocks.get(i - 1));
            } else {
                if (i == 0) {
                    if (DialogMaster.confirm("Create new block?")) {
                        newRoom(coordinates);
                    }
                }
            }
        }
    }
    try {
        LE_ObjMaster.removeObjects(coordinates);
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    } finally {
        setBlock(null);
    }
}
Also used : Coordinates(main.game.bf.Coordinates) ArrayList(java.util.ArrayList) XList(main.data.XList) MapBlock(eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)

Example 40 with Coordinates

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

the class LE_MouseMaster method pickCoordinate.

public Coordinates pickCoordinate() {
    coordinateListeningMode = true;
    // comp.refresh();
    SoundMaster.playStandardSound(STD_SOUNDS.CLICK_ACTIVATE);
    boolean result = (boolean) WaitMaster.waitForInput(WAIT_OPERATIONS.CUSTOM_SELECT);
    coordinateListeningMode = false;
    if (!result) {
        SoundMaster.playStandardSound(STD_SOUNDS.CLICK_ERROR);
        return null;
    }
    SoundMaster.playStandardSound(STD_SOUNDS.CLICK_TARGET_SELECTED);
    Coordinates coordinates = coordinateListeningObj.getCoordinates();
    return coordinates;
}
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