11 DISABLED, RATIO, VALUE
21 float _reduceRatioSecond;
22 float _reduceValueSecond;
23 ReductionType _reduceType;
26 void reduceByRatio(
float ratio);
27 void reduceByValue(
float value);
30 Entry(
const CharacterId&
id,
float aggro = 0.0f) :
31 _aggro(aggro), _minAggro(0.0f), _reduceRatioSecond(0.0f), _reduceValueSecond(0.0f), _reduceType(DISABLED), _id(
id) {
35 _aggro(other._aggro), _minAggro(other._minAggro), _reduceRatioSecond(other._reduceRatioSecond), _reduceValueSecond(other._reduceValueSecond), _reduceType(
36 other._reduceType), _id(other._id) {
40 _aggro(other._aggro), _minAggro(other._minAggro), _reduceRatioSecond(other._reduceRatioSecond), _reduceValueSecond(other._reduceValueSecond), _reduceType(
41 other._reduceType), _id(other._id) {
44 float getAggro()
const;
45 void addAggro(
float aggro);
46 void setReduceByRatio(
float reductionRatioPerSecond,
float minimumAggro);
47 void setReduceByValue(
float reductionValuePerSecond);
54 const CharacterId& getCharacterId()
const;
55 bool operator <(
Entry& other)
const;
61 inline void Entry::addAggro(
float aggro) {
65 inline void Entry::setReduceByRatio(
float reduceRatioSecond,
float minAggro) {
67 _reduceRatioSecond = reduceRatioSecond;
71 inline void Entry::setReduceByValue(
float reduceValueSecond) {
73 _reduceValueSecond = reduceValueSecond;
77 switch (_reduceType) {
79 const float f =
static_cast<float>(millis) / 1000.0f;
80 reduceByRatio(f * _reduceRatioSecond);
84 const float f =
static_cast<float>(millis) / 1000.0f;
85 reduceByValue(f * _reduceValueSecond);
94 inline void Entry::reduceByRatio(
float ratio) {
95 _aggro *= (1.0f - ratio);
96 if (_aggro < _minAggro) {
101 inline void Entry::reduceByValue(
float value) {
104 if (_aggro < 0.000001f) {
109 inline float Entry::getAggro()
const {
113 inline void Entry::resetAggro() {
117 inline bool Entry::operator <(Entry& other)
const {
118 return _aggro < other._aggro;
121 inline Entry& Entry::operator=(
const Entry& other) {
122 _aggro = other._aggro;
123 _minAggro = other._minAggro;
124 _reduceRatioSecond = other._reduceRatioSecond;
125 _reduceValueSecond = other._reduceValueSecond;
126 _reduceType = other._reduceType;
131 inline const CharacterId& Entry::getCharacterId()
const {
bool reduceByTime(int64_t millis)
Definition: Entry.h:76
One entry for the AggroMgr.
Definition: Entry.h:17