From b73a56e58773390945545bb6b1182952fa2aa953 Mon Sep 17 00:00:00 2001 From: Layla Marchant Date: Tue, 26 May 2020 20:03:42 -0400 Subject: [PATCH] Added some nerfs for the Mars mission in super-easy mode. This makes mines much less frequent and spreads the asteroids out much more. The other super-easy mode nerfs don't work on Mars, so these custom nerfs are necessary to keep the difficulty consistent. --- src/alien.c | 12 ++++++++++-- src/game.c | 9 ++++++++- src/mission.c | 20 +++++++++++++------- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/alien.c b/src/alien.c index 7e9d65d..b2c18ea 100644 --- a/src/alien.c +++ b/src/alien.c @@ -1474,8 +1474,16 @@ int alien_place(Object *alien) if (game.area == MISN_MARS) { - alien->x = screen->w + RANDRANGE(0, 400); - alien->y = RANDRANGE(-screen->h / 3, (4 * screen->h) / 3); + if (game.difficulty == DIFFICULTY_SUPEREASY) + { + alien->x = screen->w + RANDRANGE(0, 1200); + alien->y = RANDRANGE(-screen->h, screen->h); + } + else + { + alien->x = screen->w + RANDRANGE(0, 400); + alien->y = RANDRANGE(-screen->h / 3, (4 * screen->h) / 3); + } } for (int i = 0 ; i < ALIEN_MAX ; i++) diff --git a/src/game.c b/src/game.c index cd101d0..2ce321c 100644 --- a/src/game.c +++ b/src/game.c @@ -2448,6 +2448,8 @@ void game_getDifficultyText(char *dest, int difficulty) int game_mainLoop() { + float chance; + engine_resetLists(); mission_set(game.area); @@ -2774,7 +2776,12 @@ int game_mainLoop() if ((game.area == MISN_MARS) && (engine.addAliens > -1)) { - if ((rand() % 5) == 0) + if (game.difficulty == DIFFICULTY_SUPEREASY) + chance = 1. / 20.; + else + chance = 1. / 5.; + + if (CHANCE(chance)) // Note: The originally specified range for x was [800, 100], // which with the original rrand function caused the result // returned to be `800 + rand() % -699`. Clearly a mistake, diff --git a/src/mission.c b/src/mission.c index aa9eaf9..e5b131e 100644 --- a/src/mission.c +++ b/src/mission.c @@ -1186,17 +1186,23 @@ void mission_showStartScreen() if (mission.timeLimit1[0] > 0) { - if (game.area != MISN_MARS) + if (game.area == MISN_MARS) { - /// "%d" must be retained. It is replaced with the mission time - /// limit in minutes. - snprintf(temp, STRMAX_SHORT, _("TIME LIMIT: %d minutes"), mission.timeLimit1[0]); + snprintf(temp, STRMAX_SHORT, ngettext( + /// "%d" must be retained. It is replaced with the mission required + /// survival time in minutes. + "SURVIVAL FOR %d minute", + "SURVIVAL FOR %d minutes", + mission.timeLimit1[0]), mission.timeLimit1[0]); } else { - /// "%d" must be retained. It is replaced with the mission required - /// survival time in minutes. - snprintf(temp, STRMAX_SHORT, _("SURVIVAL FOR %d minutes"), mission.timeLimit1[0]); + snprintf(temp, STRMAX_SHORT, ngettext( + /// "%d" must be retained. It is replaced with the mission time + /// limit in minutes. + "TIME LIMIT: %d minute", + "TIME LIMIT: %d minutes", + mission.timeLimit1[0]), mission.timeLimit1[0]); } screen_renderUnicode(temp, -1, screen->h / 2 + 195, FONT_RED); }