use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.
the class DrawMasterStatic method drawWatchInfo.
public static void drawWatchInfo(int zoom, Graphics g) {
DC_Obj info = DC_Game.game.getManager().getInfoObj();
if (info instanceof Unit) {
java.util.List<DC_Obj> watchedObjects = WatchRule.getWatchersMap().get(info);
if (watchedObjects != null) {
drawWatchVisuals(watchedObjects, (Unit) info, g, zoom, watchedObjects, false, true);
drawWatchVisuals(watchedObjects, (Unit) info, g, zoom, watchedObjects, false, false);
}
} else {
Unit active = DC_Game.game.getManager().getActiveObj();
if (active.isMine()) {
java.util.List<DC_Obj> watchedObjects = WatchRule.getWatchersMap().get(active);
if (watchedObjects != null) {
drawWatchVisuals(watchedObjects, active, g, zoom, watchedObjects, true, true);
drawWatchVisuals(watchedObjects, active, g, zoom, watchedObjects, true, false);
}
}
}
}
use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.
the class BfMouseListener method mouseClicked.
@Override
public void mouseClicked(MouseEvent e) {
if (checkAnimationClick(e)) {
return;
}
if (checkDynamicButtonClick(e)) {
return;
}
point = e.getPoint();
cellComp = gridComp.getCompByPoint(e.getPoint());
Point relativePoint = new Point(point.x % gridComp.getCellWidth(), point.y % gridComp.getCellHeight());
objClicked = null;
for (Rectangle rect : cellComp.getMouseMap().keySet()) {
if (rect.contains(relativePoint)) {
Object object = cellComp.getMouseMap().get(rect);
if (object instanceof INTERACTIVE_ELEMENT) {
INTERACTIVE_ELEMENT element = (INTERACTIVE_ELEMENT) object;
switch(element) {
case STACK:
// if (CoreEngine.isLevelEditor())
objClicked = DialogMaster.objChoice("Which object?", cellComp.getObjects().toArray(new DC_Obj[cellComp.getObjects().size()]));
break;
case AP:
break;
case COUNTERS:
break;
case ITEMS:
Collection<? extends Obj> droppedItems = cellComp.getGame().getDroppedItemManager().getDroppedItems(cellComp.getTerrainObj());
break;
case LOCKS:
break;
case TRAPS:
break;
}
// break ;
} else if (object instanceof Obj) {
if (object instanceof Unit) {
if (objClicked != null) {
int index = cellComp.getObjects().indexOf(objClicked);
int index2 = cellComp.getObjects().indexOf(object);
LogMaster.log(1, objClicked + "'s " + index + " vs " + object + "'s " + index2);
if (index > index2) // TODO so we need to keep this always sorted...
{
continue;
}
}
Unit unit = (Unit) object;
if (unit.isOverlaying()) {
// corpseClicked(unit);
if (unit.getVisibilityLevel() == VisionEnums.VISIBILITY_LEVEL.CONCEALED) {
continue;
}
objClicked = unit;
break;
} else {
objClicked = unit;
continue;
}
} else if (object instanceof DC_Cell) {
if (e.isAltDown()) {
objClicked = (DC_Obj) object;
break;
} else if (objClicked == null) {
objClicked = (DC_Obj) object;
}
// ?
continue;
}
}
// if (objClicked == null)
// return; // ??
}
}
if (objClicked == null) {
objClicked = cellComp.getTopObjOrCell();
}
if (CoreEngine.isLevelEditor()) {
if (objClicked instanceof DC_Cell) {
return;
}
}
boolean right = SwingUtilities.isRightMouseButton(e);
if (right) {
objClicked.invokeRightClicked();
// gridComp.getGame().getManager().rightClicked(objClicked);
} else {
gridComp.getGame().getManager().objClicked(objClicked);
}
boolean debugMode = gridComp.getGame().isDebugMode();
if (debugMode) {
gridComp.getGame().getDebugMaster().setArg(objClicked);
}
if (e.isAltDown()) {
if (debugMode) {
invokeAltClick(right);
} else {
new Thread(new Runnable() {
public void run() {
gridComp.getGame().getMovementManager().moveTo(objClicked);
}
}, "moveTo thread").start();
}
}
if (e.isShiftDown()) {
invokeShiftClick(right);
}
if (e.isControlDown()) {
invokeControlClick(right);
}
}
use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.
the class BonusDamageEffect method applyThis.
@Override
public boolean applyThis() {
DC_Obj target = (DC_Obj) ref.getTargetObj();
target.addBonusDamage(CASE, getDamage());
return false;
}
use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.
the class WatchRule method updateWatchStatus.
public void updateWatchStatus(Unit watcher) {
List<DC_Obj> list = getWatchersMap().get(watcher);
boolean invalid = false;
if (list != null) {
if (!checkValidWatcher(watcher)) {
invalid = true;
removeWatcher(watcher);
} else {
for (DC_Obj watched : list) {
if (!checkValidWatchTarget(watched)) {
breakWatch(watcher, watched);
break;
} else if (!checkValidWatchPairTarget(watcher, watched)) {
breakWatch(watcher, watched);
break;
}
}
}
}
BuffObj buff = watcher.getBuff("Watching", false);
if (buff != null) {
watcher.getGame().getManager().buffRemoved(buff);
}
if (!invalid) {
if (watcher.getMode().equals(STD_MODES.ALERT)) {
Ref ref = watcher.getRef().getCopy();
try {
SpectrumEffect spectrumEffect = new SpectrumEffect(new OwnershipCondition(true, "match", "source"), new WatchActionEffect(true));
spectrumEffect.setRangeFormula(StringMaster.getValueRef(KEYS.SOURCE, PARAMS.SIGHT_RANGE));
// for now...
spectrumEffect.setApplyThrough(false);
spectrumEffect.apply(ref);
watcher.getBuff(STD_MODES.ALERT.getBuffName(), false).setOnDispelEffects(new RemoveBuffEffect("Watching ", false));
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
}
list = getWatchersMap().get(watcher);
if (ListMaster.isNotEmpty(list)) // TODO alert???
{
getWatchBuffEffect(watcher, list).apply(Ref.getSelfTargetingRefCopy(watcher));
}
}
use of eidolons.entity.obj.DC_Obj in project Eidolons by IDemiurge.
the class HitAnim method getAction.
@Override
protected Action getAction() {
if (!OptionsMaster.getAnimOptions().getBooleanValue(ANIMATION_OPTION.HIT_ANIM_DISPLACEMENT))
return null;
if (getRef() == null)
return null;
if (getRef().getSourceObj() == null)
return null;
if (getRef().getTargetObj() == null)
return null;
DIRECTION d = DirectionMaster.getRelativeDirection(getRef().getSourceObj(), getRef().getTargetObj());
int dx = d.isVertical() ? 5 : 30;
int dy = !d.isVertical() ? 5 : 30;
if (BooleanMaster.isFalse(d.growX)) {
dx = -dx;
}
if (BooleanMaster.isTrue(d.growY)) {
dy = -dy;
}
originalActorX = getActor().getX();
originalActorY = getActor().getY();
float x = originalActorX;
float y = originalActorY;
MoveByAction move = (MoveByAction) ActorMaster.getAction(MoveByAction.class);
move.setAmount(dx, dy);
move.setDuration(getDuration() / 2);
MoveToAction moveBack = (MoveToAction) ActorMaster.getAction(MoveToAction.class);
if (getRef().getSourceObj() instanceof DC_Obj) {
if (((DC_Obj) getRef().getSourceObj()).isOverlaying()) {
moveBack.setPosition(x, y);
}
}
moveBack.setPosition(x, y);
moveBack.setDuration(getDuration() / 2);
SequenceAction sequence = new SequenceAction(move, moveBack);
if (isDelayed()) {
DelayAction delayed = new DelayAction(getDuration() / 3);
delayed.setAction(sequence);
return delayed;
}
return sequence;
}
Aggregations