2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
6 ///////////////////////////////////////////////////////////////////////////////
7 // $Header: r:/t2repos/thief2/src/ai/aicombat.h,v 1.26 1999/08/05 16:45:47 Justin Exp $
25 ///////////////////////////////////////////////////////////////////////////////
27 // Publish ability and all associated link and property types
30 BOOL
AIInitCombatAbility(IAIManager
*);
31 BOOL
AITermCombatAbility();
33 ///////////////////////////////////////////////////////////////////////////////
38 class cAICombat
: public cAIAbility
43 // Standard component methods
44 STDMETHOD_(const char *, GetName
)();
45 STDMETHOD_(void, Init
)();
46 STDMETHOD_(void, Term
)();
48 STDMETHOD_(BOOL
, Save
)(ITagFile
*);
49 STDMETHOD_(BOOL
, Load
)(ITagFile
*);
52 STDMETHOD_(void, OnActionProgress
)(IAIAction
* pAction
);
53 STDMETHOD_(void, OnAlertness
)(ObjID source
,
54 eAIAwareLevel previous
,
55 eAIAwareLevel current
,
56 const sAIAlertness
* pRaw
);
57 STDMETHOD_(void, OnDamage
)(const sDamageMsg
*pMsg
, ObjID realCulpritID
);
58 STDMETHOD_(void, OnWeapon
)(eWeaponEvent ev
, ObjID victim
, ObjID culprit
);
59 STDMETHOD_(void, OnProperty
)(IProperty
*, const sPropertyListenMsg
*);
60 STDMETHOD_(void, OnSound
)(const sSoundInfo
*, const sAISoundType
* pType
);
61 STDMETHOD_(void, OnGoalChange
)(const cAIGoal
* pPrevious
, const cAIGoal
* pGoal
);
62 // @TBD (toml 07-27-98): need onmode
64 // Update the status of the current goal
65 STDMETHOD_(eAIResult
, UpdateGoal
)(cAIGoal
*);
68 STDMETHOD (SuggestMode
) (sAIModeSuggestion
*);
69 STDMETHOD (SuggestGoal
) (cAIGoal
* pPrevious
, cAIGoal
** ppNew
);
70 STDMETHOD (SuggestActions
)(cAIGoal
* pGoal
, const cAIActions
& previous
, cAIActions
* pNew
);
73 STDMETHOD_(void, SetTargetAlertnessThreshold
)(eAIAwareLevel threshold
) {m_targetAlertnessThreshold
= threshold
;}
76 // Functions potentially useful to both descendants and contained classes
78 const mxs_vector
& GetTargetLoc();
80 BOOL
CanPlayReactCharge();
81 void SetPlayedReactCharge();
86 void SetTarget(ObjID
);
88 void CheckLostContact(); // See if we need to play the LostContact concept.
90 BOOL
IsHostileToward(ObjID
);
91 eAIAwareLevel
GetTargetAlertnessThreshold(void) const {return m_targetAlertnessThreshold
;}
93 // over-ride these for ability specific targetting behavior
94 virtual BOOL
IsValidTarget(ObjID object
); // Is this valid for acquiring or retaining?
95 virtual BOOL
IsAcquirableTarget(const sAIAwareness
& awareness
); // Is this valid to acquire?
96 virtual BOOL
IsRetainableTarget(const sAIAwareness
& awareness
); // Is this valid to retain?
97 virtual eAIPriority
TargetPriority(ObjID object
); // How good is this target?
100 void SignalSubGoals() {}
102 void UpdateTargets();
107 kWasDamaged
= kBaseFirstAvailFlag
,
108 kWasThreatened
= (kWasDamaged
<< 1),
110 kCombatFirstAvailFlag
= (kWasThreatened
<< 1)
113 cAITimer m_TargetRefreshTimer
;
114 cAIRandomTimer m_ReactChargeTimer
;
115 cAIRandomTimer m_LostContactTimer
;
116 ObjID m_LostContactWith
;
117 eAIAwareLevel m_targetAlertnessThreshold
; // level at which identifying a combat target becomes easier
119 int m_lastTargetSwitch
;
122 ///////////////////////////////////////
124 inline BOOL
cAICombat::CanPlayReactCharge()
126 return m_ReactChargeTimer
.Expired();
129 ///////////////////////////////////////
131 inline void cAICombat::SetPlayedReactCharge()
133 m_ReactChargeTimer
.Reset();
136 ///////////////////////////////////////////////////////////////////////////////
139 #endif /* !__AICOMBAT_H */