use of eidolons.game.module.adventure.map.Place in project Eidolons by IDemiurge.
the class EditorManager method create.
private static <E extends MapActor> MacroObj create(ObjType type) {
MacroRef ref = new MacroRef(MacroGame.game);
ref.setPlayer(MacroGame.game.getPlayerFaction().getOwner());
ref.setPlayer(MacroGame.game.getFactions().get(0).getOwner());
if (type.getOBJ_TYPE_ENUM() == MACRO_OBJ_TYPES.PLACE)
return new Place(MacroGame.game, type, ref);
if (type.getOBJ_TYPE_ENUM() == DC_TYPE.PARTY)
try {
MacroParty party = new MacroParty(type, MacroGame.game, ref);
party.getParty().initMembers();
return party;
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
return null;
}
use of eidolons.game.module.adventure.map.Place 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.Place 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.Place 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;
}
use of eidolons.game.module.adventure.map.Place in project Eidolons by IDemiurge.
the class TravelMasterOld method travel.
private static boolean travel(MacroParty party, Route route, int hoursToTravel) {
int length = route.getLength();
int mod = route.getSpeedMod();
mod = mod - mod * route.getBendFactor() / 100;
Boolean back = // TODO
party.checkBool(DYNAMIC_BOOLS.BACKWARDS_ROUTE_TRAVEL);
int leaguesTraveled = party.getIntParam(MACRO_PARAMS.TRAVEL_SPEED) * hoursToTravel * mod / 100;
int progress = party.getIntParam(MACRO_PARAMS.ROUTE_PROGRESS);
int progressPercentageMade = 100 * leaguesTraveled / length;
TimeMaster.hoursPassed(1);
Encounter e = null;
if (!testMode) {
try {
e = EncounterMaster.checkEncounter(party, progressPercentageMade);
} catch (Exception e1) {
e1.printStackTrace();
}
}
if (e != null) {
// time instead?
progress = e.getProgressMadeBeforeBattle();
hoursToTravel = TimeMaster.getHoursPerTurn() - e.getHoursIntoTheTurn();
boolean result = EncounterMaster.resolveEncounter(e);
if (result) {
progress += party.getIntParam(MACRO_PARAMS.TRAVEL_SPEED) * mod / 100 * hoursToTravel;
} else {
return false;
}
}
progress += leaguesTraveled;
// party.getCurrentDestination(), party.getLastLocation());
if (progress < length) {
int progressPerc = 100 * route.getLength() / progress;
route.setParam(MACRO_PARAMS.ROUTE_PROGRESS_PERCENTAGE, progressPerc);
Journal.logTravelProgress(RandomWizard.random(), RandomWizard.random(), leaguesTraveled, progress, route, party);
party.setParam(MACRO_PARAMS.ROUTE_PROGRESS, progress);
// getting
return true;
} else {
leaguesTraveled = length - progress;
progress = length;
int progressPerc = 100 * route.getLength() / progress;
route.setParam(MACRO_PARAMS.ROUTE_PROGRESS_PERCENTAGE, progressPerc);
Place place = back ? route.getOrigin() : route.getDestination();
int hoursLeft = (progress - length) * TimeMaster.getHoursPerTurn() / party.getIntParam(MACRO_PARAMS.TRAVEL_SPEED);
Journal.logTravelComplete(RandomWizard.random(), RandomWizard.random(), back ? route.getOrigin() : route.getDestination(), route, party, hoursLeft);
// TimeMaster.setTimeRemaining(hoursLeft);
enterPlace(party, place);
// party.useTime(hoursLeft);
return false;
}
}
Aggregations