use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.
the class MiniGrid method refreshComp.
public void refreshComp(Integer index, Coordinates c, MiniObjComp objComp) {
if (index != null) {
this.comp.setComponentZOrder(objComp.getComp(), index);
}
DC_Obj obj = objComp.getObj();
if (c == null) {
c = obj.getCoordinates();
}
List<? extends DC_Obj> objects = getGame().getObjectsOnCoordinate(c);
ArrayList<Unit> overlaying = new ArrayList<>();
for (Unit o : map.getDungeon().getGame().getObjectsOnCoordinate(c)) {
if (o.isOverlaying()) {
overlaying.add(o);
}
}
// TODO WHAT IF THERE ARE STACKED OBJECT + OVERLAYING??? FUTURE...
// for non-Level Editor
objComp.setObjects(new DequeImpl(objects).getRemoveAll(overlaying));
// sort top?
objComp.setObj(obj);
// TODO WHAT ABOUT OVERLAYING OBJECTS?
objComp.initSize(getSize());
// Chronos.mark(obj + " objComp refresh");
objComp.refresh();
// Chronos.logTimeElapsedForMark(obj + " objComp refresh");
}
use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.
the class CoordinateTargeting method select.
public boolean select(Ref ref) {
DC_Obj obj = (DC_Obj) ref.getObj(key);
DIRECTION used_direction = direction;
if (unitDirection != null) {
Unit unit = (Unit) obj;
used_direction = DirectionMaster.getDirectionByFacing(unit.getFacing(), unitDirection);
}
Coordinates coordinate = obj.getCoordinates().getAdjacentCoordinate(used_direction);
List<BattleFieldObject> objects = obj.getGame().getMaster().getObjectsOnCoordinate(coordinate, false);
if (objects.size() == 0) {
ref.setTarget(obj.getGame().getCellByCoordinate(coordinate).getId());
} else if (objects.size() == 1) {
ref.setTarget(objects.get(0).getId());
} else {
ref.setGroup(new GroupImpl(new ArrayList<>(objects)));
}
return true;
}
use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.
the class AddSpecialEffects method applyThis.
@Override
public boolean applyThis() {
if (case_type == null) {
case_type = new EnumMaster<SPECIAL_EFFECTS_CASE>().retrieveEnumConst(SPECIAL_EFFECTS_CASE.class, caseName);
}
if (effects == null) {
effects = new AbilityEffect(abilName).getEffects();
}
if (!(ref.getTargetObj() instanceof DC_Obj)) {
return false;
}
DC_Obj targetObj = (DC_Obj) ref.getTargetObj();
targetObj.addSpecialEffect(case_type, effects);
if (triggerEffect == null) {
triggerEffect = getTriggerEffect();
if (triggerEffect != null) {
triggerEffect.apply(ref);
}
}
return true;
}
use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.
the class GridCell method init.
public GridCell init() {
backImage = new Image(backTexture);
backImage.setFillParent(true);
addActor(backImage);
setSize(GridMaster.CELL_W, GridMaster.CELL_H);
cordsText = new Label(getGridX() + ":" + getGridY(), StyleHolder.getAVQLabelStyle());
cordsText.setPosition(getWidth() / 2 - cordsText.getWidth() / 2, getHeight() / 2 - cordsText.getHeight() / 2);
cordsText.setVisible(false);
addActor(cordsText);
addListener(new BattleClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
return true;
}
@Override
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
DC_Obj dc_cell = Eidolons.gameMaster.getCellByCoordinate(new Coordinates(getGridX(), getGridY()));
if (button == Input.Buttons.RIGHT && !event.isHandled()) {
event.handle();
GuiEventManager.trigger(CREATE_RADIAL_MENU, dc_cell);
}
if (button == Input.Buttons.LEFT) {
event.handle();
if (isEmpty())
if (isAlt() || isShift() || isControl())
try {
if (DefaultActionHandler.leftClickCell(isShift(), isControl(), getGridX(), getGridY()))
return;
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
GuiEventManager.trigger(CALL_BLUE_BORDER_ACTION, GridCell.this);
GuiEventManager.trigger(RADIAL_MENU_CLOSE);
}
}
});
return this;
}
Aggregations