aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQAston <none@none>2009-03-12 23:20:51 +0100
committerQAston <none@none>2009-03-12 23:20:51 +0100
commit23010a854b9e65805e6634031580dd69aa0bce8b (patch)
tree427aa3a35db78a874355a10efad5745aa731e377
parenta38531121d45c711c47a34efdf2febb74fc760e6 (diff)
*Fix Dispersion.
*Fix Living bomb damage trigger. --HG-- branch : trunk
-rw-r--r--src/game/SpellAuras.cpp76
-rw-r--r--src/game/Unit.cpp23
-rw-r--r--src/game/Unit.h3
3 files changed, 79 insertions, 23 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 053beedd4cc..14a4c55d633 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -1986,6 +1986,19 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
caster->CastCustomSpell(caster, 48210, &m_currentBasePoints, 0, 0, true);
return;
}
+ switch(m_spellProto->SpellFamilyName)
+ {
+ case SPELLFAMILY_GENERIC:
+ // Living Bomb
+ if (m_spellProto->SpellFamilyFlags[1] & 0x20000)
+ {
+ if(!m_target || !caster || !(m_removeMode == AURA_REMOVE_BY_DISPEL || m_removeMode == AURA_REMOVE_BY_DEFAULT))
+ return;
+ caster->CastSpell(m_target, GetModifier()->m_amount, true, NULL, NULL, GetCasterGUID());
+ return;
+ }
+ break;
+ }
}
// AT APPLY & REMOVE
@@ -2058,14 +2071,6 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
}
case SPELLFAMILY_MAGE:
{
- // Living Bomb
- if (m_spellProto->SpellFamilyFlags[1] & 0x20000)
- {
- if(!m_target || !caster || !(m_removeMode == AURA_REMOVE_BY_DISPEL || m_removeMode == AURA_REMOVE_BY_DEFAULT))
- return;
- caster->CastSpell(m_target, GetModifier()->m_amount, true, NULL, NULL, GetCasterGUID());
- return;
- }
break;
}
case SPELLFAMILY_PRIEST:
@@ -5795,10 +5800,51 @@ void Aura::PeriodicTick()
break;
}
case SPELL_AURA_OBS_MOD_ENERGY:
+ {
+ if(m_modifier.m_miscvalue < 0)
+ break;
+ uint32 amount = m_modifier.m_amount;
+ if (uint32 modmask = m_modifier.m_miscvalue)
+ {
+ for(uint8 i = 0; i < MAX_POWERS; ++i)
+ {
+ if(modmask & (uint32(1) << i))
+ {
+ if(i >= MAX_POWERS)
+ continue;
+
+ Powers power = Powers(i);
+
+ if(m_target->GetMaxPower(power) == 0)
+ continue;
+
+ sLog.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
+ GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), amount, GetId());
+
+ // Warning: this packet may be not blizzlike
+ WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size
+ data.append(m_target->GetPackGUID());
+ data.appendPackGUID(GetCasterGUID());
+ data << uint32(GetId());
+ data << uint32(1);
+ data << uint32(m_modifier.m_auraname);
+ data << uint32(power); // power type
+ data << (uint32)amount;
+ m_target->SendMessageToSet(&data,true);
+
+ int32 gain = m_target->ModifyPower(power,amount);
+
+ if(Unit* pCaster = GetCaster())
+ m_target->getHostilRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto());
+ }
+ }
+ }
+ break;
+ }
case SPELL_AURA_PERIODIC_ENERGIZE:
{
// ignore non positive values (can be result apply spellmods to aura damage
- if(m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS)
+ if(m_modifier.m_amount < 0 || m_modifier.m_miscvalue >= MAX_POWERS)
break;
Powers power = Powers(m_modifier.m_miscvalue);
@@ -5807,12 +5853,6 @@ void Aura::PeriodicTick()
break;
uint32 amount = m_modifier.m_amount < 0 ? 0 : m_modifier.m_amount;
- uint32 pdamage;
-
- if( m_modifier.m_auraname == SPELL_AURA_OBS_MOD_ENERGY )
- pdamage = uint32(m_target->GetMaxPower(power) * amount/100);
- else
- pdamage = amount;
WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size
data.append(m_target->GetPackGUID());
@@ -5821,13 +5861,13 @@ void Aura::PeriodicTick()
data << uint32(1);
data << uint32(m_modifier.m_auraname);
data << (uint32)power; // power type
- data << (uint32)pdamage;
+ data << (uint32)amount;
m_target->SendMessageToSet(&data,true);
sLog.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
- GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId());
+ GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), amount, GetId());
- int32 gain = m_target->ModifyPower(power,pdamage);
+ int32 gain = m_target->ModifyPower(power,amount);
if(Unit* pCaster = GetCaster())
m_target->getHostilRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto());
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index a77155ab87a..52b7b4f5114 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -3860,7 +3860,7 @@ bool Unit::AddAura(Aura *Aur)
sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for IsSingleTargetSpell", (*itr)->GetId(), (*itr)->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex());
continue;
}
- (*itr)->GetTarget()->RemoveAura((*itr)->GetId(), (*itr)->GetEffIndex());
+ (*itr)->GetTarget()->RemoveAurasByCasterSpell((*itr)->GetId(),(*itr)->GetEffIndex(), caster->GetGUID(), AURA_REMOVE_BY_CANCEL);
restart = true;
break;
}
@@ -4070,13 +4070,28 @@ void Unit::RemoveAura(uint32 spellId, uint32 effindex, Aura* except)
}
}
-void Unit::RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID)
+void Unit::RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID, AuraRemoveMode removeMode)
{
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )
{
Aura *aur = iter->second;
if (aur->GetId() == spellId && aur->GetCasterGUID() == casterGUID)
- RemoveAura(iter);
+ RemoveAura(iter, removeMode);
+ else
+ ++iter;
+ }
+}
+
+void Unit::RemoveAurasByCasterSpell(uint32 spellId, uint8 effindex, uint64 casterGUID, AuraRemoveMode removeMode)
+{
+ spellEffectPair spair = spellEffectPair(spellId, effindex);
+ for(AuraMap::iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair);)
+ {
+ if (iter->second->GetCasterGUID() == casterGUID)
+ {
+ RemoveAura(iter, removeMode);
+ iter = m_Auras.lower_bound(spair);
+ }
else
++iter;
}
@@ -4222,7 +4237,7 @@ void Unit::RemoveNotOwnSingleTargetAuras()
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )
{
if (iter->second->GetCasterGUID()!=GetGUID() && IsSingleTargetSpell(iter->second->GetSpellProto()))
- RemoveAura(iter);
+ RemoveAura(iter, AURA_REMOVE_BY_CANCEL);
else
++iter;
}
diff --git a/src/game/Unit.h b/src/game/Unit.h
index cae075b07dc..19e188922e6 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1232,7 +1232,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex);
void RemoveAurasDueToSpell(uint32 spellId, Aura* except = NULL);
void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId);
- void RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID);
+ 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 RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler);
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer);
void RemoveAurasDueToSpellByCancel(uint32 spellId);