本文整理汇总了C++中HostilReference::addThreat方法的典型用法代码示例。如果您正苦于以下问题:C++ HostilReference::addThreat方法的具体用法?C++ HostilReference::addThreat怎么用?C++ HostilReference::addThreat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HostilReference
的用法示例。
在下文中一共展示了HostilReference::addThreat方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addThreat
HostilReference* ThreatContainer::addThreat(Unit* pVictim, float pThreat)
{
HostilReference* ref = getReferenceByTarget(pVictim);
if(ref)
ref->addThreat(pThreat);
return ref;
}
示例2: addThreat
void ThreatManager::addThreat(Unit* pVictim, float pThreat, SpellSchools pSchool, SpellEntry const *pThreatSpell)
{
//function deals with adding threat and adding players and pets into ThreatList
//mobs, NPCs, guards have ThreatList and HateOfflineList
//players and pets have only InHateListOf
//HateOfflineList is used co contain unattackable victims (in-flight, in-water, GM etc.)
if (pVictim == getOwner()) // only for same creatures :)
return;
if(!pVictim || (pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster()) )
return;
assert(getOwner()->GetTypeId()== TYPEID_UNIT);
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, pSchool, pThreatSpell);
HostilReference* ref = iThreatContainer.addThreat(pVictim, threat);
// Ref is not in the online refs, search the offline refs next
if(!ref)
ref = iThreatOfflineContainer.addThreat(pVictim, threat);
if(!ref) // there was no ref => create a new one
{
// threat has to be 0 here
HostilReference* hostilReference = new HostilReference(pVictim, this, 0);
iThreatContainer.addReference(hostilReference);
hostilReference->addThreat(threat); // now we add the real threat
if(pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster())
hostilReference->setOnlineOfflineState(false); // GM is always offline
}
}
示例3: threatAssist
void HostilRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
{
HostilReference* ref;
float size = pSingleTarget ? 1.0f : getSize(); // if pSingleTarget do not divide threat
ref = getFirst();
while(ref != NULL)
{
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
if(pVictim == getOwner())
ref->addThreat(threat / size); // It is faster to modify the threat durectly if possible
else
ref->getSource()->addThreat(pVictim, threat / size);
ref = ref->next();
}
}
示例4: _addThreat
void ThreatManager::_addThreat(Unit *pVictim, float threat)
{
HostilReference* ref = iThreatContainer.addThreat(pVictim, threat);
// Ref is not in the online refs, search the offline refs next
if(!ref)
ref = iThreatOfflineContainer.addThreat(pVictim, threat);
if(!ref) // there was no ref => create a new one
{
// threat has to be 0 here
HostilReference* hostilReference = new HostilReference(pVictim, this, 0);
iThreatContainer.addReference(hostilReference);
hostilReference->addThreat(threat); // now we add the real threat
if(pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster())
hostilReference->setOnlineOfflineState(false); // GM is always offline
}
}
示例5: threatAssist
void HostilRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
{
if (iOwner->hasUnitState(UNIT_STAT_IGNORE_ATTACKERS))
return;
HostilReference* ref;
uint32 size = pSingleTarget ? 1 : getSize(); // if pSingleTarget do not divide threat
ref = getFirst();
while (ref != NULL)
{
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, (pThreatSpell ? SpellMgr::GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
if (pVictim == getOwner())
ref->addThreat(float (threat) / size); // It is faster to modify the threat directly if possible
else
ref->getSource()->addThreat(pVictim, float (threat) / size);
ref = ref->next();
}
}