Changeset 186

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

[svn] Remove isVisible function. Check stealth and invisible in canAttack();
Use new remove aura by interrupt flag function.

Original author: megamage
Date: 2008-11-07 09:36:46-06:00

Location:
trunk
Files:
1 added
1 removed
22 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/bindings/scripts/include/sc_creature.cpp

    r153 r186  
    7474void ScriptedAI::MoveInLineOfSight(Unit *who) 
    7575{ 
    76     if (!m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessablePlaceFor(m_creature)) 
    77     { 
    78         if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) 
    79             return; 
    80  
    81         float attackRadius = m_creature->GetAttackDistance(who); 
    82         if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 
    83         { 
    84             who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    85             AttackStart(who); 
    86         } 
    87     } 
     76    if(m_creature->getVictim() || !m_creature->IsHostileTo(who) || !who->isInAccessablePlaceFor(m_creature)) 
     77        return; 
     78 
     79    if(!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) 
     80        return; 
     81 
     82    if(!m_creature->IsWithinDistInMap(who, m_creature->GetAttackDistance(who)) || !m_creature->IsWithinLOSInMap(who)) 
     83        return; 
     84     
     85    if(m_creature->canAttack(who)) 
     86        //who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
     87        AttackStart(who); 
    8888} 
    8989 
     
    778778void Scripted_NoMovementAI::MoveInLineOfSight(Unit *who) 
    779779{ 
    780     if( !m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessablePlaceFor(m_creature) ) 
     780    if( !m_creature->getVictim() && m_creature->canAttack(who) && ( m_creature->IsHostileTo( who )) && who->isInAccessablePlaceFor(m_creature) ) 
    781781    { 
    782782        if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) 
  • trunk/src/bindings/scripts/scripts/creature/mob_event_ai.cpp

    r109 r186  
    11961196            return; 
    11971197 
    1198  
    1199         if (who->isTargetableForAttack() && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who)) 
     1198        if (m_creature->canAttack(who) && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who)) 
    12001199        { 
    12011200            if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) 
     
    12051204            if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 
    12061205            { 
    1207                 if(who->HasStealthAura()) 
    1208                     who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
     1206                //if(who->HasStealthAura()) 
     1207                //    who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    12091208 
    12101209                //Begin melee attack if we are within range 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp

    r180 r186  
    414414            EnterPhase(PHASE_FLIGHT); 
    415415        } 
    416         else  
     416        else // handle flight sequence 
    417417            Timer[EVENT_FLIGHT_SEQUENCE] = 1000;     
    418418    } 
     
    692692        for(uint32 i = 1; i <= MaxTimer[Phase]; i++) 
    693693        { 
    694             if(Timer[i]) 
     694            if(Timer[i]) // Event is enabled 
    695695                if(Timer[i] <= diff) 
    696696                { 
    697                     if(!Event) 
     697                    if(!Event) // No event with higher priority 
    698698                        Event = (EventIllidan)i; 
    699699                } 
     
    709709 
    710710        case PHASE_NORMAL_2: 
    711             if(m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30) 
     711            if(HPPCT(m_creature) < 30) 
    712712                EnterPhase(PHASE_TALK_SEQUENCE); 
    713713            break; 
    714714 
    715715        case PHASE_NORMAL_MAIEV: 
    716             if(m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 1) 
     716            if(HPPCT(m_creature) < 1) 
    717717                EnterPhase(PHASE_TALK_SEQUENCE); 
    718718            break; 
     
    759759                        DoPlaySoundToSet(m_creature, soundid); 
    760760                } 
    761                 Timer[EVENT_TAUNT] = 32000; 
     761                Timer[EVENT_TAUNT] = 25000 + rand()%10000; 
    762762                break; 
    763763 
     
    834834                Phase = PHASE_FLIGHT_SEQUENCE; 
    835835                Timer[EVENT_FLIGHT_SEQUENCE] = 0;//do not start Event when changing hover point 
    836                 for (uint8 i = 0; i <= rand()%3; i++) 
    837                 { 
    838                     HoverPoint++; 
    839                     if(HoverPoint > 3) 
    840                         HoverPoint = 0; 
    841                 } 
     836                HoverPoint += (rand()%3 + 1); 
     837                if(HoverPoint > 3) 
     838                    HoverPoint -= 4; 
    842839                m_creature->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint].x, HoverPosition[HoverPoint].y, HoverPosition[HoverPoint].z); 
    843840                break; 
     
    20602057    final.y = 2 * final.y - initial.y; 
    20612058 
    2062     for(uint8 i = 0; i < 2; ++i)//core bug, two buff do not coexist 
    2063     { 
    2064         Creature* Trigger = NULL; 
    2065         Trigger = m_creature->SummonCreature(DEMON_FIRE, initial.x, initial.y, initial.z, 0, TEMPSUMMON_TIMED_DESPAWN, 13000); 
    2066         if(Trigger) 
    2067         { 
    2068             ((demonfireAI*)Trigger->AI())->IsTrigger = true; 
    2069             Trigger->SetSpeed(MOVE_WALK, 3); 
    2070             Trigger->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE); 
    2071             Trigger->GetMotionMaster()->MovePoint(0, final.x, final.y, final.z); 
    2072  
    2073             if(!i) 
    2074                 Trigger->CastSpell(Trigger, SPELL_EYE_BLAST_TRIGGER, true); 
    2075             else 
    2076             { 
    2077                 Trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
    2078                 m_creature->SetUInt64Value(UNIT_FIELD_TARGET, Trigger->GetGUID()); 
    2079                 DoCast(Trigger, SPELL_EYE_BLAST); 
    2080             } 
    2081         } 
    2082     } 
     2059    Creature* Trigger = m_creature->SummonCreature(DEMON_FIRE, initial.x, initial.y, initial.z, 0, TEMPSUMMON_TIMED_DESPAWN, 13000); 
     2060    if(!Trigger) return; 
     2061 
     2062    ((demonfireAI*)Trigger->AI())->IsTrigger = true; 
     2063    Trigger->SetSpeed(MOVE_WALK, 3); 
     2064    Trigger->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE); 
     2065    Trigger->GetMotionMaster()->MovePoint(0, final.x, final.y, final.z); 
     2066 
     2067    Trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
     2068    m_creature->SetUInt64Value(UNIT_FIELD_TARGET, Trigger->GetGUID()); 
     2069    DoCast(Trigger, SPELL_EYE_BLAST); 
    20832070} 
    20842071 
     
    21632150        m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); 
    21642151        m_creature->GetMotionMaster()->Clear(false); 
    2165         //m_creature->GetMotionMaster()->MoveIdle(); 
    21662152        m_creature->AttackStop(); 
    21672153        break; 
    21682154    case PHASE_FLIGHT_SEQUENCE: 
    2169         if(Phase == PHASE_FLIGHT) //land 
    2170             Timer[EVENT_FLIGHT_SEQUENCE] = 2000; 
    2171         else //lift off 
     2155        if(Phase == PHASE_NORMAL) //lift off 
    21722156        { 
    21732157            FlightCount = 1; 
     
    21772161            m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); 
    21782162            m_creature->GetMotionMaster()->Clear(false); 
    2179             //m_creature->GetMotionMaster()->MoveIdle(); 
    21802163            m_creature->AttackStop(); 
    21812164        } 
     2165        else //land 
     2166            Timer[EVENT_FLIGHT_SEQUENCE] = 2000; 
    21822167        break; 
    21832168    case PHASE_TRANSFORM_SEQUENCE: 
     
    21922177        } 
    21932178        m_creature->GetMotionMaster()->Clear(); 
    2194         //m_creature->GetMotionMaster()->MoveIdle(); 
    21952179        m_creature->AttackStop(); 
    21962180        break; 
  • trunk/src/game/AggressorAI.cpp

    r156 r186  
    5050        return; 
    5151     
    52     if( !i_creature.getVictim() && !i_creature.hasUnitState(UNIT_STAT_STUNNED) && u->isTargetableForAttack() && 
     52    if( !i_creature.getVictim() && !i_creature.hasUnitState(UNIT_STAT_STUNNED) && i_creature.canAttack(u) && 
    5353        ( i_creature.IsHostileTo( u ) /*|| u->getVictim() && i_creature.IsFriendlyTo( u->getVictim() )*/ ) && 
    5454        u->isInAccessablePlaceFor(&i_creature) ) 
  • trunk/src/game/Creature.cpp

    r178 r186  
    15331533} 
    15341534 
     1535bool Creature::IsWithinSightDist(Unit const* u) const 
     1536{ 
     1537    return IsWithinDistInMap(u, sWorld.getConfig(CONFIG_SIGHT_MONSTER)); 
     1538} 
     1539 
    15351540float Creature::GetAttackDistance(Unit const* pl) const 
    15361541{ 
     
    18671872        return true; 
    18681873 
    1869     if(!pVictim->isTargetableForAttack()) 
     1874    if(!canAttack(pVictim)) 
    18701875        return true; 
    18711876 
  • trunk/src/game/Creature.h

    r178 r186  
    549549 
    550550        bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const; 
     551        bool IsWithinSightDist(Unit const* u) const; 
    551552        float GetAttackDistance(Unit const* pl) const; 
    552553 
  • trunk/src/game/GameEvent.cpp

    r111 r186  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
  • trunk/src/game/GlobalEvents.cpp

    r102 r186  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
  • trunk/src/game/GridNotifiersImpl.h

    r102 r186  
    7575    if(!c->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) 
    7676    { 
    77         if( c->AI() && c->AI()->IsVisible(pl) && !c->IsInEvadeMode() ) 
     77        if( c->AI() && c->IsWithinSightDist(pl) /*c->AI()->IsVisible(pl)*/ && !c->IsInEvadeMode() ) 
    7878            c->AI()->MoveInLineOfSight(pl); 
    7979    } 
     
    8484    if(!c1->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) 
    8585    { 
    86         if( c1->AI() && c1->AI()->IsVisible(c2) && !c1->IsInEvadeMode() ) 
     86        if( c1->AI() && c1->IsWithinSightDist(c2) /*c1->AI()->IsVisible(c2)*/ && !c1->IsInEvadeMode() ) 
    8787            c1->AI()->MoveInLineOfSight(c2); 
    8888    } 
     
    9090    if(!c2->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) 
    9191    { 
    92         if( c2->AI() && c2->AI()->IsVisible(c1) && !c2->IsInEvadeMode() ) 
     92        if( c2->AI() && c1->IsWithinSightDist(c2) /*c2->AI()->IsVisible(c1)*/ && !c2->IsInEvadeMode() ) 
    9393            c2->AI()->MoveInLineOfSight(c1); 
    9494    } 
  • trunk/src/game/GuardAI.cpp

    r156 r186  
    4444        return; 
    4545 
    46     if( !i_creature.getVictim() && u->isTargetableForAttack() && 
     46    if( !i_creature.getVictim() && i_creature.canAttack(u) && 
    4747        ( u->IsHostileToPlayers() || i_creature.IsHostileTo(u) /*|| u->getVictim() && i_creature.IsFriendlyTo(u->getVictim())*/ ) && 
    4848        u->isInAccessablePlaceFor(&i_creature)) 
  • trunk/src/game/Map.cpp

    r174 r186  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    9191        if(vmgr->isMapLoadingEnabled()) 
    9292        { 
    93                                                             // x and y are swaped !! => fixed now 
     93                                                            // x and y are swapped !! => fixed now 
    9494            bool exists = vmgr->existsMap((sWorld.GetDataPath()+ "vmaps").c_str(),  mapid, x,y); 
    9595            if(!exists) 
     
    107107void Map::LoadVMap(int x,int y) 
    108108{ 
    109                                                             // x and y are swaped !! 
     109                                                            // x and y are swapped !! 
    110110    int vmapLoadResult = VMAP::VMapFactory::createOrGetVMapManager()->loadMap((sWorld.GetDataPath()+ "vmaps").c_str(),  GetId(), x,y); 
    111111    switch(vmapLoadResult) 
     
    145145    } 
    146146 
    147     //map already load, delete it before reloading (Is it neccessary? Do we really need the abilty the reload maps during runtime?) 
     147    //map already load, delete it before reloading (Is it necessary? Do we really need the ability the reload maps during runtime?) 
    148148    if(GridMaps[x][y]) 
    149149    { 
     
    335335void Map::DeleteFromWorld(T* obj) 
    336336{ 
    337     // Note: In case resurrectable corpse and pet its removed from gloabal lists in own destructors 
     337    // Note: In case resurrectable corpse and pet its removed from global lists in own destructor 
    338338    delete obj; 
    339339} 
     
    442442bool Map::Add(Player *player) 
    443443{ 
    444     player->SetInstanceId(this->GetInstanceId()); 
     444    player->SetInstanceId(GetInstanceId()); 
    445445 
    446446    // update player state for other player and visa-versa 
     
    671671 
    672672    obj->RemoveFromWorld(); 
    673  
    674673    RemoveFromGrid(obj,grid,cell); 
    675674 
     
    13911390            break; 
    13921391        case TYPEID_UNIT: 
    1393             // in case triggred sequence some spell can continue casting after prev CleanupsBeforeDelete call 
     1392            // in case triggered sequence some spell can continue casting after prev CleanupsBeforeDelete call 
    13941393            // make sure that like sources auras/etc removed before destructor start 
    13951394            ((Creature*)obj)->CleanupsBeforeDelete (); 
     
    14701469        return false; 
    14711470    } 
    1472  
    1473     /*if(!player->isGameMaster() && i_data && i_data->IsEncounterInProgress()) 
    1474     { 
    1475         sLog.outDebug("InstanceMap::CanEnter - Player '%s' can't enter instance '%s' while an encounter is in progress.", player->GetName(), GetMapName()); 
    1476         player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT); 
    1477         return false; 
    1478     }*/ 
    14791471 
    14801472    return Map::CanEnter(player); 
     
    15871579void InstanceMap::Update(const uint32& t_diff) 
    15881580{ 
    1589         Map::Update(t_diff); 
    1590  
    1591         if(i_data) 
    1592                 i_data->Update(t_diff); 
     1581    Map::Update(t_diff); 
     1582 
     1583    if(i_data) 
     1584        i_data->Update(t_diff); 
    15931585} 
    15941586 
  • trunk/src/game/OutdoorPvPObjectiveAI.cpp

    r178 r186  
    3535    // IsVisible only passes for players in range, so no need to check again 
    3636    // leaving/entering distance will be checked based on go range data 
    37     sOutdoorPvPMgr.HandleCaptureCreaturePlayerMoveInLos(((Player*)u),&i_creature); 
     37    if((u->GetTypeId() == TYPEID_PLAYER) && i_creature.IsWithinDistInMap(u, MAX_OUTDOOR_PVP_DISTANCE)) 
     38        sOutdoorPvPMgr.HandleCaptureCreaturePlayerMoveInLos(((Player*)u),&i_creature); 
    3839} 
    3940 
  • trunk/src/game/PetAI.cpp

    r156 r186  
    4949    if( !i_pet.getVictim() && i_pet.GetCharmInfo() && 
    5050        i_pet.GetCharmInfo()->HasReactState(REACT_AGGRESSIVE) && 
    51         u->isTargetableForAttack() && i_pet.IsHostileTo( u ) && 
     51        i_pet.IsHostileTo( u ) && i_pet.canAttack(u) && 
    5252        u->isInAccessablePlaceFor(&i_pet)) 
    5353    { 
     
    9696        return true; 
    9797 
    98     return !i_pet.getVictim()->isTargetableForAttack(); 
     98    return !i_pet.canAttack(i_pet.getVictim()); 
    9999} 
    100100 
  • trunk/src/game/Player.cpp

    r183 r186  
    1654716547 
    1654816548    // prevent stealth flight 
    16549     RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH); 
     16549    RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH); 
    1655016550 
    1655116551    WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); 
  • trunk/src/game/PossessedAI.cpp

    r174 r186  
    4646        return true; 
    4747 
    48     return !i_pet.getVictim()->isTargetableForAttack(); 
     48    return !i_pet.canAttack(i_pet.getVictim()); 
    4949} 
    5050 
  • trunk/src/game/Spell.cpp

    r185 r186  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    10061006            { 
    10071007                //do not remove feign death 
    1008                 unit->RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH + AURA_INTERRUPT_FLAG_DAMAGE); 
     1008                unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH + AURA_INTERRUPT_FLAG_DAMAGE); 
    10091009            } 
    10101010        } 
     
    21482148    if ( !m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo) ) 
    21492149    { 
    2150         m_caster->RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH); 
     2150        m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH); 
    21512151    } 
    21522152 
     
    22072207{ 
    22082208    SetExecutedCurrently(true); 
    2209      
     2209 
    22102210    uint8 castResult = 0; 
    22112211 
     
    23222322        handle_immediate(); 
    23232323    } 
    2324      
     2324 
    23252325    SetExecutedCurrently(false); 
    23262326} 
     
    30833083    WorldObject* target = NULL; 
    30843084 
    3085     // select first not rsusted target from target list for _0_ effect 
     3085    // select first not resisted target from target list for _0_ effect 
    30863086    if(!m_UniqueTargetInfo.empty()) 
    30873087    { 
     
    33413341    for(TriggerSpells::iterator si=m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si) 
    33423342    { 
    3343         Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, this->m_selfContainer); 
     3343        Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, m_selfContainer); 
    33443344        spell->prepare(&m_targets);                         // use original spell original targets 
    33453345    } 
     
    33983398        if(m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot))) 
    33993399            return SPELL_FAILED_TARGET_AURASTATE; 
    3400  
    34013400 
    34023401        if(target != m_caster) 
     
    40774076        return SPELL_FAILED_CASTER_DEAD; 
    40784077 
    4079     if(m_caster->IsNonMeleeSpellCasted(false))              //prevent spellcast interuption by another spellcast 
     4078    if(m_caster->IsNonMeleeSpellCasted(false))              //prevent spellcast interruption by another spellcast 
    40804079        return SPELL_FAILED_SPELL_IN_PROGRESS; 
    40814080    if(m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo)) 
     
    41694168                dispel_immune |= GetDispellMask(DispelType(m_spellInfo->EffectMiscValue[i])); 
    41704169        } 
    4171         //immune movement impairement and loss of control 
     4170        //immune movement impairment and loss of control 
    41724171        if(m_spellInfo->Id==(uint32)42292) 
    41734172            mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; 
     
    46514650 
    46524651                uint32 item_quality = itemProto->Quality; 
    4653                 // 2.0.x addon: Check player enchanting level agains the item desenchanting requirements 
     4652                // 2.0.x addon: Check player enchanting level against the item disenchanting requirements 
    46544653                uint32 item_disenchantskilllevel = itemProto->RequiredDisenchantSkill; 
    46554654                if (item_disenchantskilllevel == uint32(-1)) 
  • trunk/src/game/Spell.h

    r174 r186  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    579579                { 
    580580                    case SPELL_TARGETS_FRIENDLY: 
    581                         if (!itr->getSource()->isTargetableForAttack() || !i_caster->IsFriendlyTo( itr->getSource() )) 
     581                        if (!itr->getSource()->isAttackableByAOE() || !i_caster->IsFriendlyTo( itr->getSource() )) 
    582582                            continue; 
    583583                        break; 
     
    586586                        if(itr->getSource()->GetTypeId()==TYPEID_UNIT && ((Creature*)itr->getSource())->isTotem()) 
    587587                            continue; 
    588                         if(!itr->getSource()->isTargetableForAttack()) 
     588                        if(!itr->getSource()->isAttackableByAOE()) 
    589589                            continue; 
    590590 
  • trunk/src/game/SpellEffects.cpp

    r180 r186  
    34783478        { 
    34793479            // Reveal action + get attack 
    3480             m_caster->RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH); 
     3480            m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH); 
    34813481            if (((Creature*)unitTarget)->AI()) 
    34823482                ((Creature*)unitTarget)->AI()->AttackStart(m_caster); 
  • trunk/src/game/SpellMgr.cpp

    r173 r186  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
  • trunk/src/game/Unit.cpp

    r179 r186  
    464464} 
    465465 
    466 void Unit::RemoveInterruptableAura(uint32 flag) 
     466void Unit::RemoveAurasWithInterruptFlags(uint32 flag) 
    467467{ 
    468468    AuraList::iterator iter, next; 
     
    510510    if( damagetype != DOT) 
    511511    { 
    512         RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH); 
     512        RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH); 
    513513 
    514514        if(pVictim->GetTypeId() == TYPEID_PLAYER && !pVictim->IsStandState() && !pVictim->hasUnitState(UNIT_STAT_STUNNED)) 
     
    41014101                ++iter; 
    41024102        } 
    4103     } 
    4104 } 
    4105  
    4106 void Unit::RemoveAurasWithInterruptFlags(uint32 flags) 
    4107 { 
    4108     for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); ) 
    4109     { 
    4110         if (iter->second->GetSpellProto()->AuraInterruptFlags & flags) 
    4111             RemoveAura(iter); 
    4112         else 
    4113             ++iter; 
    41144103    } 
    41154104} 
     
    85078496} 
    85088497 
     8498//TODO: remove this function 
    85098499bool Unit::isTargetableForAttack() const 
    85108500{ 
    8511     if (GetTypeId()==TYPEID_PLAYER && ((Player *)this)->isGameMaster()) 
     8501    return isAttackableByAOE() && !hasUnitState(UNIT_STAT_DIED); 
     8502} 
     8503 
     8504bool Unit::canAttack(Unit const* target) const 
     8505{ 
     8506    assert(target); 
     8507 
     8508    if(!target->isAttackableByAOE() || target->hasUnitState(UNIT_STAT_DIED)) 
     8509        return false; 
     8510 
     8511    if((m_invisibilityMask || target->m_invisibilityMask) && !canDetectInvisibilityOf(target)) 
     8512        return false; 
     8513 
     8514    if(target->GetVisibility() == VISIBILITY_GROUP_STEALTH && !canDetectStealthOf(target, GetDistance(target))) 
     8515        return false; 
     8516 
     8517    return true; 
     8518} 
     8519 
     8520bool Unit::isAttackableByAOE() const 
     8521{ 
     8522    if(!isAlive()) 
    85128523        return false; 
    85138524 
     
    85158526        return false; 
    85168527 
    8517     return isAlive() && !hasUnitState(UNIT_STAT_DIED)&& !isInFlight() /*&& !isStealth()*/; 
     8528    if(GetTypeId()==TYPEID_PLAYER && ((Player *)this)->isGameMaster()) 
     8529        return false; 
     8530 
     8531    return !isInFlight(); 
    85188532} 
    85198533 
     
    90679081        for(AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr) 
    90689082        { 
    9069             if( (*itr)->IsInMap(this) && (*itr)->isTargetableForAttack() && (*itr)->isInAccessablePlaceFor((Creature*)this) ) 
     9083            if( (*itr)->IsInMap(this) && canAttack(*itr) && (*itr)->isInAccessablePlaceFor((Creature*)this) ) 
    90709084                return false; 
    90719085        } 
  • trunk/src/game/Unit.h

    r178 r186  
    923923 
    924924        bool isTargetableForAttack() const; 
     925        bool isAttackableByAOE() const; 
     926        bool canAttack(Unit const* target) const; 
    925927        virtual bool IsInWater() const; 
    926928        virtual bool IsUnderWater() const; 
     
    10321034 
    10331035        void RemoveSpellsCausingAura(AuraType auraType); 
    1034         void RemoveInterruptableAura(uint32 flag); 
    10351036        void RemoveRankAurasDueToSpell(uint32 spellId); 
    10361037        bool RemoveNoStackAurasDueToAura(Aura *Aur); 
  • trunk/src/game/UnitEvents.h

    r102 r186  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020