diff --git a/src/battle/ai.c b/src/battle/ai.c index 7d2522c..8e619e4 100644 --- a/src/battle/ai.c +++ b/src/battle/ai.c @@ -595,7 +595,7 @@ static int isSurrendering(void) { float chance; - if (!(self->flags & EF_SURRENDERED)) + if (!(self->aiFlags & AIF_SURRENDERED)) { if (self->health < self->maxHealth) { @@ -605,9 +605,10 @@ static int isSurrendering(void) if (rand() % 100 > chance) { - self->aiActionTime = FPS * 3; + self->aiActionTime = FPS * 2; self->aiFlags |= AIF_AVOIDS_COMBAT; + self->aiFlags |= AIF_SURRENDERING; self->aiFlags &= ~AIF_SURRENDERS; self->flags |= EF_MUST_DISABLE; @@ -633,7 +634,8 @@ static void doSurrender(void) { if (--self->aiActionTime <= 0) { - self->flags |= EF_SURRENDERED; + self->aiFlags &= ~AIF_SURRENDERING; + self->aiFlags |= AIF_SURRENDERED; nextAction(); } diff --git a/src/battle/fighters.c b/src/battle/fighters.c index e2877d7..ce6be29 100644 --- a/src/battle/fighters.c +++ b/src/battle/fighters.c @@ -234,6 +234,12 @@ void doFighter(void) self->flags |= EF_DISABLED; self->flags |= EF_SECONDARY_TARGET; + + if (self->aiFlags & AIF_SURRENDERING) + { + self->aiFlags |= AIF_SURRENDERED; + self->aiFlags &= ~AIF_SURRENDERING; + } battle.stats[STAT_ENEMIES_DISABLED]++; @@ -347,7 +353,7 @@ void doFighter(void) updateCondition(self->groupName, TT_DESTROY); /* don't fire if the opposing side is responsible */ - if (self->flags & EF_SURRENDERED && self->killedBy->side == player->side) + if (self->aiFlags & AIF_SURRENDERED && self->killedBy->side == player->side) { updateCondition("SURRENDERED", TT_DESTROY); } diff --git a/src/defs.h b/src/defs.h index 3881be3..b540789 100644 --- a/src/defs.h +++ b/src/defs.h @@ -109,8 +109,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define EF_NO_THREAT (2 << 23) #define EF_DROPS_ITEMS (2 << 24) #define EF_COMMON_FIGHTER (2 << 25) -#define EF_SURRENDERED (2 << 26) -#define EF_KILLED_PLAYER (2 << 27) +#define EF_KILLED_PLAYER (2 << 26) #define AIF_NONE 0 #define AIF_FOLLOWS_PLAYER (2 << 0) @@ -135,6 +134,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define AIF_SUSPICIOUS (2 << 19) #define AIF_ZAK_SUSPICIOUS (2 << 20) #define AIF_SURRENDERS (2 << 21) +#define AIF_SURRENDERING (2 << 22) +#define AIF_SURRENDERED (2 << 23) /* player abilities */ #define BOOST_RECHARGE_TIME (FPS * 7)