use of eidolons.game.module.adventure.map.Route in project Eidolons by IDemiurge.
the class PlaceTooltip method updateAct.
@Override
public void updateAct(float delta) {
clearChildren();
TextureRegion r = TextureCache.getOrCreateR(place.getImagePath());
ValueContainer container = new ValueContainer(r, place.getName());
float size = GdxMaster.adjustSize(128);
if (size < r.getRegionHeight() && size < r.getRegionWidth())
container.overrideImageSize(size, size);
add(container);
setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
// return ;
if (place.getRoutes().isEmpty()) {
return;
}
row();
TablePanel<ValueContainer> routesInfo = new TablePanel<>();
routesInfo.defaults().space(5);
add(routesInfo);
routesInfo.addListener(new ClickListener() {
@Override
public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) {
if (toActor == routesInfo)
return;
if (toActor == null) {
if (getWidth() >= x)
return;
if (getWidth() >= y)
return;
}
if (GdxMaster.getAncestors(toActor).contains(routesInfo))
return;
if (!checkActorExitRemoves(toActor))
return;
super.exit(event, x, y, pointer, toActor);
GuiEventManager.trigger(MapEvent.ROUTES_PANEL_HOVER_OFF);
}
});
int i = 0;
for (Route sub : place.getRoutes()) {
// reverse pic pos
TextureRegion tex = TextureCache.getOrCreateR(sub.getImagePath());
ValueContainer routeInfo = new ValueContainer(tex, sub.getName(), sub.getLength() + " leagues");
routeInfo.setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
routesInfo.add(routeInfo).left().padLeft(5).uniform(true, false);
routeInfo.setUserObject(sub);
routeInfo.addListener(new ClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
// getTapCount()
GuiEventManager.trigger(MapEvent.ROUTE_HOVERED, sub);
return super.touchDown(event, x, y, pointer, button);
}
@Override
public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) {
super.exit(event, x, y, pointer, toActor);
GuiEventManager.trigger(MapEvent.ROUTE_HOVERED, null);
}
@Override
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
super.enter(event, x, y, pointer, fromActor);
GuiEventManager.trigger(MapEvent.ROUTE_HOVERED, sub);
}
});
if (i % 2 == 1)
routesInfo.row();
i++;
}
}
use of eidolons.game.module.adventure.map.Route in project Eidolons by IDemiurge.
the class EncounterMaster method checkEncounter.
// to be invoked multiple times between threats?
public Encounter checkEncounter(MacroRef ref, boolean explore, int progress) {
MacroParty party = ref.getParty();
Route route = ref.getRoute();
Area area = route.getArea();
return checkEncounter(area, route, party, explore, progress);
}
use of eidolons.game.module.adventure.map.Route in project Eidolons by IDemiurge.
the class ExploreMaster method newTurn.
public static void newTurn() {
for (MacroParty party : MacroGame.getGame().getParties()) {
if (party.getStatus() != MACRO_STATUS.TRAVELING) {
return;
}
Place place = party.getCurrentExploration();
if (place instanceof Route) {
ExploreMaster.exploreRoute(party, (Route) place);
} else {
Boolean north_or_south = RandomWizard.random();
Boolean west_or_east = RandomWizard.random();
// getOrCreate available directions
ExploreMaster.exploreLocation(party, north_or_south, west_or_east);
}
}
}
use of eidolons.game.module.adventure.map.Route in project Eidolons by IDemiurge.
the class ExploreMaster method exploreRoute.
public static void exploreRoute(MacroParty party, Route route) {
// TravelMaster.travel(true, party, route);
// limits
int maxProgress = 0;
int progress = 0;
if (checkGotLost(party, route)) {
// true, progress);
return;
}
List<Place> potentialFinds = getPotentialFindsForRouteExplore(route, maxProgress);
Place destination = null;
for (Place p : potentialFinds) {
if (!checkDiscovered(party, p, route)) {
continue;
}
// backward?
progress = maxProgress - p.getIntParam(MACRO_PARAMS.ROUTE_PROGRESS_PERCENTAGE);
if (discovered(p)) {
destination = p;
// ++ choose to go there
break;
}
}
if (destination != null) {
if (destination instanceof Route) {
TravelMasterOld.enterRoute(party, (Route) destination);
} else {
TravelMasterOld.enterPlace(party, destination);
}
// TODO spend the "rest" of the progress there?
}
}
use of eidolons.game.module.adventure.map.Route in project Eidolons by IDemiurge.
the class ExploreMaster method getPotentialFindsForLocationExplore.
private static List<Place> getPotentialFindsForLocationExplore(Place place, Boolean north_or_south, Boolean west_or_east, MacroParty party) {
List<Place> list = new ArrayList<>();
for (Route route : place.getRoutes()) {
if (place.isLinkedToRoute(route)) {
// either direction -
}
Place dest = route.getOtherEnd(place);
PositionMaster.isAboveOr(dest, place);
if (PositionMaster.checkDirection(dest, place, north_or_south, west_or_east)) {
if (checkCapacity(place, dest, party)) // checkDIstance() instead - EXPLORE_SPEED
{
list.add(dest);
}
}
}
return list;
}
Aggregations