Enable AI flags to focus on targets.
This commit is contained in:
parent
6016e46c37
commit
52691f7be5
|
@ -332,13 +332,15 @@ static int canAttack(Entity *e)
|
||||||
{
|
{
|
||||||
if (e->aiFlags & (AIF_AVOIDS_COMBAT | AIF_EVADE) || e->flags & EF_SECONDARY_TARGET)
|
if (e->aiFlags & (AIF_AVOIDS_COMBAT | AIF_EVADE) || e->flags & EF_SECONDARY_TARGET)
|
||||||
{
|
{
|
||||||
if (rand() % 5)
|
return !(rand() % 5);
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((self->aiFlags & AIF_TARGET_FOCUS) && (!(e->flags & EF_AI_TARGET)))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return selectWeaponForTarget(e);
|
return selectWeaponForTarget(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,6 +580,11 @@ static int nearEnemies(void)
|
||||||
{
|
{
|
||||||
if ((e->flags & EF_TAKES_DAMAGE) && e->side != self->side && !(e->flags & EF_DISABLED))
|
if ((e->flags & EF_TAKES_DAMAGE) && e->side != self->side && !(e->flags & EF_DISABLED))
|
||||||
{
|
{
|
||||||
|
if ((self->aiFlags & AIF_TARGET_FOCUS) && (e->flags & EF_AI_TARGET))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (getDistance(e->x, e->y, self->x, self->y) < 1000)
|
if (getDistance(e->x, e->y, self->x, self->y) < 1000)
|
||||||
{
|
{
|
||||||
self->targetLocation.x += e->x;
|
self->targetLocation.x += e->x;
|
||||||
|
|
|
@ -115,6 +115,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define AIF_EVADE (2 << 13)
|
#define AIF_EVADE (2 << 13)
|
||||||
#define AIF_WANDERS (2 << 14)
|
#define AIF_WANDERS (2 << 14)
|
||||||
#define AIF_COVERS_RETREAT (2 << 15)
|
#define AIF_COVERS_RETREAT (2 << 15)
|
||||||
|
#define AIF_TARGET_FOCUS (2 << 16)
|
||||||
|
|
||||||
/* player abilities */
|
/* player abilities */
|
||||||
#define BOOST_RECHARGE_TIME (FPS * 7)
|
#define BOOST_RECHARGE_TIME (FPS * 7)
|
||||||
|
|
|
@ -79,6 +79,7 @@ void initLookups(void)
|
||||||
addLookup("AIF_MOVES_TO_LEADER", AIF_MOVES_TO_LEADER);
|
addLookup("AIF_MOVES_TO_LEADER", AIF_MOVES_TO_LEADER);
|
||||||
addLookup("AIF_WANDERS", AIF_WANDERS);
|
addLookup("AIF_WANDERS", AIF_WANDERS);
|
||||||
addLookup("AIF_COVERS_RETREAT", AIF_COVERS_RETREAT);
|
addLookup("AIF_COVERS_RETREAT", AIF_COVERS_RETREAT);
|
||||||
|
addLookup("AIF_TARGET_FOCUS", AIF_TARGET_FOCUS);
|
||||||
|
|
||||||
addLookup("DT_ANY", DT_ANY);
|
addLookup("DT_ANY", DT_ANY);
|
||||||
addLookup("DT_NO_SPIN", DT_NO_SPIN);
|
addLookup("DT_NO_SPIN", DT_NO_SPIN);
|
||||||
|
|
Loading…
Reference in New Issue