Complete mission if player escapes.

This commit is contained in:
Steve 2015-11-20 22:52:35 +00:00
parent 197a9fc799
commit b44f208f6c
2 changed files with 36 additions and 0 deletions

View File

@ -227,10 +227,25 @@ void doFighter(void)
battle.stats[STAT_ENEMIES_DISABLED]++;
}
}
if (self->target != NULL && self->target->alive != ALIVE_ALIVE)
{
self->target = NULL;
if (self != player)
{
self->action = doAI;
}
}
}
if (self->alive == ALIVE_ESCAPED)
{
if (self == player)
{
completeMission();
}
if (self->side != SIDE_ALLIES)
{
addHudMessage(colors.red, "Mission target has escaped.");
@ -279,6 +294,8 @@ void doFighter(void)
{
addHudMessage(colors.red, "Ally has been killed");
}
checkTrigger("ALLIES_KILLED", TRIGGER_LOSSES);
}
}
}
@ -534,6 +551,24 @@ void fleeAllEnemies(void)
}
}
void retreatAllies(void)
{
Entity *e;
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
{
if (e->type == ET_FIGHTER && e->side == SIDE_ALLIES)
{
e->flags |= EF_FLEEING;
e->aiFlags |= AIF_AVOIDS_COMBAT;
e->aiFlags |= AIF_UNLIMITED_RANGE;
e->aiFlags |= AIF_GOAL_EXTRACTION;
e->aiFlags &= ~AIF_FOLLOWS_PLAYER;
}
}
}
Entity *getFighterDef(char *name)
{
Entity *f;

View File

@ -47,6 +47,7 @@ extern char *readFile(char *filename);
extern long lookup(char *name);
extern long flagsToLong(char *flags);
extern void addShieldSplinterEffect(Entity *ent);
extern void completeMission(void);
extern App app;
extern Battle battle;