From f24e202fe748c75c926d5971e8dfc7d3cb67151b Mon Sep 17 00:00:00 2001 From: Flugente Date: Tue, 18 Sep 2012 22:16:23 +0000 Subject: [PATCH] New item flag: ItemFlag ATTENTION_ITEM (4096) makes an item 'interesting' to the AI. Upon checking for general pickup of items, these items have high priority. This can be used to lead the enemy into traps. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5575 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Item Types.h | 2 +- TacticalAI/FindLocations.cpp | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index f53433b4f..632bd4a65 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -740,7 +740,7 @@ extern OBJECTTYPE gTempObject; #define CAMO_REMOVAL 0x00000400 //1024 // item can be used to remove camo #define CLEANING_KIT 0x00000800 //2048 // weapon cleaning kit -//#define CLOTHES_CIVILIAN 0x00001000 //4096 // with this item you can disguise as a civilian // not used anymore +#define ATTENTION_ITEM 0x00001000 //4096 // this item is 'interesting' to the AI. Dumb soldiers may try to pick it up #define GAROTTE 0x00002000 //8192 // this item is a garotte #define COVERT 0x00004000 //16384 // if LBE, any gun inside will be covert. On a gun, it will covert in any LBE, even if the LBE does not have that tag itself #define CORPSE 0x00008000 //32768 // a dead body diff --git a/TacticalAI/FindLocations.cpp b/TacticalAI/FindLocations.cpp index 117ae0141..937da429d 100644 --- a/TacticalAI/FindLocations.cpp +++ b/TacticalAI/FindLocations.cpp @@ -1665,10 +1665,11 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) INT32 sGridNo; INT32 sBestSpot = NOWHERE; INT32 iTempValue, iValue, iBestValue = 0; - ITEM_POOL * pItemPool; - OBJECTTYPE * pObj; - INVTYPE * pItem; + ITEM_POOL * pItemPool; + OBJECTTYPE * pObj; + INVTYPE * pItem; INT32 iItemIndex, iBestItemIndex; + BOOLEAN fDumbEnoughtoPickup = FALSE; iTempValue = -1; iItemIndex = iBestItemIndex = -1; @@ -1755,6 +1756,10 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) FindBestPath( pSoldier, GRIDSIZE, pSoldier->pathing.bLevel, DetermineMovementMode( pSoldier, AI_ACTION_PICKUP_ITEM ), COPYREACHABLE, 0 );//dnl ch50 071009 + // Flugente: if the soldier is 'dumb enough', he may pick up certain items... which can be used to lure the AI into traps + if ( pSoldier->stats.bWisdom < 70 ) + fDumbEnoughtoPickup = TRUE; + // SET UP DOUBLE-LOOP TO STEP THROUGH POTENTIAL GRID #s for (sYOffset = -sMaxUp; sYOffset <= sMaxDown; sYOffset++) { @@ -1954,6 +1959,12 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) } } } + // Flugente: if the soldier is 'dumb enough', he may pick up 'interesting items'. This can be used to lure him into traps (a certain scene in FMJ comes to mind) + else if ( fDumbEnoughtoPickup && pItem->usItemClass == IC_MISC && HasItemFlag(pObj->usItem, ATTENTION_ITEM) ) + { + // oooh... shiny! + iTempValue = 1000; + } else { iTempValue = 0;