Allow AIF_ASSASSIN flag to be set, to always attack a target.

This commit is contained in:
Steve 2016-04-19 11:13:43 +01:00
parent add135d62e
commit c395ee25e5
3 changed files with 17 additions and 9 deletions

View File

@ -365,19 +365,23 @@ static int selectWeaponForTarget(Entity *e)
{ {
self->selectedGunType = self->guns[0].type; self->selectedGunType = self->guns[0].type;
if (e->flags & EF_MUST_DISABLE) /* if you're an assassin, just kill the target */
if (!(e->aiFlags & AIF_ASSASSIN))
{ {
if (e->systemPower > 0) if (e->flags & EF_MUST_DISABLE)
{ {
return selectWeapon(BT_MAG); if (e->systemPower > 0)
{
return selectWeapon(BT_MAG);
}
return 0;
} }
return 0; if (e->flags & EF_NO_KILL)
} {
return selectWeapon(BT_LASER) || selectWeapon(BT_MAG);
if (e->flags & EF_NO_KILL) }
{
return selectWeapon(BT_LASER) || selectWeapon(BT_MAG);
} }
if (e->shield > 0) if (e->shield > 0)

View File

@ -123,6 +123,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define AIF_COVERS_RETREAT (2 << 15) #define AIF_COVERS_RETREAT (2 << 15)
#define AIF_TARGET_FOCUS (2 << 16) #define AIF_TARGET_FOCUS (2 << 16)
#define AIF_DROPS_MINES (2 << 17) #define AIF_DROPS_MINES (2 << 17)
#define AIF_ASSASSIN (2 << 18)
/* player abilities */ /* player abilities */
#define BOOST_RECHARGE_TIME (FPS * 7) #define BOOST_RECHARGE_TIME (FPS * 7)
@ -188,6 +189,7 @@ enum
SIDE_REBEL, SIDE_REBEL,
SIDE_PANDORAN, SIDE_PANDORAN,
SIDE_PIRATE, SIDE_PIRATE,
SIDE_MERC,
SIDE_CSN, SIDE_CSN,
SIDE_UNF, SIDE_UNF,
SIDE_MAX SIDE_MAX

View File

@ -83,6 +83,7 @@ void initLookups(void)
addLookup("AIF_COVERS_RETREAT", AIF_COVERS_RETREAT); addLookup("AIF_COVERS_RETREAT", AIF_COVERS_RETREAT);
addLookup("AIF_TARGET_FOCUS", AIF_TARGET_FOCUS); addLookup("AIF_TARGET_FOCUS", AIF_TARGET_FOCUS);
addLookup("AIF_DROPS_MINES", AIF_DROPS_MINES); addLookup("AIF_DROPS_MINES", AIF_DROPS_MINES);
addLookup("AIF_ASSASSIN", AIF_ASSASSIN);
addLookup("DT_ANY", DT_ANY); addLookup("DT_ANY", DT_ANY);
addLookup("DT_NO_SPIN", DT_NO_SPIN); addLookup("DT_NO_SPIN", DT_NO_SPIN);
@ -106,6 +107,7 @@ void initLookups(void)
addLookup("SIDE_ALLIES", SIDE_ALLIES); addLookup("SIDE_ALLIES", SIDE_ALLIES);
addLookup("SIDE_PIRATE", SIDE_PIRATE); addLookup("SIDE_PIRATE", SIDE_PIRATE);
addLookup("SIDE_REBEL", SIDE_REBEL); addLookup("SIDE_REBEL", SIDE_REBEL);
addLookup("SIDE_MERC", SIDE_MERC);
addLookup("SIDE_PANDORAN", SIDE_PANDORAN); addLookup("SIDE_PANDORAN", SIDE_PANDORAN);
addLookup("SIDE_CSN", SIDE_CSN); addLookup("SIDE_CSN", SIDE_CSN);
addLookup("SIDE_UNF", SIDE_UNF); addLookup("SIDE_UNF", SIDE_UNF);