Disabled target AI bug fixes.
This commit is contained in:
parent
c87c95fbde
commit
db78edb5a3
|
@ -148,7 +148,7 @@ static void doFighterAI(void)
|
|||
self->target = NULL;
|
||||
}
|
||||
|
||||
if (!self->target || self->target->systemPower <= 0)
|
||||
if (!self->target || (self->target->systemPower <= 0 && (self->target->flags & EF_MUST_DISABLE)))
|
||||
{
|
||||
findTarget();
|
||||
|
||||
|
@ -344,6 +344,13 @@ static int canAttack(Entity *e)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!(self->aiFlags & AIF_ASSASSIN))
|
||||
{
|
||||
if (e->flags & EF_MUST_DISABLE)
|
||||
{
|
||||
return e->systemPower > 0;
|
||||
}
|
||||
|
||||
if (!(e->flags & EF_AI_TARGET))
|
||||
{
|
||||
if (e->aiFlags & (AIF_AVOIDS_COMBAT | AIF_EVADE) || e->flags & EF_SECONDARY_TARGET)
|
||||
|
@ -357,6 +364,7 @@ static int canAttack(Entity *e)
|
|||
{
|
||||
return !(rand() % 100);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -369,15 +377,10 @@ static int selectWeaponForTarget(Entity *e)
|
|||
if (!(self->aiFlags & AIF_ASSASSIN))
|
||||
{
|
||||
if (e->flags & EF_MUST_DISABLE)
|
||||
{
|
||||
if (e->systemPower > 0)
|
||||
{
|
||||
return selectWeapon(BT_MAG);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (e->flags & EF_NO_KILL)
|
||||
{
|
||||
return selectWeapon(BT_LASER) || selectWeapon(BT_MAG);
|
||||
|
@ -482,7 +485,7 @@ static void preAttack(void)
|
|||
{
|
||||
fireGuns(self);
|
||||
}
|
||||
else if (self->missiles && (!(self->target->flags & EF_NO_KILL)) && getDistance(self->x, self->y, self->target->x, self->target->y) >= 350)
|
||||
else if (self->missiles && (!(self->target->flags & (EF_NO_KILL|EF_MUST_DISABLE))) && getDistance(self->x, self->y, self->target->x, self->target->y) >= 350)
|
||||
{
|
||||
fireMissile(self);
|
||||
|
||||
|
|
Loading…
Reference in New Issue