Search in sources :

Example 36 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class LE_TreePlanPanel method blockAdded.

public void blockAdded(MapBlock b) {
    DefaultMutableTreeNode blockNode = new DefaultMutableTreeNode(b);
    for (Obj o : b.getObjects()) {
        blockNode.add(new DefaultMutableTreeNode(o));
    }
    DefaultMutableTreeNode node = getZoneNodeForBlock(b);
    node.insert(blockNode, node.getChildCount() - 1);
    return;
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) Obj(main.entity.obj.Obj)

Example 37 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class LE_TreePlanPanel method initTree.

public void initTree() {
    root = new DefaultMutableTreeNode(plan.getDungeon().getName() + " plan");
    for (MapZone z : plan.getZones()) {
        DefaultMutableTreeNode node = new DefaultMutableTreeNode(z);
        root.add(node);
        for (MapBlock b : plan.getBlocks()) {
            if (b.getType() == BLOCK_TYPE.CORRIDOR) {
                // TODO
                continue;
            }
            DefaultMutableTreeNode blockNode = new DefaultMutableTreeNode(b);
            node.add(blockNode);
            if (b.getObjects() != null) {
                for (Obj o : b.getObjects()) {
                    blockNode.add(new DefaultMutableTreeNode(o));
                    b.getConnectedBlocks();
                }
            }
        }
        root.add(node);
    }
    setTree(new JTree(root));
    tree.setOpaque(false);
    tree.setSize(new Dimension(VISUALS.PLAN_PANEL_FRAME.getWidth() - 50, 20 * 32));
    getTree().setLargeModel(true);
    try {
        getTree().setUI(this);
    } catch (Exception e) {
        // new Thread (
        // getTree().setUI(this); ).start()
        main.system.ExceptionMaster.printStackTrace(e);
    }
    getTree().getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    getTree().setCellRenderer(this);
    getTree().addTreeSelectionListener(this);
}
Also used : MapZone(eidolons.game.battlecraft.logic.dungeon.location.building.MapZone) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) Obj(main.entity.obj.Obj) MapBlock(eidolons.game.battlecraft.logic.dungeon.location.building.MapBlock)

Example 38 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class FilterMaster method getUnitsInRadius.

public static List<? extends Entity> getUnitsInRadius(Obj unit, int radius) {
    Conditions conditions = new Conditions(ConditionMaster.getAliveFilterCondition(), ConditionMaster.getDistanceFilterCondition("SOURCE", radius, true));
    Set<Obj> set = new Filter<Obj>(unit.getRef(), conditions, C_OBJ_TYPE.UNITS_CHARS).getObjects();
    return new ArrayList<>(set);
}
Also used : Obj(main.entity.obj.Obj) ArrayList(java.util.ArrayList) Conditions(main.elements.conditions.Conditions)

Example 39 with Obj

use of main.entity.obj.Obj in project Eidolons by IDemiurge.

the class FilterMaster method getCellsInRadius.

public static Set<Obj> getCellsInRadius(Obj centerObj, Integer radius) {
    Conditions conditions = new Conditions();
    conditions.add(ConditionMaster.getDistanceFilterCondition("SOURCE", radius, true));
    conditions.add(new NotCondition(new OccupiedCondition("MATCH")));
    Set<Obj> set = new Filter<Obj>(centerObj.getRef(), conditions, DC_TYPE.TERRAIN).getObjects();
    return set;
}
Also used : NotCondition(main.elements.conditions.NotCondition) Obj(main.entity.obj.Obj) OccupiedCondition(main.elements.conditions.standard.OccupiedCondition) Conditions(main.elements.conditions.Conditions)

Example 40 with Obj

use of main.entity.obj.Obj 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)

Aggregations

Obj (main.entity.obj.Obj)127 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)34 DC_Obj (eidolons.entity.obj.DC_Obj)30 Coordinates (main.game.bf.Coordinates)27 Unit (eidolons.entity.obj.unit.Unit)24 ArrayList (java.util.ArrayList)19 Ref (main.entity.Ref)15 DC_SpellObj (eidolons.entity.active.DC_SpellObj)14 BuffObj (main.entity.obj.BuffObj)13 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)12 DC_QuickItemObj (eidolons.entity.item.DC_QuickItemObj)11 ActiveObj (main.entity.obj.ActiveObj)10 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)9 PassiveAbilityObj (main.ability.PassiveAbilityObj)9 ObjType (main.entity.type.ObjType)8 DC_HeroItemObj (eidolons.entity.item.DC_HeroItemObj)7 DC_BuffObj (eidolons.entity.obj.attach.DC_BuffObj)7 PARAMETER (main.content.values.parameters.PARAMETER)7 Conditions (main.elements.conditions.Conditions)6 MicroObj (main.entity.obj.MicroObj)6