From 4e36f0731fe996508c7f97f74c3dc07253828099 Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 25 May 2016 12:26:25 +0100 Subject: [PATCH] Check surrender chance earlier in ai call. --- src/battle/ai.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/battle/ai.c b/src/battle/ai.c index 5215121..86ea420 100644 --- a/src/battle/ai.c +++ b/src/battle/ai.c @@ -65,6 +65,11 @@ void doAI(void) deployMine(); } + if ((self->aiFlags & AIF_SURRENDERS) && (battle.stats[STAT_TIME] % 6 == 0) && isSurrendering()) + { + return; + } + if ((self->aiFlags & (AIF_AVOIDS_COMBAT | AIF_EVADE)) && nearEnemies()) { return; @@ -107,11 +112,6 @@ void doAI(void) return; } - if ((self->aiFlags & AIF_SURRENDERS) && (battle.stats[STAT_TIME] % 6 == 0) && isSurrendering()) - { - return; - } - if (!(self->aiFlags & AIF_AVOIDS_COMBAT)) { if (self->speed) @@ -605,7 +605,7 @@ static int isSurrendering(void) { chance = self->health; chance /= self->maxHealth; - chance *= 75; + chance *= 100; if (rand() % 100 > chance) {