本文整理汇总了C++中HostileReference::getSource方法的典型用法代码示例。如果您正苦于以下问题:C++ HostileReference::getSource方法的具体用法?C++ HostileReference::getSource怎么用?C++ HostileReference::getSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HostileReference
的用法示例。
在下文中一共展示了HostileReference::getSource方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteReferencesForFaction
void HostileRefManager::deleteReferencesForFaction(uint32 faction)
{
HostileReference* ref = getFirst();
while (ref)
{
HostileReference* nextRef = ref->next();
if (ref->getSource()->getOwner()->getFactionTemplateEntry()->faction == faction)
{
ref->removeReference();
delete ref;
}
ref = nextRef;
}
}
示例2: setOnlineOfflineState
void HostileRefManager::setOnlineOfflineState(Unit *pCreature, bool bIsOnline)
{
HostileReference* ref = getFirst();
while (ref)
{
HostileReference* nextRef = ref->next();
if (ref->getSource()->getOwner() == pCreature)
{
ref->setOnlineOfflineState(bIsOnline);
break;
}
ref = nextRef;
}
}
示例3: deleteReference
void HostileRefManager::deleteReference(Unit *pCreature)
{
HostileReference* ref = getFirst();
while(ref)
{
HostileReference* nextRef = ref->next();
if(ref->getSource()->getOwner() == pCreature)
{
ref->removeReference();
delete ref;
break;
}
ref = nextRef;
}
}
示例4: threatAssist
void HostileRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
{
float redirectedMod = pVictim->getHostileRefManager().GetThreatRedirectionMod();
Unit* redirectedTarget = redirectedMod ? pVictim->getHostileRefManager().GetThreatRedirectionTarget() : NULL;
uint32 size = pSingleTarget ? 1 : getSize(); // if pSingleTarget do not devide threat
float threat = pThreat/size;
HostileReference* ref = getFirst();
while (ref)
{
ref->getSource()->addThreat(pVictim, threat, false, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
ref = ref->next();
}
}
示例5: UpdateVisibility
void HostileRefManager::UpdateVisibility()
{
HostileReference* ref = getFirst();
while (ref)
{
HostileReference* nextRef = ref->next();
if (!ref->getSource()->getOwner()->canSeeOrDetect(getOwner()))
{
HostileReference* nextRef = ref->next();
ref->removeReference();
delete ref;
}
ref = nextRef;
}
}
示例6: threatAssist
void HostileRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
{
HostileReference* 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();
}
}
示例7: threatAssist
void HostileRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
{
if (iOwner->hasUnitState(UNIT_STAT_IGNORE_ATTACKERS))
return;
HostileReference* 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();
}
}
示例8: Refresh
void RandomPlayerbotMgr::Refresh(Player* bot)
{
if (bot->IsDead())
{
PlayerbotChatHandler ch(bot);
ch.revive(*bot);
bot->GetPlayerbotAI()->ResetStrategies();
}
bot->GetPlayerbotAI()->Reset();
HostileReference *ref = bot->GetHostileRefManager().getFirst();
while( ref )
{
ThreatManager *threatManager = ref->getSource();
Unit *unit = threatManager->getOwner();
float threat = ref->getThreat();
unit->RemoveAllAttackers();
unit->ClearInCombat();
ref = ref->next();
}
bot->RemoveAllAttackers();
bot->ClearInCombat();
bot->DurabilityRepairAll(false, 1.0f);
bot->SetHealthPercent(100);
bot->SetPvP(true);
if (bot->GetMaxPower(POWER_MANA) > 0)
bot->SetPower(POWER_MANA, bot->GetMaxPower(POWER_MANA));
if (bot->GetMaxPower(POWER_ENERGY) > 0)
bot->SetPower(POWER_ENERGY, bot->GetMaxPower(POWER_ENERGY));
}