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;
}
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);
}
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();
}
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);
}
}
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);
}
Aggregations