*Fix blood frenzy remove (and possibly some other SPELL_AURA_ADD_TARGET_TRIGGER auras too).

*Fix some problems with Cut to the Chase.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-03-22 16:24:53 +01:00
parent f4d3a583bd
commit a0530658ff
5 changed files with 60 additions and 15 deletions
+13
View File
@@ -1183,10 +1183,23 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->IsAIEnabled) if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->IsAIEnabled)
((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo); ((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo);
if (m_ChanceTriggerSpells.size())
{
int _duration=0;
for(ChanceTriggerSpells::const_iterator i = m_ChanceTriggerSpells.begin(); i != m_ChanceTriggerSpells.end(); ++i) for(ChanceTriggerSpells::const_iterator i = m_ChanceTriggerSpells.begin(); i != m_ChanceTriggerSpells.end(); ++i)
{ {
if(roll_chance_i(i->second)) if(roll_chance_i(i->second))
{
m_caster->CastSpell(unit, i->first, true); 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)
_duration = unit->GetAuraByCasterSpell(m_spellInfo->Id, m_caster->GetGUID())->GetAuraDuration();
unit->SetAurasDurationByCasterSpell(i->first->Id, m_caster->GetGUID(), _duration);
}
}
} }
if(m_customAttr & SPELL_ATTR_CU_LINK_HIT) if(m_customAttr & SPELL_ATTR_CU_LINK_HIT)
+1 -9
View File
@@ -584,7 +584,7 @@ void Aura::Update(uint32 diff)
else else
m_target->RemoveAurasByCasterSpell(GetId(),GetCasterGUID()); m_target->RemoveAurasByCasterSpell(GetId(),GetCasterGUID());
} }
else if (caster->GetPower(powertype)>manaPerSecond) else if (caster->GetPower(powertype)>=manaPerSecond)
caster->ModifyPower(powertype,-manaPerSecond); caster->ModifyPower(powertype,-manaPerSecond);
else else
m_target->RemoveAurasByCasterSpell(GetId(),GetCasterGUID()); m_target->RemoveAurasByCasterSpell(GetId(),GetCasterGUID());
@@ -5424,14 +5424,6 @@ void Aura::HandleSpiritOfRedemption( bool apply, bool Real )
void Aura::CleanupTriggeredSpells() void Aura::CleanupTriggeredSpells()
{ {
if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR && m_spellProto->SpellFamilyFlags[1] & 0x00000010 || m_spellProto->SpellFamilyFlags[0] & 0x00000020)
{
// Blood Frenzy remove
m_target->RemoveAurasDueToSpell(30069);
m_target->RemoveAurasDueToSpell(30070);
return;
}
uint32 tSpellId = m_spellProto->EffectTriggerSpell[GetEffIndex()]; uint32 tSpellId = m_spellProto->EffectTriggerSpell[GetEffIndex()];
if(!tSpellId) if(!tSpellId)
return; return;
+8 -1
View File
@@ -230,7 +230,14 @@ class TRINITY_DLL_SPEC Aura
int32 GetAuraMaxDuration() const { return m_maxduration; } int32 GetAuraMaxDuration() const { return m_maxduration; }
void SetAuraMaxDuration(int32 duration) { m_maxduration = duration; } void SetAuraMaxDuration(int32 duration) { m_maxduration = duration; }
int32 GetAuraDuration() const { return m_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;
}
void SetAuraDurationAndUpdate(int32 duration) void SetAuraDurationAndUpdate(int32 duration)
{ {
m_duration = duration; m_duration = duration;
+32 -2
View File
@@ -4151,6 +4151,37 @@ void Unit::RefreshAurasByCasterSpell(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) void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler)
{ {
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); ) for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )
@@ -5996,8 +6027,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
if( spellProto->SpellFamilyName == SPELLFAMILY_ROGUE && if( spellProto->SpellFamilyName == SPELLFAMILY_ROGUE &&
spellProto->SpellFamilyFlags[0] & 0x40000) spellProto->SpellFamilyFlags[0] & 0x40000)
{ {
(*itr)->SetAuraMaxDuration(GetSpellMaxDuration(spellProto)); RefreshAurasByCasterSpell(spellProto->Id, GetGUID());
(*itr)->RefreshAura();
return true; return true;
} }
} }
+3
View File
@@ -1247,6 +1247,9 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT); void RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT);
void RemoveAurasByCasterSpell(uint32 spellId, uint8 effindex, uint64 casterGUID, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT); void RemoveAurasByCasterSpell(uint32 spellId, uint8 effindex, uint64 casterGUID, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT);
void RefreshAurasByCasterSpell(uint32 spellId, uint64 casterGUID); void RefreshAurasByCasterSpell(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 RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler);
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer); void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer);
void RemoveAurasDueToSpellByCancel(uint32 spellId); void RemoveAurasDueToSpellByCancel(uint32 spellId);