Skip to content

Commit

Permalink
[11082] Correct meaning of two threat/aggro related spell attributes
Browse files Browse the repository at this point in the history
- SPELL_ATTR_EX_NO_INITIAL_AGGRO renamed to SPELL_ATTR_EX_NO_THREAT
- SPELL_ATTR_EX3_UNK17 renamed to SPELL_ATTR_EX3_NO_INITIAL_AGGRO
- Remove custom spell modifier from talent 30675 and ranks handler
  • Loading branch information
zergtmn committed Jan 29, 2011
1 parent a527201 commit fb590ff
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/game/SharedDefines.h
Expand Up @@ -274,7 +274,7 @@ const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = {
#define SPELL_ATTR_EX_NEGATIVE 0x00000080 // 7
#define SPELL_ATTR_EX_NOT_IN_COMBAT_TARGET 0x00000100 // 8 Spell req target not to be in combat state
#define SPELL_ATTR_EX_UNK9 0x00000200 // 9
#define SPELL_ATTR_EX_NO_INITIAL_AGGRO 0x00000400 // 10 no generates threat on cast 100%
#define SPELL_ATTR_EX_NO_THREAT 0x00000400 // 10 no generates threat on cast 100%
#define SPELL_ATTR_EX_UNK11 0x00000800 // 11
#define SPELL_ATTR_EX_UNK12 0x00001000 // 12
#define SPELL_ATTR_EX_UNK13 0x00002000 // 13
Expand Down Expand Up @@ -347,7 +347,7 @@ const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = {
#define SPELL_ATTR_EX3_UNK14 0x00004000 // 14 "Honorless Target" only this spells have this flag
#define SPELL_ATTR_EX3_UNK15 0x00008000 // 15 Auto Shoot, Shoot, Throw, - this is autoshot flag
#define SPELL_ATTR_EX3_UNK16 0x00010000 // 16 no triggers effects that trigger on casting a spell??
#define SPELL_ATTR_EX3_UNK17 0x00020000 // 17 no triggers effects that trigger on casting a spell??
#define SPELL_ATTR_EX3_NO_INITIAL_AGGRO 0x00020000 // 17 Causes no aggro if not missed
#define SPELL_ATTR_EX3_UNK18 0x00040000 // 18
#define SPELL_ATTR_EX3_UNK19 0x00080000 // 19
#define SPELL_ATTR_EX3_DEATH_PERSISTENT 0x00100000 // 20 Death persistent spells
Expand Down
4 changes: 2 additions & 2 deletions src/game/Spell.cpp
Expand Up @@ -1173,7 +1173,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
unit->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);

// can cause back attack (if detected), stealth removed at Spell::cast if spell break it
if (!(m_spellInfo->AttributesEx & SPELL_ATTR_EX_NO_INITIAL_AGGRO) && !IsPositiveSpell(m_spellInfo->Id) &&
if (!(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO) && !IsPositiveSpell(m_spellInfo->Id) &&
m_caster->isVisibleForOrDetect(unit, unit, false))
{
// use speedup check to avoid re-remove after above lines
Expand Down Expand Up @@ -1211,7 +1211,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
if (unit->hasUnitState(UNIT_STAT_ATTACK_PLAYER))
realCaster->SetContestedPvP();

if (unit->isInCombat() && !(m_spellInfo->AttributesEx & SPELL_ATTR_EX_NO_INITIAL_AGGRO))
if (unit->isInCombat() && !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO))
{
realCaster->SetInCombatState(unit->GetCombatTimer() > 0);
unit->getHostileRefManager().threatAssist(realCaster, 0.0f, m_spellInfo);
Expand Down
2 changes: 1 addition & 1 deletion src/game/SpellAuras.cpp
Expand Up @@ -233,7 +233,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleNoImmediateEffect, //180 SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS implemented in Unit::SpellDamageBonusDone
&Aura::HandleUnused, //181 unused (3.0.8a-3.2.2a) old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS
&Aura::HandleAuraModResistenceOfStatPercent, //182 SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT
&Aura::HandleNoImmediateEffect, //183 SPELL_AURA_MOD_CRITICAL_THREAT only used in 28746, implemented in ThreatCalcHelper::calcThreat
&Aura::HandleNoImmediateEffect, //183 SPELL_AURA_MOD_CRITICAL_THREAT only used in 28746, implemented in ThreatCalcHelper::CalcThreat
&Aura::HandleNoImmediateEffect, //184 SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
&Aura::HandleNoImmediateEffect, //185 SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
&Aura::HandleNoImmediateEffect, //186 SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE implemented in Unit::MagicSpellHitResult
Expand Down
17 changes: 10 additions & 7 deletions src/game/ThreatManager.cpp
Expand Up @@ -30,22 +30,25 @@
//==============================================================

// The pHatingUnit is not used yet
float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* /*pHatingUnit*/, float pThreat, bool crit, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
float ThreatCalcHelper::CalcThreat(Unit* pHatedUnit, Unit* /*pHatingUnit*/, float threat, bool crit, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
{
// all flat mods applied early
if(!pThreat)
if (!threat)
return 0.0f;

if (pThreatSpell)
{
if (pThreatSpell->AttributesEx & SPELL_ATTR_EX_NO_THREAT)
return 0.0f;

if (Player* modOwner = pHatedUnit->GetSpellModOwner())
modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, pThreat);
modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, threat);

if(crit)
pThreat *= pHatedUnit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRITICAL_THREAT,schoolMask);
if (crit)
threat *= pHatedUnit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRITICAL_THREAT, schoolMask);
}

float threat = pHatedUnit->ApplyTotalThreatModifier(pThreat, schoolMask);
threat = pHatedUnit->ApplyTotalThreatModifier(threat, schoolMask);
return threat;
}

