diff options
| author | megamage <none@none> | 2009-05-09 10:48:14 -0500 |
|---|---|---|
| committer | megamage <none@none> | 2009-05-09 10:48:14 -0500 |
| commit | 6592e99f4aa8972452ee5fd426893f2cf832e291 (patch) | |
| tree | c6fff6cda83001d606d4f26ef69539f93da628ab /src/game/Spell.cpp | |
| parent | 3b4e4b82159eff3411297e8e300cbc9a7bf7a1b5 (diff) | |
*Some update of spell target selection.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Spell.cpp')
| -rw-r--r-- | src/game/Spell.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index d4e2207964b..9f0a5dc0fde 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -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 && |
