Search in sources :

Example 86 with Unit

use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.

the class HeroCreator method createHeroObj.

public static Unit createHeroObj(ObjType type) {
    Unit hero = new Unit(type, 0, 0, getDefaultPlayer(), Eidolons.getGame(), new Ref(Eidolons.getGame()));
    newId(type);
    Eidolons.getGame().getState().addObject(hero);
    // hero.afterEffects();
    return hero;
}
Also used : Ref(main.entity.Ref) Unit(eidolons.entity.obj.unit.Unit)

Example 87 with Unit

use of eidolons.entity.obj.unit.Unit 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 88 with Unit

use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.

the class MiniGrid method objAdded.

public void objAdded(DC_Obj obj, boolean stack) {
    // comp.remove(compMap.getOrCreate(obj.getCoordinates()).getComp());
    MiniObjComp minicomp;
    if (obj instanceof Unit) {
        Unit unit = (Unit) obj;
        if (unit.isOverlaying()) {
            minicomp = new MiniObjComp(true, obj, map);
            if (editMode) {
                minicomp.getComp().addMouseListener(customMouseListener);
            }
            boolean multi = false;
            for (MiniObjComp comp : overlayingObjComps) {
                if (comp.getObj().getCoordinates().equals(minicomp)) {
                    multi = true;
                }
            }
            this.comp.add(minicomp.getComp(), getOverlayingMigString(unit, multi));
            overlayingObjComps.add(minicomp);
            refresh();
            return;
        }
    }
    minicomp = compMap.get(obj.getCoordinates());
    if (minicomp == null) {
        return;
    }
    if (stack) {
        minicomp.addObj(obj);
    } else {
        minicomp.setObj(obj);
    }
    minicomp.refresh();
// addObj(obj);
// refresh();
}
Also used : Unit(eidolons.entity.obj.unit.Unit)

Example 89 with Unit

use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.

the class MiniGrid method objRemoved.

public void objRemoved(DC_Obj obj) {
    if (obj instanceof Unit) {
        Unit unit = (Unit) obj;
        if (unit.isOverlaying()) {
            for (MiniObjComp c : overlayingObjComps) {
                if (c.getObj().equals(obj)) {
                    overlayingObjComps.remove(c);
                    comp.remove(c.getComp());
                    break;
                }
            }
            return;
        }
    }
    DC_Cell cell = dungeon.getGame().getCellByCoordinate(obj.getCoordinates());
    if (cell == null) {
        return;
    }
    // compMap.getOrCreate(obj.getCoordinates()).removeObj(obj);
    if (compMap.get(obj.getCoordinates()).getObjects().size() <= 1) {
        objAdded(cell);
    }
}
Also used : DC_Cell(eidolons.entity.obj.DC_Cell) Unit(eidolons.entity.obj.unit.Unit)

Example 90 with Unit

use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.

the class RestMasterOld method rest.

// setFinishDate / setRestTime / defaultTime (4/8/12 hours)
// TODO endTurn => auto-rest? valid modes preCheck
public static boolean rest(MacroParty party) {
    for (Unit hero : party.getMembers()) {
        MACRO_MODES mode = hero.getMacroMode();
        if (mode == null || !checkModeValid(party, mode)) {
            DialogMaster.inform("Choose a mode on the lowermost panel!");
            return false;
        // mode = promptMode(hero); // or auto-set for non-leaders?
        }
        hero.setMacroMode(mode);
    }
    // each hero gain as per Mode
    // non-cancelable perhaps? Or also an Order?
    // 
    party.setStatus(MACRO_STATUS.CAMPING);
    return true;
// party.setCurrentDestination(null);
// party.setCurrentRoute(null);
}
Also used : Unit(eidolons.entity.obj.unit.Unit) MACRO_MODES(eidolons.game.module.adventure.entity.MacroActionManager.MACRO_MODES)

Aggregations

Unit (eidolons.entity.obj.unit.Unit)258 Coordinates (main.game.bf.Coordinates)53 Ref (main.entity.Ref)33 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)30 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)26 DC_Obj (eidolons.entity.obj.DC_Obj)26 ArrayList (java.util.ArrayList)26 Obj (main.entity.obj.Obj)26 ObjType (main.entity.type.ObjType)23 DC_SpellObj (eidolons.entity.active.DC_SpellObj)13 DC_Cell (eidolons.entity.obj.DC_Cell)11 Event (main.game.logic.event.Event)11 DC_UnitAction (eidolons.entity.active.DC_UnitAction)10 List (java.util.List)10 DC_Game (eidolons.game.core.game.DC_Game)9 Action (eidolons.game.battlecraft.ai.elements.actions.Action)8 DequeImpl (main.system.datatypes.DequeImpl)8 OUTLINE_TYPE (main.content.enums.rules.VisionEnums.OUTLINE_TYPE)7 Entity (main.entity.Entity)7 DIRECTION (main.game.bf.Coordinates.DIRECTION)7