Skip to content

Commit

Permalink
Added chronoTrigger 3 (and unified live alien recovery)
Browse files Browse the repository at this point in the history
- chronoTrigger: 3 is instant win (as chronoTrigger: 2) + all remaining enemies surrender
- mind controlled and surrendered enemies are not recovered anymore
if their corpseItem is not recoverable (=same condition as for stunned enemies)
  • Loading branch information
MeridianOXC committed Jan 18, 2018
1 parent 09951c8 commit 1399ef1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/Battlescape/BattlescapeGame.cpp
Expand Up @@ -634,6 +634,7 @@ void BattlescapeGame::endTurn()
_parentState->finishBattle(true, inExit);
return;
case FORCE_WIN:
case FORCE_WIN_SURRENDER:
_parentState->finishBattle(false, liveSoldiers);
return;
case FORCE_LOSE:
Expand Down
28 changes: 22 additions & 6 deletions src/Battlescape/DebriefingState.cpp
Expand Up @@ -1443,11 +1443,19 @@ void DebriefingState::prepareDebriefing()
}
}
}
recoverAlien(*j, base);
if (!(*j)->getArmor()->getCorpseBattlescape().empty())
{
RuleItem *corpseRule = _game->getMod()->getItem((*j)->getArmor()->getCorpseBattlescape().front());
if (corpseRule && corpseRule->isRecoverable())
{
recoverAlien(*j, base);
}
}
}
else if (oldFaction == FACTION_HOSTILE && !aborted && !_destroyBase
// surrendered units may as well count as unconscious too
&& playersSurvived > 0 && faction != FACTION_PLAYER && !(*j)->isOut() && (*j)->isSurrendering())
&& playersSurvived > 0 && faction != FACTION_PLAYER && (!(*j)->isOut() || (*j)->getStatus() == STATUS_IGNORE_ME)
&& ((*j)->isSurrendering() || battle->getChronoTrigger() == FORCE_WIN_SURRENDER))
{
if ((*j)->getTile())
{
Expand All @@ -1459,7 +1467,14 @@ void DebriefingState::prepareDebriefing()
}
}
}
recoverAlien(*j, base);
if (!(*j)->getArmor()->getCorpseBattlescape().empty())
{
RuleItem *corpseRule = _game->getMod()->getItem((*j)->getArmor()->getCorpseBattlescape().front());
if (corpseRule && corpseRule->isRecoverable())
{
recoverAlien(*j, base);
}
}
}
else if (oldFaction == FACTION_NEUTRAL)
{
Expand Down Expand Up @@ -2175,16 +2190,17 @@ void DebriefingState::recoverAlien(BattleUnit *from, Base *base)
else
{
RuleResearch *research = _game->getMod()->getResearch(type);
bool surrender = !from->isOut() && from->isSurrendering();
bool surrendered = (!from->isOut() || from->getStatus() == STATUS_IGNORE_ME)
&& (from->isSurrendering() || _game->getSavedGame()->getSavedBattle()->getChronoTrigger() == FORCE_WIN_SURRENDER);
if (research != 0 && !_game->getSavedGame()->isResearched(type))
{
// more points if it's not researched
addStat(surrender ? "STR_LIVE_ALIENS_SURRENDERED" : "STR_LIVE_ALIENS_RECOVERED", 1, from->getValue() * 2);
addStat(surrendered ? "STR_LIVE_ALIENS_SURRENDERED" : "STR_LIVE_ALIENS_RECOVERED", 1, from->getValue() * 2);
}
else
{
// 10 points for recovery
addStat(surrender ? "STR_LIVE_ALIENS_SURRENDERED" : "STR_LIVE_ALIENS_RECOVERED", 1, 10);
addStat(surrendered ? "STR_LIVE_ALIENS_SURRENDERED" : "STR_LIVE_ALIENS_RECOVERED", 1, 10);
}

base->getStorageItems()->addItem(type, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/AlienDeployment.h
Expand Up @@ -49,7 +49,7 @@ struct BriefingData
bool showCraft, showTarget;
BriefingData() : palette(0), textOffset(0), music("GMDEFEND"), background("BACK16.SCR"), showCraft(true), showTarget(true) { /*Empty by Design*/ };
};
enum ChronoTrigger { FORCE_LOSE, FORCE_ABORT, FORCE_WIN };
enum ChronoTrigger { FORCE_LOSE, FORCE_ABORT, FORCE_WIN, FORCE_WIN_SURRENDER };
enum EscapeType { ESCAPE_NONE, ESCAPE_EXIT, ESCAPE_ENTRY, ESCAPE_EITHER };
/**
* Represents a specific type of Alien Deployment.
Expand Down

0 comments on commit 1399ef1

Please sign in to comment.