Apply style fix

This commit is contained in:
Antz 2020-01-10 23:13:44 +00:00
parent 5531a0087d
commit 35405dd549
155 changed files with 10968 additions and 3660 deletions

View file

@ -40,18 +40,26 @@ float ThreatCalcHelper::CalcThreat(Unit* pHatedUnit, Unit* /*pHatingUnit*/, floa
{
// all flat mods applied early
if (!threat)
{ return 0.0f; }
{
return 0.0f;
}
if (pThreatSpell)
{
if (pThreatSpell->HasAttribute(SPELL_ATTR_EX_NO_THREAT))
{ return 0.0f; }
{
return 0.0f;
}
if (Player* modOwner = pHatedUnit->GetSpellModOwner())
{ modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, threat); }
{
modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, threat);
}
if (crit)
{ threat *= pHatedUnit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRITICAL_THREAT, schoolMask); }
{
threat *= pHatedUnit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRITICAL_THREAT, schoolMask);
}
}
threat = pHatedUnit->ApplyTotalThreatModifier(threat, schoolMask);
@ -100,7 +108,9 @@ void HostileReference::sourceObjectDestroyLink()
void HostileReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent)
{
if (getSource())
{ getSource()->processThreatEvent(&pThreatRefStatusChangeEvent); }
{
getSource()->processThreatEvent(&pThreatRefStatusChangeEvent);
}
}
//============================================================
@ -114,7 +124,9 @@ void HostileReference::addThreat(float pMod)
// the threat is changed. Source and target unit have to be availabe
// if the link was cut before relink it again
if (!isOnline())
{ updateOnlineStatus(); }
{
updateOnlineStatus();
}
if (pMod != 0.0f)
{
ThreatRefStatusChangeEvent event(UEV_THREAT_REF_THREAT_CHANGE, this, pMod);
@ -140,7 +152,9 @@ void HostileReference::updateOnlineStatus()
if (!isValid())
{
if (Unit* target = ObjectAccessor::GetUnit(*getSourceUnit(), getUnitGuid()))
{ link(target, getSource()); }
{
link(target, getSource());
}
}
// only check for online status if
// ref is valid
@ -251,7 +265,9 @@ HostileReference* ThreatContainer::addThreat(Unit* pVictim, float pThreat)
{
HostileReference* ref = getReferenceByTarget(pVictim);
if (ref)
{ ref->addThreat(pThreat); }
{
ref->addThreat(pThreat);
}
return ref;
}
@ -318,7 +334,9 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
if (!onlySecondChoiceTargetsFound && pAttacker->IsSecondChoiceTarget(pTarget, pCurrentRef == pCurrentVictim))
{
if (iter != lastRef)
{ ++iter; }
{
++iter;
}
else
{
// if we reached to this point, everyone in the threatlist is a second choice target. In such a situation the target with the highest threat should be attacked.
@ -328,7 +346,9 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
// current victim is a second choice target, so don't compare threat with it below
if (pCurrentRef == pCurrentVictim)
{ pCurrentVictim = NULL; }
{
pCurrentVictim = NULL;
}
// second choice targets are only handled threat dependend if we have only have second choice targets
continue;
@ -385,7 +405,9 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
++iter;
}
if (!found)
{ pCurrentRef = NULL; }
{
pCurrentRef = NULL;
}
return pCurrentRef;
}
@ -421,15 +443,21 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, bool crit, SpellScho
// not to self
if (pVictim == getOwner())
{ return; }
{
return;
}
// not to GM
if (!pVictim || (pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster()))
{ return; }
{
return;
}
// not to dead and not for dead
if (!pVictim->IsAlive() || !getOwner()->IsAlive())
{ return; }
{
return;
}
MANGOS_ASSERT(getOwner()->GetTypeId() == TYPEID_UNIT);
@ -588,7 +616,9 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
else
{
if (getCurrentVictim() && hostileReference->getThreat() > (1.1f * getCurrentVictim()->getThreat()))
{ setDirty(true); }
{
setDirty(true);
}
iThreatContainer.addReference(hostileReference);
iUpdateNeed = true;
iThreatOfflineContainer.remove(hostileReference);