Check surrender chance earlier in ai call.
This commit is contained in:
parent
4c224fdabb
commit
4e36f0731f
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue