From c395ee25e56cd444d5e749cdb18e642bf3963018 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 19 Apr 2016 11:13:43 +0100 Subject: [PATCH] Allow AIF_ASSASSIN flag to be set, to always attack a target. --- src/battle/ai.c | 22 +++++++++++++--------- src/defs.h | 2 ++ src/system/lookup.c | 2 ++ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/battle/ai.c b/src/battle/ai.c index d0e382e..9bdf5b3 100644 --- a/src/battle/ai.c +++ b/src/battle/ai.c @@ -365,19 +365,23 @@ static int selectWeaponForTarget(Entity *e) { 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) diff --git a/src/defs.h b/src/defs.h index 489a053..3fac736 100644 --- a/src/defs.h +++ b/src/defs.h @@ -123,6 +123,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define AIF_COVERS_RETREAT (2 << 15) #define AIF_TARGET_FOCUS (2 << 16) #define AIF_DROPS_MINES (2 << 17) +#define AIF_ASSASSIN (2 << 18) /* player abilities */ #define BOOST_RECHARGE_TIME (FPS * 7) @@ -188,6 +189,7 @@ enum SIDE_REBEL, SIDE_PANDORAN, SIDE_PIRATE, + SIDE_MERC, SIDE_CSN, SIDE_UNF, SIDE_MAX diff --git a/src/system/lookup.c b/src/system/lookup.c index 161e310..2d32858 100644 --- a/src/system/lookup.c +++ b/src/system/lookup.c @@ -83,6 +83,7 @@ void initLookups(void) addLookup("AIF_COVERS_RETREAT", AIF_COVERS_RETREAT); addLookup("AIF_TARGET_FOCUS", AIF_TARGET_FOCUS); addLookup("AIF_DROPS_MINES", AIF_DROPS_MINES); + addLookup("AIF_ASSASSIN", AIF_ASSASSIN); addLookup("DT_ANY", DT_ANY); addLookup("DT_NO_SPIN", DT_NO_SPIN); @@ -106,6 +107,7 @@ void initLookups(void) addLookup("SIDE_ALLIES", SIDE_ALLIES); addLookup("SIDE_PIRATE", SIDE_PIRATE); addLookup("SIDE_REBEL", SIDE_REBEL); + addLookup("SIDE_MERC", SIDE_MERC); addLookup("SIDE_PANDORAN", SIDE_PANDORAN); addLookup("SIDE_CSN", SIDE_CSN); addLookup("SIDE_UNF", SIDE_UNF);