use of main.game.logic.action.context.Context in project Eidolons by IDemiurge.
the class DC_MovementManager method moveTo.
public void moveTo(Coordinates coordinates) {
Unit unit = game.getManager().getActiveObj();
List<ActionPath> paths = pathCache.get(unit);
if (paths == null) {
paths = buildPath(unit, coordinates);
// Coordinates adjacentCoordinate = coordinates.getAdjacentCoordinate(DirectionMaster
// .getRelativeDirection(unit.getCoordinates(), coordinates));
// if (DialogMaster.confirm("No path could be built to " + coordinates
// + "; proceed to the closest cell? - " + adjacentCoordinate)) {
// moveTo(adjacentCoordinate);
// } else {
// return;
// }
pathCache.put(unit, paths);
}
if (paths == null) {
return;
}
Action action = null;
for (ActionPath path : paths) {
// if (DialogMaster.confirm("Path built to : " + path + "\nExecute "
// + path.getActions().get(0).toString() + "?")) {
// action = path.getActions().get(0);
// break;
// }
// just check if still passible
// if (path.getActions().get(0))
action = path.getActions().get(0);
break;
}
if (action == null) {
pathCache.remove(unit);
return;
}
// ActionAnimation anim = new ActionAnimation(action);
// anim.start();
Context context = new Context(unit.getRef());
if (action.getActive().isMove()) {
context.setTarget(game.getCellByCoordinate(coordinates).getId());
}
unit.getGame().getGameLoop().actionInput(new ActionInput(action.getActive(), context));
}
use of main.game.logic.action.context.Context in project Eidolons by IDemiurge.
the class DeathMaster method unitAnnihilated.
public void unitAnnihilated(Obj _killed, Obj _killer) {
String message = null;
if (_killed == _killer) {
// + _killed.getInfoString();
message = _killed + " annihilates ";
} else
message = _killed + " annihilated by " + _killer;
SpecialLogger.getInstance().appendSpecialLog(SPECIAL_LOG.MAIN, message);
getGame().getGraveyardManager().removeCorpse(_killed);
_killed.setAnnihilated(true);
getGame().fireEvent(new Event(STANDARD_EVENT_TYPE.UNIT_HAS_BEEN_ANNIHILATED, new Context(_killer, _killed)));
// TODO getGame().getDroppedItemManager().remove((DC_HeroObj) _killed, item);
}
use of main.game.logic.action.context.Context in project Eidolons by IDemiurge.
the class AttackTest method attackTest.
@Test
public void attackTest() {
assertTrue(source != null);
assertTrue(target != null);
int origToughness = target.getIntParam(PARAMS.C_TOUGHNESS);
int origEndurance = target.getIntParam(PARAMS.C_ENDURANCE);
assertTrue(source.getNaturalWeapon() != null);
DC_UnitAction attackAction = source.getAction("punch");
assertTrue(attackAction != null);
Eidolons.getGame().getGameLoop().actionInput(new ActionInput(attackAction, new Context(source, target)));
// old! attackAction.activateOn(target);
Boolean result = (Boolean) WaitMaster.waitForInput(WAIT_OPERATIONS.ACTION_COMPLETE);
assertTrue(result);
Integer newToughness = target.getIntParam(PARAMS.C_TOUGHNESS);
Integer newEndurance = target.getIntParam(PARAMS.C_ENDURANCE);
assertTrue(newToughness < origToughness);
assertTrue(newEndurance < origEndurance);
}
use of main.game.logic.action.context.Context in project Eidolons by IDemiurge.
the class FacingPanel method getGearListener.
private EventListener getGearListener(boolean clockwise) {
return new ClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
// GuiEventManager
WaitMaster.receiveInput(WAIT_OPERATIONS.ACTION_INPUT, new ActionInput(dataSource.getTurnAction(clockwise), new Context(dataSource.getEntity().getRef())));
GearCluster gear = clockwise ? gearsClockwise : gearsAntiClockwise;
gear.activeWork(0.25f, 0.5f);
return super.touchDown(event, x, y, pointer, button);
}
};
}
use of main.game.logic.action.context.Context in project Eidolons by IDemiurge.
the class QuickWeaponPanel method getListener.
private EventListener getListener() {
return new ClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
if (button == 1) {
GuiEventManager.trigger(GuiEventType.RADIAL_MENU_CLOSE);
GuiEventManager.trigger(GuiEventType.CREATE_RADIAL_MENU, dataSource.getWeapon());
} else {
WaitMaster.receiveInput(WAIT_OPERATIONS.ACTION_INPUT, new ActionInput(getDataSource().getOwnerObj().getAttackAction(offhand), new Context(getDataSource().getOwnerObj(), null)));
}
return false;
}
@Override
public boolean mouseMoved(InputEvent event, float x, float y) {
return super.mouseMoved(event, x, y);
}
@Override
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
super.enter(event, x, y, pointer, fromActor);
weapon.setZIndex(getChildren().size - 2);
}
@Override
public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) {
super.exit(event, x, y, pointer, toActor);
weapon.setZIndex(1);
}
};
}
Aggregations