diff --git a/data/fighters/ataf.json b/data/fighters/ataf.json index 701f84c..fbc75b8 100644 --- a/data/fighters/ataf.json +++ b/data/fighters/ataf.json @@ -7,6 +7,7 @@ "shieldRechargeRate" : 5, "textureName" : "gfx/fighters/ataf.png", "flags" : "EF_NO_EPIC", + "aiFlags" : "AIF_MOVES_TO_PLAYER", "guns" : [ { "type" : "BT_PLASMA", diff --git a/data/fighters/civilian.json b/data/fighters/civilian.json index 3d38a84..44606ea 100644 --- a/data/fighters/civilian.json +++ b/data/fighters/civilian.json @@ -7,5 +7,5 @@ "shieldRechargeRate" : 0, "textureName" : "gfx/craft/civilian01.png", "flags" : "EF_MISSION_TARGET+EF_RETREATING", - "aiFlags" : "AIF_GOAL_EXTRACTION+AIF_AVOIDS_COMBAT" + "aiFlags" : "AIF_GOAL_EXTRACTION+AIF_AVOIDS_COMBAT+AIF_FOLLOWS_PLAYER" } diff --git a/data/fighters/firefly.json b/data/fighters/firefly.json index de58151..65c27a5 100644 --- a/data/fighters/firefly.json +++ b/data/fighters/firefly.json @@ -24,5 +24,6 @@ } ], "combinedGuns" : 1, - "missiles" : 3 + "missiles" : 3, + "aiFlags" : "AIF_MOVES_TO_PLAYER" } diff --git a/data/fighters/hammerhead.json b/data/fighters/hammerhead.json index 16ee7da..ae09eb0 100644 --- a/data/fighters/hammerhead.json +++ b/data/fighters/hammerhead.json @@ -24,5 +24,5 @@ } ], "missiles" : 6, - "aiFlags" : "AIF_MISSILE_BOAT+AIF_DEFENSIVE" + "aiFlags" : "AIF_MISSILE_BOAT+AIF_DEFENSIVE+AIF_MOVES_TO_PLAYER" } diff --git a/data/fighters/hyenaA.json b/data/fighters/hyenaA.json index c7ad6a1..3c0adae 100644 --- a/data/fighters/hyenaA.json +++ b/data/fighters/hyenaA.json @@ -28,5 +28,6 @@ "y" : -12 } ], - "missiles" : 4 + "missiles" : 4, + "aiFlags" : "AIF_MOVES_TO_PLAYER" } diff --git a/data/fighters/hyenaB.json b/data/fighters/hyenaB.json index 9b0b557..01c1281 100644 --- a/data/fighters/hyenaB.json +++ b/data/fighters/hyenaB.json @@ -28,5 +28,6 @@ "y" : -12 } ], - "missiles" : 4 + "missiles" : 4, + "aiFlags" : "AIF_MOVES_TO_PLAYER" } diff --git a/data/fighters/kingfisher.json b/data/fighters/kingfisher.json index 629d65d..f5f2540 100644 --- a/data/fighters/kingfisher.json +++ b/data/fighters/kingfisher.json @@ -28,5 +28,6 @@ "y" : -12 } ], - "missiles" : 4 + "missiles" : 4, + "aiFlags" : "AIF_MOVES_TO_PLAYER" } diff --git a/data/fighters/leopard.json b/data/fighters/leopard.json index be28362..7389e0b 100644 --- a/data/fighters/leopard.json +++ b/data/fighters/leopard.json @@ -23,5 +23,6 @@ "y" : -16 } ], - "missiles" : 3 + "missiles" : 3, + "aiFlags" : "AIF_MOVES_TO_PLAYER" } diff --git a/data/fighters/nymph.json b/data/fighters/nymph.json index 6331512..13cd585 100644 --- a/data/fighters/nymph.json +++ b/data/fighters/nymph.json @@ -18,5 +18,6 @@ "y" : -2 } ], - "missiles" : 3 + "missiles" : 3, + "aiFlags" : "AIF_MOVES_TO_PLAYER" } diff --git a/data/fighters/ray.json b/data/fighters/ray.json index c65c13a..217608f 100644 --- a/data/fighters/ray.json +++ b/data/fighters/ray.json @@ -28,5 +28,6 @@ "y" : -12 } ], - "missiles" : 4 + "missiles" : 4, + "aiFlags" : "AIF_MOVES_TO_PLAYER" } diff --git a/data/fighters/rook.json b/data/fighters/rook.json index 51304b9..036813e 100644 --- a/data/fighters/rook.json +++ b/data/fighters/rook.json @@ -28,5 +28,6 @@ "y" : 0 } ], - "missiles" : 4 + "missiles" : 4, + "aiFlags" : "AIF_MOVES_TO_PLAYER" } diff --git a/data/fighters/shuttle.json b/data/fighters/shuttle.json index 8b01832..5af01ec 100644 --- a/data/fighters/shuttle.json +++ b/data/fighters/shuttle.json @@ -7,5 +7,5 @@ "shieldRechargeRate" : 60, "textureName" : "gfx/craft/shuttle.png", "flags" : "EF_COLLECTS_ITEMS", - "aiFlags" : "AIF_AVOIDS_COMBAT+AIF_COLLECTS_ITEMS+AIF_UNLIMITED_RANGE" + "aiFlags" : "AIF_AVOIDS_COMBAT+AIF_COLLECTS_ITEMS+AIF_MOVES_TO_PLAYER" } diff --git a/data/fighters/taf.json b/data/fighters/taf.json index ca1c729..9540eb0 100644 --- a/data/fighters/taf.json +++ b/data/fighters/taf.json @@ -18,5 +18,6 @@ "y" : -12 } ], - "missiles" : 4 + "missiles" : 4, + "aiFlags" : "AIF_MOVES_TO_PLAYER" } diff --git a/data/fighters/tug.json b/data/fighters/tug.json index f961124..064fb6f 100644 --- a/data/fighters/tug.json +++ b/data/fighters/tug.json @@ -14,5 +14,5 @@ } ], "flags" : "EF_HAS_ROPE", - "aiFlags" : "AIF_AVOIDS_COMBAT+AIF_TOWS" + "aiFlags" : "AIF_AVOIDS_COMBAT+AIF_TOWS+AIF_MOVES_TO_PLAYER" } diff --git a/src/battle/ai.c b/src/battle/ai.c index 6c9e76d..a069951 100644 --- a/src/battle/ai.c +++ b/src/battle/ai.c @@ -87,7 +87,7 @@ void doAI(void) return; } - if (self->aiFlags & AIF_FOLLOWS_PLAYER) + if (self->aiFlags & (AIF_FOLLOWS_PLAYER|AIF_MOVES_TO_PLAYER)) { lookForPlayer(); return; @@ -114,7 +114,7 @@ static void doFighterAI(void) if (self->target == NULL) { - if (self->aiFlags & AIF_FOLLOWS_PLAYER && player != NULL) + if (self->aiFlags & AIF_MOVES_TO_PLAYER && player != NULL) { moveToPlayer(); } @@ -627,7 +627,7 @@ static void moveToTowableCraft(void) static void lookForPlayer(void) { - long range = (self->aiFlags & AIF_UNLIMITED_RANGE) ? MAX_TARGET_RANGE : 1000; + int range = (self->aiFlags & AIF_MOVES_TO_PLAYER) ? MAX_TARGET_RANGE : 2000; if (player != NULL && getDistance(self->x, self->y, player->x, player->y) < range) { diff --git a/src/battle/fighters.c b/src/battle/fighters.c index 4571586..81c8b9f 100644 --- a/src/battle/fighters.c +++ b/src/battle/fighters.c @@ -52,11 +52,6 @@ Entity *spawnFighter(char *name, int x, int y, int side) { case SIDE_ALLIES: f->aiAggression = rand() % 3; - f->aiFlags |= AIF_FOLLOWS_PLAYER; - if (!(f->aiFlags & AIF_AVOIDS_COMBAT)) - { - f->aiFlags |= AIF_UNLIMITED_RANGE; - } break; case SIDE_PIRATE: @@ -557,6 +552,7 @@ void retreatAllies(void) e->aiFlags |= AIF_UNLIMITED_RANGE; e->aiFlags |= AIF_GOAL_EXTRACTION; e->aiFlags &= ~AIF_FOLLOWS_PLAYER; + e->aiFlags &= ~AIF_MOVES_TO_PLAYER; } } } diff --git a/src/defs.h b/src/defs.h index 012f0c2..11b47a3 100644 --- a/src/defs.h +++ b/src/defs.h @@ -78,14 +78,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define AIF_NONE 0 #define AIF_FOLLOWS_PLAYER (2 << 0) -#define AIF_UNLIMITED_RANGE (2 << 1) -#define AIF_COLLECTS_ITEMS (2 << 2) -#define AIF_TOWS (2 << 3) -#define AIF_RETREATS (2 << 4) -#define AIF_GOAL_EXTRACTION (2 << 5) -#define AIF_AVOIDS_COMBAT (2 << 6) -#define AIF_DEFENSIVE (2 << 7) -#define AIF_MISSILE_BOAT (2 << 8) +#define AIF_MOVES_TO_PLAYER (2 << 1) +#define AIF_UNLIMITED_RANGE (2 << 2) +#define AIF_COLLECTS_ITEMS (2 << 3) +#define AIF_TOWS (2 << 4) +#define AIF_RETREATS (2 << 5) +#define AIF_GOAL_EXTRACTION (2 << 6) +#define AIF_AVOIDS_COMBAT (2 << 7) +#define AIF_DEFENSIVE (2 << 8) +#define AIF_MISSILE_BOAT (2 << 9) /* player abilities */ #define BOOST_RECHARGE_TIME (FPS * 7) diff --git a/src/system/lookup.c b/src/system/lookup.c index 546b103..5d6fd9e 100644 --- a/src/system/lookup.c +++ b/src/system/lookup.c @@ -44,6 +44,7 @@ void initLookups(void) addLookup("EF_NO_EPIC", EF_NO_EPIC); addLookup("AIF_NONE", AIF_NONE); + addLookup("AIF_MOVES_TO_PLAYER", AIF_MOVES_TO_PLAYER); addLookup("AIF_FOLLOWS_PLAYER", AIF_FOLLOWS_PLAYER); addLookup("AIF_UNLIMITED_RANGE", AIF_UNLIMITED_RANGE); addLookup("AIF_COLLECTS_ITEMS", AIF_COLLECTS_ITEMS);