use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class Spawner method spawnDone.
protected void spawnDone() {
// TODO selective??
// getGame().getMetaMaster().getPartyManager().getParty().getMembers()
List<Unit> unitsList = new ArrayList<>();
unitsList.addAll(game.getUnits());
getFacingAdjuster().adjustFacing(unitsList);
final Integer cellsX = game.getDungeon().getCellsX();
final Integer cellsY = game.getDungeon().getCellsY();
GuiEventManager.trigger(SCREEN_LOADED, new BFDataCreatedEvent(cellsX, cellsY, game.getBfObjects()));
// WaitMaster.waitForInput(WAIT_OPERATIONS.DUNGEON_SCREEN_READY);
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class Spawner method spawnPlayerParty.
private void spawnPlayerParty(Party party, String partyData) {
DC_ObjInitializer.initializePartyPositions(partyData, party.getMembers());
int i = 0;
getPositioner().setMaxSpacePercentageTaken(MAX_SPACE_PERC_PARTY);
Boolean last = null;
for (Unit hero : party.getMembers()) {
if (party.getPartyCoordinates() == null) {
if (getGame().getGameMode() == GAME_MODES.ARENA || getGame().getGameMode() == GAME_MODES.ARENA_ARCADE) {
hero.setFacing(FacingMaster.getPresetFacing(true));
}
// else
// hero.setFacing(getPositioner().getPartyMemberFacing(hero.getCoordinates()));
}
hero.setOriginalOwner(game.getPlayer(true));
i++;
if (i == party.getMembers().size()) {
last = true;
}
if (game.isDebugMode()) {
TestMasterContent.addTestItems(hero.getType(), last);
}
last = false;
if (!Launcher.isRunning()) {
continue;
}
hero.setSpells(null);
hero.initSpells(false);
hero.fullReset(game);
}
// game.getPlayer(true).setEmblem(party.getLeader().getEmblem().getImage());
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class ArenaSpawner method spawnWave.
private void spawnWave(List<ObjAtCoordinate> unitMap, Wave wave, boolean prespawnMode) {
game.getLogManager().log("New encounter: " + wave.getName());
if (unitMap == null) {
getPositioner().setMaxSpacePercentageTaken(MAX_SPACE_PERC_CREEPS);
wave.initUnitMap();
unitMap = wave.getUnitMap();
}
try {
getBattleMaster().getWaveAssembler().resetPositions(wave);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
for (ObjAtCoordinate oac : unitMap) {
Coordinates c = oac.getCoordinates();
FACING_DIRECTION facing = getFacingAdjuster().getFacingForEnemy(c);
boolean invalid = false;
if (c == null) {
invalid = true;
} else if (c.isInvalid()) {
invalid = true;
} else if (game.getBattleField().getGrid().isCoordinateObstructed(c)) {
invalid = true;
}
if (invalid) {
c = Positioner.adjustCoordinate(c, facing);
}
ObjType type = oac.getType();
Unit unit = (Unit) game.createUnit(type, c, wave.getOwner());
UnitTrainingMaster.train(unit);
unit.setFacing(facing);
wave.addUnit(unit);
game.fireEvent(new Event(STANDARD_EVENT_TYPE.UNIT_HAS_CHANGED_FACING, Ref.getSelfTargetingRefCopy(unit)));
}
if (!PartyHelper.checkMergeParty(wave)) {
try {
PartyHelper.addCreepParty(wave);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class GridPanel method updateOutlines.
public void updateOutlines() {
viewMap.keySet().forEach(obj -> {
if (!obj.isOverlaying())
if (!obj.isMine())
if (!obj.isWall()) {
OUTLINE_TYPE outline = obj.getOutlineType();
GridUnitView uv = (GridUnitView) viewMap.get(obj);
TextureRegion texture = null;
if (outline != null) {
String path = Eidolons.game.getVisionMaster().getVisibilityMaster().getImagePath(outline, obj);
if (obj instanceof Unit) {
main.system.auxiliary.log.LogMaster.log(1, obj + " has OUTLINE: " + path);
}
texture = TextureCache.getOrCreateR(path);
uv.setOutline(texture);
} else {
if (obj instanceof Unit) {
if (!obj.isOutsideCombat()) {
main.system.auxiliary.log.LogMaster.log(1, obj + " has NO OUTLINE: ");
}
}
uv.setOutline(null);
}
}
});
}
use of eidolons.entity.obj.unit.Unit in project Eidolons by IDemiurge.
the class GridPanel method onIngameEvent.
private EventCallback onIngameEvent() {
return param -> {
Event event = (Event) param.get();
Ref ref = event.getRef();
boolean caught = false;
if (event.getType() == STANDARD_EVENT_TYPE.EFFECT_HAS_BEEN_APPLIED) {
GuiEventManager.trigger(GuiEventType.EFFECT_APPLIED, event.getRef());
caught = true;
} else if (event.getType() == STANDARD_EVENT_TYPE.UNIT_HAS_CHANGED_FACING || event.getType() == STANDARD_EVENT_TYPE.UNIT_HAS_TURNED_CLOCKWISE || event.getType() == STANDARD_EVENT_TYPE.UNIT_HAS_TURNED_ANTICLOCKWISE) {
BattleFieldObject hero = (BattleFieldObject) ref.getObj(KEYS.TARGET);
// if (hero.isMainHero()) TODO this is an experiment (insane) feature...
// if (hero.isMine()) {
// turnField(event.getType());
// }
BaseView view = viewMap.get(hero);
if (view != null && view instanceof GridUnitView) {
GridUnitView unitView = ((GridUnitView) view);
unitView.updateRotation(hero.getFacing().getDirection().getDegrees());
// SoundController.getCustomEventSound(SOUND_EVENT.UNIT_TURNS, );
if (hero instanceof Unit)
DC_SoundMaster.playTurnSound((Unit) hero);
}
caught = true;
} else if (event.getType() == STANDARD_EVENT_TYPE.UNIT_HAS_FALLEN_UNCONSCIOUS) {
GuiEventManager.trigger(UNIT_GREYED_OUT_ON, ref.getSourceObj());
} else if (event.getType() == STANDARD_EVENT_TYPE.UNIT_HAS_RECOVERED_FROM_UNCONSCIOUSNESS) {
GuiEventManager.trigger(UNIT_GREYED_OUT_OFF, ref.getSourceObj());
} else if (event.getType() == STANDARD_EVENT_TYPE.UNIT_HAS_BEEN_KILLED) {
GuiEventManager.trigger(UNIT_GREYED_OUT_OFF, ref.getSourceObj());
if (!DeathAnim.isOn() || ref.isDebug()) {
GuiEventManager.trigger(DESTROY_UNIT_MODEL, ref.getTargetObj());
}
caught = true;
} else if (event.getType() == STANDARD_EVENT_TYPE.UNIT_BEING_MOVED) {
if (// || AnimMaster.isAnimationOffFor(ref.getSourceObj(), viewMap.get(ref.getSourceObj())))
!MoveAnimation.isOn())
removeUnitView((BattleFieldObject) ref.getSourceObj());
caught = true;
} else if (event.getType() == STANDARD_EVENT_TYPE.UNIT_FINISHED_MOVING) {
if (!MoveAnimation.isOn() || AnimMaster.isAnimationOffFor(ref.getSourceObj(), viewMap.get(ref.getSourceObj())))
moveUnitView((BattleFieldObject) ref.getSourceObj());
caught = true;
} else if (event.getType().name().startsWith("PARAM_BEING_MODIFIED")) {
caught = true;
} else if (event.getType().name().startsWith("PROP_")) {
caught = true;
} else if (event.getType().name().startsWith("ABILITY_")) {
caught = true;
} else if (event.getType().name().startsWith("EFFECT_")) {
caught = true;
} else if (event.getType().name().startsWith("PARAM_MODIFIED")) {
if (GuiEventManager.isParamEventAlwaysFired(event.getType().getArg())) {
UnitView view = (UnitView) getViewMap().get(event.getRef().getSourceObj());
if (view != null)
if (view.isVisible())
if (view.getHpBar() != null)
// if (view.getHpBar( ).getDataSource().canHpBarBeVisible())
view.resetHpBar(new ResourceSourceImpl((BattleFieldObject) event.getRef().getSourceObj()));
}
caught = true;
}
if (!caught) {
/* System.out.println("catch ingame event: " + event.getType() + " in " + event.getRef());
*/
}
};
}
Aggregations