Search in sources :

Example 21 with BattleFieldObject

use of eidolons.entity.obj.BattleFieldObject in project Eidolons by IDemiurge.

the class SightMaster method getSpectrumCoordinates.

public DequeImpl<Coordinates> getSpectrumCoordinates(Integer range, Integer side_penalty, Integer back_bonus, BattleFieldObject source, boolean vision, FACING_DIRECTION facing, boolean extended) {
    DequeImpl<Coordinates> list = new DequeImpl<>();
    BattleFieldObject unit = null;
    Coordinates orig = source.getCoordinates();
    if (source instanceof BattleFieldObject) {
        unit = (BattleFieldObject) source;
    }
    if (facing == null) {
        if (unit != null) {
            facing = unit.getFacing();
        }
    }
    DIRECTION direction;
    if (facing == null) {
        facing = FacingMaster.getRandomFacing();
    }
    direction = facing.getDirection();
    if (range == null) {
        range = source.getIntParam(PARAMS.SIGHT_RANGE);
        if (extended) {
            range = MathMaster.applyModIfNotZero(range, source.getIntParam(PARAMS.SIGHT_RANGE_EXPANSION));
        }
    }
    if (side_penalty == null) {
        side_penalty = source.getIntParam(PARAMS.SIDE_SIGHT_PENALTY);
        if (extended) {
            side_penalty = MathMaster.applyModIfNotZero(side_penalty, source.getIntParam(PARAMS.SIGHT_RANGE_EXPANSION_SIDES));
        }
    }
    if (back_bonus == null) {
        back_bonus = source.getIntParam(PARAMS.BEHIND_SIGHT_BONUS);
        if (!extended)
            back_bonus--;
    // back_bonus = MathMaster.applyModIfNotZero(back_bonus, source
    // .getIntParam(PARAMS.SIGHT_RANGE_EXPANSION_BACKWARD));
    }
    addLine(orig.getAdjacentCoordinate(direction), range, list, direction, true);
    addSides(list, orig, direction, range - side_penalty, false);
    DIRECTION backDirection = DirectionMaster.flip(direction);
    Coordinates backCoordinate = orig.getAdjacentCoordinate(backDirection);
    if (back_bonus > 0) {
        if (backCoordinate != null) {
            addLine(backCoordinate, back_bonus, list, backDirection, true);
        // if (back_bonus > side_penalty)
        // addSides(list, backCoordinate, backDirection, back_bonus -
        // side_penalty, false);
        }
    }
    Collection<Coordinates> blocked = getBlockedList(list, source, facing);
    list.removeAll(blocked);
    list.add(source.getCoordinates());
    return list;
}
Also used : BattleFieldObject(eidolons.entity.obj.BattleFieldObject) Coordinates(main.game.bf.Coordinates) FACING_DIRECTION(main.game.bf.Coordinates.FACING_DIRECTION) DIRECTION(main.game.bf.Coordinates.DIRECTION) DequeImpl(main.system.datatypes.DequeImpl)

Example 22 with BattleFieldObject

use of eidolons.entity.obj.BattleFieldObject in project Eidolons by IDemiurge.

the class DC_GameMaster method getObjects.

public BattleFieldObject[] getObjects(int x_, int y_) {
    BattleFieldObject[] array = getObjCells()[x_][y_];
    if (array == null) {
        List<BattleFieldObject> list = getObjectsOnCoordinate(new Coordinates(x_, y_), false);
        if (list.isEmpty())
            array = new BattleFieldObject[0];
        else
            array = list.toArray(new BattleFieldObject[list.size()]);
        objCells[x_][y_] = array;
    }
    return array;
}
Also used : BattleFieldObject(eidolons.entity.obj.BattleFieldObject) Coordinates(main.game.bf.Coordinates)

Example 23 with BattleFieldObject

use of eidolons.entity.obj.BattleFieldObject in project Eidolons by IDemiurge.

the class DcHelper method object.

