mirror of
https://github.com/araxiaonline/TrinityCore2.git
synced 2026-06-16 13:00:42 -04:00
*Some update of spell target selection.
--HG-- branch : trunk
This commit is contained in:
@@ -198,7 +198,7 @@ void GameObject::Update(uint32 /*p_time*/)
|
||||
{
|
||||
// Arming Time for GAMEOBJECT_TYPE_TRAP (6)
|
||||
Unit* owner = GetOwner();
|
||||
if (owner && ((Player*)owner)->isInCombat())
|
||||
if (owner && owner->isInCombat())
|
||||
m_cooldownTime = time(NULL) + GetGOInfo()->trap.startDelay;
|
||||
m_lootState = GO_READY;
|
||||
break;
|
||||
|
||||
@@ -1597,6 +1597,8 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType)
|
||||
break;
|
||||
}
|
||||
case SPELL_TARGET_TYPE_CREATURE:
|
||||
if(m_targets.getUnitTarget() && m_targets.getUnitTarget()->GetEntry() == i_spellST->second.targetEntry)
|
||||
return m_targets.getUnitTarget();
|
||||
case SPELL_TARGET_TYPE_DEAD:
|
||||
default:
|
||||
{
|
||||
@@ -1925,7 +1927,13 @@ void Spell::SetTargetMap(uint32 i, uint32 cur)
|
||||
m_targets.setDestination(st->target_X, st->target_Y, st->target_Z);
|
||||
}
|
||||
else
|
||||
sLog.outError( "SPELL: unknown target coordinates for spell ID %u\n", m_spellInfo->Id );
|
||||
{
|
||||
sLog.outError( "SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id );
|
||||
Unit *target = NULL;
|
||||
if(uint64 guid = m_caster->GetUInt64Value(UNIT_FIELD_TARGET))
|
||||
target = ObjectAccessor::GetUnit(*m_caster, guid);
|
||||
m_targets.setDestination(target ? target : m_caster);
|
||||
}
|
||||
break;
|
||||
case TARGET_DST_HOME:
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -2045,7 +2053,7 @@ void Spell::SetTargetMap(uint32 i, uint32 cur)
|
||||
else if(pushType)
|
||||
{
|
||||
// Dummy, just for client
|
||||
if(spellmgr.EffectTargetType[m_spellInfo->Effect[i]] == SPELL_REQUIRE_DEST)
|
||||
if(spellmgr.EffectTargetType[m_spellInfo->Effect[i]] != SPELL_REQUIRE_UNIT)
|
||||
return;
|
||||
|
||||
float radius;
|
||||
@@ -3971,13 +3979,16 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
return SPELL_FAILED_NOT_IN_ARENA;
|
||||
|
||||
// zone check
|
||||
uint32 zone, area;
|
||||
m_caster->GetZoneAndAreaId(zone,area);
|
||||
if(m_caster->GetTypeId() == TYPEID_UNIT || !((Player*)m_caster)->isGameMaster())
|
||||
{
|
||||
uint32 zone, area;
|
||||
m_caster->GetZoneAndAreaId(zone,area);
|
||||
|
||||
SpellCastResult locRes= spellmgr.GetSpellAllowedInLocationError(m_spellInfo,m_caster->GetMapId(),zone,area,
|
||||
m_caster->GetTypeId()==TYPEID_PLAYER ? ((Player*)m_caster) : NULL);
|
||||
if(locRes != SPELL_CAST_OK)
|
||||
return locRes;
|
||||
SpellCastResult locRes= spellmgr.GetSpellAllowedInLocationError(m_spellInfo,m_caster->GetMapId(),zone,area,
|
||||
m_caster->GetTypeId()==TYPEID_PLAYER ? ((Player*)m_caster) : NULL);
|
||||
if(locRes != SPELL_CAST_OK)
|
||||
return locRes;
|
||||
}
|
||||
|
||||
// not let players cast spells at mount (and let do it to creatures)
|
||||
if( m_caster->IsMounted() && m_caster->GetTypeId()==TYPEID_PLAYER && !m_IsTriggeredSpell &&
|
||||
|
||||
@@ -1000,7 +1000,7 @@ void Aura::_AddAura()
|
||||
for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
|
||||
{
|
||||
if(*itr < 0)
|
||||
m_target->ApplySpellImmune(id, IMMUNITY_ID, -(*itr), m_target);
|
||||
m_target->ApplySpellImmune(id, IMMUNITY_ID, -(*itr), true);
|
||||
else if(Unit* caster = GetCaster())
|
||||
caster->AddAura(*itr, m_target);
|
||||
}
|
||||
|
||||
@@ -4775,17 +4775,17 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
unitTarget->CastSpell(unitTarget, 44870, true);
|
||||
break;
|
||||
}
|
||||
// spell of Brutallus - Stomp
|
||||
case 45185:
|
||||
{
|
||||
if(!unitTarget)
|
||||
return;
|
||||
|
||||
if(unitTarget->HasAura(46394)) // spell of Brutallus - Burn
|
||||
unitTarget->RemoveAurasDueToSpell(46394);
|
||||
// spell of Brutallus - Stomp
|
||||
case 45185:
|
||||
{
|
||||
if(!unitTarget)
|
||||
return;
|
||||
|
||||
break;
|
||||
}
|
||||
if(unitTarget->HasAura(46394)) // spell of Brutallus - Burn
|
||||
unitTarget->RemoveAurasDueToSpell(46394);
|
||||
|
||||
break;
|
||||
}
|
||||
// Negative Energy
|
||||
case 46289:
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user