AI tweaks - make the game less frantic, and AI less likely to fire missiles at player.

This commit is contained in:
Steve 2015-11-14 11:32:37 +00:00
parent 1760c9e3b3
commit f4402bfb72
2 changed files with 13 additions and 14 deletions

View File

@ -22,11 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static int aggression[][5] = static int aggression[][5] =
{ {
{25, 35, 35, 40, 50}, {60, 65, 70, 75, 80},
{20, 30, 30, 35, 40}, {50, 55, 60, 65, 70},
{15, 20, 25, 30, 35}, {40, 45, 50, 55, 60},
{10, 15, 20, 25, 30}, {30, 35, 40, 45, 50},
{5, 10, 15, 20, 25} {20, 25, 30, 35, 40}
}; };
static void faceTarget(Entity *f); static void faceTarget(Entity *f);
@ -86,22 +86,22 @@ void doAI(void)
if (r <= aggression[self->aggression][0]) if (r <= aggression[self->aggression][0])
{ {
self->action = dodge; self->action = dodge;
self->aiActionTime = FPS * 2; self->aiActionTime = FPS;
} }
else if (r <= aggression[self->aggression][1]) else if (r <= aggression[self->aggression][1])
{ {
self->action = boost; self->action = boost;
self->aiActionTime = FPS * 1; self->aiActionTime = FPS / 2;
} }
else if (r <= aggression[self->aggression][2]) else if (r <= aggression[self->aggression][2])
{ {
self->action = slow; self->action = slow;
self->aiActionTime = FPS * 1; self->aiActionTime = FPS / 2;
} }
else if (r <= aggression[self->aggression][3]) else if (r <= aggression[self->aggression][3])
{ {
self->action = flyStraight; self->action = flyStraight;
self->aiActionTime = FPS * 1; self->aiActionTime = FPS;
} }
else if (r <= aggression[self->aggression][4]) else if (r <= aggression[self->aggression][4])
{ {
@ -111,7 +111,7 @@ void doAI(void)
else else
{ {
self->action = huntAndAttackTarget; self->action = huntAndAttackTarget;
self->aiActionTime = FPS * 1; self->aiActionTime = FPS;
} }
if (player != NULL && battle.numEnemies <= 2 && self->flags & EF_FLEES) if (player != NULL && battle.numEnemies <= 2 && self->flags & EF_FLEES)
@ -157,7 +157,6 @@ static void huntAndAttackTarget(void)
if (dist <= 250) if (dist <= 250)
{ {
applyFighterBrakes(); applyFighterBrakes();
self->aiActionTime = MIN(FPS, self->aiActionTime);
} }
else else
{ {
@ -308,11 +307,11 @@ static void preAttack(void)
{ {
if (!self->reload) if (!self->reload)
{ {
if (self->guns[0].type && (self->missiles.ammo == 0 || (rand() % 50) > 0)) if (self->guns[0].type && (self->missiles.ammo == 0 || rand() % 50 > 0))
{ {
fireGuns(self); fireGuns(self);
} }
else if (self->missiles.ammo) else if (self->missiles.ammo && (self->target != player || rand() % 10 == 0))
{ {
fireMissile(self); fireMissile(self);
} }

View File

@ -48,7 +48,7 @@ Entity *spawnFighter(char *name, int x, int y, int side)
switch (side) switch (side)
{ {
case SIDE_ALLIES: case SIDE_ALLIES:
f->aggression = 1 + rand() % 3; f->aggression = 2 + rand() % 3;
break; break;
case SIDE_PIRATE: case SIDE_PIRATE: