MMOCoin

Likes Likes:  0
Results 1 to 10 of 1117

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Banned

    Join Date
    Jan 2010
    Posts
    41
    Post Thanks / Like
    Rep Power
    0
    Reputation
    6
    PHP Code:
    #include "precompiled.h"
    #include "def_spire.h"

    enum BossSpells
    {
        
    SPELL_INFEST                     70541,
        
    SPELL_NECROTIC_PLAGUE            70337,
        
    SPELL_PLAGUE_SIPHON              74074,
        
    SPELL_SOUL_REAPER                69409,
        
    SPELL_SPAWN_DEFILE               72762,
        
    SPELL_HARVEST_SOUL               68980,
        
    SPELL_HARVEST_SOUL_TELEPORT      71372,
    //
        
    SPELL_CHANNEL_KING               71769,
        
    SPELL_BROKEN_FROSTMOURNE         72398,
        
    SPELL_BOOM_VISUAL                72726,
        
    SPELL_ICEBLOCK_TRIGGER           71614,
        
    SPELL_TIRION_LIGHT               71797,
        
    SPELL_FROSTMOURNE_TRIGGER        72405,
        
    SPELL_SUMMON_BROKEN_FROSTMOURNE  72406,
        
    SPELL_SUMMON_BROKEN_FROSTMOURNE_2 73017,
        
    SPELL_DISENGAGE                  61508,
        
    SPELL_FURY_OF_FROSTMOURNE        70063,
        
    SPELL_REVIVE_VISUAL              37755
        
    SPELL_REVIVE                     51918,
        
    SPELL_CLONE_PLAYER               57507,
        
    SPELL_BERSERK                    47008,

        
    SPELL_REMORSELESS_WINTER         68981,
        
    SPELL_PAIN_AND_SUFFERING         72133,
        
    SPELL_QUAKE                      72262,

    //  SPELL_SUMMON_RAGING_SPIRIT       = 69201, // triggered
        
    SPELL_SUMMON_RAGING_SPIRIT       69200,
        
    SPELL_SOUL_SHRIEK                69242,

        
    SPELL_SUMMON_ICE_SPHERE          69103,
        
    SPELL_ICE_PULSE                  69099,
        
    SPELL_ICE_BURST                  69108,
        
    SPELL_ICE_SPHERE_VISUAL          69090,

        
    SPELL_SUMMON_DRUDGE_GHOULS       70358,

        
    SPELL_SUMMON_SHAMBLING_HORROR    70372,
        
    SPELL_SHOCKWAVE                  72149,
        
    SPELL_HORROR_ENRAGE              72143,

        
    SPELL_SUMMON_VILE_SPIRITS        70498,
        
    SPELL_SPIRITS_BURST              70503,

        
    SPELL_SUMMON_VALKYR              69037,
        
    NPC_VALKYR                       36609,
        
    SPELL_WINGS_OF_THE_DAMNED        74352,

        
    SPELL_DEFILE                     72743,

        
    SPELL_REVALL                     26687,

        
    NPC_ICE_SPHERE                   36633,
        
    NPC_DEFILER                      38757,
        
    NPC_RAGING_SPIRIT                36701,
        
    NPC_VILE_SPIRIT                  37799,
        
    NPC_STRANGULATE_VEHICLE          36598,

    };

    enum Common
    {
         
    FINAL_ARTHAS_MOVIE             16,
    };

    static 
    Locations SpawnLoc[]=
    {
        {
    459.93689f, -2124.638184f1040.860107f},    // 0 Lich King Intro
        
    {503.15652f, -2124.516602f1040.860107f},    // 1 Lich king move end
        
    {491.27118f, -2124.638184f1040.860107f},    // 2 Tirion 1
        
    {481.69797f, -2124.638184f1040.860107f},    // 3 Tirion 2
        
    {498.00448f, -2201.573486f1046.093872f},    // 4 Valkyrs?
        
    {517.48291f, -2124.905762f1040.861328f},    // 5 Tirion?
        
    {529.85302f, -2124.709961f1040.859985f},    // 6 Lich king final, o=3.1146
        
    {520.311f, -2124.709961f1040.859985f},      // 7 Frostmourne
    };

    struct MANGOS_DLL_DECL boss_the_lich_king_iccAI : public BSWScriptedAI
    {
        
    boss_the_lich_king_iccAI(CreaturepCreature) : BSWScriptedAI(pCreature)
        {
            
    pInstance = (instance_icecrown_spire*)pCreature->GetInstanceData();
            
    oldflag 0;
            
    Reset();
        }

        
    instance_icecrown_spirepInstance;
        
    uint8 stage;
        
    uint32 nextEvent;
        
    uint32 nextPoint;
        
    uint32 UpdateTimer;
        
    uint32 oldflag;
        
    bool movementstarted;
        
    bool battlestarted;
        
    bool finalphase;
        
    CreaturepTirion;
        
    CreaturepFrostmourne;

        
    void Reset()
        {
            if(!
    pInstance) return;
            
    resetTimers();
            
    stage 0;
            
    nextEvent 0;
            
    nextPoint 0;
            
    movementstarted false;
            
    battlestarted false;
            
    finalphase false;
            
    m_creature->SetOrientation(0.0f);
            
    pInstance->CloseDoor(pInstance->GetData64(GO_ICESHARD_1));
            
    pInstance->CloseDoor(pInstance->GetData64(GO_ICESHARD_2));
            
    pInstance->CloseDoor(pInstance->GetData64(GO_ICESHARD_3));
            
    pInstance->CloseDoor(pInstance->GetData64(GO_ICESHARD_4));
            if (
    oldflag)
                if (
    GameObjectpGoFloor pInstance->instance->GetGameObject(pInstance->GetData64(GO_ARTHAS_PLATFORM)))
                {
                   
    pGoFloor->RemoveFlag(GAMEOBJECT_FLAGSGO_FLAG_DAMAGED GO_FLAG_NODESPAWN);
                   
    pGoFloor->SetUInt32Value(GAMEOBJECT_BYTES_1,oldflag);
                }
            
    pInstance->CloseDoor(pInstance->GetData64(GO_FROSTY_WIND));
        }

        
    void MoveInLineOfSight(UnitpWho
        {
        }

        
    void EnterEvadeMode()
        {
            if (!
    pInstance) return;
            if (
    finalphase && pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS) return;

            
    m_creature->RemoveAllAuras();
            
    m_creature->DeleteThreatList();
            
    m_creature->CombatStop(true);
            
    m_creature->LoadCreaturesAddon();
            if (
    m_creature->isAlive())
                
    m_creature->GetMotionMaster()->MoveTargetedHome();

            
    m_creature->SetLootRecipient(NULL);

            
    Reset();
        }

        
    void MovementInform(uint32 typeuint32 id)
        {
            if (
    type != POINT_MOTION_TYPE || !movementstarted) return;
            if (
    id == nextPoint
            {
                
    movementstarted false;
                
    pInstance->SetData(TYPE_EVENT,nextEvent);
                
    m_creature->GetMotionMaster()->MovementExpired();
            }
        }

        
    void KilledUnit(UnitpVictim)
        {

         if (!
    battlestarted) return;

         switch (
    urand(0,1)) {
            case 
    0:
                   
    DoScriptText(-1631519,m_creature,pVictim);
                   break;
            case 
    1:
                   
    DoScriptText(-1631517,m_creature,pVictim);
                   break;
            };
        }

        
    void JustReachedHome()
        {
            if (!
    pInstance) return;
            
    pInstance->SetData(TYPE_LICH_KINGFAIL);
            
    stage 0;
            
    battlestarted false;
            
    finalphase false;
        }


        
    void StartMovement(uint32 iduint32 _nextEvent)
        {
            
    nextPoint id;
            
    nextEvent _nextEvent;
            
    m_creature->GetMotionMaster()->Clear();
            
    m_creature->GetMotionMaster()->MovePoint(idSpawnLoc[id].xSpawnLoc[id].ySpawnLoc[id].z);
            
    pInstance->SetData(TYPE_EVENT,0);
            
    movementstarted true;
        }

        
    void JustSummoned(Creaturesummoned)
        {
            if(!
    pInstance || !summoned) return;

            if (
    UnitpTarget doSelectRandomPlayerAtRange(60.0f))
               {
                  
    summoned->SetInCombatWith(pTarget);
                  
    summoned->AddThreat(pTarget,100.0f);
               }
        }

        
    void Aggro(Unit *who
        {
            if(!
    pInstance) return;
            
    pInstance->SetData(TYPE_LICH_KINGIN_PROGRESS);
        }

        
    void JustDied(Unit *killer)
        {
            if(!
    pInstance) return;
            
    pInstance->SetData(TYPE_LICH_KINGDONE);
            
    DoScriptText(-1631528,m_creature,killer);

            
    pInstance->SetData(TYPE_EVENT,14010);

        }

        
    void UpdateAI(const uint32 diff)
        {

            if(!
    pInstance) return;

            if (
    pInstance->GetData(TYPE_EVENT_NPC) == NPC_LICH_KING)
            {
                
    UpdateTimer pInstance->GetData(TYPE_EVENT_TIMER);
                if (
    UpdateTimer <= diff)
                {
                
    debug_log("EventMGR: creature %u received signal %u ",m_creature->GetEntry(),pInstance->GetData(TYPE_EVENT));
                switch (
    pInstance->GetData(TYPE_EVENT))
                    {
                    case 
    12000:
                              
    m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATEEMOTE_STATE_STAND);
                              
    m_creature->SetStandState(UNIT_STAND_STATE_STAND);
                              
    StartMovement(0,12020);
                              break;
                    case 
    12020:
                              
    m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATEEMOTE_STATE_TALK);
                              
    DoScriptText(-1631501m_creature);
                              
    UpdateTimer 12000;
                              
    pInstance->SetData(TYPE_EVENT,12030);
                              break;
                    case 
    12040:
                              
    m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATEEMOTE_STATE_READY2H);
                              
    DoScriptText(-1631503m_creature);
                              
    UpdateTimer 8000;
                              
    pInstance->SetData(TYPE_EVENT,12041);
                              break;
                    case 
    12041:
                              
    m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATEEMOTE_STATE_LAUGH);
                              
    UpdateTimer 3000;
                              
    pInstance->SetData(TYPE_EVENT,12042);
                              break;
                    case 
    12042:
                              
    m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,EMOTE_ONESHOT_POINT_NOSHEATHE);
                              
    UpdateTimer 2000;
                              
    pInstance->SetData(TYPE_EVENT,12043);
                              break;
                    case 
    12043:
                              
    m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,EMOTE_ONESHOT_NONE);
                              
    UpdateTimer 10000;
                              
    pInstance->SetData(TYPE_EVENT,12050);
                              break;
                    case 
    12060:
                              
    m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATEEMOTE_STATE_TALK);
                              
    DoScriptText(-1631505m_creature);
                              
    UpdateTimer 10000;
                              
    pInstance->SetData(TYPE_EVENT,12080);
                              break;
                    case 
    12080:
                              
    m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,EMOTE_STATE_READY2H);
                              
    UpdateTimer 2000;
                              
    pInstance->SetData(TYPE_EVENT,12100);
                              break;
                    case 
    12100:
                              
    m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,EMOTE_ONESHOT_NONE);
                              
    UpdateTimer 6000;
                              
    pInstance->SetData(TYPE_EVENT,12120);
                              break;
                    case 
    12120:
                              
    m_creature->SetInCombatWithZone();
                              
    battlestarted true;
                              
    pInstance->SetData(TYPE_EVENT,12200);
                              
    UpdateTimer 10000;
                              break;
                    case 
    12200:
                              
    DoScriptText(-1631506m_creature);
                              
    UpdateTimer 5000;
                              
    pInstance->SetData(TYPE_EVENT,12220);
                              break;
                    case 
    13000:
                              
    m_creature->SetOrientation(3.1146f);
                              
    DoScriptText(-1631507m_creature);
                              
    UpdateTimer 12000;
                              
    finalphase true;
                              
    doCast(SPELL_FURY_OF_FROSTMOURNE);
                              
    pInstance->SetData(TYPE_EVENT,13020);
                              if (
    pTirion = (Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(NPC_TIRION))) {
                                    
    m_creature->SetInCombatWith(pTirion);
                                    
    pTirion->AddThreat(m_creature1000.0f);
                                    }
                              
    m_creature->SetInCombatWithZone();
                              break;
                    case 
    13020:
                              
    DoScriptText(-1631508m_creature);
                              
    UpdateTimer 12000;
                              
    pInstance->SetData(TYPE_EVENT,13060);
                              break;
                    case 
    13060:
                              
    DoScriptText(-1631509m_creature);
                              
    UpdateTimer 15000;
                              
    pInstance->SetData(TYPE_EVENT,13100);
                              break;
                    case 
    13100:
                              
    DoScriptText(-1631510m_creature);
                              
    UpdateTimer 15000;
                              
    pInstance->SetData(TYPE_EVENT,13110);
                              
    doCast(SPELL_CHANNEL_KING);
                              break;
                    case 
    13120:
                              
    DoScriptText(-1631511m_creature);
                              
    UpdateTimer 12000;
                              
    pInstance->SetData(TYPE_EVENT,13130);
                              break;
                    case 
    13140:
                              
    UpdateTimer 6000;
                              
    doRemove(SPELL_CHANNEL_KING);
                              
    pInstance->SetData(TYPE_EVENT,13150);
                              
    m_creature->CastSpell(m_creatureSPELL_SUMMON_BROKEN_FROSTMOURNEfalse);
                              break;
                    case 
    13160:
                              
    UpdateTimer 6000;
                              
    pInstance->SetData(TYPE_EVENT,13170);
                              
    m_creature->CastSpell(m_creatureSPELL_SUMMON_BROKEN_FROSTMOURNE_2false);
                              break;
                    case 
    13180:
                              
    UpdateTimer 12000;
                              
    pInstance->SetData(TYPE_EVENT,13190);
                              if (
    pFrostmourne m_creature->SummonCreature(NPC_FROSTMOURNE_HOLDERSpawnLoc[7].xSpawnLoc[7].ySpawnLoc[7].z0TEMPSUMMON_MANUAL_DESPAWN5000))
                                 {
                                     
    pFrostmourne->CastSpell(pFrostmourneSPELL_BROKEN_FROSTMOURNEfalse);
                                     
    pFrostmourne->CastSpell(pFrostmourneSPELL_FROSTMOURNE_TRIGGERfalse);
                                     
    pFrostmourne->GetMotionMaster()->MoveChase(m_creature);
                                     
    m_creature->SetFlag(UNIT_FIELD_FLAGSUNIT_FLAG_DISARMED);
                                 }
                              break;
                    case 
    13200:
                              
    DoScriptText(-1631512m_creature);
                              
    m_creature->RemoveAurasDueToSpell(SPELL_SUMMON_BROKEN_FROSTMOURNE);
                              
    m_creature->RemoveAllAuras();
                              
    pFrostmourne->RemoveAurasDueToSpell(SPELL_FROSTMOURNE_TRIGGER);
                              
    UpdateTimer 5000;
                              
    pInstance->SetData(TYPE_EVENT,13210);
                              break;
                    case 
    13280:
                              
    UpdateTimer 2000;
                              
    pInstance->SetData(TYPE_EVENT,13290);
                              
    stage 13;
                              if (
    pFrostmournepFrostmourne->ForcedDespawn();
                              if (
    CreaturepTemp = (Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(NPC_FROSTMOURNE_TRIGGER)))
                                 
    pTemp->ForcedDespawn();
                              if (
    CreaturepTemp = (Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(NPC_FROSTMOURNE_HOLDER)))
                                 
    pTemp->ForcedDespawn();
                              
    SetCombatMovement(true);
                              
    battlestarted true;
                              break;
                    default:
                              break;
                    }
                 } else 
    UpdateTimer -= diff;
                 
    pInstance->SetData(TYPE_EVENT_TIMERUpdateTimer);
            }

            if (
    battlestarted && !m_creature->SelectHostileTarget() && !finalphase)
            {
                
    battlestarted false;
                
    pInstance->SetData(TYPE_LICH_KINGFAIL);
                
    pInstance->SetData(TYPE_EVENT,0);
                
    EnterEvadeMode();
                return;
            }

            if (!
    m_creature->SelectHostileTarget() || !m_creature->getVictim())
                return;

            switch(
    stage)
            {
                case 
    0:           // Phase 1
    //                    timedCast(SPELL_SHOCKWAVE, diff);
                        
    timedCast(SPELL_INFESTdiff);
                        
    timedCast(SPELL_SUMMON_DRUDGE_GHOULSdiff);
                        
    timedCast(SPELL_PLAGUE_SIPHONdiff);
                        
    timedCast(SPELL_SUMMON_SHAMBLING_HORRORdiff);
                        
    timedCast(SPELL_NECROTIC_PLAGUEdiff);

                        
    DoMeleeAttackIfReady();
                        if (
    timedQuery(SPELL_BERSERKdiff))
                        {
                            
    doCast(SPELL_BERSERK);
                            
    DoScriptText(-1631518,m_creature);
                        };

                        if (
    m_creature->GetHealthPercent() < 70.0f
                           {
                                
    stage 1;
                                
    DoScriptText(-1631515,m_creature);
                           }
                        break;
                case 
    1:             // Go in transition phase
                        
    m_creature->AttackStop();
                        
    m_creature->SetFlag(UNIT_FIELD_FLAGSUNIT_FLAG_NON_ATTACKABLE);
                        
    SetCombatMovement(false);
                        
    StartMovement(1,0);
                        
    stage 2;
                        break;
                case 
    2:
                        if (
    movementstarted) return;
                        
    doCast(SPELL_REMORSELESS_WINTER);
                        
    stage 3;
                        break;
                case 
    3:
                        
    timedCast(SPELL_SUMMON_RAGING_SPIRITdiff);
                        
    timedCast(SPELL_SUMMON_ICE_SPHEREdiff);
                        
    timedCast(SPELL_PAIN_AND_SUFFERINGdiff);

                        if (
    timedQuery(SPELL_BERSERKdiff))
                        {
                            
    doCast(SPELL_BERSERK);
                            
    DoScriptText(-1631518,m_creature);
                        };

                        if (
    timedQuery(SPELL_REMORSELESS_WINTERdiff))
                           {
                                
    doCast(SPELL_QUAKE);
                                
    stage 4;
                                
    DoScriptText(-1631524m_creature);
                                
    pInstance->OpenDoor(pInstance->GetData64(GO_SNOW_EDGE));
                           };
                        break;
                case 
    4:           // Platform destruct
                        
    if (timedQuery(SPELL_QUAKEdiff))
                           {
                                
    pInstance->OpenDoor(pInstance->GetData64(GO_ICESHARD_1));
                                
    pInstance->OpenDoor(pInstance->GetData64(GO_ICESHARD_2));
                                
    pInstance->OpenDoor(pInstance->GetData64(GO_ICESHARD_3));
                                
    pInstance->OpenDoor(pInstance->GetData64(GO_ICESHARD_4));
                                if (
    GameObjectpGoFloor pInstance->instance->GetGameObject(pInstance->GetData64(GO_ARTHAS_PLATFORM)))
                                {
                                     
    pGoFloor->SetFlag(GAMEOBJECT_FLAGSGO_FLAG_DAMAGED GO_FLAG_NODESPAWN);
                                     
    oldflag pGoFloor->GetUInt32Value(GAMEOBJECT_BYTES_1);
                                     
    pGoFloor->SetUInt32Value(GAMEOBJECT_BYTES_1,8449);
                                }
                                
    pInstance->CloseDoor(pInstance->GetData64(GO_FROSTY_WIND));
                                
    pInstance->CloseDoor(pInstance->GetData64(GO_SNOW_EDGE));
                                
    m_creature->GetMotionMaster()->Clear();
                                
    m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                                
    m_creature->RemoveFlag(UNIT_FIELD_FLAGSUNIT_FLAG_NON_ATTACKABLE);
                                
    SetCombatMovement(true);
                                
    stage 5;
                           }
                        break;
                case 
    5:           // Phase 2

                        
    if (timedQuery(SPELL_SPAWN_DEFILEdiff)) 
                           {
                                
    doCast(SPELL_SPAWN_DEFILE);
                                
    DoScriptText(-1631531,m_creature);
                           }
                        if (
    timedQuery(SPELL_SUMMON_VALKYRdiff)) 
                           {
                                
    doCast(SPELL_SUMMON_VALKYR);
                                
    DoScriptText(-1631527,m_creature);
                           }

                        
    timedCast(SPELL_SOUL_REAPERdiff);
                        
    timedCast(SPELL_INFESTdiff);

                        
    DoMeleeAttackIfReady();

                        if (
    timedQuery(SPELL_BERSERKdiff))
                        {
                            
    doCast(SPELL_BERSERK);
                            
    DoScriptText(-1631518,m_creature);
                        };

                        if (
    m_creature->GetHealthPercent() < 40.0f
                           {
                                
    stage 6;
                                
    DoScriptText(-1631523,m_creature);
                           }
                        break;
                case 
    6:           // Go in transition phase
                        
    m_creature->AttackStop();
                        
    m_creature->SetFlag(UNIT_FIELD_FLAGSUNIT_FLAG_NON_ATTACKABLE);
                        
    SetCombatMovement(false);
                        
    StartMovement(1,0);
                        
    stage 7;
                        break;
                case 
    7:          // Platform restore
                        
    if (movementstarted) return;
                        if (
    GameObjectpGoFloor pInstance->instance->GetGameObject(pInstance->GetData64(GO_ARTHAS_PLATFORM)))
                        {
                            
    pGoFloor->RemoveFlag(GAMEOBJECT_FLAGSGO_FLAG_DAMAGED GO_FLAG_NODESPAWN);
                            
    pGoFloor->SetUInt32Value(GAMEOBJECT_BYTES_1,oldflag);
                        }
                        
    pInstance->OpenDoor(pInstance->GetData64(GO_FROSTY_WIND));
                        
    doCast(SPELL_REMORSELESS_WINTER);
                        
    stage 8;
                        break;
                case 
    8:
                        
    timedCast(SPELL_SUMMON_RAGING_SPIRITdiff);
                        
    timedCast(SPELL_SUMMON_ICE_SPHEREdiff);
                        
    timedCast(SPELL_PAIN_AND_SUFFERINGdiff);

                        if (
    timedQuery(SPELL_BERSERKdiff))
                        {
                            
    doCast(SPELL_BERSERK);
                            
    DoScriptText(-1631518,m_creature);
                        };

                        if (
    timedQuery(SPELL_REMORSELESS_WINTERdiff))
                           {
                                
    DoScriptText(-1631524m_creature);
                                
    doCast(SPELL_SUMMON_VILE_SPIRITS);
                                for (
    uint8 i 0getSpellData(SPELL_SUMMON_VILE_SPIRITS); ++i)
                                     
    doCast(NPC_VILE_SPIRIT);
                                
    doCast(SPELL_QUAKE);
                                
    stage 9;
                                
    pInstance->OpenDoor(pInstance->GetData64(GO_SNOW_EDGE));
                           };

                        break;
                case 
    9:           // Platform destruct
                        
    if (timedQuery(SPELL_QUAKEdiff))
                           {
                                if (
    GameObjectpGoFloor pInstance->instance->GetGameObject(pInstance->GetData64(GO_ARTHAS_PLATFORM)))
                                {
                                     
    pGoFloor->SetFlag(GAMEOBJECT_FLAGSGO_FLAG_DAMAGED GO_FLAG_NODESPAWN);
                                     
    oldflag pGoFloor->GetUInt32Value(GAMEOBJECT_BYTES_1);
                                     
    pGoFloor->SetUInt32Value(GAMEOBJECT_BYTES_1,8449);
                                }
                                
    pInstance->CloseDoor(pInstance->GetData64(GO_SNOW_EDGE));
                                
    pInstance->CloseDoor(pInstance->GetData64(GO_FROSTY_WIND));
                                
    m_creature->GetMotionMaster()->Clear();
                                
    m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                                
    m_creature->RemoveFlag(UNIT_FIELD_FLAGSUNIT_FLAG_NON_ATTACKABLE);
                                
    SetCombatMovement(true);
                                
    stage 10;
                           }
                       break;
                case 
    10:           // Phase 3
                        
    if (timedQuery(SPELL_SPAWN_DEFILEdiff)) 
                           {
                                
    doCast(SPELL_SPAWN_DEFILE);
    //                            DoScriptText(-1631527,m_creature);
                           
    }
                        
    timedCast(SPELL_SOUL_REAPERdiff);

                        if (
    timedQuery(SPELL_HARVEST_SOULdiff)) 
                           {
                                
    doCast(SPELL_HARVEST_SOUL);
                                
    DoScriptText(-1631520,m_creature);
                           }

                        
    timedCast(SPELL_SOUL_REAPERdiff);
                        
    timedCast(SPELL_INFESTdiff);

                        
    DoMeleeAttackIfReady();

                        if (
    m_creature->GetHealthPercent() < 10.0f
                           {
                                
    stage 11;
                                
    DoScriptText(-1631513,m_creature);
                           }
                        break;
                case 
    11:           // Ending Phase start
                        
    m_creature->AttackStop();
                        
    SetCombatMovement(false);
                        
    StartMovement(6,13000);
                        
    stage 12;
                        
    battlestarted false;
                        break;
                case 
    12:
                        break;
                case 
    13:
                        
    DoMeleeAttackIfReady();
                        break;
            }
        }
    };


    CreatureAIGetAI_boss_the_lich_king_icc(CreaturepCreature)
    {
        return new 
    boss_the_lich_king_iccAI(pCreature);
    };

    struct MANGOS_DLL_DECL boss_tirion_iccAI : public ScriptedAI
    {
        
    boss_tirion_iccAI(CreaturepCreature) : ScriptedAI(pCreature)
        {
            
    pInstance = (ScriptedInstance*)pCreature->GetInstanceData();
            
    Reset();
        }

        
    ScriptedInstance *pInstance;
        
    uint32 UpdateTimer;
        
    uint32 nextEvent;
        
    uint32 nextPoint;
        
    bool movementstarted;
        
    CreaturepMenethil;

        
    void Reset()
        {
            if(!
    pInstance) return;
            
    movementstarted false;
            
    m_creature->RemoveAurasDueToSpell(SPELL_ICEBLOCK_TRIGGER);
            
    m_creature->SetOrientation(M_PI_F);
        }

        
    void StartMovement(uint32 iduint32 _nextEvent)
        {
            
    nextPoint id;
            
    nextEvent _nextEvent;
            
    m_creature->GetMotionMaster()->MovePoint(idSpawnLoc[id].xSpawnLoc[id].ySpawnLoc[id].z);
            
    pInstance->SetData(TYPE_EVENT,0);
            
    movementstarted true;
        }

        
    void MovementInform(uint32 typeuint32 id)
        {
            if (
    type != POINT_MOTION_TYPE || !movementstarted) return;
            if (
    id == nextPoint
            {
                
    movementstarted false;
                
    pInstance->SetData(TYPE_EVENT,nextEvent);
                
    m_creature->GetMotionMaster()->MovementExpired();
            }
        }

        
    void doSendCinematic()
        {
            
    Map::PlayerList const &pList m_creature->GetMap()->GetPlayers();
            if (
    pList.isEmpty()) return;
            for (
    Map::PlayerList::const_iterator i pList.begin(); != pList.end(); ++i)
                 if (
    PlayerpPlayer i->getSource())
                     if (
    pPlayer && pPlayer->isAlive() && pPlayer->IsInMap(m_creature))
                         
    pPlayer->SendMovieStart(FINAL_ARTHAS_MOVIE);
        }

        
    void doRevivePlayers()
        {
            
    Map::PlayerList const &pList pMenethil->GetMap()->GetPlayers();
            if (
    pList.isEmpty()) return;
            for (
    Map::PlayerList::const_iterator i pList.begin(); != pList.end(); ++i)
                {
                   if (
    PlayerpPlayer i->getSource())
                   {
                       if (
    pPlayer && !pPlayer->isAlive() && pPlayer->IsInMap(pMenethil))
                          {
                              
    pMenethil->CastSpell(pPlayerSPELL_REVALLtrue);
                              
    pPlayer->ResurrectPlayer(100false);
                           }
                    }
                 };
        }

        
    void UpdateAI(const uint32 diff)
        {

            if (
    pInstance->GetData(TYPE_LICH_KING) == FAIL && m_creature->HasAura(SPELL_ICEBLOCK_TRIGGER)) 
            {
                
    m_creature->RemoveAurasDueToSpell(SPELL_ICEBLOCK_TRIGGER);
                
    m_creature->GetMotionMaster()->MoveTargetedHome();
                
    Reset();
            }

            if (
    pInstance->GetData(TYPE_EVENT_NPC) == NPC_TIRION)
            {
                
    UpdateTimer pInstance->GetData(TYPE_EVENT_TIMER);
                if (
    UpdateTimer <= diff)
                {
                
    debug_log("EventMGR: creature %u received signal %u ",m_creature->GetEntry(),pInstance->GetData(TYPE_EVENT));
                switch (
    pInstance->GetData(TYPE_EVENT))
                    {
                    case 
    12030:
                              
    m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATEEMOTE_ONESHOT_TALK);
                              
    DoScriptText(-1631552m_creature);
                              
    UpdateTimer 9000;
                              
    pInstance->SetData(TYPE_EVENT,12040);
                              break;
                    case 
    12050:
                              
    m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATEEMOTE_ONESHOT_POINT_NOSHEATHE);
                              
    DoScriptText(-1631554m_creature);
                              
    UpdateTimer 3000;
                              
    pInstance->SetData(TYPE_EVENT,12051);
                              break;
                    case 
    12051:
                              
    m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATEEMOTE_ONESHOT_NONE);
                              
    UpdateTimer 1000;
                              
    pInstance->SetData(TYPE_EVENT,12052);
                              break;
                    case 
    12052:
                              
    m_creature->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
                              
    StartMovement(3,12053);
                              break;
                    case 
    12053:
                              
    UpdateTimer 3000;
                              
    pInstance->SetData(TYPE_EVENT,12060);
                              
    m_creature->CastSpell(m_creatureSPELL_ICEBLOCK_TRIGGERtrue);
                              break;
                    case 
    13110:
                              
    DoScriptText(-1631555m_creature);
                              
    UpdateTimer 6000;
                              
    m_creature->CastSpell(m_creatureSPELL_TIRION_LIGHTfalse);
                              
    pInstance->SetData(TYPE_EVENT,13120);
                              break;
                    case 
    13130:
                              
    SetCombatMovement(false);
                              
    m_creature->RemoveAurasDueToSpell(SPELL_ICEBLOCK_TRIGGER);
                              
    UpdateTimer 500;
                              
    m_creature->SetOrientation(0.0f);
                              
    pInstance->SetData(TYPE_EVENT,13131);
                              break;
                    case 
    13131:
                              
    m_creature->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
                              
    StartMovement(2,13132);
                              break;
                    case 
    13132:
                              
    StartMovement(5,13140);
                              
    DoScriptText(-1631556m_creature);
                              
    m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATEEMOTE_STATE_READY2H);
                              break;
                    case 
    13150:
                              
    UpdateTimer 1000;
                              
    pInstance->SetData(TYPE_EVENT,13160);
                              break;
                    case 
    13170:
                              
    UpdateTimer 2000;
                              
    pInstance->SetData(TYPE_EVENT,13180);
                              break;
                    case 
    13190:
                              
    UpdateTimer 500;
                              
    pInstance->SetData(TYPE_EVENT,13200);
                              break;
                    case 
    13210:
                              
    UpdateTimer 3000;
                              
    pInstance->SetData(TYPE_EVENT,13230);
                              break;
                    case 
    13230:
                              
    UpdateTimer 12000;
                              
    pMenethil m_creature->SummonCreature(NPC_MENETHILm_creature->GetPositionX()+5m_creature->GetPositionY()+5m_creature->GetPositionZ(), 0TEMPSUMMON_MANUAL_DESPAWN5000);
                              
    pInstance->SetData(TYPE_EVENT,13250);
                              
    DoScriptText(-1631560pMenethil);
                              break;
                    case 
    13250:
                              
    UpdateTimer 6000;
                              
    pInstance->SetData(TYPE_EVENT,13270);
                              
    DoScriptText(-1631561pMenethil);
                              
    pMenethil->CastSpell(pMenethilSPELL_REVIVE_VISUALfalse);
                              
    doRevivePlayers();
                              break;
                    case 
    13270:
                              
    UpdateTimer 6000;
                              
    pInstance->SetData(TYPE_EVENT,13280);
                              if (
    CreaturepLichKing = (Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(NPC_LICH_KING)))
                              {
                                  
    m_creature->SetInCombatWith(pLichKing);
                                  
    pLichKing->SetInCombatWith(m_creature);
                                  
    pLichKing->AddThreat(m_creature1000.0f);
                                  
    m_creature->AI()->AttackStart(pLichKing);
                                  
    pMenethil->AI()->AttackStart(pLichKing);
                                  
    SetCombatMovement(true);
                                  
    m_creature->GetMotionMaster()->MoveChase(pLichKing);
                              };
                              break;
                    case 
    13290:
                              
    UpdateTimer 5000;
                              
    pInstance->SetData(TYPE_EVENT,13310);
                              
    DoScriptText(-1631590pMenethil);
                              break;
                    case 
    13310:
                              
    UpdateTimer 5000;
                              
    pInstance->SetData(TYPE_EVENT,13330);
                              
    DoScriptText(-1631591m_creature);
                              break;
                    case 
    13330:
                              
    UpdateTimer 5000;
                              
    pInstance->SetData(TYPE_EVENT,13350);
                              
    DoScriptText(-1631592pMenethil);
                              break;
                    case 
    13350:
                              
    UpdateTimer 2000;
                              
    pInstance->SetData(TYPE_EVENT,13370);
                              
    DoScriptText(-1631593m_creature);
                              break;
                    case 
    14010:
                              
    m_creature->AttackStop();
                              
    SetCombatMovement(false);
                              
    UpdateTimer =90000;
                              
    pInstance->SetData(TYPE_EVENT,14030);
                              
    m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATEEMOTE_ONESHOT_NONE);
                              if (
    CreaturepLichKing = (Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(NPC_LICH_KING)))
                                  
    pLichKing->RemoveFlag(UNIT_DYNAMIC_FLAGSUNIT_DYNFLAG_LOOTABLE);
                              
    doSendCinematic();
                              break;
                    case 
    14030:
                              
    UpdateTimer 20000;
                              
    pInstance->SetData(TYPE_EVENT,14030);
                              
    DoScriptText(-1631594m_creature);
    //                          if (pMenethil && pMenethil->isAlive()) pMenethil->ForcedDespawn();
                              
    if (pMenethil && pMenethil->isAlive()) pMenethil->SetVisibility(VISIBILITY_OFF);
                              if (
    CreaturepLichKing = (Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(NPC_LICH_KING)))
                                  
    pLichKing->SetFlag(UNIT_DYNAMIC_FLAGSUNIT_DYNFLAG_LOOTABLE);
                              
    pInstance->SetData(TYPE_EVENT,0);
                              
    EnterEvadeMode();
                              break;
                    default:
                              break;
                    }
                 } else 
    UpdateTimer -= diff;
                 
    pInstance->SetData(TYPE_EVENT_TIMERUpdateTimer);
            }

            if (!
    m_creature->SelectHostileTarget() || !m_creature->getVictim())
                return;
            
    DoMeleeAttackIfReady();
        }


    };

    bool GossipHello_boss_tirion_icc(PlayerpPlayerCreaturepCreature)
    {
        
    ScriptedInstancepInstance;
        
    pInstance = (ScriptedInstance*)pCreature->GetInstanceData();

        if (
    pInstance->GetData(TYPE_LICH_KING) != NOT_STARTED &&
            
    pInstance->GetData(TYPE_LICH_KING) != FAIL )
            {
                
    pPlayer->PlayerTalkClass->SendGossipMenu(721002pCreature->GetGUID());
                return 
    true;
            };

        
    pPlayer->ADD_GOSSIP_ITEM_ID(GOSSIP_ICON_CHAT, -1631608GOSSIP_SENDER_MAINGOSSIP_ACTION_INFO_DEF);
        
    pPlayer->PlayerTalkClass->SendGossipMenu(721001pCreature->GetGUID());
        return 
    true;
    };

    bool GossipSelect_boss_tirion_icc(PlayerpPlayerCreaturepCreatureuint32 uiSenderuint32 uiAction)
    {
        
    ScriptedInstancepInstance;
        
    pInstance = (ScriptedInstance*)pCreature->GetInstanceData();
        if (!
    pInstance) return false;

        if (
    uiAction == GOSSIP_ACTION_INFO_DEF)
        {
            
    pPlayer->CLOSE_GOSSIP_MENU();
            
    pInstance->SetData(TYPE_LICH_KINGIN_PROGRESS);
            
    pInstance->SetData(TYPE_EVENT,12000);
            return 
    true;
        } else return 
    false;
    };

    CreatureAIGetAI_boss_tirion_icc(CreaturepCreature)
    {
        return new 
    boss_tirion_iccAI(pCreature);
    };

    struct MANGOS_DLL_DECL  mob_ice_sphere_iccAI : public BSWScriptedAI
    {
        
    mob_ice_sphere_iccAI(Creature *pCreature) : BSWScriptedAI(pCreature
        {
            
    pInstance = (ScriptedInstance*)pCreature->GetInstanceData();
            
    Reset();
        }

        
    ScriptedInstance *pInstance;

        
    void Reset()
        {
           
    resetTimers();
           
    doCast(SPELL_ICE_SPHERE_VISUAL);
           
    m_creature->AddSplineFlag(SPLINEFLAG_WALKMODE);
        }


        
    void UpdateAI(const uint32 uiDiff)
        {
            if (!
    pInstance || pInstance->GetData(TYPE_LICH_KING) != IN_PROGRESS
                  
    m_creature->ForcedDespawn();

            if (!
    m_creature->SelectHostileTarget() || !m_creature->getVictim())
                {
                    if (
    UnitpTarget doSelectRandomPlayerAtRange(120.0f))
                    {
                       
    m_creature->SetInCombatWith(pTarget);
                       
    m_creature->AddThreat(pTarget,100.0f);
                    }
                return;
                }

            if (
    m_creature->getVictim()->GetTypeId() != TYPEID_PLAYER
                return;

            
    timedCast(SPELL_ICE_PULSEuiDiff);

            if (
    m_creature->IsWithinDistInMap(m_creature->getVictim(), 1.0f))
                
    timedCast(SPELL_ICE_BURST,uiDiff);
        }
    };

    CreatureAIGetAI_mob_ice_sphere_icc(CreaturepCreature)
    {
        return new 
    mob_ice_sphere_iccAI(pCreature);
    };

    struct MANGOS_DLL_DECL mob_defiler_iccAI : public BSWScriptedAI
    {
        
    mob_defiler_iccAI(Creature *pCreature) : BSWScriptedAI(pCreature)
        {
            
    m_pInstance = ((ScriptedInstance*)pCreature->GetInstanceData());
            
    Reset();
        }

        
    ScriptedInstance *m_pInstance;
        
    uint32 life_timer;
        
    float m_Size0;
        
    float m_Size;

        
    void Reset()
        {
            
    SetCombatMovement(false);
            
    life_timer 30000;
            
    m_creature->SetFlag(UNIT_FIELD_FLAGSUNIT_FLAG_NON_ATTACKABLE);
            
    m_creature->SetFlag(UNIT_FIELD_FLAGSUNIT_FLAG_NOT_SELECTABLE);
            
    m_creature->CastSpell(m_creatureSPELL_DEFILEtrue);
            
    m_Size0 m_creature->GetFloatValue(OBJECT_FIELD_SCALE_X);
            
    m_Size m_Size0;
        }

        
    void AttackStart(Unit *pWho)
        {
            return;
        }

        
    bool doSearchPlayers()
        {
            if(
    doSelectRandomPlayerAtRange(m_Size 3.0f)) return true;
            else return 
    false;
        }

        
    void UpdateAI(const uint32 uiDiff)
        {
            if(
    m_pInstance && m_pInstance->GetData(TYPE_LICH_KING) != IN_PROGRESS)
                
    m_creature->ForcedDespawn();

            if (
    life_timer <= uiDiff)
                
    m_creature->ForcedDespawn();
            else 
    life_timer -= uiDiff;

            if (
    doSearchPlayers() && m_Size <= m_Size0 6.0f) {
                    
    m_Size m_Size*1.01;
                    
    m_creature->SetFloatValue(OBJECT_FIELD_SCALE_Xm_Size);
                    }

        }

    };

    CreatureAIGetAI_mob_defiler_icc(CreaturepCreature)
    {
        return new 
    mob_defiler_iccAI(pCreature);
    }

    struct MANGOS_DLL_DECL mob_strangulate_vehicleAI : public ScriptedAI
    {
        
    mob_strangulate_vehicleAI(Creature *pCreature) : ScriptedAI(pCreature)
        {
            
    m_pInstance = ((ScriptedInstance*)pCreature->GetInstanceData());
            
    Reset();
        }

        
    ScriptedInstance *m_pInstance;

        
    void Reset()
        {
            
    SetCombatMovement(false);
            
    m_creature->SetFlag(UNIT_FIELD_FLAGSUNIT_FLAG_NON_ATTACKABLE);
            
    m_creature->SetFlag(UNIT_FIELD_FLAGSUNIT_FLAG_NOT_SELECTABLE);
        }

        
    void AttackStart(Unit *pWho)
        {
            return;
        }

        
    void UpdateAI(const uint32 uiDiff)
        {
           
    m_creature->ForcedDespawn();
        }

    };

    CreatureAIGetAI_mob_strangulate_vehicle(CreaturepCreature)
    {
        return new 
    mob_strangulate_vehicleAI(pCreature);
    }

    struct MANGOS_DLL_DECL  mob_vile_spiritAI : public BSWScriptedAI
    {
        
    mob_vile_spiritAI(Creature *pCreature) : BSWScriptedAI(pCreature
        {
            
    pInstance = (ScriptedInstance*)pCreature->GetInstanceData();
            
    Reset();
        }

        
    ScriptedInstance *pInstance;
        
    bool movementstarted;

        
    void Reset()
        {
           
    resetTimers();
           if (
    UnitpTarget doSelectRandomPlayerAtRange(120.0f))
               {
                   
    m_creature->SetInCombatWith(pTarget);
                   
    m_creature->AddThreat(pTarget,1000.0f);
               }
           
    SetCombatMovement(false);
           
    movementstarted false;
           
    m_creature->AddSplineFlag(SPLINEFLAG_WALKMODE);
        }


        
    void UpdateAI(const uint32 uiDiff)
        {
            if (!
    pInstance || pInstance->GetData(TYPE_LICH_KING) != IN_PROGRESS
                  
    m_creature->ForcedDespawn();

            if (!
    m_creature->SelectHostileTarget() || !m_creature->getVictim())
                return;

            if (
    timedQuery(SPELL_SPIRITS_BURSTuiDiff) && !movementstarted)
            {
               
    SetCombatMovement(true);
               
    m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
               
    movementstarted true;
            }

            if (
    m_creature->getVictim()->GetTypeId() != TYPEID_PLAYER
                return;

            if (
    m_creature->IsWithinDistInMap(m_creature->getVictim(), 1.0f))
            {
                
    doCast(SPELL_SPIRITS_BURST);
                
    m_creature->ForcedDespawn();
            };
        }
    };

    CreatureAIGetAI_mob_vile_spirit(CreaturepCreature)
    {
        return new 
    mob_vile_spiritAI(pCreature);
    }

    struct MANGOS_DLL_DECL  mob_raging_spiritAI : public BSWScriptedAI
    {
        
    mob_raging_spiritAI(Creature *pCreature) : BSWScriptedAI(pCreature
        {
            
    pInstance = (ScriptedInstance*)pCreature->GetInstanceData();
            
    Reset();
        }

        
    ScriptedInstance *pInstance;

        
    void Reset()
        {
            
    resetTimers();
            
    m_creature->SetDisplayId(10771);
        }

        
    void UpdateAI(const uint32 uiDiff)
        {
            if (!
    pInstance || pInstance->GetData(TYPE_LICH_KING) != IN_PROGRESS
                  
    m_creature->ForcedDespawn();

            if (!
    m_creature->SelectHostileTarget() || !m_creature->getVictim())
                return;

                
    timedCast(SPELL_SOUL_SHRIEKuiDiff);
        }
    };

    CreatureAIGetAI_mob_raging_spirit(CreaturepCreature)
    {
        return new 
    mob_raging_spiritAI(pCreature);
    }

    void AddSC_boss_the_lich_king_icc()
    {
        
    Script *newscript;

        
    newscript = new Script;
        
    newscript->Name "boss_the_lich_king_icc";
        
    newscript->GetAI = &GetAI_boss_the_lich_king_icc;
        
    newscript->RegisterSelf();

        
    newscript = new Script;
        
    newscript->Name "boss_tirion_icc";
        
    newscript->GetAI = &GetAI_boss_tirion_icc;
        
    newscript->pGossipHello = &GossipHello_boss_tirion_icc;
        
    newscript->pGossipSelect = &GossipSelect_boss_tirion_icc;
        
    newscript->RegisterSelf();

        
    newscript = new Script;
        
    newscript->Name "mob_ice_sphere_icc";
        
    newscript->GetAI = &GetAI_mob_ice_sphere_icc;
        
    newscript->RegisterSelf();

        
    newscript = new Script;
        
    newscript->Name "mob_defiler_icc";
        
    newscript->GetAI = &GetAI_mob_defiler_icc;
        
    newscript->RegisterSelf();

        
    newscript = new Script;
        
    newscript->Name "mob_strangulate_vehicle";
        
    newscript->GetAI = &GetAI_mob_strangulate_vehicle;
        
    newscript->RegisterSelf();

        
    newscript = new Script;
        
    newscript->Name "mob_vile_spirit";
        
    newscript->GetAI = &GetAI_mob_vile_spirit;
        
    newscript->RegisterSelf();

        
    newscript = new Script;
        
    newscript->Name "mob_raging_spirit";
        
    newscript->GetAI = &GetAI_mob_raging_spirit;
        
    newscript->RegisterSelf();

    }; 
    Can you make this script in your next update is the lichking fight

    PHP Code:
    // Script Generated: 2010-03-29 23:23:48
    // Run this query on your world database
    // UPDATE `creature_template` SET ScriptName='npc_Professor Putricide' WHERE `entry`=36678;
    #include "precompiled.h"


    struct MANGOS_DLL_DECL Professor PutricideAI : public ScriptedAI
    {
        
    Professor PutricideAI(CreaturepCreature) : ScriptedAI(pCreature)
        {
            
    Reset();
        }

        
    uint32 spell1_phase1_Timer;
        
    uint32 spell2_phase1_Timer;
        
    uint32 spell3_phase1_Timer;
        
    uint32 spell4_phase1_Timer;
        
    uint32 spell5_phase1_Timer;
        
    uint32 spell6_phase1_Timer;
        
    uint32 spell1_phase2_Timer;
        
    uint32 spell2_phase2_Timer;
        
    uint32 spell3_phase2_Timer;
        
    uint32 spell4_phase2_Timer;
        
    uint32 spell5_phase2_Timer;
        
    uint32 spell6_phase2_Timer;
        
    uint32 spell1_phase3_Timer;
        
    uint32 spell2_phase3_Timer;
        
    uint32 phase;

        
    void Aggro(UnitpWho)
        {
        }

        
    void KilledUnit(UnitpVictim)
        {
        }

        
    void JustDied(UnitpKiller)
        {
        }

        
    void Reset()
        {
            
    spell1_phase1_Timer 20000+rand()%20000;
            
    spell2_phase1_Timer 80000+rand()%20000;
            
    spell3_phase1_Timer 20000+rand()%20000;
            
    spell4_phase1_Timer 20000+rand()%20000;
            
    spell5_phase1_Timer 50000+rand()%30000;
            
    spell6_phase1_Timer 80000+rand()%20000;
            
    spell1_phase2_Timer 20000+rand()%20000;
            
    spell2_phase2_Timer 60000+rand()%20000;
            
    spell3_phase2_Timer 50000+rand()%30000;
            
    spell4_phase2_Timer 50000+rand()%30000;
            
    spell5_phase2_Timer 30000+rand()%30000;
            
    spell6_phase2_Timer 50000+rand()%40000;
            
    spell1_phase3_Timer 20000+rand()%20000;
            
    spell2_phase3_Timer 10000+rand()%10000;
            
    phase 0;
        }

        
    void UpdateAI(const uint32 diff)
        {
            if (!
    m_creature->SelectHostileTarget() || !m_creature->getVictim())
                return;

            if (
    phase == 1)
            {

                if (
    spell1_phase1_Timer <= diff)
                {
                    
    DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM0), 70346);
                    
    spell1_phase1_Timer 20000+rand()%20000;
                } else 
    spell1_phase1_Timer -= diff;

                if (
    spell2_phase1_Timer <= diff)
                {
                    
    DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM0), 71968);
                    
    spell2_phase1_Timer 80000+rand()%20000;
                } else 
    spell2_phase1_Timer -= diff;

                if (
    spell3_phase1_Timer <= diff)
                {
                    
    DoCastSpellIfCan(m_creature->getVictim(), 70672);
                    
    spell3_phase1_Timer 20000+rand()%20000;
                } else 
    spell3_phase1_Timer -= diff;

                if (
    spell4_phase1_Timer <= diff)
                {
                    
    DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM0), 70701);
                    
    spell4_phase1_Timer 20000+rand()%20000;
                } else 
    spell4_phase1_Timer -= diff;

                if (
    spell5_phase1_Timer <= diff)
                {
                    
    DoCastSpellIfCan(m_creature->getVictim(), 70447);
                    
    spell5_phase1_Timer 50000+rand()%30000;
                } else 
    spell5_phase1_Timer -= diff;

                if (
    spell6_phase1_Timer <= diff)
                {
                    
    DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM0), 71617);
                    
    spell6_phase1_Timer 80000+rand()%20000;
                } else 
    spell6_phase1_Timer -= diff;
            }

            if (
    phase == 2)
            {

                if (
    spell1_phase2_Timer <= diff)
                {
                    
    DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM0), 70346);
                    
    spell1_phase2_Timer 20000+rand()%20000;
                } else 
    spell1_phase2_Timer -= diff;

                if (
    spell2_phase2_Timer <= diff)
                {
                    
    DoCastSpellIfCan(m_creature->getVictim(), 71968);
                    
    spell2_phase2_Timer 60000+rand()%20000;
                } else 
    spell2_phase2_Timer -= diff;

                if (
    spell3_phase2_Timer <= diff)
                {
                    
    DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM0), 70672);
                    
    spell3_phase2_Timer 50000+rand()%30000;
                } else 
    spell3_phase2_Timer -= diff;

                if (
    spell4_phase2_Timer <= diff)
                {
                    
    DoCastSpellIfCan(m_creature->getVictim(), 70447);
                    
    spell4_phase2_Timer 50000+rand()%30000;
                } else 
    spell4_phase2_Timer -= diff;

                if (
    spell5_phase2_Timer <= diff)
                {
                    
    DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM0), 71278);
                    
    spell5_phase2_Timer 30000+rand()%30000;
                } else 
    spell5_phase2_Timer -= diff;

                if (
    spell6_phase2_Timer <= diff)
                {
                    
    DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM0), 72297);
                    
    spell6_phase2_Timer 50000+rand()%40000;
                } else 
    spell6_phase2_Timer -= diff;
            }

            if (
    phase == 3)
            {

                if (
    spell1_phase3_Timer <= diff)
                {
                    
    DoCastSpellIfCan(m_creature71603);
                    
    spell1_phase3_Timer 20000+rand()%20000;
                } else 
    spell1_phase3_Timer -= diff;

                if (
    spell2_phase3_Timer <= diff)
                {
                    
    DoCastSpellIfCan(SelectUnit(SELECT_TARGET_RANDOM0), 72672);
                    
    spell2_phase3_Timer 10000+rand()%10000;
                } else 
    spell2_phase3_Timer -= diff;
            }

            
    DoMeleeAttackIfReady();
        }
    };

    CreatureAIGetAIProfessor Putricide(CreaturepCreature)
    {
        return new 
    Professor PutricideAI (pCreature);
    }

    void AddSC_Professor Putricide()
    {
        
    Script *newscript;
        
    newscript = new Script;
        
    newscript->Name "npc_Professor Putricide";
        
    newscript->GetAI = &GetAIProfessor Putricide;
        
    newscript->RegisterSelf();

    this is the script from Professor Putricide or is this wrong for mangos

    Last edited by ellenya; 05-09-10 at 01:12 PM.



  2. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

 

 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •