SimpleAI
 All Classes Namespaces Files Functions Variables Typedefs Macros Groups Pages
Classes | Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
ai::AggroMgr Class Reference

Manages the aggro values for one AI instance. There are several ways to degrade the aggro values. More...

#include <AggroMgr.h>

Collaboration diagram for ai::AggroMgr:
[legend]

Classes

class  CharacterIdPredicate
 

Public Types

typedef std::vector< EntryEntries
 
typedef Entries::iterator EntriesIter
 

Public Member Functions

 AggroMgr (std::size_t expectedEntrySize=0u)
 
void setReduceByRatio (float reduceRatioSecond, float minAggro)
 
void setReduceByValue (float reduceValueSecond)
 
void resetReduceValue ()
 
void update (int64_t deltaMillis)
 this will update the aggro list according to the reduction type of an entry. More...
 
EntryPtr addAggro (CharacterId id, float amount)
 will increase the aggro More...
 
const Entries & getEntries () const
 
EntryPtr getHighestEntry () const
 Get the entry with the highest aggro value. More...
 

Protected Member Functions

void cleanupList ()
 Remove the entries from the list that have no aggro left. This list is ordered, so we will only remove the first X elements.
 
void sort () const
 

Static Protected Member Functions

static bool EntrySorter (const Entry &a, const Entry &b)
 

Protected Attributes

Entries _entries
 
bool _dirty
 
float _minAggro = 0.0f
 
float _reduceRatioSecond = 0.0f
 
float _reduceValueSecond = 0.0f
 
ReductionType _reduceType = DISABLED
 

Detailed Description

Manages the aggro values for one AI instance. There are several ways to degrade the aggro values.

Member Function Documentation

EntryPtr ai::AggroMgr::addAggro ( CharacterId  id,
float  amount 
)
inline

will increase the aggro

Parameters
[in]idThe entity id to increase the aggro against
[in]amountThe amount to increase the aggro for
Returns
The aggro Entry that was added or updated. Useful for changing the reduce type or amount.
const Entries& ai::AggroMgr::getEntries ( ) const
inline
Returns
All the aggro entries
EntryPtr ai::AggroMgr::getHighestEntry ( ) const
inline

Get the entry with the highest aggro value.

Note
Might execute a sort on the list if its dirty
void ai::AggroMgr::update ( int64_t  deltaMillis)
inline

this will update the aggro list according to the reduction type of an entry.

Parameters
[in]deltaMillisThe current milliseconds to use to update the aggro value of the entries.

The documentation for this class was generated from the following file: