本文整理汇总了C++中ThreatMapEntry::addAggro方法的典型用法代码示例。如果您正苦于以下问题:C++ ThreatMapEntry::addAggro方法的具体用法?C++ ThreatMapEntry::addAggro怎么用?C++ ThreatMapEntry::addAggro使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThreatMapEntry
的用法示例。
在下文中一共展示了ThreatMapEntry::addAggro方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addDamage
void ThreatMap::addDamage(CreatureObject* target, uint32 damage, String xp) {
Locker locker(&lockMutex);
ManagedReference<TangibleObject*> strongSelf = self.get();
if (strongSelf == NULL || strongSelf.get() == target)
return;
int idx = find(target);
String xpToAward = "";
if (xp == "") {
WeaponObject* weapon = target->getWeapon();
xpToAward = weapon->getXpType();
} else
xpToAward = xp;
if (idx == -1) {
ThreatMapEntry entry;
entry.addDamage(xpToAward, damage);
entry.addAggro(1);
put(target, entry);
registerObserver(target);
} else {
ThreatMapEntry* entry = &elementAt(idx).getValue();
entry->addDamage(xpToAward, damage);
entry->addAggro(1);
}
}
示例2: addDamage
void ThreatMap::addDamage(CreatureObject* target, uint32 damage, String xp) {
Locker locker(&lockMutex);
int idx = find(target);
String xpToAward = "";
if (xp == "") {
WeaponObject* weapon = target->getWeapon();
xpToAward = weapon->getXpType();
} else
xpToAward = xp;
if (idx == -1) {
ThreatMapEntry entry;
entry.addDamage(xpToAward, damage);
entry.addAggro(1);
put(target, entry);
registerObserver(target);
} else {
ThreatMapEntry* entry = &elementAt(idx).getValue();
entry->addDamage(xpToAward, damage);
entry->addAggro(1);
}
// randomly change target everytime threatmap is added to, TODO: keep this in mind and perhaps make it slightly more complicated
if (System::random(5) == 0)
currentThreat = target;
}
示例3: addAggro
void ThreatMap::addAggro(CreatureObject* target, int value, uint64 duration) {
Locker locker(&lockMutex);
ManagedReference<TangibleObject*> strongSelf = self.get();
if (strongSelf == NULL || strongSelf.get() == target)
return;
int idx = find(target);
if (idx == -1) {
ThreatMapEntry entry;
entry.addAggro(value);
put(target, entry);
registerObserver(target);
} else {
ThreatMapEntry* entry = &elementAt(idx).getValue();
entry->addAggro(value);
}
if(duration > 0) {
Reference<RemoveAggroTask*> removeAggroTask = new RemoveAggroTask(self.get(), target, value);
removeAggroTask->schedule(duration);
}
}
示例4: addHeal
void ThreatMap::addHeal(CreatureObject* target, int value) {
Locker locker(&lockMutex);
int idx = find(target);
if (idx == -1) {
ThreatMapEntry entry;
entry.addHeal(value);
entry.addAggro(2);
put(target, entry);
registerObserver(target);
} else {
ThreatMapEntry* entry = &elementAt(idx).getValue();
entry->addHeal(value);
entry->addAggro(2);
}
}
示例5: addHeal
void ThreatMap::addHeal(CreatureObject* target, int value) {
Locker locker(&lockMutex);
ManagedReference<TangibleObject*> strongSelf = self.get();
if (strongSelf == NULL || strongSelf.get() == target)
return;
int idx = find(target);
if (idx == -1) {
ThreatMapEntry entry;
entry.addHeal(value);
entry.addAggro(1);
put(target, entry);
registerObserver(target);
} else {
ThreatMapEntry* entry = &elementAt(idx).getValue();
entry->addHeal(value);
entry->addAggro(1);
}
}