当前位置: 首页>>代码示例>>C++>>正文


C++ ThreatMapEntry类代码示例

本文整理汇总了C++中ThreatMapEntry的典型用法代码示例。如果您正苦于以下问题:C++ ThreatMapEntry类的具体用法?C++ ThreatMapEntry怎么用?C++ ThreatMapEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ThreatMapEntry类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: locker

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);
	}
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:25,代码来源:ThreatMap.cpp

示例2: locker

CreatureObject* ThreatMap::getHighestDamagePlayer() {
	Locker locker(&lockMutex);

	uint32 maxDamage = 0;
	VectorMap<uint64,uint32> damageMap;
	CreatureObject* player = NULL;

	for (int i = 0; i < size(); ++i) {
		ThreatMapEntry* entry = &elementAt(i).getValue();

		uint32 totalDamage = 0;

		for (int j = 0; j < entry->size(); ++j) {
			uint32 damage = entry->elementAt(j).getValue();

			totalDamage += damage;
		}

		CreatureObject* creature = elementAt(i).getKey();

		if (creature->isPlayerCreature()) {
			if(!damageMap.contains(creature->getObjectID())){
				damageMap.put(creature->getObjectID(),totalDamage);
			} else {
				damageMap.get(creature->getObjectID()) += totalDamage;
			}

			if (damageMap.get(creature->getObjectID()) > maxDamage) {
				maxDamage = damageMap.get(creature->getObjectID());
				player = cast<CreatureObject*>(creature);
			}
		} else if (creature->isPet()) {
			CreatureObject* owner = creature->getLinkedCreature().get();

			if (owner != NULL && owner->isPlayerCreature()) {
				if(!damageMap.contains(owner->getObjectID())){
					damageMap.put(owner->getObjectID(),totalDamage);
				} else {
					damageMap.get(owner->getObjectID()) += totalDamage;
				}

				if (damageMap.get(owner->getObjectID()) > maxDamage) {
					maxDamage = damageMap.get(owner->getObjectID());
					player = cast<CreatureObject*>(owner);
				}
			}
		}
	}

	return player;
}
开发者ID:dogg-jr,项目名称:GR-Core,代码行数:51,代码来源:ThreatMap.cpp

示例3: llocker

void ThreatMap::dropDamage(CreatureObject* target) {
	Locker llocker(&lockMutex);

	ManagedReference<TangibleObject*> selfStrong = self.get();
	if (target == NULL || selfStrong == NULL || target->isDead() || !target->isOnline() || target->getPlanetCRC() != selfStrong->getPlanetCRC()) {
		drop(target);

		if (threatMapObserver != NULL)
			target->dropObserver(ObserverEventType::HEALINGPERFORMED, threatMapObserver);
	} else {
		ThreatMapEntry *entry = &get(target);
		entry->setNonAggroDamage(entry->getTotalDamage());
		entry->addHeal(-entry->getHeal()); // don't need to store healing
		entry->clearAggro();
	}

	llocker.release();

	if (currentThreat == target)
		currentThreat = NULL;
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:21,代码来源:ThreatMap.cpp


注:本文中的ThreatMapEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。