Skip to content

Commit

Permalink
#700 Adds starting scenarion from another galaxy.
Browse files Browse the repository at this point in the history
AKA homeless.
  • Loading branch information
tuomount committed Feb 24, 2024
1 parent dddb4a0 commit d3c24d1
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 3 deletions.
13 changes: 12 additions & 1 deletion src/main/java/org/openRealmOfStars/player/StartingScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ public enum StartingScenario {
/**
* Start without home planet with 4 scouts and 2 colony ships.
*/
DESTROYED_HOME_PLANET;
DESTROYED_HOME_PLANET,
/**
* Start without home planet, since realm arrived from another galaxy.
* Start with 4 scouts and 2 colony ships.
*/
FROM_ANOTHER_GALAXY;


/**
Expand All @@ -91,6 +96,7 @@ public int getIndex() {
case HOT_ARID_SIZE12: return 8;
case FARMING_PLANET: return 9;
case DESTROYED_HOME_PLANET: return 10;
case FROM_ANOTHER_GALAXY: return 11;
default: throw new IllegalArgumentException("Unknown starting scenario.");
}
}
Expand All @@ -113,6 +119,7 @@ public static StartingScenario getByIndex(final int index) {
case 8: return HOT_ARID_SIZE12;
case 9: return FARMING_PLANET;
case 10: return DESTROYED_HOME_PLANET;
case 11: return FROM_ANOTHER_GALAXY;
default: throw new IllegalArgumentException("Unknown starting scenario.");
}
}
Expand All @@ -135,6 +142,7 @@ public String toString() {
case HOT_ARID_SIZE12: return "Hot, arid planet with extra tech";
case FARMING_PLANET: return "Temperate arid farming planet, but no ships";
case DESTROYED_HOME_PLANET: return "No home, start from deep space";
case FROM_ANOTHER_GALAXY: return "Arrived from another galaxy";
}
}

Expand Down Expand Up @@ -171,6 +179,9 @@ public String getDescription() {
+ " from deep space with 4 scouts and 2 colony ships. Colony fleet in"
+ " deep space provides extra research point."
+ " Single start allowed.";
case FROM_ANOTHER_GALAXY: return "No home planet. Start from deep space"
+ " with 4 scouts and 2 colony ships. Colony fleet in deep space"
+ " provides extra research point. Start with extra technology.";

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ public static String generateBackgroundStory(final PlayerInfo info,
sb.append("\n\n");
sb.append(generateGovernmentType(info, namePlural));
sb.append("\n\n");
sb.append(generateFtlStory(info, startingYear));
if (info.getStartingScenario() != StartingScenario.FROM_ANOTHER_GALAXY) {
sb.append(generateFtlStory(info, startingYear));
}
sb.append(generateExploration(info, namePlural, startPlanet));
return sb.toString();
}
Expand Down Expand Up @@ -910,6 +912,11 @@ private static String generateGovernmentType(final PlayerInfo info,
if (info.getGovernment().hasCreditRush()) {
traders = true;
}
if (info.getStartingScenario() == StartingScenario.FROM_ANOTHER_GALAXY) {
sb.append("Space pioneers space craft logs tell about history of ");
sb.append(info.getRace().getName());
sb.append("with following information: \n");
}
if (unity) {
switch (DiceGenerator.getRandom(3)) {
default:
Expand Down Expand Up @@ -1239,6 +1246,40 @@ private static String generateWorldType(final PlayerInfo info,
boolean harsh = false;
boolean cold = false;
boolean hot = false;
if (info.getStartingScenario() == StartingScenario.FROM_ANOTHER_GALAXY) {
sb.append(namePlural);
sb.append(" have been travelling millions of star years deep space "
+ "with help of cryo sleep. They have travelling from another"
+ " galaxy to this. ");
sb.append(" Their knowledge of their home planet is ");
switch (DiceGenerator.getRandom(3)) {
default:
case 0: {
sb.append("very vague and none of the pioneers cannot remember it due"
+ " the cryo sleep.");
break;
}
case 1: {
sb.append("limited to knowledge that it was ");
sb.append(startPlanet.getPlanetType().getTypeAsString());
sb.append(". No other information of ");
sb.append(namePlural);
sb.append(" home planet is available.");
break;
}
case 2: {
sb.append("unknown. Since all the records on space crafts of the home"
+ " planet was destroyed in ion storm star centuries ago.");
break;
}
case 3: {
sb.append("limited. None of the pioneers cannot remember due cryo"
+ " sleep and it seems left out of space crafts on purpose.");
break;
}
}
return sb.toString();
}
if (info.getRace().isLithovorian()) {
sb.append("Life were developed from silicate material");
switch (DiceGenerator.getRandom(2)) {
Expand Down
24 changes: 23 additions & 1 deletion src/main/java/org/openRealmOfStars/starMap/StarMapGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,9 @@ public void createRealmToGalaxy(final int x, final int y,
for (ShipStat stat : stats) {
int numShip = 1;
if (playerInfo.getStartingScenario()
== StartingScenario.DESTROYED_HOME_PLANET) {
== StartingScenario.DESTROYED_HOME_PLANET
|| playerInfo.getStartingScenario()
== StartingScenario.FROM_ANOTHER_GALAXY) {
if (stat.getDesign().isMilitaryShip()) {
numShip = 4;
}
Expand Down Expand Up @@ -904,6 +906,26 @@ private void createSolarSystem(final int sunx, final int suny,
}
playerInfo.setStartingScenario(StartingScenario.TEMPERATE_HUMID_SIZE12);
}
if (playerInfo.getStartingScenario()
== StartingScenario.FROM_ANOTHER_GALAXY) {
destroyedPlanetStartAdded = true;
int sx = sunx + DiceGenerator.getRandom(-1, 1);
int sy = suny + DiceGenerator.getRandom(-1, 1);
if (!elderRealmStart) {
createRealmToGalaxy(sx, sy, playerInfo, playerIndex);
} else if (playerInfo.isElderRealm()) {
createRealmToGalaxy(sx, sy, playerInfo, playerIndex);
} else {
SquareInfo info = new SquareInfo(SquareInfo.TYPE_DEEP_SPACE_START,
playerIndex);
starMap.setSquareInfo(sx, sy, info);
starMap.setTile(sx, sy, Tiles.getTileByName(TileNames.EMPTY)
.getIndex());
}
solarSystem = StarMapUtilities.setSolarSystem(solarSystem, sx,
sy, getMaxX(), getMaxY());
return;
}
}
if (playerIndex == -1 && !solHasAdded
&& DiceGenerator.getRandom(99) < 10) {
Expand Down

0 comments on commit d3c24d1

Please sign in to comment.