Changeset 82

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

[svn] Add Alar script.
Update Magtheridon script.
Update Vorpil script. Patch provided by BroodWyrm?.
Add sunwell boss scripts into scriptmgr.cpp (forgot to do so in previous revs).

Original author: megamage
Date: 2008-10-20 14:02:13-05:00

Location:
trunk/src/bindings/scripts
Files:
2 added
13 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/bindings/scripts/Makefile.am

    r63 r82  
    338338scripts/zone/tempest_keep/botanica/boss_laj.cpp \ 
    339339scripts/zone/tempest_keep/botanica/boss_warp_splinter.cpp \ 
     340scripts/zone/tempest_keep/the_eye/boss_alar.cpp \ 
    340341scripts/zone/tempest_keep/the_eye/boss_astromancer.cpp \ 
    341342scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp \ 
  • trunk/src/bindings/scripts/ScriptMgr.cpp

    r53 r82  
    496496 
    497497//Sunken Temple 
     498//Sunwell Plateau 
     499extern void AddSC_instance_sunwell_plateau(); 
     500extern void AddSC_boss_kalecgos(); 
     501extern void AddSC_boss_brutallus(); 
     502extern void AddSC_boss_felmyst(); 
     503extern void AddSC_boss_eredar_twins(); 
     504 
    498505//Tanaris 
    499506extern void AddSC_tanaris(); 
     
    512519 
    513520//--The Eye 
     521extern void AddSC_boss_alar(); 
    514522extern void AddSC_boss_kaelthas(); 
    515523extern void AddSC_boss_void_reaver(); 
     
    16781686 
    16791687    //Sunken Temple 
     1688        //Sunwell Plateau 
     1689    AddSC_instance_sunwell_plateau(); 
     1690    AddSC_boss_kalecgos(); 
     1691        AddSC_boss_brutallus(); 
     1692    AddSC_boss_felmyst(); 
     1693    AddSC_boss_eredar_twins(); 
     1694 
    16801695    //Tanaris 
    16811696    AddSC_tanaris(); 
     
    16941709 
    16951710    //--The Eye 
     1711    AddSC_boss_alar(); 
    16961712    AddSC_boss_kaelthas(); 
    16971713    AddSC_boss_void_reaver(); 
  • trunk/src/bindings/scripts/VC71/71ScriptDev2.vcproj

    r63 r82  
    15211521                                                Name="The Eye" 
    15221522                                                > 
     1523                                                <File 
     1524                                                        RelativePath="..\scripts\zone\tempest_keep\the_eye\boss_alar.cpp" 
     1525                                                        > 
     1526                                                </File>                                                  
    15231527                                                <File 
    15241528                                                        RelativePath="..\scripts\zone\tempest_keep\the_eye\boss_astromancer.cpp" 
  • trunk/src/bindings/scripts/VC80/80ScriptDev2.vcproj

    r63 r82  
    17541754                                                Name="The Eye" 
    17551755                                                > 
     1756                                                <File 
     1757                                                        RelativePath="..\scripts\zone\tempest_keep\the_eye\boss_alar.cpp" 
     1758                                                        > 
     1759                                                </File>                                                  
    17561760                                                <File 
    17571761                                                        RelativePath="..\scripts\zone\tempest_keep\the_eye\boss_astromancer.cpp" 
  • trunk/src/bindings/scripts/VC90/90ScriptDev2.vcproj

    r63 r82  
    17521752                                                Name="The Eye" 
    17531753                                                > 
     1754                                                <File 
     1755                                                        RelativePath="..\scripts\zone\tempest_keep\the_eye\boss_alar.cpp" 
     1756                                                        > 
     1757                                                </File>                                          
    17541758                                                <File 
    17551759                                                        RelativePath="..\scripts\zone\tempest_keep\the_eye\boss_astromancer.cpp" 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp

    r48 r82  
    1717/* ScriptData 
    1818SDName: Boss_Grandmaster_Vorpil 
    19 SD%Complete: 75 
    20 SDComment: Despawn all summoned on death not implemented. Void Traveler effects not implemented. 
     19SD%Complete: 100 
     20SDComment:  
    2121SDCategory: Auchindoun, Shadow Labyrinth 
    2222EndScriptData */ 
     
    2525#include "def_shadow_labyrinth.h" 
    2626 
    27 #define SPELL_DRAW_SHADOWS              33563 
    28 #define SPELL_VOID_PORTAL_A             33566               //spell only summon one unit, but we use it for the visual effect and summon the 4 other portals manual way(only one spell exist) 
    29 #define SPELL_VOID_PORTAL_VISUAL        33569 
    30 #define SPELL_SHADOW_BOLT_VOLLEY        32963 
    31 #define SPELL_SUMMON_VOIDWALKER_A       33582 
    32 #define SPELL_SUMMON_VOIDWALKER_B       33583 
    33 #define SPELL_SUMMON_VOIDWALKER_C       33584 
    34 #define SPELL_SUMMON_VOIDWALKER_D       33585 
    35 #define SPELL_SUMMON_VOIDWALKER_E       33586 
    36 #define SPELL_RAIN_OF_FIRE              33617 
    37 #define H_SPELL_RAIN_OF_FIRE            39363 
    38 #define H_SPELL_BANISH                  38791 
    39  
    40 #define SAY_INTRO               "Keep your minds focused for the days of reckoning are close at hand. Soon, the destroyer of worlds will return to make good on his promise. Soon the destruction of all that is will begin!" 
    41 #define SAY_AGGRO1              "I'll make an offering of your blood!" 
    42 #define SAY_AGGRO2              "You'll be a fine example, for the others." 
    43 #define SAY_AGGRO3              "Good, a worthy sacrifice." 
    44 #define SAY_HELP                "Come to my aid, heed your master now!" 
    45 #define SAY_SLAY1               "I serve with pride." 
    46 #define SAY_SLAY2               "Your death is for the greater cause!" 
    47 #define SAY_DEATH               "I give my life... Gladly." 
    48  
    49 #define SOUND_INTRO             10522 
    50 #define SOUND_AGGRO1            10524 
    51 #define SOUND_AGGRO2            10525 
    52 #define SOUND_AGGRO3            10526 
    53 #define SOUND_HELP              10523 
    54 #define SOUND_SLAY1             10527 
    55 #define SOUND_SLAY2             10528 
    56 #define SOUND_DEATH             10529 
    57  
    58 #define ENTRY_VOID_PORTAL       19224 
    59 #define ENTRY_VOID_TRAVELER     19226 
    60  
    61 #define LOCX                    -253.06f 
    62 #define LOCY                    -264.02f 
    63 #define LOCZ                    17.08 
     27#define SAY_INTRO                "Keep your minds focused for the days of reckoning are close at hand. Soon, the destroyer of worlds will return to make good on his promise. Soon the destruction of all that is will begin!" 
     28#define SAY_AGGRO1               "I'll make an offering of your blood!" 
     29#define SAY_AGGRO2               "You'll be a fine example, for the others." 
     30#define SAY_AGGRO3               "Good, a worthy sacrifice." 
     31#define SAY_HELP                 "Come to my aid, heed your master now!" 
     32#define SAY_SLAY1                "I serve with pride." 
     33#define SAY_SLAY2                "Your death is for the greater cause!" 
     34#define SAY_DEATH                "I give my life... Gladly." 
     35 
     36#define SOUND_INTRO              10522 
     37#define SOUND_AGGRO1             10524 
     38#define SOUND_AGGRO2             10525 
     39#define SOUND_AGGRO3             10526 
     40#define SOUND_HELP               10523 
     41#define SOUND_SLAY1              10527 
     42#define SOUND_SLAY2              10528 
     43#define SOUND_DEATH              10529 
     44 
     45#define SPELL_RAIN_OF_FIRE          33617 
     46#define H_SPELL_RAIN_OF_FIRE        39363 
     47 
     48#define SPELL_DRAWN_SHADOWS         33563 
     49#define SPELL_SHADOWBOLT_VOLLEY     33841 
     50 
     51#define MOB_VOID_TRAVELER           19226 
     52#define SPELL_SACRIFICE             33587 
     53#define SPELL_SHADOW_NOVA           33846 
     54#define SPELL_HEALVORPIL            33783 
     55#define H_SPELL_HEALVORPIL          39364 
     56 
     57#define MOB_VOID_PORTAL             19224 
     58#define SPELL_VOID_PORTAL_VISUAL    33569 
     59 
     60float VorpilPosition[1][3] = 
     61{ 
     62    {-252.8820,-264.3030,17.1} 
     63}; 
     64 
     65float VoidPortalCoords[5][3] =  
     66{ 
     67    {-283.5894, -239.5718, 12.7}, 
     68    {-306.5853, -258.4539, 12.7}, 
     69    {-295.8789, -269.0899, 12.7}, 
     70    {-209.3401, -262.7564, 17.1}, 
     71    {-261.4533, -297.3298, 17.1} 
     72}; 
    6473 
    6574struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI 
    6675{ 
    6776    boss_grandmaster_vorpilAI(Creature *c) : ScriptedAI(c) 
     77    { 
     78        pInstance = ((ScriptedInstance*)c->GetInstanceData()); 
     79        Intro = false; 
     80        Reset(); 
     81    } 
     82 
     83    ScriptedInstance *pInstance; 
     84    bool Intro; 
     85    bool sumportals; 
     86    bool HeroicMode; 
     87    
     88    uint32 ShadowBoltVolley_Timer; 
     89    uint32 DrawnShadows_Timer; 
     90    uint32 sumportals_Timer; 
     91    uint32 summonTraveler_Timer; 
     92    uint64 PortalsGuid[5];  
     93 
     94    void summonPortals() 
     95    { 
     96        for (int i = 0;i<5;i++) 
     97        { 
     98            Creature *Portal = NULL; 
     99            Portal = m_creature->SummonCreature(MOB_VOID_PORTAL,VoidPortalCoords[i][0],VoidPortalCoords[i][1],VoidPortalCoords[i][2],0,TEMPSUMMON_CORPSE_DESPAWN,3000000); 
     100            PortalsGuid[i] = Portal->GetGUID(); 
     101            Portal->CastSpell(Portal,SPELL_VOID_PORTAL_VISUAL,false); 
     102        } 
     103        sumportals = true; 
     104        summonTraveler_Timer = 5000; 
     105    } 
     106 
     107    void destroyPortals() 
     108    { 
     109        for (int i = 0;i < 5; i ++) 
     110        { 
     111            Unit *Portal = Unit::GetUnit((*m_creature), PortalsGuid[i]); 
     112            if (Portal) 
     113                if (Portal->isAlive()) 
     114                    Portal->DealDamage(Portal, Portal->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); 
     115            PortalsGuid[i] = 0; 
     116        }      
     117    } 
     118 
     119    void spawnVoidTraveler() 
     120    { 
     121        srand( (unsigned) time(NULL) ) ;  
     122        int pos = rand()%5; 
     123        Creature *traveler; 
     124        traveler = m_creature->SummonCreature(MOB_VOID_TRAVELER,VoidPortalCoords[pos][0],VoidPortalCoords[pos][1],VoidPortalCoords[pos][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000); 
     125    } 
     126 
     127    void Reset() 
     128    { 
     129        HeroicMode = m_creature->GetMap()->IsHeroic(); 
     130        if( HeroicMode ) 
     131            debug_log("SD2: creature %u is in heroic mode",m_creature->GetEntry()); 
     132 
     133        ShadowBoltVolley_Timer = 15000; 
     134        DrawnShadows_Timer = 45000; 
     135        sumportals_Timer = 10000; 
     136        summonTraveler_Timer = 90000; 
     137 
     138        InCombat = false; 
     139        sumportals = false; 
     140        destroyPortals(); 
     141 
     142        if(pInstance) 
     143            pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, NOT_STARTED); 
     144    } 
     145 
     146    void KilledUnit(Unit *victim) 
     147    { 
     148        switch(rand()%2) 
     149        { 
     150            case 0: 
     151            DoYell(SAY_SLAY1, LANG_UNIVERSAL, NULL); 
     152            DoPlaySoundToSet(m_creature, SOUND_SLAY1); 
     153            break; 
     154 
     155            case 1: 
     156            DoYell(SAY_SLAY2, LANG_UNIVERSAL, NULL); 
     157            DoPlaySoundToSet(m_creature, SOUND_SLAY2); 
     158            break; 
     159        } 
     160    } 
     161 
     162    void JustDied(Unit *victim) 
     163    { 
     164        DoYell(SAY_DEATH, LANG_UNIVERSAL, NULL); 
     165        DoPlaySoundToSet(m_creature, SOUND_DEATH); 
     166        destroyPortals(); 
     167        if(pInstance) 
     168            pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, DONE); 
     169    } 
     170 
     171    void StartEvent() 
     172    { 
     173        switch(rand()%3) 
     174        { 
     175            case 0: 
     176            DoYell(SAY_AGGRO1, LANG_UNIVERSAL, NULL); 
     177            DoPlaySoundToSet(m_creature, SOUND_AGGRO1); 
     178            break; 
     179 
     180            case 1: 
     181            DoYell(SAY_AGGRO2, LANG_UNIVERSAL, NULL); 
     182            DoPlaySoundToSet(m_creature, SOUND_AGGRO2); 
     183            break; 
     184 
     185            case 2: 
     186            DoYell(SAY_AGGRO3, LANG_UNIVERSAL, NULL); 
     187            DoPlaySoundToSet(m_creature, SOUND_AGGRO3); 
     188            break; 
     189        } 
     190 
     191        if(pInstance) 
     192            pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, IN_PROGRESS); 
     193    } 
     194 
     195    void Aggro(Unit *who) 
     196    { 
     197        if(!InCombat) 
     198        {    
     199            InCombat = true; 
     200            StartEvent(); 
     201        } 
     202    } 
     203 
     204    void MoveInLineOfSight(Unit *who) 
     205    { 
     206        if (!who || m_creature->getVictim()) 
     207            return; 
     208 
     209        if (who->isTargetableForAttack() && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who)) 
     210        { 
     211            float attackRadius = m_creature->GetAttackDistance(who); 
     212            if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && m_creature->IsWithinLOSInMap(who)) 
     213            { 
     214                if(who->HasStealthAura()) 
     215                    who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
     216 
     217                DoStartAttackAndMovement(who); 
     218                Aggro(who); 
     219            } 
     220        } 
     221        else if (!Intro && m_creature->IsWithinLOSInMap(who)&& m_creature->IsWithinDistInMap(who, 100) ) //not sure about right radius 
     222        { 
     223            DoYell(SAY_INTRO, LANG_UNIVERSAL, NULL); 
     224            DoPlaySoundToSet(m_creature, SOUND_INTRO); 
     225            Intro = true; 
     226        } 
     227 
     228    } 
     229    
     230    void UpdateAI(const uint32 diff) 
     231    { 
     232 
     233        if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) 
     234            return; 
     235         
     236        if (!sumportals) 
     237        if (sumportals_Timer < diff) 
     238        { 
     239            DoYell(SAY_HELP, LANG_UNIVERSAL, NULL); 
     240            DoPlaySoundToSet(m_creature, SOUND_HELP); 
     241            summonPortals(); 
     242            sumportals_Timer = 1000000; 
     243                     
     244        }else sumportals_Timer -= diff; 
     245 
     246        if (ShadowBoltVolley_Timer < diff) 
     247        { 
     248            DoCast(m_creature,SPELL_SHADOWBOLT_VOLLEY); 
     249            ShadowBoltVolley_Timer = 15000; 
     250        }else ShadowBoltVolley_Timer -= diff; 
     251 
     252        if ( DrawnShadows_Timer < diff) 
     253        { 
     254            Map *map = m_creature->GetMap(); 
     255            if(map->IsDungeon()) 
     256            { 
     257                InstanceMap::PlayerList const &PlayerList = ((InstanceMap*)map)->GetPlayers(); 
     258                for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) 
     259                { 
     260                    if((*i)->isAlive()) 
     261                    { 
     262                        (*i)->TeleportTo(555,VorpilPosition[0][0],VorpilPosition[0][1],VorpilPosition[0][2],0); 
     263                    } 
     264                } 
     265            } 
     266            m_creature->Relocate(VorpilPosition[0][0],VorpilPosition[0][1],VorpilPosition[0][2],0); 
     267            DoCast(m_creature,SPELL_DRAWN_SHADOWS,true); 
     268 
     269            if(!HeroicMode) DoCast(m_creature,SPELL_RAIN_OF_FIRE); 
     270            else DoCast(m_creature,H_SPELL_RAIN_OF_FIRE); 
     271 
     272            ShadowBoltVolley_Timer = 6000; 
     273            DrawnShadows_Timer = 45000;     
     274        }else DrawnShadows_Timer -= diff; 
     275 
     276        if ( summonTraveler_Timer < diff) 
     277        { 
     278            spawnVoidTraveler(); 
     279            summonTraveler_Timer = 10000; 
     280        }else summonTraveler_Timer -=diff; 
     281 
     282        DoMeleeAttackIfReady(); 
     283    } 
     284}; 
     285CreatureAI* GetAI_boss_grandmaster_vorpil(Creature *_Creature) 
     286{ 
     287    return new boss_grandmaster_vorpilAI (_Creature); 
     288} 
     289 
     290struct TRINITY_DLL_DECL mob_voidtravelerAI : public ScriptedAI 
     291{ 
     292    mob_voidtravelerAI(Creature *c) : ScriptedAI(c) 
    68293    { 
    69294        pInstance = ((ScriptedInstance*)c->GetInstanceData()); 
     
    71296    } 
    72297 
    73     ScriptedInstance* pInstance; 
     298    ScriptedInstance *pInstance; 
     299    uint32 VorpilCheck_Timer; 
     300    uint32 eventCheck_Timer; 
     301    bool sacrifice; 
     302    bool sacrificed; 
     303    bool oneTarget; 
    74304    bool HeroicMode; 
    75305 
    76     uint32 ShadowBoltVolley_Timer; 
    77     uint32 DrawShadows_Timer; 
    78     uint32 Teleport_Timer; 
    79     uint32 VoidTraveler_Timer; 
    80     uint32 Banish_Timer; 
    81     bool Intro; 
    82     bool Teleport; 
     306    uint32 target_timer; 
    83307 
    84308    void Reset() 
    85309    { 
    86310        HeroicMode = m_creature->GetMap()->IsHeroic(); 
    87  
    88         ShadowBoltVolley_Timer = 15000; 
    89         DrawShadows_Timer = 40000; 
    90         Teleport_Timer = 1000; 
    91         VoidTraveler_Timer = 20000; 
    92         Banish_Timer = 25000; 
    93         Intro = false; 
    94         Teleport = false; 
    95  
    96         if( pInstance ) 
    97             pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, NOT_STARTED); 
    98     } 
    99  
    100     void MoveInLineOfSight(Unit *who) 
    101     { 
    102         if( !m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessablePlaceFor(m_creature) ) 
    103         { 
    104             //not sure about right radius 
    105             if(!Intro && m_creature->IsWithinDistInMap(who, 50)) 
     311        if( HeroicMode ) 
     312            debug_log("SD2: creature %u is in heroic mode",m_creature->GetEntry()); 
     313 
     314        VorpilCheck_Timer = 5000; 
     315        eventCheck_Timer = 1000; 
     316        target_timer = 2000; 
     317        oneTarget = false; 
     318        sacrificed = false; 
     319        sacrifice = false;        
     320    } 
     321    void EnterEvadeMode(){} 
     322    void Aggro(Unit *who) {} 
     323    void AttackStart(Unit *who){} 
     324    void MoveInLineOfSight(Unit *who){} 
     325 
     326    void UpdateAI(const uint32 diff) 
     327    { 
     328        if (eventCheck_Timer < diff) 
     329        { 
     330            if(pInstance) 
    106331            { 
    107                 DoYell(SAY_INTRO, LANG_UNIVERSAL, NULL); 
    108                 DoPlaySoundToSet(m_creature, SOUND_INTRO); 
    109                 DoCast(m_creature, SPELL_VOID_PORTAL_A,true); 
    110                 m_creature->SummonCreature(ENTRY_VOID_PORTAL,-262.40,-229.57,17.08,0,TEMPSUMMON_CORPSE_DESPAWN,0); 
    111                 m_creature->SummonCreature(ENTRY_VOID_PORTAL,-260.35,-297.56,17.08,0,TEMPSUMMON_CORPSE_DESPAWN,0); 
    112                 m_creature->SummonCreature(ENTRY_VOID_PORTAL,-292.05,-270.37,12.68,0,TEMPSUMMON_CORPSE_DESPAWN,0); 
    113                 m_creature->SummonCreature(ENTRY_VOID_PORTAL,-301.64,-255.97,12.68,0,TEMPSUMMON_CORPSE_DESPAWN,0); 
    114                 Intro = true; 
    115             } 
    116  
    117             if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) 
    118                 return; 
    119  
    120             float attackRadius = m_creature->GetAttackDistance(who); 
    121             if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 
    122             { 
    123                 DoStartAttackAndMovement(who); 
    124                 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    125  
    126                 if (!InCombat) 
     332                Unit *Vorpil = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_GRANDMASTERVORPIL)); 
     333                if (Vorpil) 
    127334                { 
    128                     InCombat = true; 
    129                     Aggro(who); 
     335                    if (Vorpil->isDead()) 
     336                    { 
     337                         m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); 
     338                    } 
     339 
     340                    if (Vorpil->getVictim()) 
     341                    {     
     342                        if((*m_creature).GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) 
     343                            (*m_creature).GetMotionMaster()->MoveFollow(Vorpil,1,0); 
     344                    } 
     345                }   
     346                if(pInstance->GetData(DATA_GRANDMASTERVORPILEVENT) != IN_PROGRESS) 
     347                { 
     348                    m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); 
    130349                } 
    131350            } 
    132         } 
    133     } 
    134  
    135     void Aggro(Unit *who) 
    136     { 
    137         switch(rand()%3) 
    138         { 
    139             case 0: 
    140                 DoYell(SAY_AGGRO1, LANG_UNIVERSAL, NULL); 
    141                 DoPlaySoundToSet(m_creature, SOUND_AGGRO1); 
    142                 break; 
    143             case 1: 
    144                 DoYell(SAY_AGGRO2, LANG_UNIVERSAL, NULL); 
    145                 DoPlaySoundToSet(m_creature, SOUND_AGGRO2); 
    146                 break; 
    147             case 2: 
    148                 DoYell(SAY_AGGRO3, LANG_UNIVERSAL, NULL); 
    149                 DoPlaySoundToSet(m_creature, SOUND_AGGRO3); 
    150                 break; 
    151         } 
    152  
    153         if( pInstance ) 
    154             pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, IN_PROGRESS); 
    155     } 
    156  
    157     void KilledUnit(Unit *victim) 
    158     { 
    159         switch(rand()%2) 
    160         { 
    161             case 0: 
    162                 DoYell(SAY_SLAY1, LANG_UNIVERSAL, NULL); 
    163                 DoPlaySoundToSet(m_creature, SOUND_SLAY1); 
    164                 break; 
    165             case 1: 
    166                 DoYell(SAY_SLAY2, LANG_UNIVERSAL, NULL); 
    167                 DoPlaySoundToSet(m_creature, SOUND_SLAY2); 
    168                 break; 
    169         } 
    170     } 
    171  
    172     void JustSummoned(Creature *summoned) 
    173     { 
    174         if( summoned->GetEntry() == ENTRY_VOID_TRAVELER ) 
    175         { 
    176             summoned->GetMotionMaster()->MoveChase(m_creature); 
    177             summoned->SetSpeed(MOVE_WALK,0.8,true); 
    178         } 
    179  
    180         if( summoned->GetEntry() == ENTRY_VOID_PORTAL ) 
    181             summoned->CastSpell(summoned,SPELL_VOID_PORTAL_VISUAL,true); 
    182     } 
    183  
    184     void JustDied(Unit *victim) 
    185     { 
    186         DoYell(SAY_DEATH, LANG_UNIVERSAL, NULL); 
    187         DoPlaySoundToSet(m_creature, SOUND_DEATH); 
    188  
    189         if( pInstance ) 
    190             pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, DONE); 
    191     } 
    192  
    193     void UpdateAI(const uint32 diff) 
    194     { 
    195         //Return since we have no target 
    196         if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) 
    197             return; 
    198  
    199         if( Teleport ) 
    200         { 
    201             if( Teleport_Timer <= diff ) 
     351            eventCheck_Timer = 5000; 
     352        }else eventCheck_Timer -=diff; 
     353 
     354        if (VorpilCheck_Timer < diff) 
     355        { 
     356            if (pInstance) 
    202357            { 
    203                 m_creature->Relocate(LOCX,LOCY,LOCZ); 
    204                 m_creature->SendMonsterMove(LOCX,LOCY,LOCZ,0,true,0); 
    205  
    206                 float ranX = LOCX; 
    207                 float ranY = LOCY; 
    208                 float ranZ = LOCZ; 
    209  
    210                 std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList(); 
    211                 for( std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr ) 
     358                if (!sacrificed) 
    212359                { 
    213                     Unit* target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); 
    214                     if( target && target->GetTypeId() == TYPEID_PLAYER ) 
     360                    if (!sacrifice) 
    215361                    { 
    216                         target->GetRandomPoint(LOCX,LOCY,LOCZ,3.0,ranX,ranY,ranZ); 
    217                         DoTeleportPlayer(target,ranX,ranY,ranZ,m_creature->GetAngle(m_creature->GetPositionX(),m_creature->GetPositionY())); 
     362                        Unit *Vorpil = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_GRANDMASTERVORPIL)); 
     363                        if (Vorpil) 
     364                            if (Vorpil->isAlive()) 
     365                            { 
     366                                if (m_creature->IsWithinDistInMap(Vorpil, 2)) 
     367                                { 
     368                                    sacrifice = true; 
     369                                    DoCast(m_creature,SPELL_SACRIFICE); 
     370                                    VorpilCheck_Timer = 2000; 
     371                                } 
     372                            } 
     373 
     374                        if (!sacrifice) 
     375                            VorpilCheck_Timer = 3000; 
     376                    } 
     377                    else 
     378                    {  
     379                        Unit *Vorpil = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_GRANDMASTERVORPIL)); 
     380                        if (Vorpil) 
     381                            if (Vorpil->isAlive()) 
     382                            { 
     383                                if(!HeroicMode) Vorpil->CastSpell(Vorpil,SPELL_HEALVORPIL,true); 
     384                                else Vorpil->CastSpell(Vorpil,H_SPELL_HEALVORPIL,true); 
     385                            }; 
     386                        DoCast(m_creature,SPELL_SHADOW_NOVA);  
     387                        sacrificed = true; 
     388                        m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); 
     389                        VorpilCheck_Timer = 100000; 
    218390                    } 
    219391                } 
    220                 Teleport = false; 
    221  
    222                 if( HeroicMode ) DoCast(m_creature->getVictim(), H_SPELL_RAIN_OF_FIRE); 
    223                 else DoCast(m_creature->getVictim(), SPELL_RAIN_OF_FIRE); 
    224  
    225                 Teleport_Timer = 1000; 
    226             }else Teleport_Timer -= diff; 
    227         } 
    228  
    229         if( ShadowBoltVolley_Timer < diff ) 
    230         { 
    231             DoCast(m_creature->getVictim(), SPELL_SHADOW_BOLT_VOLLEY); 
    232             ShadowBoltVolley_Timer = 30000; 
    233         }else ShadowBoltVolley_Timer -= diff; 
    234  
    235         if( DrawShadows_Timer < diff ) 
    236         { 
    237             DoCast(m_creature,SPELL_DRAW_SHADOWS); 
    238             DrawShadows_Timer = 35000; 
    239             Teleport = true; 
    240         }else DrawShadows_Timer -= diff; 
    241  
    242         if( VoidTraveler_Timer < diff ) 
    243         { 
    244             DoYell(SAY_HELP, LANG_UNIVERSAL, NULL); 
    245             DoPlaySoundToSet(m_creature, SOUND_HELP); 
    246  
    247             switch(rand()%5) 
    248             { 
    249                 case 0: 
    250                     DoCast(m_creature,SPELL_SUMMON_VOIDWALKER_A,true); 
    251                     break; 
    252                 case 1: 
    253                     DoCast(m_creature,SPELL_SUMMON_VOIDWALKER_B,true); 
    254                     break; 
    255                 case 2: 
    256                     DoCast(m_creature,SPELL_SUMMON_VOIDWALKER_C,true); 
    257                     break; 
    258                 case 3: 
    259                     DoCast(m_creature,SPELL_SUMMON_VOIDWALKER_D,true); 
    260                     break; 
    261                 case 4: 
    262                     DoCast(m_creature,SPELL_SUMMON_VOIDWALKER_E,true); 
    263                     break; 
    264392            } 
    265             //faster rate when below (X) health? 
    266             VoidTraveler_Timer = 35000; 
    267         }else VoidTraveler_Timer -= diff; 
    268  
    269         if( HeroicMode ) 
    270         { 
    271             if( Banish_Timer < diff ) 
    272             { 
    273                 if( Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1) ) 
    274                     DoCast(target,H_SPELL_BANISH); 
    275                 Banish_Timer = 35000; 
    276             }else Banish_Timer -= diff; 
    277         } 
    278  
    279         DoMeleeAttackIfReady(); 
     393         }else VorpilCheck_Timer -= diff; 
    280394    } 
    281395}; 
    282 CreatureAI* GetAI_boss_grandmaster_vorpil(Creature *_Creature) 
    283 { 
    284     return new boss_grandmaster_vorpilAI (_Creature); 
     396 
     397CreatureAI* GetAI_mob_voidtraveler(Creature *_Creature) 
     398{ 
     399    return new mob_voidtravelerAI (_Creature); 
    285400} 
    286401 
     
    292407    newscript->GetAI = GetAI_boss_grandmaster_vorpil; 
    293408    m_scripts[nrscripts++] = newscript; 
     409 
     410    newscript = new Script; 
     411    newscript->Name="mob_voidtraveler"; 
     412    newscript->GetAI = GetAI_mob_voidtraveler; 
     413    m_scripts[nrscripts++] = newscript; 
    294414} 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/def_shadow_labyrinth.h

    r46 r82  
    1111#define DATA_GRANDMASTERVORPILEVENT 4 
    1212#define DATA_MURMUREVENT 5 
     13#define DATA_GRANDMASTERVORPIL 6 
    1314#endif 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp

    r66 r82  
    157157    uint64 GetData64(uint32 identifier) 
    158158    { 
    159         if(identifier  == DATA_GRANDMASTERVORPILEVENT) 
     159        if(identifier  == DATA_GRANDMASTERVORPIL) 
    160160            return GrandmasterVorpil; 
    161161 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp

    r48 r82  
    1 /* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> 
    2  * This program is free software; you can redistribute it and/or modify 
    3  * it under the terms of the GNU General Public License as published by 
    4  * the Free Software Foundation; either version 2 of the License, or 
    5  * (at your option) any later version. 
    6  * 
    7  * This program is distributed in the hope that it will be useful, 
    8  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    10  * GNU General Public License for more details. 
    11  * 
    12  * You should have received a copy of the GNU General Public License 
    13  * along with this program; if not, write to the Free Software 
    14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
    15  */ 
     1/* Copyright(C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> 
     2* This program is free software; you can redistribute it and/or modify 
     3* it under the terms of the GNU General Public License as published by 
     4* the Free Software Foundation; either version 2 of the License, or 
     5*(at your option) any later version. 
     6* 
     7* This program is distributed in the hope that it will be useful, 
     8* but WITHOUT ANY WARRANTY; without even the implied warranty of 
     9* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     10* GNU General Public License for more details. 
     11* 
     12* You should have received a copy of the GNU General Public License 
     13* along with this program; if not, write to the Free Software 
     14* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
     15*/ 
    1616 
    1717/* ScriptData 
     
    2424#include "precompiled.h" 
    2525#include "def_magtheridons_lair.h" 
    26 #include "WorldPacket.h" 
    27  
    28 //Phase 2 Spells 
    29 #define SPELL_QUAKE_PROC            30571 
    30 #define SPELL_QUAKE                 30576                   //must be cast with 30561 as the proc spell 
    31 #define SPELL_BLASTNOVA             30616 
     26 
     27#define MOB_MAGTHERIDON     17257 
     28#define MOB_ROOM            17516 
     29#define MOB_CHANNELLER      17256 
     30#define MOB_ABYSSAL         17454 
     31 
     32#define SPELL_BLASTNOVA             30616   
    3233#define SPELL_CLEAVE                30619 
     34#define SPELL_QUAKE_TRIGGER         30576 // must be cast with 30561 as the proc spell 
     35#define SPELL_QUAKE_KNOCKBACK       30571 
     36#define SPELL_BLAZE_TARGET          30541 // core bug, does not support target 7 
     37#define SPELL_BLAZE_TRAP            30542 
     38#define SPELL_DEBRIS_KNOCKDOWN      36449 
     39#define SPELL_DEBRIS_VISUAL                     30632 
     40#define SPELL_DEBRIS_DAMAGE                     30631 // core bug, does not support target 8 
     41#define SPELL_CAMERA_SHAKE          36455 
    3342#define SPELL_BERSERK               27680 
    34 #define SPELL_DEBRIS                30631 
    35 #define SPELL_CAMERA_SHAKE          36455 
    36  
    37 //Banish 
    38 #define SPELL_SHADOW_CAGE           30205 
    39  
    40 //Player version of the banish 
    41 #define SPELL_SHADOW_CAGE_2         30168 
    42  
    43 //Spell that is cast on players from the cube 
     43 
     44#define SPELL_SHADOW_CAGE           30168 
    4445#define SPELL_SHADOW_GRASP          30410 
    45 #define SPELL_SHADOW_GRASP_UKN      30166 
    46 #define SPELL_SHADOW_GRASP_VIS      30207 
     46#define SPELL_SHADOW_GRASP_VISUAL   30166 
     47#define SPELL_MIND_EXHAUSTION           44032   //Casted by the cubes when channeling ends 
     48 
     49#define SPELL_SHADOW_CAGE_C         30205 
     50#define SPELL_SHADOW_GRASP_C        30207 
     51 
     52#define SPELL_SHADOW_BOLT_VOLLEY    30510 
     53#define SPELL_DARK_MENDING          30528 
     54#define SPELL_FEAR                  30530 //39176 
     55#define SPELL_BURNING_ABYSSAL       30511 
     56#define SPELL_SOUL_TRANSFER         30531 // core bug, does not support target 7 
     57 
     58#define SPELL_FIRE_BLAST                        37110 
    4759 
    4860//Dialog 
    4961#define SAY_AGGRO                   "Thank you for releasing me. Now...die!" 
    5062#define SOUND_AGGRO                 10254 
    51  
    5263#define SAY_BANISH                  "Not again...NOT AGAIN!" 
    5364#define SOUND_BANISH                10256 
    54  
    5565#define SAY_FREED                   "I...am...UNLEASHED!!!" 
    5666#define SOUND_FREED                 10253 
    57  
    5867#define SAY_CHAMBER_DESTROY         "I will not be taken so easily. Let the walls of this prison tremble...and FALL!!!" 
    5968#define SOUND_CHAMBER_DESTROY       10257 
    60  
    6169#define SAY_PLAYER_KILLED           "Did you think me weak? Soft? Who is the weak one now?!" 
    6270#define SOUND_PLAYER_KILLED         10255 
    63  
    6471#define SAY_DEATH                   "The Legion...will consume you...all...." 
    65 #define SOUND_DEATH                 10258 
    66  
     72#define SOUND_DEATH                 10258  
    6773#define EMOTE_BERSERK               "becomes enraged!" 
    6874#define EMOTE_BLASTNOVA             "begins to cast Blast Nova!" 
    6975#define EMOTE_BEGIN                 "%s's bonds begin to weaken!" 
    7076 
    71 //Spawned objects 
    72 #define SPELL_COLLAPSE              34233                   //This spell casted by the "cave in" type object 
    73  
    74 #define SPELL_CONFLAGERATION        35840                   //Actually casted by a creature or object spawned on the ground 
    75  
    76 //Cubes 
    77 #define SPELL_MIND_EXHAUSTIOIN      30509                   //Casted by the cubes when channeling ends 
    78  
    79 //Channeler spells 
    80 //#define MOB_HELLFIRE_CHANNELLER    17256 
    81  
    82 #define SPELL_SOUL_TRANSFER         30531 
    83 #define SPELL_SHADOW_BOLT_VOLLEY    30510 
    84 #define SPELL_DARK_MENDING          30528 
    85 #define SPELL_HELLFIRE_CHANNELING   31059 
    86 #define SPELL_HELLFIRE_CAST_VISUAL  24207 
    87 #define SPELL_FEAR                  39176 
    88  
    89 #define SPELL_BURNING_ABYSSAL       30511 
     77// count of clickers needed to interrupt blast nova 
     78#define CLICKERS_COUNT                          5 
    9079 
    9180// Unkown sounds 
    9281uint32 RandomSound[] = {10247, 10248, 10249, 10250, 10251, 10252}; 
    9382 
     83typedef std::map<uint64, uint64> CubeMap; 
     84 
     85struct TRINITY_DLL_DECL mob_abyssalAI : public ScriptedAI 
     86{ 
     87    mob_abyssalAI(Creature *c) : ScriptedAI(c) 
     88    { 
     89        trigger = 0; 
     90        Despawn_Timer = 60000; 
     91        Reset(); 
     92    } 
     93 
     94    uint32 FireBlast_Timer; 
     95    uint32 Despawn_Timer; 
     96    uint32 trigger; 
     97 
     98    void Reset() 
     99    { 
     100        FireBlast_Timer = 6000; 
     101    } 
     102 
     103    void SpellHit(Unit*, const SpellEntry *spell) 
     104    { 
     105        if(trigger == 2 && spell->Id == SPELL_BLAZE_TARGET) 
     106        { 
     107            m_creature->CastSpell(m_creature, SPELL_BLAZE_TRAP, true); 
     108            m_creature->SetVisibility(VISIBILITY_OFF); 
     109            Despawn_Timer = 130000; 
     110        } 
     111    } 
     112 
     113    void SetTrigger(uint32 _trigger) 
     114    { 
     115        trigger = _trigger; 
     116        m_creature->SetDisplayId(11686); 
     117        if(trigger == 1) //debris 
     118        { 
     119            m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
     120            m_creature->CastSpell(m_creature, SPELL_DEBRIS_VISUAL, true); 
     121            FireBlast_Timer = 5000; 
     122            Despawn_Timer = 10000;      
     123        } 
     124    } 
     125 
     126    void Aggro(Unit*) {DoZoneInCombat();} 
     127    void AttackStart(Unit *who) {if(!trigger) ScriptedAI::AttackStart(who);} 
     128    void MoveInLineOfSight(Unit *who) {if(!trigger) ScriptedAI::MoveInLineOfSight(who);} 
     129 
     130    void UpdateAI(const uint32 diff) 
     131    { 
     132        if(trigger) 
     133        { 
     134            if(trigger == 1) 
     135            { 
     136                if(FireBlast_Timer < diff) 
     137                { 
     138                    m_creature->CastSpell(m_creature, SPELL_DEBRIS_DAMAGE, true); 
     139                    trigger = 3; 
     140                }else FireBlast_Timer -= diff; 
     141            } 
     142            return; 
     143        } 
     144 
     145        if(Despawn_Timer < diff) 
     146        { 
     147            m_creature->SetVisibility(VISIBILITY_OFF); 
     148            m_creature->setDeathState(JUST_DIED); 
     149        }else Despawn_Timer -= diff; 
     150 
     151        if(!m_creature->SelectHostilTarget() && !m_creature->getVictim()) 
     152            return; 
     153 
     154        if(FireBlast_Timer < diff) 
     155        { 
     156            DoCast(m_creature->getVictim(), SPELL_FIRE_BLAST); 
     157            FireBlast_Timer = 5000+rand()%10000; 
     158        }else FireBlast_Timer -= diff; 
     159 
     160        DoMeleeAttackIfReady(); 
     161    } 
     162}; 
     163 
    94164struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI 
    95165{ 
    96     boss_magtheridonAI(Creature *c) : ScriptedAI(c) 
    97     { 
    98         pInst = (ScriptedInstance*)m_creature->GetInstanceData(); 
     166    boss_magtheridonAI(Creature *c) : ScriptedAI(c)  
     167    { 
     168        pInstance =(ScriptedInstance*)m_creature->GetInstanceData();       
     169        m_creature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); 
     170        m_creature->SetFloatValue(UNIT_FIELD_COMBATREACH, 10); 
    99171        Reset(); 
    100172    } 
    101173 
    102     ScriptedInstance* pInst; 
    103  
    104     uint32 Phase1_Timer; 
     174    CubeMap Cube; 
     175 
     176    ScriptedInstance* pInstance; 
     177 
     178    uint32 Berserk_Timer; 
     179    uint32 Quake_Timer; 
    105180    uint32 Cleave_Timer; 
    106181    uint32 BlastNova_Timer; 
    107     uint32 Quake_Timer; 
    108     uint32 QuakePhase; 
    109     uint32 Collapse_Timer; 
    110     uint32 Berserk_Timer; 
    111     bool Banished; 
     182    uint32 Blaze_Timer; 
     183    uint32 Debris_Timer; 
     184 
    112185    bool Phase3; 
    113  
    114     uint32 RandChat_Timer; 
     186    bool NeedCheckCube; 
    115187 
    116188    void Reset() 
    117     { 
    118         RandChat_Timer = 90000; 
    119  
    120         Phase1_Timer = 0; 
     189    {    
     190        if(pInstance) 
     191        { 
     192            pInstance->SetData(DATA_MAGTHERIDON_EVENT, NOT_STARTED); 
     193            pInstance->SetData(DATA_COLLAPSE, false); 
     194        } 
     195 
     196        Berserk_Timer = 1320000; 
     197        Quake_Timer = 40000; 
     198        Debris_Timer = 10000; 
     199        Blaze_Timer = 10000+rand()%20000; 
     200        BlastNova_Timer = 60000; 
    121201        Cleave_Timer = 15000; 
    122         Berserk_Timer = 1200000;                            //20 minutes 
    123         BlastNova_Timer = 60000; 
    124         Quake_Timer = 40000; 
    125         QuakePhase = 0; 
    126         Collapse_Timer = 0; 
    127         Banished = false; 
    128  
    129         m_creature->setFaction(35); 
    130         m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 
     202 
     203        Phase3 = false; 
     204 
     205        m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 
    131206        m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
    132         m_creature->CastSpell(m_creature, SPELL_SHADOW_CAGE, false); 
    133  
    134         if(pInst) 
    135             pInst->SetData(DATA_MAGTHERIDON_EVENT_ENDED, false); 
     207        m_creature->addUnitState(UNIT_STAT_STUNNED); 
     208        m_creature->CastSpell(m_creature, SPELL_SHADOW_CAGE_C, true); 
     209    } 
     210 
     211    void SetClicker(uint64 cubeGUID, uint64 clickerGUID) 
     212    { 
     213        // to avoid multiclicks from 1 cube 
     214        if(uint64 guid = Cube[cubeGUID]) 
     215            DebuffClicker(Unit::GetUnit(*m_creature, guid)); 
     216        Cube[cubeGUID] = clickerGUID; 
     217        NeedCheckCube = true; 
     218    } 
     219 
     220    //function to interrupt channeling and debuff clicker with mind exh(used if second person clicks with same cube or after dispeling/ending shadow grasp DoT) 
     221    void DebuffClicker(Unit *clicker) 
     222    { 
     223        if(!clicker || !clicker->isAlive()) 
     224            return; 
     225 
     226        clicker->RemoveAurasDueToSpell(SPELL_SHADOW_GRASP); // cannot interrupt triggered spells 
     227        clicker->InterruptNonMeleeSpells(false); 
     228        clicker->CastSpell(clicker, SPELL_MIND_EXHAUSTION, true); 
     229    } 
     230 
     231    void NeedCheckCubeStatus() 
     232    { 
     233        uint32 ClickerNum = 0; 
     234        // now checking if every clicker has debuff from manticron(it is dispelable atm rev 6110 : S) 
     235        // if not - apply mind exhaustion and delete from clicker's list 
     236        for(CubeMap::iterator i = Cube.begin(); i != Cube.end(); ++i) 
     237        { 
     238            Unit *clicker = Unit::GetUnit(*m_creature, (*i).second); 
     239            if(!clicker || !clicker->HasAura(SPELL_SHADOW_GRASP, 1)) 
     240            { 
     241                DebuffClicker(clicker); 
     242                (*i).second = 0; 
     243            }else ClickerNum++; 
     244        } 
     245 
     246        // if 5 clickers from other cubes apply shadow cage 
     247        if(ClickerNum >= CLICKERS_COUNT && !m_creature->HasAura(SPELL_SHADOW_CAGE, 0)) 
     248        { 
     249            DoYell(SAY_BANISH, LANG_UNIVERSAL, NULL); 
     250            DoPlaySoundToSet(m_creature, SOUND_BANISH);   
     251            m_creature->CastSpell(m_creature, SPELL_SHADOW_CAGE, true); 
     252        } 
     253        else if(ClickerNum < CLICKERS_COUNT && m_creature->HasAura(SPELL_SHADOW_CAGE, 0)) 
     254            m_creature->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE); 
     255 
     256        if(!ClickerNum) NeedCheckCube = false; 
    136257    } 
    137258 
     
    144265    void JustDied(Unit* Killer) 
    145266    { 
     267        if(pInstance) 
     268            pInstance->SetData(DATA_MAGTHERIDON_EVENT, DONE); 
     269 
    146270        DoYell(SAY_DEATH,LANG_UNIVERSAL, NULL); 
    147271        DoPlaySoundToSet(m_creature, SOUND_DEATH); 
    148272    } 
    149273 
    150     void Aggro(Unit *who) {} 
    151  
    152     void MoveInLineOfSight(Unit* who) {} 
     274    void MoveInLineOfSight(Unit*) {} 
     275 
     276    void AttackStart(Unit *who) 
     277    { 
     278        if(!m_creature->hasUnitState(UNIT_STAT_STUNNED)) 
     279            ScriptedAI::AttackStart(who); 
     280    } 
     281 
     282    void Aggro(Unit *who) 
     283    { 
     284        if(pInstance) 
     285            pInstance->SetData(DATA_MAGTHERIDON_EVENT, IN_PROGRESS); 
     286        DoZoneInCombat(); 
     287 
     288        m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 
     289        m_creature->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE_C); 
     290 
     291        DoYell(SAY_FREED, LANG_UNIVERSAL, NULL); 
     292        DoPlaySoundToSet(m_creature, SOUND_FREED);           
     293   } 
    153294 
    154295    void UpdateAI(const uint32 diff) 
    155296    { 
    156         if (!InCombat && !Phase1_Timer) 
    157             if (RandChat_Timer < diff) 
    158         { 
    159             DoPlaySoundToSet(m_creature, RandomSound[rand()%5]); 
    160  
    161             RandChat_Timer = 90000; 
    162         }else RandChat_Timer -= diff; 
    163  
    164         if (!InCombat && !Phase1_Timer && pInst && pInst->GetData64(DATA_EVENT_STARTER)) 
    165         { 
    166             //Unbanish self after 2 minutes 
    167             Phase1_Timer = 120000; 
    168             DoTextEmote(EMOTE_BEGIN, NULL); 
     297        if(!m_creature->SelectHostilTarget() && !m_creature->getVictim()) 
    169298            return; 
    170         } 
    171  
    172         //Phase timer 
    173         if (Phase1_Timer) 
    174             if (Phase1_Timer <= diff) 
    175         { 
    176             m_creature->setFaction(14); 
    177             m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 
    178             m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
    179  
    180             DoYell(SAY_FREED, LANG_UNIVERSAL, NULL); 
    181             DoPlaySoundToSet(m_creature, SOUND_FREED); 
    182             m_creature->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE); 
    183             AttackStart(Unit::GetUnit(*m_creature, pInst->GetData64(DATA_EVENT_STARTER))); 
    184  
    185             Phase1_Timer = 0; 
    186         }else 
    187         { 
    188             if (!Unit::GetUnit(*m_creature, pInst->GetData64(DATA_EVENT_STARTER))) 
    189             { 
    190                 Phase1_Timer = 0; 
    191                 return; 
    192             } 
    193  
    194             Phase1_Timer -= diff; 
    195             return; 
    196         } 
    197  
    198         //Return since we have no target 
    199         if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) 
    200             return; 
    201  
    202         //Interrupt Blast Nova 
    203         if (m_creature->HasAura(SPELL_SHADOW_GRASP_VIS, 0) && m_creature->HasAura(SPELL_BLASTNOVA, 0) && !Banished) 
    204         { 
    205             DoYell(SAY_BANISH, LANG_UNIVERSAL, NULL); 
    206             DoPlaySoundToSet(m_creature, SOUND_BANISH); 
    207             m_creature->RemoveAurasDueToSpell(SPELL_BLASTNOVA); 
    208             m_creature->InterruptNonMeleeSpells(false); 
    209             DoCast(m_creature, SPELL_SHADOW_CAGE_2); 
    210             Banished = true; 
    211         } 
    212  
    213         if (Banished && !m_creature->HasAura(SPELL_SHADOW_GRASP_VIS, 0)) 
    214         { 
    215             Banished = false; 
    216             m_creature->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE_2); 
    217         } 
    218  
    219         //Berserk_Timer 
    220         if (Berserk_Timer < diff) 
    221         { 
    222             DoCast(m_creature, SPELL_BERSERK); 
     299 
     300        if(NeedCheckCube) NeedCheckCubeStatus(); 
     301 
     302        if(Berserk_Timer < diff) 
     303        { 
     304            m_creature->CastSpell(m_creature, SPELL_BERSERK, true); 
    223305            DoTextEmote(EMOTE_BERSERK, NULL); 
    224  
    225             Berserk_Timer = 300000; 
     306            Berserk_Timer = 60000; 
    226307        }else Berserk_Timer -= diff; 
    227308 
    228         //Cleave_Timer 
    229         if (Cleave_Timer < diff) 
     309        if(Cleave_Timer < diff) 
    230310        { 
    231311            DoCast(m_creature->getVictim(),SPELL_CLEAVE); 
     
    233313        }else Cleave_Timer -= diff; 
    234314 
    235         //Quake_Timer 
    236         if (Quake_Timer < diff) 
    237         { 
    238             int32 i = SPELL_QUAKE_PROC; 
    239             m_creature->CastCustomSpell(m_creature, SPELL_QUAKE, &i, 0, 0, false); 
    240  
    241             Quake_Timer = 40000; 
     315        if(BlastNova_Timer < diff) 
     316        { 
     317            // to avoid earthquake interruption 
     318            if(!m_creature->hasUnitState(UNIT_STAT_STUNNED)) 
     319            { 
     320                DoTextEmote(EMOTE_BLASTNOVA, NULL); 
     321                DoCast(m_creature, SPELL_BLASTNOVA); 
     322                BlastNova_Timer = 60000; 
     323            } 
     324        }else BlastNova_Timer -= diff; 
     325 
     326        if(Quake_Timer < diff) 
     327        { 
     328            // to avoid blastnova interruption 
     329            if(!m_creature->IsNonMeleeSpellCasted(false)) 
     330            { 
     331                int32 i = SPELL_QUAKE_KNOCKBACK; 
     332                m_creature->CastCustomSpell(m_creature, SPELL_QUAKE_TRIGGER, &i, 0, 0, false); 
     333                Quake_Timer = 50000; 
     334            } 
    242335        }else Quake_Timer -= diff; 
    243336 
    244         //BlastNova_Timer 
    245         if (BlastNova_Timer < diff) 
    246         { 
    247             //Inturrupt Quake if it is casting 
    248             m_creature->InterruptNonMeleeSpells(false); 
    249  
    250             DoTextEmote(EMOTE_BLASTNOVA, NULL); 
    251             DoCast(m_creature, SPELL_BLASTNOVA); 
    252  
    253             BlastNova_Timer = 40000; 
    254         }else BlastNova_Timer -= diff; 
    255  
    256         //Phase3 if not already enraged and below 30% 
    257         if (!Phase3 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 30) 
    258         { 
     337        if(Blaze_Timer < diff) 
     338        { 
     339            if(Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) 
     340            { 
     341                float x, y, z; 
     342                target->GetPosition(x, y, z); 
     343                Creature *summon = m_creature->SummonCreature(MOB_ABYSSAL, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); 
     344                if(summon) 
     345                { 
     346                    ((mob_abyssalAI*)summon->AI())->SetTrigger(2); 
     347                    m_creature->CastSpell(summon, SPELL_BLAZE_TARGET, true); 
     348                    summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
     349                } 
     350            } 
     351            Blaze_Timer = 20000 + rand()%20000; 
     352        }else Blaze_Timer -= diff; 
     353 
     354        if(!Phase3 && m_creature->GetHealth()*10 < m_creature->GetMaxHealth()*3  
     355            && !m_creature->IsNonMeleeSpellCasted(false) // blast nova 
     356            && !m_creature->hasUnitState(UNIT_STAT_STUNNED)) // shadow cage and earthquake 
     357        {                         
    259358            Phase3 = true; 
    260  
    261359            DoYell(SAY_CHAMBER_DESTROY, LANG_UNIVERSAL, NULL); 
    262360            DoPlaySoundToSet(m_creature, SOUND_CHAMBER_DESTROY); 
    263         } 
    264  
    265         //Melee 
     361            m_creature->CastSpell(m_creature, SPELL_CAMERA_SHAKE, true); 
     362            m_creature->CastSpell(m_creature, SPELL_DEBRIS_KNOCKDOWN, true); 
     363 
     364            if(pInstance) 
     365                pInstance->SetData(DATA_COLLAPSE, true); 
     366        } 
     367 
     368        if(Phase3) 
     369        { 
     370            if(Debris_Timer < diff) 
     371            { 
     372                if(Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) 
     373                { 
     374                    float x, y, z; 
     375                    target->GetPosition(x, y, z); 
     376                    Creature *summon = m_creature->SummonCreature(MOB_ABYSSAL, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); 
     377                    if(summon) ((mob_abyssalAI*)summon->AI())->SetTrigger(1); 
     378                } 
     379                Debris_Timer = 10000; 
     380            }else Debris_Timer -= diff; 
     381        } 
     382 
    266383        DoMeleeAttackIfReady(); 
    267384    } 
     
    272389    mob_hellfire_channelerAI(Creature *c) : ScriptedAI(c) 
    273390    { 
    274         pInst = (ScriptedInstance*)m_creature->GetInstanceData(); 
     391        pInstance =(ScriptedInstance*)m_creature->GetInstanceData(); 
    275392        Reset(); 
    276393    } 
    277394 
    278     ScriptedInstance* pInst; 
     395    ScriptedInstance* pInstance; 
    279396 
    280397    uint32 ShadowBoltVolley_Timer; 
     
    283400    uint32 Infernal_Timer; 
    284401 
    285     bool InfernalSpawned; 
     402    uint32 Check_Timer; 
    286403 
    287404    void Reset() 
    288405    { 
    289406        ShadowBoltVolley_Timer = 8000 + rand()%2000; 
    290         DarkMending_Timer = 30000; 
     407        DarkMending_Timer = 10000; 
    291408        Fear_Timer = 15000 + rand()%5000; 
    292         Infernal_Timer = 20000 + rand()%5000; 
    293  
    294         InfernalSpawned = false; 
    295  
    296         //Suprisingly this works very well, but only if the channelers are spawned after magtheridon 
    297         DoCast(m_creature, SPELL_SHADOW_GRASP_VIS); 
    298         if(pInst) 
    299             pInst->SetData(DATA_MAGTHERIDON_EVENT_ENDED, false); 
     409        Infernal_Timer = 10000 + rand()%40000; 
     410 
     411        Check_Timer = 5000; 
     412 
     413        if(pInstance) 
     414            pInstance->SetData(DATA_CHANNELER_EVENT, NOT_STARTED); 
     415 
     416        m_creature->CastSpell(m_creature, SPELL_SHADOW_GRASP_C, false); 
    300417    } 
    301418 
    302419    void Aggro(Unit *who) 
    303420    { 
     421        if(pInstance) 
     422            pInstance->SetData(DATA_CHANNELER_EVENT, IN_PROGRESS); 
     423 
    304424        m_creature->InterruptNonMeleeSpells(false); 
    305  
    306         if(!pInst || pInst->GetData64(DATA_EVENT_STARTER)) 
    307             return; 
    308  
    309         pInst->SetData64(DATA_EVENT_STARTER, who->GetGUID()); 
    310         pInst->SetData(DATA_MAGTHERIDON_EVENT_STARTED, true); 
    311     } 
    312  
    313     void MoveInLineOfSight(Unit*) 
    314     { 
     425        DoZoneInCombat(); 
     426    } 
     427 
     428    void JustSummoned(Creature *summon) {summon->AI()->AttackStart(m_creature->getVictim());} 
     429 
     430    void MoveInLineOfSight(Unit*) {} 
     431 
     432    // bugged 
     433    /*void DamageTaken(Unit*, uint32 &damage) 
     434    { 
     435        if(damage >= m_creature->GetHealth()) 
     436            m_creature->CastSpell(m_creature, SPELL_SOUL_TRANSFER, true); 
     437    }*/ 
     438 
     439    void JustDied(Unit*) 
     440    { 
     441        if(pInstance) 
     442            pInstance->SetData(DATA_CHANNELER_EVENT, DONE); 
    315443    } 
    316444 
    317445    void UpdateAI(const uint32 diff) 
    318446    { 
    319         if (!InCombat && pInst && pInst->GetData64(DATA_EVENT_STARTER)) 
    320         { 
    321             m_creature->InterruptNonMeleeSpells(false); 
    322             AttackStart(Unit::GetUnit(*m_creature, pInst->GetData64(DATA_EVENT_STARTER))); 
    323             return; 
    324         } 
    325  
    326         //Return since we have no target 
    327         if (!m_creature->SelectHostilTarget() || !m_creature->getVictim() ) 
    328             return; 
    329  
    330         //Shadow bolt volley 
    331         if (ShadowBoltVolley_Timer < diff) 
    332         { 
    333             DoCast(m_creature->getVictim(),SPELL_SHADOW_BOLT_VOLLEY); 
    334  
    335             ShadowBoltVolley_Timer = 10000 + (rand()%10000); 
     447        if(!m_creature->SelectHostilTarget() && !m_creature->getVictim()) 
     448            return;     
     449  
     450        if(ShadowBoltVolley_Timer < diff) 
     451        { 
     452            DoCast(m_creature, SPELL_SHADOW_BOLT_VOLLEY); 
     453            ShadowBoltVolley_Timer = 10000 + rand()%10000; 
    336454        }else ShadowBoltVolley_Timer -= diff; 
    337455 
    338         //Dark Mending 
    339         if (DarkMending_Timer < diff) 
    340         { 
    341             if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 50) 
    342             { 
    343                 //Cast on ourselves if we are lower then lowest hp friendly unit 
    344                 /*if (pLowestHPTarget && LowestHP < m_creature->GetHealth()) 
    345                     DoCast(pLowestHPTarget, SPELL_DARK_MENDING); 
    346                 else*/ 
     456        if(DarkMending_Timer < diff) 
     457        { 
     458            if((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 50) 
    347459                DoCast(m_creature, SPELL_DARK_MENDING); 
    348             } 
    349  
    350             DarkMending_Timer = 10000 + (rand() % 10000); 
     460            DarkMending_Timer = 10000 +(rand() % 10000); 
    351461        }else DarkMending_Timer -= diff; 
    352462 
    353         //Fear 
    354         if (Fear_Timer < diff) 
    355         { 
    356             Unit* target = NULL; 
    357             target = SelectUnit(SELECT_TARGET_RANDOM, 1); 
    358  
    359             if (target) 
    360                 DoCast(target,SPELL_FEAR); 
    361  
    362             Fear_Timer = 25000 + (rand()%15000); 
     463        if(Fear_Timer < diff) 
     464        { 
     465            if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1)) 
     466                DoCast(target, SPELL_FEAR); 
     467            Fear_Timer = 25000 + rand()%15000; 
    363468        }else Fear_Timer -= diff; 
    364469 
    365         //Infernal spawning 
    366         if (!InfernalSpawned && Infernal_Timer < diff) 
    367         { 
    368             Unit* target = NULL; 
    369             target = SelectUnit(SELECT_TARGET_RANDOM, 0); 
    370  
    371             if (target) 
    372                 DoCast(target, SPELL_BURNING_ABYSSAL); 
    373  
    374             InfernalSpawned = true; 
     470        if(Infernal_Timer < diff) 
     471        { 
     472            if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) 
     473                m_creature->CastSpell(target, SPELL_BURNING_ABYSSAL, true); 
     474            Infernal_Timer = 30000 + rand()%10000;  
    375475        }else Infernal_Timer -= diff; 
    376476 
    377477        DoMeleeAttackIfReady(); 
    378478    } 
    379  
    380479}; 
    381480 
     
    383482bool GOHello_go_Manticron_Cube(Player *player, GameObject* _GO) 
    384483{ 
    385     ScriptedInstance* pInst = (ScriptedInstance*)_GO->GetInstanceData(); 
    386  
    387     Unit* pUnit = NULL; 
    388     if(pInst) 
    389         pUnit = Unit::GetUnit(*_GO, pInst->GetData64(DATA_MAGTHERIDON)); 
    390     else 
    391     { 
    392         _GO->TextEmote("Manticron Cube: NO INSTANCE", 0); 
     484    ScriptedInstance* pInstance =(ScriptedInstance*)_GO->GetInstanceData(); 
     485    if(!pInstance) return true; 
     486    if(pInstance->GetData(DATA_MAGTHERIDON_EVENT) != IN_PROGRESS) return true; 
     487    Creature *Magtheridon =(Creature*)Unit::GetUnit(*_GO, pInstance->GetData64(DATA_MAGTHERIDON)); 
     488    if(!Magtheridon || !Magtheridon->isAlive()) return true; 
     489 
     490    // if exhausted or already channeling return 
     491    if(player->HasAura(SPELL_MIND_EXHAUSTION, 0) || player->HasAura(SPELL_SHADOW_GRASP, 1)) 
    393492        return true; 
    394     } 
    395  
    396     if (!pUnit || !pUnit->isAlive() || !player) 
    397     { 
    398         _GO->TextEmote("Mantricon Cube: NO TARGET", 0); 
    399         return true; 
    400     } 
    401493 
    402494    player->InterruptNonMeleeSpells(false); 
    403     player->CastSpell(pUnit, SPELL_SHADOW_GRASP, true); 
    404     player->CastSpell(pUnit, SPELL_SHADOW_GRASP_VIS, false); 
    405  
    406     _GO->Say("Mantricon Cube Clicked", LANG_UNIVERSAL, 0); 
     495    player->CastSpell(player, SPELL_SHADOW_GRASP, true); 
     496    player->CastSpell(player, SPELL_SHADOW_GRASP_VISUAL, false); 
     497    ((boss_magtheridonAI*)Magtheridon->AI())->SetClicker(_GO->GetGUID(), player->GetGUID()); 
    407498    return true; 
    408499} 
     
    410501CreatureAI* GetAI_boss_magtheridon(Creature *_Creature) 
    411502{ 
    412     return new boss_magtheridonAI (_Creature); 
     503    return new boss_magtheridonAI(_Creature); 
    413504} 
    414505 
    415506CreatureAI* GetAI_mob_hellfire_channeler(Creature *_Creature) 
    416507{ 
    417     return new mob_hellfire_channelerAI (_Creature); 
     508    return new mob_hellfire_channelerAI(_Creature); 
     509} 
     510 
     511CreatureAI* GetAI_mob_abyssalAI(Creature *_Creature) 
     512{ 
     513    return new mob_abyssalAI(_Creature); 
    418514} 
    419515 
     
    435531    newscript->pGOHello = &GOHello_go_Manticron_Cube; 
    436532    m_scripts[nrscripts++] = newscript; 
     533 
     534    newscript = new Script; 
     535    newscript->Name="mob_abyssal"; 
     536    newscript->GetAI = GetAI_mob_abyssalAI; 
     537    m_scripts[nrscripts++] = newscript; 
     538 
    437539} 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/def_magtheridons_lair.h

    r46 r82  
    66#define DEF_MAGTHERIDONS_LAIR_H 
    77 
    8 #define DATA_EVENT_STARTER 1 
    9 #define DATA_MAGTHERIDON 2 
    10 #define DATA_MAGTHERIDON_EVENT_ENDED 3 
    11 #define DATA_MAGTHERIDON_EVENT_STARTED 4 
    12 #define DATA_MAGTHERIDON_EVENT_STATUS 5 
     8#define DATA_MAGTHERIDON_EVENT          1 
     9#define DATA_MAGTHERIDON                                3 
     10#define DATA_CHANNELER_EVENT        2 
     11#define DATA_COLLAPSE                                   6 
     12#define DATA_CHANNELER                                  9 
    1313#endif 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp

    r48 r82  
    77 * This program is distributed in the hope that it will be useful, 
    88 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1010 * GNU General Public License for more details. 
    1111 * 
    1212 * You should have received a copy of the GNU General Public License 
    1313 * along with this program; if not, write to the Free Software 
    14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1515 */ 
    1616 
     
    2525#include "def_magtheridons_lair.h" 
    2626 
     27#define SPELL_SOUL_TRANSFER         30531 // core bug, does not support target 7 
     28#define SPELL_BLAZE_TARGET          30541 // core bug, does not support target 7 
     29#define SPELL_DEBRIS_DAMAGE                     30631 // core bug, does not support target 8 
     30#define SPELL_DEBRIS_KNOCKDOWN      36449 // core bug, does not support target 8 
     31 
     32#define CHAMBER_CENTER_X                        -15.14 
     33#define CHAMBER_CENTER_Y                          1.8 
     34#define CHAMBER_CENTER_Z                         -0.4 
     35 
     36#define ENCOUNTERS 2 
     37 
    2738struct TRINITY_DLL_DECL instance_magtheridons_lair : public ScriptedInstance 
    2839{ 
    29     instance_magtheridons_lair(Map *Map) : ScriptedInstance(Map) {Initialize();}; 
    30  
    31     bool EncounterInProgress; 
    32     uint64 Magtheridon; 
    33     uint64 EventStarter; 
     40    instance_magtheridons_lair(Map *Map) : ScriptedInstance(Map) 
     41    { 
     42        Initialize(); 
     43        // target 7, random target with certain entry spell, need core fix 
     44        SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_BLAZE_TARGET); 
     45        if(TempSpell && TempSpell->EffectImplicitTargetA[0] != 6) 
     46        { 
     47            TempSpell->EffectImplicitTargetA[0] = 6; 
     48            TempSpell->EffectImplicitTargetB[0] = 0; 
     49        } 
     50        TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_SOUL_TRANSFER); 
     51        if(TempSpell && TempSpell->EffectImplicitTargetB[0] != 30) 
     52        { 
     53            TempSpell->EffectImplicitTargetA[0] = 1; 
     54            TempSpell->EffectImplicitTargetA[1] = 1; 
     55            TempSpell->EffectImplicitTargetA[2] = 1; 
     56            TempSpell->EffectImplicitTargetB[0] = 0; 
     57            TempSpell->EffectImplicitTargetB[1] = 0; 
     58            TempSpell->EffectImplicitTargetB[2] = 0; 
     59        } 
     60        // target 8, but core only push back the caster 
     61        TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_DEBRIS_DAMAGE); 
     62        if(TempSpell && TempSpell->EffectImplicitTargetA[0] != 53) 
     63        { 
     64            TempSpell->EffectImplicitTargetA[0] = 53; 
     65            TempSpell->EffectImplicitTargetB[0] = 16; 
     66        }   
     67        TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_DEBRIS_KNOCKDOWN); 
     68        if(TempSpell && TempSpell->EffectImplicitTargetA[0] != 53) 
     69        { 
     70            TempSpell->EffectImplicitTargetA[0] = 53; 
     71            TempSpell->EffectImplicitTargetB[0] = 16; 
     72            TempSpell->EffectImplicitTargetA[1] = 53; 
     73            TempSpell->EffectImplicitTargetB[1] = 16; 
     74        }   
     75    } 
     76 
     77    uint32 Encounters[ENCOUNTERS]; 
     78 
     79    uint64 MagtheridonGUID; 
     80    std::set<uint64> ChannelerGUID; 
     81    uint64 DoorGUID; 
     82    std::set<uint64> ColumnGUID; 
     83 
     84    uint32 CageTimer; 
     85    uint32 RespawnTimer; 
    3486 
    3587    void Initialize() 
    3688    { 
    37         Magtheridon = 0; 
    38         EventStarter = 0; 
    39         EncounterInProgress = false; 
     89        for(uint8 i = 0; i < ENCOUNTERS; i++) 
     90            Encounters[i] = NOT_STARTED; 
     91 
     92        MagtheridonGUID = 0; 
     93        ChannelerGUID.clear(); 
     94        DoorGUID = 0; 
     95        ColumnGUID.clear();       
     96 
     97        CageTimer = 0; 
     98        RespawnTimer = 0; 
    4099    } 
    41100 
    42101    bool IsEncounterInProgress() const 
    43102    { 
    44         return EncounterInProgress; 
     103        for(uint8 i = 0; i < ENCOUNTERS; i++) 
     104            if(Encounters[i] == IN_PROGRESS) return true; 
     105        return false; 
    45106    } 
    46107 
    47108    void OnCreatureCreate(Creature *creature, uint32 creature_entry) 
    48109    { 
    49         if (creature_entry == 17257) 
    50             Magtheridon = creature->GetGUID(); 
    51     } 
    52  
    53     uint64 GetData64(uint32 identifier) 
    54     { 
    55         switch(identifier) 
    56         { 
    57             case DATA_MAGTHERIDON: 
    58                 return Magtheridon; 
    59  
    60             case DATA_EVENT_STARTER: 
    61                 return EventStarter; 
     110        switch(creature->GetEntry()) 
     111        { 
     112        case 17257: 
     113            MagtheridonGUID = creature->GetGUID(); 
     114            break; 
     115        case 17256: 
     116            ChannelerGUID.insert(creature->GetGUID()); 
     117            break; 
     118        } 
     119    } 
     120 
     121    void OnObjectCreate(GameObject *go) 
     122    { 
     123        switch(go->GetEntry()) 
     124        { 
     125        case 181713: 
     126            go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); 
     127            break; 
     128        case 183847: 
     129            DoorGUID = go->GetGUID(); 
     130            break; 
     131        case 184653: // hall 
     132        case 184634: // six columns 
     133        case 184635: 
     134        case 184636: 
     135        case 184637: 
     136        case 184638: 
     137        case 184639: 
     138            ColumnGUID.insert(go->GetGUID()); 
     139            break; 
     140        } 
     141    } 
     142 
     143    uint64 GetData64(uint32 type) 
     144    { 
     145        switch(type) 
     146        { 
     147        case DATA_MAGTHERIDON: 
     148            return MagtheridonGUID; 
    62149        } 
    63150        return 0; 
    64151    } 
    65152 
    66     void SetData64(uint32 identifier, uint64 guid) 
    67     { 
    68         switch(identifier) 
    69         { 
    70             case DATA_MAGTHERIDON: 
    71                 Magtheridon = guid; 
    72                 break; 
    73  
    74             case DATA_EVENT_STARTER: 
    75                 EventStarter = guid; 
    76                 break; 
    77         } 
    78     } 
    79  
    80153    void SetData(uint32 type, uint32 data) 
    81154    { 
     155        Player *player = GetPlayer(); 
     156        if(!player) return; 
     157 
    82158        switch(type) 
    83159        { 
    84             case DATA_MAGTHERIDON_EVENT_STARTED: 
    85                 EncounterInProgress = true; 
    86                 break; 
    87  
    88             case DATA_MAGTHERIDON_EVENT_ENDED: 
    89                 EncounterInProgress = false; 
    90                 EventStarter = 0; 
    91                 break; 
     160        case DATA_MAGTHERIDON_EVENT: 
     161            Encounters[0] = data; 
     162            if(data == NOT_STARTED) 
     163                RespawnTimer = 10000; 
     164            if(data != IN_PROGRESS) 
     165            { 
     166                if(GameObject *Door = GameObject::GetGameObject(*player, DoorGUID)) 
     167                    Door->SetGoState(0); 
     168            } 
     169            break; 
     170        case DATA_CHANNELER_EVENT: 
     171            switch(data) 
     172            { 
     173            case NOT_STARTED: // Reset all channelers once one is reset. 
     174                if(Encounters[1] != NOT_STARTED) 
     175                { 
     176                    Encounters[1] = NOT_STARTED; 
     177                    for(std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) 
     178                    { 
     179                        if(Creature *Channeler = (Creature*)Unit::GetUnit(*player, *i)) 
     180                        { 
     181                            if(Channeler->isAlive()) 
     182                                Channeler->AI()->EnterEvadeMode(); 
     183                            else 
     184                                Channeler->Respawn(); 
     185                        } 
     186                    } 
     187                    CageTimer = 0; 
     188                    if(GameObject *Door = GameObject::GetGameObject(*player, DoorGUID)) 
     189                        Door->SetGoState(0); 
     190                }break; 
     191            case IN_PROGRESS: // Event start. 
     192                if(Encounters[1] != IN_PROGRESS) 
     193                { 
     194                    Encounters[1] = IN_PROGRESS; 
     195                    // Let all five channelers aggro. 
     196                    for(std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) 
     197                    { 
     198                        Creature *Channeler = (Creature*)Unit::GetUnit(*player, *i); 
     199                        if(Channeler && Channeler->isAlive()) 
     200                        { 
     201                            //if(Unit *target = Channeler->SelectNearbyTarget()) 
     202                            //always return true, do not know why 
     203                            AttackNearestTarget(Channeler); 
     204                        } 
     205                    } 
     206                    // Release Magtheridon after two minutes. 
     207                    Creature *Magtheridon = (Creature*)Unit::GetUnit(*player, MagtheridonGUID); 
     208                    if(Magtheridon && Magtheridon->isAlive()) 
     209                    { 
     210                        Magtheridon->TextEmote("'s bonds begin to weaken!", 0); 
     211                        CageTimer = 120000; 
     212                    } 
     213                    if(GameObject *Door = GameObject::GetGameObject(*player, DoorGUID)) 
     214                        Door->SetGoState(1); 
     215                }break; 
     216            case DONE: // Add buff and check if all channelers are dead. 
     217                for(std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) 
     218                { 
     219                    Unit *Channeler = Unit::GetUnit(*player, *i); 
     220                    if(Channeler && Channeler->isAlive()) 
     221                    { 
     222                        Channeler->CastSpell(Channeler, SPELL_SOUL_TRANSFER, true); 
     223                        data = IN_PROGRESS; 
     224                    } 
     225                }break; 
     226            } 
     227            Encounters[1] = data; 
     228            break; 
     229        case DATA_COLLAPSE: 
     230            // true - collapse / false - reset 
     231            for(std::set<uint64>::iterator i = ColumnGUID.begin(); i != ColumnGUID.end(); ++i) 
     232            { 
     233                if(GameObject *Column = GameObject::GetGameObject(*player, *i)) 
     234                    Column->SetGoState(!data); 
     235            } 
     236            break; 
     237        default: 
     238            break; 
    92239        } 
    93240    } 
     
    95242    uint32 GetData(uint32 type) 
    96243    { 
    97         if(type == DATA_MAGTHERIDON_EVENT_STATUS) 
    98             return EncounterInProgress; 
    99  
     244        if(type == DATA_MAGTHERIDON_EVENT) 
     245            return Encounters[0]; 
    100246        return 0; 
     247    } 
     248 
     249    Player* GetPlayer() 
     250    { 
     251        if(((InstanceMap*)instance)->GetPlayers().size()) 
     252            return ((InstanceMap*)instance)->GetPlayers().front(); 
     253        return NULL; 
     254    } 
     255 
     256    void AttackNearestTarget(Creature *creature) 
     257    { 
     258        float minRange = 999.0f; 
     259        float range; 
     260        Player* target = NULL; 
     261        InstanceMap::PlayerList const &PlayerList = ((InstanceMap*)instance)->GetPlayers(); 
     262        InstanceMap::PlayerList::const_iterator i; 
     263        for(i = PlayerList.begin(); i != PlayerList.end(); ++i) 
     264        { 
     265            if((*i)->isTargetableForAttack()) 
     266            { 
     267                range = (*i)->GetDistance(creature); 
     268                if(range < minRange) 
     269                { 
     270                    minRange = range; 
     271                    target = *i; 
     272                }                 
     273            } 
     274        } 
     275        creature->AI()->AttackStart(target); 
     276    } 
     277 
     278    void Update(uint32 diff) 
     279    { 
     280        if(CageTimer) 
     281        { 
     282            if(CageTimer <= diff) 
     283            { 
     284                if(Player *player = GetPlayer()) 
     285                { 
     286                    Creature *Magtheridon = (Creature*)Unit::GetUnit(*player, MagtheridonGUID); 
     287                    if(Magtheridon && Magtheridon->isAlive()) 
     288                    { 
     289                        Magtheridon->clearUnitState(UNIT_STAT_STUNNED); 
     290                        AttackNearestTarget(Magtheridon); 
     291                    } 
     292                } 
     293                CageTimer = 0; 
     294            }else CageTimer -= diff; 
     295        } 
     296 
     297        if(RespawnTimer) 
     298        { 
     299            if(RespawnTimer <= diff) 
     300            { 
     301                if(Player *player = GetPlayer()) 
     302                { 
     303                    for(std::set<uint64>::iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i) 
     304                    { 
     305                        if(Creature *Channeler = (Creature*)Unit::GetUnit(*player, *i)) 
     306                        { 
     307                            if(Channeler->isAlive()) 
     308                                Channeler->AI()->EnterEvadeMode(); 
     309                            else 
     310                                Channeler->Respawn(); 
     311                        } 
     312                    } 
     313                } 
     314                RespawnTimer = 0; 
     315            }else RespawnTimer -= diff; 
     316        } 
    101317    } 
    102318}; 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/def_the_eye.h

    r46 r82  
    1818#define DATA_THALADREDTHEDARKENER           11 
    1919#define DATA_VOIDREAVEREVENT                12 
     20#define DATA_ALAR 13 
    2021#endif 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/instance_the_eye.cpp

    r48 r82  
    77 * This program is distributed in the hope that it will be useful, 
    88 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1010 * GNU General Public License for more details. 
    1111 * 
    1212 * You should have received a copy of the GNU General Public License 
    1313 * along with this program; if not, write to the Free Software 
    14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1515 */ 
    1616 
     
    4444    uint64 Kaelthas; 
    4545    uint64 Astromancer; 
     46    uint64 Alar; 
    4647 
    4748    uint8 KaelthasEventPhase; 
     49    uint8 AlarEventPhase; 
    4850 
    4951    bool Encounters[ENCOUNTERS]; 
     
    5759        Kaelthas = 0; 
    5860        Astromancer = 0; 
     61        Alar = 0; 
    5962 
    6063        KaelthasEventPhase = 0; 
     64        AlarEventPhase = 0; 
    6165 
    6266        for(uint8 i = 0; i < ENCOUNTERS; i++) 
     
    8286            case 19622: Kaelthas = creature->GetGUID(); break; 
    8387            case 18805: Astromancer = creature->GetGUID(); break; 
     88 
     89            case 19514: 
     90                Alar = creature->GetGUID(); 
     91                break; 
    8492        } 
    8593    } 
     
    106114            case DATA_ASTROMANCER: 
    107115                return Astromancer; 
     116 
     117            case DATA_ALAR: 
     118                return Alar; 
    108119        } 
    109120 
     
    116127        { 
    117128            case DATA_ALAREVENT: 
     129                AlarEventPhase = data; 
    118130                Encounters[0] = (data) ? true : false; 
    119131                break; 
     
    144156        { 
    145157            case DATA_ALAREVENT: 
    146                 return Encounters[0]; 
     158                return AlarEventPhase; 
    147159 
    148160            case DATA_SOLARIANEVENT: