From 23e38a6313fce77cb5f1896eac05e624e49b6126 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 8 May 2016 08:43:16 +0100 Subject: [PATCH] Allow player to be disabled in Challenge mode. --- src/battle/hud.c | 4 ++++ src/battle/player.c | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/battle/hud.c b/src/battle/hud.c index 006d720..773d0e4 100644 --- a/src/battle/hud.c +++ b/src/battle/hud.c @@ -458,6 +458,10 @@ static void drawObjectives(void) { drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, "%d / %d", battle.stats[STAT_CIVILIANS_RESCUED], game.currentMission->challengeData.rescueLimit); } + else if (player->flags & EF_MUST_DISABLE) + { + drawText(SCREEN_WIDTH / 2, 35, 14, TA_CENTER, colors.white, _("System Power : %d%%"), player->systemPower); + } } } diff --git a/src/battle/player.c b/src/battle/player.c index 9918fa0..457b4ea 100644 --- a/src/battle/player.c +++ b/src/battle/player.c @@ -142,6 +142,16 @@ void doPlayer(void) initPlayerSelect(); } } + + /* really only used in challenge mode */ + if (player->systemPower <= 0 && battle.status == MS_IN_PROGRESS) + { + if (game.currentMission->challengeData.isChallenge) + { + addHudMessage(colors.red, _("Challenge Failed!")); + failMission(); + } + } if (battle.status == MS_IN_PROGRESS) {