From 7799c60652e425df84618872e7846f8d0bf1711c Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 28 Jul 2016 14:57:23 +0100 Subject: [PATCH] Allow suspicion level to drop if player is close to wing leader. --- src/battle/ai.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/battle/ai.c b/src/battle/ai.c index 819a887..3d6fc9c 100644 --- a/src/battle/ai.c +++ b/src/battle/ai.c @@ -1085,21 +1085,32 @@ static void wander(void) */ void checkSuspicionLevel(void) { + long distance; + if (battle.status == MS_IN_PROGRESS && player->side != SIDE_ALLIES) { battle.suspicionCoolOff = MAX(battle.suspicionCoolOff - 1, 0); + distance = getDistance(self->x, self->y, player->x, player->y); + /* raise if player is too far away and there are no enemies */ - if (battle.suspicionCoolOff == 0 && battle.numEnemies == 0 && getDistance(self->x, self->y, player->x, player->y) > SCREEN_HEIGHT) + if (battle.suspicionCoolOff == 0 && battle.numEnemies == 0 && distance > SCREEN_HEIGHT) { battle.suspicionLevel++; } - /* raise while there are enemies around, to spir the player into taking action */ - if (battle.numEnemies > 0 && battle.stats[STAT_TIME] % 5 == 0) + /* raise if there are enemies around, lower if none and player is close to leader */ + if (battle.stats[STAT_TIME] % 5 == 0) { - battle.suspicionLevel++; - battle.suspicionCoolOff = FPS * 30; + if (battle.numEnemies > 0) + { + battle.suspicionLevel++; + battle.suspicionCoolOff = FPS * 30; + } + else if (distance <= SCREEN_HEIGHT / 2) + { + battle.suspicionLevel = MAX(battle.suspicionLevel - 1, 0); + } } } }