*Fix living bomb using a better way.
--HG-- branch : trunk
This commit is contained in:
+2
-4
@@ -1380,9 +1380,6 @@ void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, float max_range, uin
|
||||
void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, const uint32 &type, SpellTargets TargetType, uint32 entry)
|
||||
{
|
||||
float x, y, z;
|
||||
|
||||
Unit *target = m_targets.getUnitTarget();
|
||||
|
||||
if(type == PUSH_DEST_CENTER)
|
||||
{
|
||||
if(!m_targets.HasDest())
|
||||
@@ -1396,6 +1393,7 @@ void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, const u
|
||||
}
|
||||
else if(type == PUSH_TARGET_CENTER)
|
||||
{
|
||||
Unit *target = m_targets.getUnitTarget();
|
||||
if(!target)
|
||||
{
|
||||
sLog.outError( "SPELL: cannot find unit target for spell ID %u\n", m_spellInfo->Id );
|
||||
@@ -1412,7 +1410,7 @@ void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, const u
|
||||
z = m_caster->GetPositionZ();
|
||||
}
|
||||
|
||||
Trinity::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, type, TargetType, entry, x, y, z, target);
|
||||
Trinity::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, type, TargetType, entry, x, y, z);
|
||||
if((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_PLAYERS_ONLY)
|
||||
|| TargetType == SPELL_TARGETS_ENTRY && !entry)
|
||||
m_caster->GetMap()->VisitWorld(x, y, radius, notifier);
|
||||
|
||||
+32
-46
@@ -631,87 +631,73 @@ namespace Trinity
|
||||
const uint32& i_push_type;
|
||||
float i_radius, i_radiusSq;
|
||||
SpellTargets i_TargetType;
|
||||
Unit* i_caster;
|
||||
Unit* i_source;
|
||||
uint32 i_entry;
|
||||
float i_x, i_y, i_z;
|
||||
Unit* i_unitTarget;
|
||||
Unit* i_origCaster;
|
||||
|
||||
SpellNotifierCreatureAndPlayer(Spell &spell, std::list<Unit*> &data, float radius, const uint32 &type,
|
||||
SpellTargets TargetType = SPELL_TARGETS_ENEMY, uint32 entry = 0, float x = 0, float y = 0, float z = 0, Unit * unitTarget=NULL)
|
||||
SpellTargets TargetType = SPELL_TARGETS_ENEMY, uint32 entry = 0, float x = 0, float y = 0, float z = 0)
|
||||
: i_data(&data), i_spell(spell), i_push_type(type), i_radius(radius), i_radiusSq(radius*radius)
|
||||
, i_TargetType(TargetType), i_entry(entry), i_x(x), i_y(y), i_z(z), i_unitTarget(unitTarget)
|
||||
, i_TargetType(TargetType), i_entry(entry), i_x(x), i_y(y), i_z(z)
|
||||
{
|
||||
i_caster = spell.GetCaster();
|
||||
i_origCaster = spell.GetOriginalCaster();
|
||||
i_source = spell.GetCaster();
|
||||
assert(i_source);
|
||||
}
|
||||
|
||||
template<class T> inline void Visit(GridRefManager<T> &m)
|
||||
{
|
||||
assert(i_data);
|
||||
|
||||
if(!i_origCaster)
|
||||
return;
|
||||
|
||||
for(typename GridRefManager<T>::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if( !itr->getSource()->isAlive() || (itr->getSource()->GetTypeId() == TYPEID_PLAYER && ((Player*)itr->getSource())->isInFlight()))
|
||||
continue;
|
||||
Unit *target = (Unit*)itr->getSource();
|
||||
|
||||
switch (i_TargetType)
|
||||
{
|
||||
case SPELL_TARGETS_ALLY:
|
||||
if (!itr->getSource()->isAttackableByAOE() || !i_origCaster->IsFriendlyTo( itr->getSource() ))
|
||||
continue;
|
||||
break;
|
||||
case SPELL_TARGETS_ENEMY:
|
||||
{
|
||||
if (itr->getSource() == i_unitTarget)
|
||||
break;
|
||||
|
||||
if(itr->getSource()->GetTypeId()==TYPEID_UNIT && ((Creature*)itr->getSource())->isTotem())
|
||||
if(target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isTotem())
|
||||
continue;
|
||||
if(!itr->getSource()->isAttackableByAOE())
|
||||
if(!target->isAttackableByAOE())
|
||||
continue;
|
||||
|
||||
Unit* check = i_origCaster->GetCharmerOrOwnerOrSelf();
|
||||
|
||||
if( check->GetTypeId()==TYPEID_PLAYER )
|
||||
if(i_source->GetTypeId()==TYPEID_PLAYER)
|
||||
{
|
||||
if (check->IsFriendlyTo( itr->getSource() ))
|
||||
if(i_source->IsFriendlyTo(target))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!check->IsHostileTo( itr->getSource() ))
|
||||
if(!i_source->IsHostileTo(target))
|
||||
continue;
|
||||
}
|
||||
}break;
|
||||
case SPELL_TARGETS_ENTRY:
|
||||
{
|
||||
if(itr->getSource()->GetEntry()!= i_entry)
|
||||
break;
|
||||
case SPELL_TARGETS_ALLY:
|
||||
if(!target->isAttackableByAOE() || !i_source->IsFriendlyTo(target))
|
||||
continue;
|
||||
}break;
|
||||
default: continue;
|
||||
break;
|
||||
case SPELL_TARGETS_ENTRY:
|
||||
if(target->GetEntry()!= i_entry)
|
||||
continue;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
switch(i_push_type)
|
||||
{
|
||||
case PUSH_DEST_CENTER:
|
||||
case PUSH_TARGET_CENTER:
|
||||
if((target->GetDistanceSq(i_x, i_y, i_z) < i_radiusSq))
|
||||
i_data->push_back(target);
|
||||
break;
|
||||
case PUSH_IN_FRONT:
|
||||
if(i_caster->isInFront((Unit*)(itr->getSource()), i_radius, M_PI/3 ))
|
||||
i_data->push_back(itr->getSource());
|
||||
if(i_source->isInFront(target, i_radius, M_PI/3))
|
||||
i_data->push_back(target);
|
||||
break;
|
||||
case PUSH_IN_BACK:
|
||||
if(i_caster->isInBack((Unit*)(itr->getSource()), i_radius, M_PI/3 ))
|
||||
i_data->push_back(itr->getSource());
|
||||
if(i_source->isInBack(target, i_radius, M_PI/3))
|
||||
i_data->push_back(target);
|
||||
break;
|
||||
case PUSH_IN_LINE:
|
||||
if(i_caster->isInLine((Unit*)(itr->getSource()), i_radius ))
|
||||
i_data->push_back(itr->getSource());
|
||||
break;
|
||||
default:
|
||||
if((itr->getSource()->GetDistanceSq(i_x, i_y, i_z) < i_radiusSq))
|
||||
i_data->push_back(itr->getSource());
|
||||
if(i_source->isInLine(target, i_radius))
|
||||
i_data->push_back(target);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+16
-14
@@ -2051,25 +2051,27 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||
m_target->SetReducedThreatPercent(0, 0);
|
||||
return;
|
||||
}
|
||||
// Haunt
|
||||
if(caster && m_spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellProto->SpellFamilyFlags[1] & 0x40000)
|
||||
{
|
||||
caster->CastCustomSpell(caster, 48210, &m_currentBasePoints, 0, 0, true);
|
||||
return;
|
||||
}
|
||||
|
||||
switch(m_spellProto->SpellFamilyName)
|
||||
{
|
||||
case SPELLFAMILY_MAGE:
|
||||
// Living Bomb
|
||||
if (m_spellProto->SpellFamilyFlags[1] & 0x20000)
|
||||
case SPELLFAMILY_WARLOCK:
|
||||
// Haunt
|
||||
if(m_spellProto->SpellFamilyFlags[1] & 0x40000)
|
||||
{
|
||||
if(!m_target || !(m_removeMode == AURA_REMOVE_BY_DISPEL || m_removeMode == AURA_REMOVE_BY_DEFAULT))
|
||||
return;
|
||||
Unit* target=NULL;
|
||||
m_target->CastSpell(target, GetModifier()->m_amount, true, NULL, NULL, GetCasterGUID());
|
||||
if(caster)
|
||||
caster->CastCustomSpell(caster, 48210, &m_currentBasePoints, 0, 0, true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case SPELLFAMILY_MAGE:
|
||||
// Living Bomb
|
||||
if(m_spellProto->SpellFamilyFlags[1] & 0x20000)
|
||||
{
|
||||
if(caster && (m_removeMode == AURA_REMOVE_BY_DISPEL || m_removeMode == AURA_REMOVE_BY_DEFAULT))
|
||||
caster->CastSpell(m_target, GetModifier()->m_amount, true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user