Added defensive AI flags - only attack sometimes.

This commit is contained in:
Steve 2015-11-21 23:27:43 +00:00
parent f273862c19
commit 94e0259953
7 changed files with 22 additions and 8 deletions

View File

@ -22,6 +22,5 @@
"type" : "MISSILE_MISSILE",
"ammo" : 60
},
"flags" : "EF_AVOIDS_COMBAT",
"aiFlags" : "AIF_MISSILE_BOAT"
"aiFlags" : "AIF_MISSILE_BOAT+AIF_DEFENSIVE"
}

View File

@ -27,6 +27,5 @@
"type" : "MISSILE_MISSILE",
"ammo" : 80
},
"flags" : "EF_AVOIDS_COMBAT",
"aiFlags" : "AIF_MISSILE_BOAT"
"aiFlags" : "AIF_MISSILE_BOAT+AIF_DEFENSIVE"
}

View File

@ -19,5 +19,8 @@
"data/fighters/kingfisher.json",
"data/fighters/mantis.json",
"data/fighters/rook.json",
"data/fighters/thunderhead.json"
"data/fighters/thunderhead.json",
"data/fighters/scarab.json",
"data/fighters/hammerhead.json",
"data/fighters/khepri.json"
]

View File

@ -16,12 +16,16 @@
"type" : "BT_PLASMA",
"x" : 12,
"y" : 0
},
{
"type" : "BT_ROCKET",
"x" : 0,
"y" : 0
}
],
"missiles" : {
"type" : "MISSILE_MISSILE",
"ammo" : 60
"ammo" : 8
},
"flags" : "EF_AVOIDS_COMBAT",
"aiFlags" : "AIF_MISSILE_BOAT"
"aiFlags" : "AIF_MISSILE_BOAT+AIF_DEFENSIVE"
}

View File

@ -55,6 +55,11 @@ void doAI(void)
return;
}
if ((self->aiFlags & AIF_DEFENSIVE) && rand() % 50 && nearEnemies())
{
return;
}
if ((self->aiFlags & AIF_GOAL_EXTRACTION) && nearExtractionPoint())
{
return;

View File

@ -83,6 +83,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#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)
/* player abilities */
#define BOOST_RECHARGE_TIME (FPS * 7)

View File

@ -51,6 +51,8 @@ void initLookups(void)
addLookup("AIF_RETREATS", AIF_RETREATS);
addLookup("AIF_GOAL_EXTRACTION", AIF_GOAL_EXTRACTION);
addLookup("AIF_AVOIDS_COMBAT", AIF_AVOIDS_COMBAT);
addLookup("AIF_DEFENSIVE", AIF_DEFENSIVE);
addLookup("AIF_MISSILE_BOAT", AIF_MISSILE_BOAT);
addLookup("TT_DESTROY", TT_DESTROY);
addLookup("TT_DISABLE", TT_DISABLE);