public BattleFieldObject object(String name, int x, int y, DC_Player owner, DC_TYPE TYPE) {
    ObjType type = DataManager.getType(name, TYPE);
    assertTrue(type != null);
    return (BattleFieldObject) game.getManager().getObjCreator().createUnit(type, x, y, owner, new Ref(game));
}
Also used : Ref(main.entity.Ref) ObjType(main.entity.type.ObjType) BattleFieldObject(eidolons.entity.obj.BattleFieldObject)

Example 24 with BattleFieldObject

use of eidolons.entity.obj.BattleFieldObject in project Eidolons by IDemiurge.

the class Level method getFacingMapData.

private String getFacingMapData() {
    String facingMapData = "";
    Map<Coordinates, List<Unit>> multiMap = new HashMap<>();
    for (Coordinates c : getDirectionMap().keySet()) {
        Map<BattleFieldObject, DIRECTION> map = getDirectionMap().get(c);
        for (DC_Obj obj : map.keySet()) {
            if (obj instanceof Unit) {
                Unit u = (Unit) obj;
                DIRECTION facing = map.get(u);
                if (facing != null) {
                    u.setCoordinates(c);
                    String string = DC_ObjInitializer.getObjString(u);
                    List<Unit> list = multiMap.get(c);
                    if (list == null) {
                        list = new ArrayList<>();
                        multiMap.put(c, list);
                    }
                    list.add(u);
                    if (list.size() > 1) {
                        string += list.size() + 1;
                    }
                    facingMapData += RandomWizard.getWeightStringItem(string, facing.toString());
                }
            }
        }
    }
    return facingMapData;
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) HashMap(java.util.HashMap) BattleFieldObject(eidolons.entity.obj.BattleFieldObject) Coordinates(main.game.bf.Coordinates) DIRECTION(main.game.bf.Coordinates.DIRECTION) ArrayList(java.util.ArrayList) List(java.util.List) Unit(eidolons.entity.obj.unit.Unit)

Example 25 with BattleFieldObject

use of eidolons.entity.obj.BattleFieldObject in project Eidolons by IDemiurge.

the class DeathMaster method killAllUnits.

public void killAllUnits(boolean removeBfObjects, boolean retainPlayerParty, boolean quiet) {
    DequeImpl<BattleFieldObject> list = new DequeImpl();
    List<BattleFieldObject> toRemove = new ArrayList<>();
    list.addAll(getGame().getUnits());
    if (removeBfObjects) {
        list.addAll(getGame().getStructures());
    }
    for (BattleFieldObject unit : list) {
        if (retainPlayerParty) {
            if (PartyHelper.getParty() != null) {
                if (PartyHelper.getParty().getMembers().contains(unit)) {
                    continue;
                }
            }
        // if (unit.isMine())
        // continue;
        }
        unit.kill(unit, false, quiet);
        toRemove.add(unit);
    }
    // if (remove)
    for (BattleFieldObject unit : toRemove) {
        getGame().remove(unit);
    }
// reset();
// refreshAll();
// WaitMaster.receiveInput(WAIT_OPERATIONS.ACTION_COMPLETE, true);
}
Also used : BattleFieldObject(eidolons.entity.obj.BattleFieldObject) ArrayList(java.util.ArrayList) DequeImpl(main.system.datatypes.DequeImpl)

Aggregations

BattleFieldObject (eidolons.entity.obj.BattleFieldObject)52 Unit (eidolons.entity.obj.unit.Unit)24 Coordinates (main.game.bf.Coordinates)22 DC_Obj (eidolons.entity.obj.DC_Obj)12 Ref (main.entity.Ref)12 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)10 Obj (main.entity.obj.Obj)9 DequeImpl (main.system.datatypes.DequeImpl)8 Event (main.game.logic.event.Event)7 ArrayList (java.util.ArrayList)6 List (java.util.List)6 DIRECTION (main.game.bf.Coordinates.DIRECTION)5 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)4 Vector2 (com.badlogic.gdx.math.Vector2)4 Align (com.badlogic.gdx.utils.Align)4 Eidolons (eidolons.game.core.Eidolons)4 Gdx (com.badlogic.gdx.Gdx)3 Keys (com.badlogic.gdx.Input.Keys)3 Batch (com.badlogic.gdx.graphics.g2d.Batch)3 Group (com.badlogic.gdx.scenes.scene2d.Group)3