Added a feature to force slave ships and cloak fighters to appear.

This causes these mission targets to always appear the first time
the player enters an interception, and every time after they fail
to appear (so that you never have two time-wasting interceptions in
a row). In the case of the rescue slaves mission, this takes the
form of forcing the first ship to be a slave ship, and in the case
of the cloak fighter, it simply forces the cloak fighter to appear.
In each case, the variable controlling whether or not the condition
is forced gets set to 0 if the mission target spawned, ensuring that
time-waster interceptions can still occur as long as they both are
preceded and followed by worthwhile interceptions.

I decided this was important when I was playing and noticed that I
wasn't getting slaves to rescue several times in a row. This
situation would be confusing to new players and possibly make them
think they were doing something wrong. It can also be very annoying
to just not get any chances to make progress because of bad RNG.
Forcing them to appear the first time allows the player to be
immediately introduced to the targets, and forcing them to appear if
they didn't last time limits the frustration of bad RNG by ensuring
that even with the worst RNG, some amount of progress can be made.
This commit is contained in:
diligentcircle 2021-09-16 02:16:00 -04:00
parent 36e6853fe1
commit 87fea0b2e0
5 changed files with 37 additions and 7 deletions

View File

@ -1190,7 +1190,11 @@ void aliens_init()
}
}
int alien_add()
/* Adds an alien. If spawnedMisnTarget is non-NULL, it is set to 1 if
* a mission target which can be forced with game.forceMisnTarget was
* spawned (or otherwise left unchanged).
*/
int alien_add(int *spawnedMisnTarget)
{
int index = alien_getFreeIndex();
@ -1315,10 +1319,19 @@ int alien_add()
&& (game.area != MISN_SIVEDI)
&& (game.area != MISN_MARS))
{
if ((game.system == SYSTEM_EYANANTH) && (game.area == MISN_INTERCEPTION))
if ((game.system == SYSTEM_EYANANTH)
&& (game.area == MISN_INTERCEPTION))
{
if (CHANCE(1. / 5.))
if (CHANCE(1. / 5.)
|| (game.difficulty != DIFFICULTY_ORIGINAL
&& game.forceMisnTarget))
{
randEnemy = CD_SLAVETRANSPORT;
game.forceMisnTarget = 0;
if (spawnedMisnTarget != NULL)
*spawnedMisnTarget = 1;
}
}
if (CHANCE(1. / 6.))

View File

@ -29,7 +29,7 @@ extern Object aliens[ALIEN_MAX];
void alien_nerf(int index);
void alien_defs_init();
void aliens_init();
int alien_add();
int alien_add(int *spawnedMisnTarget);
void alien_addDrone(Object *hostAlien);
void alien_addSmallAsteroid(Object *hostAlien);
void alien_addFriendly(int type);

View File

@ -104,6 +104,8 @@ void game_init()
game.slavesRescued = 0;
game.experimentalShield = 1000;
game.forceMisnTarget = 1;
game.timeTaken = 0;
game.stationedPlanet = -1;
@ -2523,6 +2525,7 @@ void game_getDifficultyText(char *dest, int difficulty)
int game_mainLoop()
{
int spawnedMisnTarget;
float chance;
engine_resetLists();
@ -2541,8 +2544,12 @@ int game_mainLoop()
if (game.area == MISN_ELAMALE)
aliens[ALIEN_KLINE].active = 0;
spawnedMisnTarget = 0;
for (int i = 0 ; i < engine.maxAliens ; i++)
alien_add();
alien_add(&spawnedMisnTarget);
if (!spawnedMisnTarget)
game.forceMisnTarget = 1;
if (game.hasWingMate1)
alien_addFriendly(ALIEN_PHOEBE);
@ -2594,7 +2601,9 @@ int game_mainLoop()
if ((game.system == SYSTEM_MORDOR) && (game.experimentalShield > 0))
{
if (CHANCE(4. / 5.))
if (CHANCE(4. / 5.)
|| (game.difficulty != DIFFICULTY_ORIGINAL
&& game.forceMisnTarget))
{
aliens[ALIEN_BOSS] = alien_defs[CD_CLOAKFIGHTER];
aliens[ALIEN_BOSS].owner = &aliens[ALIEN_BOSS];
@ -2605,7 +2614,10 @@ int game_mainLoop()
aliens[ALIEN_BOSS].y = player.y;
player_setTarget(ALIEN_BOSS);
aliens[ALIEN_BOSS].shield = game.experimentalShield;
game.forceMisnTarget = 0;
}
else
game.forceMisnTarget = 1;
}
// Note: music is started here only for interceptions. For
@ -2893,7 +2905,7 @@ int game_mainLoop()
WRAP_ADD(engine.addAliens, -1, 0, mission.addAliens);
if ((engine.addAliens == 0) && (allowableAliens > 0))
{
allowableAliens -= alien_add();
allowableAliens -= alien_add(NULL);
}
}

View File

@ -64,6 +64,9 @@ typedef struct Game_ {
// remaining shield for experimental fighter
int experimentalShield;
// Whether to force interception targets to appear
int forceMisnTarget;
Uint32 timeTaken; // In seconds
int missionCompleted[MAX_PLANETS];

View File

@ -179,6 +179,7 @@ void intermission_updateSystemStatus()
game.stationedPlanet = 0;
game.system = 1;
game.area = MISN_RESCUESLAVES;
game.forceMisnTarget = 1;
intermission_initPlanets(game.system);
if (game.difficulty == DIFFICULTY_ORIGINAL)
@ -189,6 +190,7 @@ void intermission_updateSystemStatus()
game.stationedPlanet = 0;
game.system = 2;
game.area = MISN_CLOAKFIGHTER;
game.forceMisnTarget = 1;
intermission_initPlanets(game.system);
if (game.difficulty == DIFFICULTY_ORIGINAL)