diff options
author | megamage <none@none> | 2008-11-01 15:08:12 -0500 |
---|---|---|
committer | megamage <none@none> | 2008-11-01 15:08:12 -0500 |
commit | d292b85d3849cf45028ee98220311af9b0ccafa0 (patch) | |
tree | c038dfd8aba50141a3fa5665250ddadde753add7 /src/game/Spell.cpp | |
parent | e2eb694c57885e49f37c328b899d802e1ff4ea90 (diff) |
[svn] Fix teleport spells.
Fix cone spells.
Use interrupt_aura_flag to remove stealth/invisible/feign death auras.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Spell.cpp')
-rw-r--r-- | src/game/Spell.cpp | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 074eff34950..a200ef88467 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -94,7 +94,7 @@ void SpellCastTargets::setUnitTarget(Unit *target) m_targetMask |= TARGET_FLAG_UNIT; } -void SpellCastTargets::setDestination(float x, float y, float z, bool send) +void SpellCastTargets::setDestination(float x, float y, float z, bool send, uint32 mapId) { m_destX = x; m_destY = y; @@ -102,6 +102,8 @@ void SpellCastTargets::setDestination(float x, float y, float z, bool send) m_hasDest = true; if(send) m_targetMask |= TARGET_FLAG_DEST_LOCATION; + if(mapId) + m_mapId = mapId; } void SpellCastTargets::setDestination(Unit *target, bool send) @@ -1006,12 +1008,14 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) //if(!IsPositiveSpell(m_spellInfo->Id)) { - unit->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); + //do not remove feign death + unit->RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH + AURA_INTERRUPT_FLAG_DAMAGE); } } else { // for delayed spells ignore negative spells (after duel end) for friendly targets + // TODO: this cause soul transfer bugged if(m_spellInfo->speed > 0.0f && !IsPositiveSpell(m_spellInfo->Id)) { m_caster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE); @@ -1249,13 +1253,24 @@ void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, Unit* pUnitTarget, f void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, const uint32 &type, SpellTargets TargetType, uint32 entry) { - if(type == PUSH_DEST_CENTER && !m_targets.HasDest()) + float x, y; + if(type == PUSH_DEST_CENTER) { - sLog.outError( "SPELL: cannot find destination for spell ID %u\n", m_spellInfo->Id ); - return; + if(!m_targets.HasDest()) + { + sLog.outError( "SPELL: cannot find destination for spell ID %u\n", m_spellInfo->Id ); + return; + } + x = m_targets.m_destX; + y = m_targets.m_destY; + } + else + { + x = m_caster->GetPositionX(); + y = m_caster->GetPositionY(); } - CellPair p(Trinity::ComputeCellPair(m_targets.m_destX, m_targets.m_destY)); + CellPair p(Trinity::ComputeCellPair(x, y)); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); @@ -1435,12 +1450,21 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) case TARGET_TABLE_X_Y_Z_COORDINATES: if(SpellTargetPosition const* st = spellmgr.GetSpellTargetPosition(m_spellInfo->Id)) { - if (st->target_mapId == m_caster->GetMapId()) + //TODO: fix this check + if(m_spellInfo->Effect[0] == SPELL_EFFECT_TELEPORT_UNITS + || m_spellInfo->Effect[1] == SPELL_EFFECT_TELEPORT_UNITS + || m_spellInfo->Effect[2] == SPELL_EFFECT_TELEPORT_UNITS) + m_targets.setDestination(st->target_X, st->target_Y, st->target_Z, true, st->target_mapId); + else if(st->target_mapId == m_caster->GetMapId()) 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 ); break; + case TARGET_INNKEEPER_COORDINATES: + if(m_caster->GetTypeId() == TYPEID_PLAYER) + m_targets.setDestination(((Player*)m_caster)->m_homebindX,((Player*)m_caster)->m_homebindY,((Player*)m_caster)->m_homebindZ, true, ((Player*)m_caster)->m_homebindMapId); + break; // area targets case TARGET_ALL_ENEMY_IN_AREA_INSTANT: @@ -1480,7 +1504,6 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) }break; case TARGET_IN_FRONT_OF_CASTER: case TARGET_UNIT_CONE_ENEMY_UNKNOWN: - { switch(spellmgr.GetSpellExtraAttr(m_spellInfo->Id, SPELL_EXTRA_ATTR_CONE_TYPE)) { default: @@ -1493,12 +1516,10 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) case 2: SearchAreaTarget(TagUnitMap, radius, PUSH_IN_LINE, SPELL_TARGETS_AOE_DAMAGE); break; - } - }break; + }break; case TARGET_UNIT_CONE_ALLY: - { SearchAreaTarget(TagUnitMap, radius, PUSH_IN_FRONT, SPELL_TARGETS_FRIENDLY); - }break; + break; // nearby target case TARGET_UNIT_NEARBY_ALLY: @@ -1999,7 +2020,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) // destination around destination case TARGET_DEST_DEST_RANDOM: { - if(!(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)) + if(!m_targets.HasDest()) { sLog.outError("SPELL: no destination for spell ID %u\n", m_spellInfo->Id); break; @@ -2013,7 +2034,11 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap) m_targets.setDestination(px, py, pz); }break; case TARGET_SELF2: - m_targets.m_hasDest = true; + if(!m_targets.HasDest()) + { + sLog.outError("SPELL: no destination for spell ID %u\n", m_spellInfo->Id); + break; + } break; default: break; @@ -2123,8 +2148,7 @@ void Spell::prepare(SpellCastTargets * targets, Aura* triggeredByAura) // skip triggered spell (item equip spell casting and other not explicit character casts/item uses) if ( !m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo) ) { - m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); - m_caster->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); + m_caster->RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH); } if(m_IsTriggeredSpell) |