Changeset 186 for trunk/src/bindings

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/src/bindings/scripts
Files:
3 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;