Expand Down Expand Up @@ -390,7 +393,7 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, bool crit, SpellScho

MANGOS_ASSERT(getOwner()->GetTypeId()== TYPEID_UNIT);

float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, crit, schoolMask, pThreatSpell);
float threat = ThreatCalcHelper::CalcThreat(pVictim, iOwner, pThreat, crit, schoolMask, pThreatSpell);

if (threat > 0.0f)
{
Expand Down
2 changes: 1 addition & 1 deletion src/game/ThreatManager.h
Expand Up @@ -41,7 +41,7 @@ struct SpellEntry;
class ThreatCalcHelper
{
public:
static float calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float threat, bool crit, SpellSchoolMask schoolMask, SpellEntry const *threatSpell);
static float CalcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float threat, bool crit, SpellSchoolMask schoolMask, SpellEntry const *threatSpell);
};

//==============================================================
Expand Down
11 changes: 2 additions & 9 deletions src/game/UnitAuraProcHandler.cpp
Expand Up @@ -2470,22 +2470,15 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura
sLog.outError("Unit::HandleDummyAuraProc: non handled spell id: %u (LO)", procSpell->Id);
return SPELL_AURA_PROC_FAILED;
}
// No thread generated mod
// TODO: exist special flag in spell attributes for this, need found and use!
SpellModifier *mod = new SpellModifier(SPELLMOD_THREAT,SPELLMOD_PCT,-100,triggeredByAura);

((Player*)this)->AddSpellMod(mod, true);

// Remove cooldown (Chain Lightning - have Category Recovery time)
if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000002))
((Player*)this)->RemoveSpellCooldown(spellId);

CastSpell(pVictim, spellId, true, castItem, triggeredByAura);

((Player*)this)->AddSpellMod(mod, false);

if( cooldown && GetTypeId()==TYPEID_PLAYER )
((Player*)this)->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown);
if (cooldown && GetTypeId() == TYPEID_PLAYER)
((Player*)this)->AddSpellCooldown(dummySpell->Id, 0, time(NULL) + cooldown);

return SPELL_AURA_PROC_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11081"
#define REVISION_NR "11082"
#endif // __REVISION_NR_H__

0 comments on commit fb590ff

Please sign in to comment.