From 93979c396f4c597803bd8819a80adb753322120b Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 11 Nov 2015 22:34:48 +0000 Subject: [PATCH] ALIVE_ESCAPED entities invoke triggers, objective, and condition updates. --- src/battle/fighters.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/battle/fighters.c b/src/battle/fighters.c index 9960462..9372057 100644 --- a/src/battle/fighters.c +++ b/src/battle/fighters.c @@ -226,6 +226,25 @@ void doFighter(void) } } + if (self->alive == ALIVE_ESCAPED) + { + if (self->side != SIDE_ALLIES) + { + addHudMessage(colors.red, "Mission target has escaped."); + battle.stats[STAT_ENEMIES_ESCAPED]++; + } + else + { + battle.stats[STAT_ALLIES_ESCAPED]++; + } + + updateObjective(self->name, TT_ESCAPED); + + updateCondition(self->name, TT_ESCAPED); + + checkTrigger("ESCAPE", TRIGGER_ESCAPES); + } + if (self->alive == ALIVE_DEAD) { if (self == player) @@ -471,18 +490,6 @@ static void checkHasFled(void) if (distance > 5000) { - if (self->side != SIDE_ALLIES) - { - addHudMessage(colors.red, "Mission target has escaped."); - battle.stats[STAT_ENEMIES_ESCAPED]++; - } - else - { - battle.stats[STAT_ALLIES_ESCAPED]++; - } - - checkTrigger("ESCAPE", TRIGGER_ESCAPES); - - self->alive = ALIVE_DEAD; + self->alive = ALIVE_ESCAPED; } }