Show
Ignore:
Timestamp:
11/19/08 13:40:02 (17 years ago)
Author:
yumileroy
Message:

[svn] Fix teleport spells.
Fix cone spells.
Use interrupt_aura_flag to remove stealth/invisible/feign death auras.

Original author: megamage
Date: 2008-11-01 15:08:12-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Spell.cpp

    r141 r142  
    9595} 
    9696 
    97 void SpellCastTargets::setDestination(float x, float y, float z, bool send) 
     97void SpellCastTargets::setDestination(float x, float y, float z, bool send, uint32 mapId) 
    9898{ 
    9999    m_destX = x; 
     
    103103    if(send) 
    104104        m_targetMask |= TARGET_FLAG_DEST_LOCATION; 
     105    if(mapId) 
     106        m_mapId = mapId; 
    105107} 
    106108 
     
    10071009            //if(!IsPositiveSpell(m_spellInfo->Id)) 
    10081010            { 
    1009                 unit->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
     1011                //do not remove feign death 
     1012                unit->RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH + AURA_INTERRUPT_FLAG_DAMAGE); 
    10101013            } 
    10111014        } 
     
    10131016        { 
    10141017            // for delayed spells ignore negative spells (after duel end) for friendly targets 
     1018            // TODO: this cause soul transfer bugged 
    10151019            if(m_spellInfo->speed > 0.0f && !IsPositiveSpell(m_spellInfo->Id)) 
    10161020            { 
     
    12501254void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, const uint32 &type, SpellTargets TargetType, uint32 entry) 
    12511255{ 
    1252     if(type == PUSH_DEST_CENTER && !m_targets.HasDest()) 
    1253     { 
    1254         sLog.outError( "SPELL: cannot find destination for spell ID %u\n", m_spellInfo->Id ); 
    1255         return; 
    1256     } 
    1257  
    1258     CellPair p(Trinity::ComputeCellPair(m_targets.m_destX, m_targets.m_destY)); 
     1256    float x, y; 
     1257    if(type == PUSH_DEST_CENTER) 
     1258    { 
     1259        if(!m_targets.HasDest()) 
     1260        { 
     1261            sLog.outError( "SPELL: cannot find destination for spell ID %u\n", m_spellInfo->Id ); 
     1262            return; 
     1263        } 
     1264        x = m_targets.m_destX; 
     1265        y = m_targets.m_destY; 
     1266    } 
     1267    else 
     1268    { 
     1269        x = m_caster->GetPositionX(); 
     1270        y = m_caster->GetPositionY(); 
     1271    } 
     1272 
     1273    CellPair p(Trinity::ComputeCellPair(x, y)); 
    12591274    Cell cell(p); 
    12601275    cell.data.Part.reserved = ALL_DISTRICT; 
     
    14361451            if(SpellTargetPosition const* st = spellmgr.GetSpellTargetPosition(m_spellInfo->Id)) 
    14371452            { 
    1438                 if (st->target_mapId == m_caster->GetMapId()) 
     1453                //TODO: fix this check 
     1454                if(m_spellInfo->Effect[0] == SPELL_EFFECT_TELEPORT_UNITS 
     1455                    || m_spellInfo->Effect[1] == SPELL_EFFECT_TELEPORT_UNITS 
     1456                    || m_spellInfo->Effect[2] == SPELL_EFFECT_TELEPORT_UNITS) 
     1457                    m_targets.setDestination(st->target_X, st->target_Y, st->target_Z, true, st->target_mapId); 
     1458                else if(st->target_mapId == m_caster->GetMapId()) 
    14391459                    m_targets.setDestination(st->target_X, st->target_Y, st->target_Z); 
    14401460            } 
    14411461            else 
    14421462                sLog.outError( "SPELL: unknown target coordinates for spell ID %u\n", m_spellInfo->Id ); 
     1463            break; 
     1464        case TARGET_INNKEEPER_COORDINATES: 
     1465            if(m_caster->GetTypeId() == TYPEID_PLAYER) 
     1466                m_targets.setDestination(((Player*)m_caster)->m_homebindX,((Player*)m_caster)->m_homebindY,((Player*)m_caster)->m_homebindZ, true, ((Player*)m_caster)->m_homebindMapId); 
    14431467            break; 
    14441468 
     
    14811505        case TARGET_IN_FRONT_OF_CASTER: 
    14821506        case TARGET_UNIT_CONE_ENEMY_UNKNOWN: 
    1483         { 
    14841507            switch(spellmgr.GetSpellExtraAttr(m_spellInfo->Id, SPELL_EXTRA_ATTR_CONE_TYPE)) 
    14851508            { 
     
    14941517                    SearchAreaTarget(TagUnitMap, radius, PUSH_IN_LINE, SPELL_TARGETS_AOE_DAMAGE); 
    14951518                    break; 
    1496             } 
    1497         }break; 
     1519            }break; 
    14981520        case TARGET_UNIT_CONE_ALLY: 
    1499         { 
    15001521            SearchAreaTarget(TagUnitMap, radius, PUSH_IN_FRONT, SPELL_TARGETS_FRIENDLY); 
    1501         }break; 
     1522            break; 
    15021523 
    15031524        // nearby target 
     
    20002021        case TARGET_DEST_DEST_RANDOM: 
    20012022        { 
    2002             if(!(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)) 
     2023            if(!m_targets.HasDest()) 
    20032024            { 
    20042025                sLog.outError("SPELL: no destination for spell ID %u\n", m_spellInfo->Id); 
     
    20142035        }break; 
    20152036        case TARGET_SELF2: 
    2016             m_targets.m_hasDest = true; 
     2037            if(!m_targets.HasDest()) 
     2038            { 
     2039                sLog.outError("SPELL: no destination for spell ID %u\n", m_spellInfo->Id); 
     2040                break; 
     2041            } 
    20172042            break; 
    20182043        default: 
     
    21242149    if ( !m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo) ) 
    21252150    { 
    2126         m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    2127         m_caster->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); 
     2151        m_caster->RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH); 
    21282152    } 
    21292153