Search in sources :

Example 1 with Route

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++;
    }
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) PlaceActor(eidolons.libgdx.screens.map.obj.PlaceActor) Actor(com.badlogic.gdx.scenes.scene2d.Actor) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener) Route(eidolons.game.module.adventure.map.Route) NinePatchDrawable(com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable) TablePanel(eidolons.libgdx.gui.panels.TablePanel)

Example 2 with Route

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);
}
Also used : Area(eidolons.game.module.adventure.map.Area) MacroParty(eidolons.game.module.adventure.entity.MacroParty) Route(eidolons.game.module.adventure.map.Route)

Example 3 with Route

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);
        }
    }
}
Also used : MacroParty(eidolons.game.module.adventure.entity.MacroParty) Place(eidolons.game.module.adventure.map.Place) Route(eidolons.game.module.adventure.map.Route)

Example 4 with Route

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?
    }
}
Also used : Place(eidolons.game.module.adventure.map.Place) Route(eidolons.game.module.adventure.map.Route)

Example 5 with Route

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;
}
Also used : ArrayList(java.util.ArrayList) Place(eidolons.game.module.adventure.map.Place) Route(eidolons.game.module.adventure.map.Route)

Aggregations

Route (eidolons.game.module.adventure.map.Route)14 Place (eidolons.game.module.adventure.map.Place)6 MacroParty (eidolons.game.module.adventure.entity.MacroParty)3 ObjType (main.entity.type.ObjType)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)1 NinePatchDrawable (com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)1 Area (eidolons.game.module.adventure.map.Area)1 ValueContainer (eidolons.libgdx.gui.generic.ValueContainer)1 TablePanel (eidolons.libgdx.gui.panels.TablePanel)1 PlaceActor (eidolons.libgdx.screens.map.obj.PlaceActor)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Coordinates (main.game.bf.Coordinates)1