*Backport blood frenzy fix from TC2.
--HG-- branch : trunk
This commit is contained in:
+21
-3
@@ -1221,10 +1221,28 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
|
||||
if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->IsAIEnabled)
|
||||
((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo);
|
||||
|
||||
for(ChanceTriggerSpells::const_iterator i = m_ChanceTriggerSpells.begin(); i != m_ChanceTriggerSpells.end(); ++i)
|
||||
if (m_ChanceTriggerSpells.size())
|
||||
{
|
||||
if(roll_chance_i(i->second))
|
||||
m_caster->CastSpell(unit, i->first, true);
|
||||
int _duration=0;
|
||||
for(ChanceTriggerSpells::const_iterator i = m_ChanceTriggerSpells.begin(); i != m_ChanceTriggerSpells.end(); ++i)
|
||||
{
|
||||
if(roll_chance_i(i->second))
|
||||
{
|
||||
m_caster->CastSpell(unit, i->first, true);
|
||||
// SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration
|
||||
// set duration equal to triggering spell
|
||||
if (GetSpellDuration(i->first)==-1)
|
||||
{
|
||||
// get duration from aura-only once
|
||||
if (!_duration)
|
||||
{
|
||||
Aura * aur = unit->GetAuraByCasterSpell(m_spellInfo->Id, m_caster->GetGUID());
|
||||
_duration = aur ? aur->GetAuraDuration() : -1;
|
||||
}
|
||||
unit->SetAurasDurationByCasterSpell(i->first->Id, m_caster->GetGUID(), _duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(m_customAttr & SPELL_ATTR_CU_LINK_HIT)
|
||||
|
||||
@@ -228,7 +228,14 @@ class TRINITY_DLL_SPEC Aura
|
||||
int32 GetAuraMaxDuration() const { return m_maxduration; }
|
||||
void SetAuraMaxDuration(int32 duration) { m_maxduration = duration; }
|
||||
int32 GetAuraDuration() const { return m_duration; }
|
||||
void SetAuraDuration(int32 duration) { m_duration = duration; }
|
||||
void SetAuraDuration(int32 duration)
|
||||
{
|
||||
m_duration = duration;
|
||||
if (duration<0)
|
||||
m_permanent=true;
|
||||
else
|
||||
m_permanent=false;
|
||||
}
|
||||
time_t GetAuraApplyTime() { return m_applyTime; }
|
||||
void UpdateAuraDuration();
|
||||
void SendAuraDurationForCaster(Player* caster);
|
||||
|
||||
@@ -4497,6 +4497,37 @@ void Unit::RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID)
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::SetAurasDurationByCasterSpell(uint32 spellId, uint64 casterGUID, int32 duration)
|
||||
{
|
||||
for(uint8 i = 0; i < 3; ++i)
|
||||
{
|
||||
spellEffectPair spair = spellEffectPair(spellId, i);
|
||||
for(AuraMap::const_iterator itr = GetAuras().lower_bound(spair); itr != GetAuras().upper_bound(spair); ++itr)
|
||||
{
|
||||
if(itr->second->GetCasterGUID()==casterGUID)
|
||||
{
|
||||
itr->second->SetAuraDuration(duration);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Aura* Unit::GetAuraByCasterSpell(uint32 spellId, uint64 casterGUID)
|
||||
{
|
||||
// Returns first found aura from spell-use only in cases where effindex of spell doesn't matter!
|
||||
for(uint8 i = 0; i < 3; ++i)
|
||||
{
|
||||
spellEffectPair spair = spellEffectPair(spellId, i);
|
||||
for(AuraMap::const_iterator itr = GetAuras().lower_bound(spair); itr != GetAuras().upper_bound(spair); ++itr)
|
||||
{
|
||||
if(itr->second->GetCasterGUID()==casterGUID)
|
||||
return itr->second;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler)
|
||||
{
|
||||
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )
|
||||
|
||||
@@ -1128,6 +1128,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
void RemoveAurasDueToSpell(uint32 spellId, Aura* except = NULL);
|
||||
void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId);
|
||||
void RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID);
|
||||
void SetAurasDurationByCasterSpell(uint32 spellId, uint64 casterGUID, int32 duration);
|
||||
Aura* GetAuraByCasterSpell(uint32 spellId, uint64 casterGUID);
|
||||
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler);
|
||||
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer);
|
||||
void RemoveAurasDueToSpellByCancel(uint32 spellId);
|
||||
|
||||
Reference in New Issue
Block a user