Exemple #1
0
 TransitionQuads::TransitionQuads() : _center(0, 0)
 {
     //_singleDirection = true;
     getStage()->addEventListener(TouchEvent::CLICK, CLOSURE(this, &TransitionQuads::clicked));
 }
 int32 applicationUnPause(void* systemData, void* userData)
 {
     Event ev(Stage::ACTIVATE);
     getStage()->dispatchEvent(&ev);
     return 0;
 }
Exemple #3
0
 // returns true if the pipeline endpoint is a writer
 bool isWriterPipeline() const
     { return (bool)getStage(); }
Exemple #4
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            switch (getStage())
            {
                case 0: //GROUND
                     if (m_uiFlameBreathTimer <= diff)
                     {
						 if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC)
							DoCast(SPELL_FLAME_BREATH_25);
						 else DoCast(SPELL_FLAME_BREATH_10);
                         m_uiFlameBreathTimer = urand(12*IN_MILLISECONDS,13*IN_MILLISECONDS);
                     } else m_uiFlameBreathTimer -= diff;

                     if (m_uiEnrage <= diff)
                     {
                         DoCast(SPELL_ENRAGE);
                         m_uiEnrage = urand(17*IN_MILLISECONDS,20*IN_MILLISECONDS);
                         DoScriptText(-1666404,me);
                     } else m_uiEnrage -= diff;

					 if (m_uiBeakonTimer <= diff)
                     {
                         doBeacon(true);
                         setStage(1);
                         m_uiBeakonTimer = urand(30*IN_MILLISECONDS,31*IN_MILLISECONDS);
                     } else m_uiBeakonTimer -= diff;

                     break;

                case 1: //Air phase start
                     SetCombatMovement(false);
                     me->InterruptNonMeleeSpells(true);
                     SetFly(true);
                     doBeacon(true);
                     StartMovement(1);
                     setStage(2);
                     break;

                case 2: // Wait for movement
                     if (MovementStarted) return;
                     DoCast(SPELL_CONFLAGATION);
                     DoScriptText(-1666403,me);
                     setStage(3);
                     break;

                case 3: // Wait for cast finish
                     if (!me->IsNonMeleeSpellCasted(false))
                     {
                         doBeacon(false);
                         setStage(4);
                     }
                     break;

                case 4: // Air phase
                    // if (m_uiConflagrateTimer <= diff)
                    // {
                        // if (conflagated)
                       //  { 
                             //DoCast(SPELL_CONFLAGATION_1);
                             doBeacon(false);
                       //  }
						 setStage(5);
                     //    m_uiConflagrateTimer = 5*IN_MILLISECONDS;
                   //  } else m_uiConflagrateTimer -= diff;
                     break;

                case 5: //Air phase end
                     StartMovement(0);
                     setStage(6);
                     break;

                case 6: // Wait for movement
                     if (MovementStarted) return;
                     SetFly(false);
                     SetCombatMovement(true);
                     me->GetMotionMaster()->Clear();
                     me->GetMotionMaster()->MoveChase(me->getVictim());
					 for (std::list<Unit*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
					 {
						 Unit *pTemp = (*itr);
						 me->CastSpell(pTemp, SPELL_CONFLAGATION_2, true);
					 }
					// DoCast(SPELL_CONFLAGATION_2);
					 playerList.clear();
					 setStage(0);
                     break;

                default:
                    break;
            }

            DoMeleeAttackIfReady();
        }
    void DebugActor::render(RenderState const& parentRS)
    {
        timeMS tm = getTimeMS();

        static int fps = 0;
        ++_frames;
        if (_frames > 50)
        {
            if (tm != _startTime)
            {
                fps = int(((float)_frames / (tm - _startTime)) * 1000);
            }
            _startTime = tm;
            _frames = 0;
        }

        std::stringstream s;
        s << "fps=" << fps << std::endl;



#ifdef __S3E__
        int mem_used = -1;
        int mem_free = -1;

        mem_used = s3eMemoryGetInt(S3E_MEMORY_USED);
        mem_free = s3eMemoryGetInt(S3E_MEMORY_FREE);

        s << "mfree=" << mem_free << " mem=" << mem_used << std::endl;
#endif

        const IVideoDriver::Stats& vstats = IVideoDriver::_stats;

#ifdef OXYGINE_DEBUG_TRACE_LEAKS
        s << "objects=" << (int)ObjectBase::__getCreatedObjects().size() << std::endl;
#endif

#if OXYGINE_TRACE_VIDEO_STATS
        int primitives = 0;
        primitives += vstats.elements[IVideoDriver::PT_TRIANGLES] / 3;
        if (vstats.elements[IVideoDriver::PT_TRIANGLE_STRIP])
            primitives += vstats.elements[IVideoDriver::PT_TRIANGLE_STRIP] - 2;
        s << "batches=" << aligned(vstats.batches, 3) << " primitives=" << aligned(primitives, 3) << std::endl;
#endif

        s << "update=" << aligned(getStage()->_statUpdate, 2) << "ms ";
        s << "render=" << aligned(vstats.duration, 2) << "ms ";
        s << "textures=" << aligned(NativeTexture::created, 2) << " ";

#ifdef __APPLE__
        size_t mem;
        iosGetMemoryUsage(mem);
        s << "memory=" << mem / 1024 << "kb ";
#endif

#ifdef _WIN32
        PROCESS_MEMORY_COUNTERS_EX pmc;
        GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*) &pmc, sizeof(pmc));
        s << "memory=" << pmc.PrivateUsage / 1024 << "kb ";

#endif

        if (!_debugText.empty())
        {
            s << "\n";
            s << _debugText;
        }
        _debugText = "";

        _text->setText(s.str());


        setHeight(_text->getTextRect().size.y + _text->getY() + 3);
        _bg->setSize(getSize());


        Vector2 ds = core::getDisplaySize();

        Vector2 pos(0, 0);

        switch (_corner)
        {
            case 1:
                pos.x = ds.x;
                break;
            case 2:
                pos = ds;
                break;
            case 3:
                pos.y = ds.y;
                break;
        }

        pos = getStage()->parent2local(pos);

        Vector2 realSize = getScaledSize();
        switch (_corner)
        {
            case 1:
                pos.x -= realSize.x;
                break;
            case 2:
                pos -= realSize;
                break;
            case 3:
                pos.y -= realSize.y;
                break;
        }

        //setPosition(pos);
        setScale(1.0f / getStage()->getScaleX());

        RenderState rs = parentRS;
        parentRS.material->finish();

        STDRenderer renderer;
        STDMaterial mat(&renderer);
        mat.apply(0);


        IVideoDriver* driver = renderer.getDriver();


        Rect vp(Point(0, 0), core::getDisplaySize());
        driver->setViewport(vp);
        renderer.initCoordinateSystem(vp.getWidth(), vp.getHeight());
        renderer.resetSettings();
        rs.material = &mat;
        Actor::render(rs);
        renderer.drawBatch();

        mat.finish();

        Material::setCurrent(0);

        timeMS dur = getTimeMS() - tm;

        IVideoDriver::_stats.start += dur;
    }
Exemple #6
0
        void TransitionQuads::_run(spScene current, spScene next, bool back)
        {
            Point ds = core::getDisplaySize();
            spActor holder = new Actor;
            holder->setPosition(getStage()->global2local(Vector2(0, 0)));
            //holder->setVisible(false);
            holder->setSize(core::getDisplaySize());
            holder->attachTo(getStage());
            holder->setPriority(1000);

            int numX = ds.x / 40;
            int numY = ds.y / 40;

            //log::messageln("tq1");
            Vector2 quad(holder->getWidth() / numX, holder->getHeight() / numY);
            spTween slowestTween;

            for (int y = 0; y < numY; ++y)
            {
                for (int x = 0; x < numX; ++x)
                {
                    spSprite sp = new ColorRectSprite;
                    Vector2 pos(quad.x * x, quad.y * y);
                    pos += quad / 2;
                    sp->setPosition(pos);
                    sp->setAnchor(Vector2(0.5f, 0.5f));
                    sp->setSize(quad);
                    sp->attachTo(holder);
                    sp->setScale(0);
                    sp->setColor(Color(0xffffffff));
                    Vector2 d = pos - _center;
                    float time = d.length() / holder->getSize().length();
                    /*
                    if (back)
                    time = 1.0f - time;
                    */

                    float mp = 4.0f;
                    //mp = 10;
                    int tm = int(1 + time * 800 * mp);
                    spTween nt = sp->addTween(Actor::TweenScale(1.0f), int(100 * mp), 1, false, tm);
                    if (!slowestTween || (int)slowestTween->getDelay() < tm)
                        slowestTween = nt;
                }
            }

            //log::messageln("tq2");


#if OXYGINE_RENDERER <= 2

            STDRenderer r;
            RenderState rs;
            rs.renderer = &r;
            rs.renderer->initCoordinateSystem(ds.x, ds.y, true);

            spNativeTexture mask = IVideoDriver::instance->createTexture();
            mask->init(ds.x, ds.y, TF_R5G5B5A1, true);

            _mask = mask;


            spSprite maskSprite = new Sprite;
            {
                AnimationFrame fr;
                Diffuse df;
                df.base = mask;
                RectF srcRect(0, 0, (float)ds.x / mask->getWidth(), (float)ds.y / mask->getHeight());
                RectF destRect(Vector2(0, 0), ds);
                fr.init(0, df, srcRect, destRect, ds);
                maskSprite->setAnimFrame(fr);
            }

            //log::messageln("tq3");

            //#define BUG
            //STDMaterial
            spMaskedSprite bg = new MaskedSprite;
            bg->setMask(maskSprite);

            bg->attachTo(getStage());
            bg->setPriority(100);


            bg->addChild(next->getHolder());
            bg->setInputEnabled(false);
            _bg = bg;

            timeMS tm = getTimeMS() + 3000;

            holder->setCallbackDoUpdate(CLOSURE(this, &TransitionQuads::update));



            //_r = r;
            _holder = holder;
            waitTween(slowestTween);
#endif
        }
    void UpdateAI(const uint32 uiDiff)
    {
        if (!pInstance)
            return;

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

        switch (getStage())
        {
            case 0: //PHASE 1 PHYSICAL REALM
                timedCast(SPELL_FLAME_BREATH, uiDiff);
                timedCast(SPELL_FIERY_COMBUSTION, uiDiff);
                timedCast(SPELL_METEOR, uiDiff);
                if (m_creature->GetHealthPercent() < 75.0f) setStage(1);
                break;

            case 1: // Switch to phase 2
                m_creature->AttackStop();
                m_creature->InterruptNonMeleeSpells(true);
                DoScriptText(SAY_HALION_PHASE_2,m_creature);
                pInstance->SetData(TYPE_HALION_EVENT, NOT_STARTED);
                SetCombatMovement(false);
                StartMovement(0);
                {
                    Creature* pControl = pInstance->GetSingleCreatureFromStorage(NPC_HALION_CONTROL);
                    if (!pControl)
                        pControl = m_creature->SummonCreature(NPC_HALION_CONTROL, SpawnLoc[0].x, SpawnLoc[0].y, SpawnLoc[0].z, 0, TEMPSUMMON_MANUAL_DESPAWN, 1000);
                    else if (!pControl->isAlive())
                        pControl->Respawn();
                    pControl->SetActiveObjectState(true);
                    pControl->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    m_creature->SetInCombatWith(pControl);
                    pControl->SetInCombatWith(m_creature);
                }
                setStage(2);
                break;

            case 2:
                if (MovementStarted) return;
                doCast(SPELL_SUMMON_TWILIGHT_PORTAL);
                setStage(3);
                if (GameObject* pGoPortal = pInstance->GetSingleGameObjectFromStorage(GO_HALION_PORTAL_1))
                      pGoPortal->SetPhaseMask(31,true);
                if (GameObject* pGoRing = pInstance->GetSingleGameObjectFromStorage(GO_FLAME_RING))
                      pGoRing->SetPhaseMask(65535,true);
                break;

            case 3:
                if (m_creature->IsNonMeleeSpellCasted(false)) return;
                m_creature->SetActiveObjectState(true);
                doCast(SPELL_START_PHASE2);
                setStage(4);
                break;

            case 4:
                if (!m_creature->IsNonMeleeSpellCasted(false))
                {
                    if (Creature* pControl = pInstance->GetSingleCreatureFromStorage(NPC_HALION_CONTROL))
                    {
                        m_creature->SetInCombatWith(pControl);
                        pControl->SetInCombatWith(m_creature);
                    }
                    Creature* pTwilight = pInstance->GetSingleCreatureFromStorage(NPC_HALION_TWILIGHT);
                    if (!pTwilight)
                        pTwilight = m_creature->SummonCreature(NPC_HALION_TWILIGHT, SpawnLoc[0].x, SpawnLoc[0].y, SpawnLoc[0].z, 0, TEMPSUMMON_MANUAL_DESPAWN, 1000);
                    else if (!pTwilight->isAlive())
                        pTwilight->Respawn();
                    pTwilight->SetCreatorGuid(ObjectGuid());
                    m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    setStage(5);
                }
                break;

            case 5: // HALION awaiting end battle in TWILIGHT REALM
                if (pInstance->GetData(TYPE_HALION_EVENT) == IN_PROGRESS)
                    {
//                        pInstance->SetData(TYPE_HALION_EVENT, SPECIAL);
                        doRemove(SPELL_START_PHASE2);
                        if (Creature* pControl = pInstance->GetSingleCreatureFromStorage(NPC_HALION_CONTROL))
                        {
                            m_creature->SetInCombatWith(pControl);
                            pControl->SetInCombatWith(m_creature);
                        }
                        m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                        m_creature->SetHealth(m_creature->GetMaxHealth()/2);
                        m_creature->SetInCombatWithZone();
                        setStage(6);
                    }
                return;

            case 6: // Switch to phase 3
//                doCast(SPELL_TWILIGHT_DIVISION);
                DoScriptText(SAY_HALION_PHASE_3,m_creature);
                pInstance->SetData(TYPE_HALION_EVENT, SPECIAL);
                setStage(7);
                break;

            case 7:
                if (m_creature->IsNonMeleeSpellCasted(false)) return;
                if (m_creature->getVictim()->GetTypeId() != TYPEID_PLAYER) return;
                SetCombatMovement(true);
                m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                setStage(8);
                break;

            case 8: //PHASE 3 BOTH REALMS
                timedCast(SPELL_FLAME_BREATH, uiDiff);
                timedCast(SPELL_FIERY_COMBUSTION, uiDiff);
                timedCast(SPELL_METEOR, uiDiff);
                break;

            default:
                break;
        }

        timedCast(SPELL_BERSERK, uiDiff);

        DoMeleeAttackIfReady();

    }
		bool update()
		{
			ThreadMessages::message msg;
			while (_threadMessages.peek(msg, true))
			{

			}
#ifdef __S3E__

			s3eDeviceYield(0);
			s3eKeyboardUpdate();
			s3ePointerUpdate();

			bool done = false;

			if (s3eDeviceCheckQuitRequest())
				done = true;

			if (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_PRESSED)
				done = true;

			return done;
#endif


	#if OXYGINE_SDL || EMSCRIPTEN

			//log::messageln("update");
			Input *input = &Input::instance;
			bool done = false;
			SDL_Event event;
			while (SDL_PollEvent(&event)) 
			{
				Event ev(Input::event_platform);
				ev.userData = &event;
				Input::instance.dispatchEvent(&ev);

				switch(event.type)
				{
				case SDL_QUIT:
					done = true;
					break;
				case SDL_WINDOWEVENT:
					{					
						/*
						if (event.window.event == SDL_WINDOWEVENT_ENTER)
							active = false;
						if (event.window.event == SDL_WINDOWEVENT_LEAVE)
							active = true;
							*/

						if (event.window.event == SDL_WINDOWEVENT_MINIMIZED)
							active = false;
						if (event.window.event == SDL_WINDOWEVENT_RESTORED)
							active = true;

						bool newFocus = focus;
						if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
							newFocus = false;
						if (event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
							newFocus = true;
						if (focus != newFocus)
						{
							focus = newFocus;
#if HANDLE_FOCUS_LOST
							if (focus)							
								lostContext();
							else
								focusLost();

							log::messageln("focus: %d", (int)focus);
							Event ev(focus ? Stage::ACTIVATE : Stage::DEACTIVATE);
							if (getStage())
								getStage()->dispatchEvent(&ev);
#endif							
						}
						//log::messageln("SDL_SYSWMEVENT %d", (int)event.window.event);
						break;
					}
				case SDL_MOUSEWHEEL:
					input->sendPointerWheelEvent(event.wheel.y, &input->_pointerMouse);
					break;
				case SDL_KEYDOWN:
				{
					KeyEvent ev(KeyEvent::KEY_DOWN, &event.key);
					getStage()->dispatchEvent(&ev);
				} break;
				case SDL_KEYUP:
				{
					KeyEvent ev(KeyEvent::KEY_UP, &event.key);
					getStage()->dispatchEvent(&ev);
				} break;
#if SDL_VIDEO_OPENGL
				case SDL_MOUSEMOTION:
					input->sendPointerMotionEvent((float)event.motion.x, (float)event.motion.y, 1.0f, &input->_pointerMouse);
					break;
				case SDL_MOUSEBUTTONDOWN:
				case SDL_MOUSEBUTTONUP:
					{
						MouseButton b = MouseButton_Left;
						switch(event.button.button)
						{
							case 1: b = MouseButton_Left; break;
							case 2: b = MouseButton_Middle; break;
							case 3: b = MouseButton_Right; break;
						}

						input->sendPointerButtonEvent(b, (float)event.button.x, (float)event.button.y, 1.0f, 
							event.type == SDL_MOUSEBUTTONDOWN ? TouchEvent::TOUCH_DOWN : TouchEvent::TOUCH_UP, &input->_pointerMouse);
					}					
					break;
#else

				case SDL_FINGERMOTION:
					{
						//log::messageln("SDL_FINGERMOTION");
						Vector2 pos = convertTouch(event);
						input->sendPointerMotionEvent(
							pos.x, pos.y, event.tfinger.pressure,
							input->getTouchByID((int)event.tfinger.fingerId));
					}
				
					break;
				case SDL_FINGERDOWN:
				case SDL_FINGERUP:
					{				
						//log::messageln("SDL_FINGER");
						Vector2 pos = convertTouch(event);
						input->sendPointerButtonEvent(
							MouseButton_Touch,
							pos.x, pos.y, event.tfinger.pressure,
							event.type == SDL_FINGERDOWN ? TouchEvent::TOUCH_DOWN : TouchEvent::TOUCH_UP,
							input->getTouchByID((int)event.tfinger.fingerId));
					}				
					break;
#endif
				}
			}


			return done;
	#elif EMSCRIPTEN
			return false;
	#endif


			log::warning("update not implemented");
			return true;
			/*
#if __FLASHPLAYER__
			//log::messageln("update...");
			//SDL_Delay(3);
			SDL_Delay(3);
			//log::messageln("update...2");
			((VideoDriverStage3D*)IVideoDriver::instance)->present();
			avm2_ui_thunk(handleFrame, NULL);	
			//log::messageln("update...3");
			return false;
#endif
			*/
		}
Exemple #9
0
void FightStage::init() {
	this->setSize(getStage()->getSize());

	// create background
	this->_bg = new Sprite();
	this->_bg->setResAnim(GameResource::ui.getResAnim("sky"));
	this->_bg->attachTo(this);

	_initBgClouds();

	//type, id, quantity, diameter
	spPickup pickup_pup0 = new Pickup("pup", 0, 5, 20, true);
	pickup_pup0->init(Vector2(scalar::randFloat(0, getWidth()), scalar::randFloat(0, getHeight())), 0, this);
	spPickup pickup_pup1 = new Pickup("pup", 1, 5, 20, true);
	pickup_pup1->init(Vector2(scalar::randFloat(0, getWidth()), scalar::randFloat(0, getHeight())), 0, this);
	spPickup pickup_wpn0 = new Pickup("wpn", 0, 5, 20, true);
	pickup_wpn0->init(Vector2(scalar::randFloat(0, getWidth()), scalar::randFloat(0, getHeight())), 0, this);
	spPickup pickup_wpn1 = new Pickup("wpn", 1, 5, 20, true);
	pickup_wpn1->init(Vector2(scalar::randFloat(0, getWidth()), scalar::randFloat(0, getHeight())), 0, this);

	spTextField textDetails = new TextField();
	textDetails->setTouchEnabled(false);
	const Font* systemFont = textDetails->getFont();

	// create aircrafts, get keys from config
	this->_af1 = new AircraftFighter("Red AF", "red");
	this->_af1->init(Vector2(0,0), 180, this);
	this->_af1->setKeys(Config::getInstance().getPlayerKeys(0));
	this->_af1->setPosition(Vector2(
		(this->getWidth() / 2 - this->_af1->getWidth() / 2) - 125, 
		this->getHeight() - this->_af1->getHeight()
	));
	
	this->_af2 = new AircraftFighter("Green AF", "green");
	this->_af2->init(Vector2(0, 0), 0, this);
	this->_af2->setKeys(Config::getInstance().getPlayerKeys(1));
	this->_af2->setPosition(Vector2(
		(this->getWidth() / 2 - this->_af2->getWidth() / 2) + 125, 
		50
	));

	//GUI initialization
	_initGui();

	//Display red player health level (max 10)
	_playerRedHealthLevel = createText("0", "red");
	_playerRedHealthLevel->attachTo(this);
	_playerRedHealthLevel->setX(this->getWidth() - 80);
	_playerRedHealthLevel->setY(this->getHeight() - 25);

	//Display green player health level (max 10)
	_playerGreenHealthLevel = createText("0", "green");
	_playerGreenHealthLevel->attachTo(this);
	_playerGreenHealthLevel->setX(this->getWidth() - 80);
	_playerGreenHealthLevel->setY(35);

	spTextField playerNameRed = createText("RED PLAYER", "red");
	playerNameRed->setText(Config::getInstance().getPlayerName(0));
	playerNameRed->attachTo(this);
	playerNameRed->setX(this->getWidth()-170);
	playerNameRed->setY(this->getHeight() - 25);

	spTextField playerNameGreen = createText("GREEN PLAYER", "green");
	playerNameGreen->setText(Config::getInstance().getPlayerName(1));
	playerNameGreen->attachTo(this);
	playerNameGreen->setX(this->getWidth() - 170);
	playerNameGreen->setY(35);

	//clouds after aircrafts
	spPickup slowCloud = new Pickup("pup", 2, -1, 76, false);
	slowCloud->init(Vector2(45+ getWidth()/2,150), 0, this);
	
	spPickup fastCloud = new Pickup("pup", 3, -1, 76, false);
	fastCloud->init(Vector2( getWidth() / 2, 120 +getHeight() / 2), 0, this);
}
void PipelineManager::prepare() const
{
    Stage *s = getStage();
    if (s)
       s->prepare(m_table);
}
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch(getStage())
        {
            case 0: 
                    if (timedQuery(SPELL_BONE_STRIKE, diff))
                        if (Unit* pTarget = doSelectRandomPlayer(SPELL_BONE_STRIKE_IMPALE, false, 60.0f, isHeroic()))
                            if (doCast(SPELL_BONE_STRIKE, pTarget) == CAST_OK)
                            {
                                doSummonSpike(pTarget);
                                switch (urand(0,1)) {
                                                   case 0:
                                                   DoScriptText(-1631003,m_creature,pTarget);
                                                   break;
                                                   case 1:
                                                   DoScriptText(-1631004,m_creature,pTarget);
                                                   break;
                                                   case 2:
                                                   DoScriptText(-1631005,m_creature,pTarget);
                                                   break;
                                                   };

                            };

                    if (timedQuery(SPELL_BONE_STORM, diff)) setStage(1);

                    if (timedQuery(SPELL_CALL_COLD_FLAME, diff))
                    {
                        if (urand(0,1)) doCast(SPELL_CALL_COLD_FLAME);
                            else  doCast(SPELL_CALL_COLD_FLAME_1);

                        if (m_creature->GetHealthPercent() <= 30.0f)
                        {
                            if (urand(0,1)) doCast(SPELL_CALL_COLD_FLAME);
                                else  doCast(SPELL_CALL_COLD_FLAME_1);
                        }
                    }

                    timedCast(SPELL_SABER_LASH, diff);

                    DoMeleeAttackIfReady();

                    break;
            case 1:
                    m_creature->InterruptNonMeleeSpells(true);
                    doCast(SPELL_BONE_STORM);
                    setStage(2);
                    DoScriptText(-1631002,m_creature);
                    DoResetThreat();
                    m_creature->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
                    m_creature->SetSpeedRate(MOVE_RUN, 3);
                    m_creature->SetSpeedRate(MOVE_WALK, 3);
                    break;
            case 2:
                    if (!m_creature->IsNonMeleeSpellCasted(false)) setStage(3);
                    break;
            case 3:
                    if (isHeroic())
                        if (timedQuery(SPELL_BONE_STRIKE, diff, true))
                            if (Unit* pTarget = doSelectRandomPlayer(SPELL_BONE_STRIKE_IMPALE, false, 60.0f))
                                doSummonSpike(pTarget);

                    if (timedQuery(SPELL_CALL_COLD_FLAME, diff, true)
                        && m_creature->IsWithinDistInMap(m_creature->getVictim(),2.0f))
                    {
                        pInstance->SetData(DATA_DIRECTION, (uint32)(1000*2.0f*M_PI_F*((float)urand(1,16)/16.0f)));
//                        if (urand(0,1)) doCast(SPELL_CALL_COLD_FLAME);
//                            else  doCast(SPELL_CALL_COLD_FLAME_1);
                        float fPosX, fPosY, fPosZ;
                        m_creature->GetPosition(fPosX, fPosY, fPosZ);
                        doSummon(NPC_COLD_FLAME, fPosX, fPosY, fPosZ);
                        DoResetThreat();
                        if (Unit* pTarget = doSelectRandomPlayerAtRange(60.0f))
                            AttackStart(pTarget);
                    }
                    if (!hasAura(SPELL_BONE_STORM_STRIKE, m_creature) && !hasAura(SPELL_BONE_STORM, m_creature)) setStage(4);
                    break;
            case 4:
                    pInstance->SetData(DATA_DIRECTION, 0);
                    m_creature->SetSpeedRate(MOVE_RUN, 1);
                    m_creature->SetSpeedRate(MOVE_WALK, 1);
//                    m_creature->AddSplineFlag(SPLINEFLAG_WALKMODE);
                    setStage(0);
                    break;
            default:
                    break;
            }

        if (timedQuery(SPELL_BERSERK, diff))
            {
                doCast(SPELL_BERSERK);
                DoScriptText(-1631008,m_creature);
            }


    }
Exemple #12
0
void Test::run(spTest actor)
{
    instance = actor;
    actor->attachTo(getStage());
}
    void UpdateAI(const uint32 diff)
    {

        if(!pInstance) return;

        if (!pet) 
        {
            if (Creature* pGuard = pInstance->GetSingleCreatureFromStorage(NPC_STINKY))
                if (!pGuard->isAlive())
                {
                     pet = true;
                     if (pInstance->GetData(TYPE_STINKY) == NOT_STARTED)
                     {
                         DoScriptText(-1631209,m_creature);
                         pInstance->SetData(TYPE_STINKY,DONE);
                     }
                }
        }

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

        Creature* pBlightTarget = m_creature->GetMap()->GetCreature(blightTargetGUID);

        switch(getStage())
        {
            case 0:
                    if (timedQuery(SPELL_GASEOUS_BLIGHT_2, diff))
                        setStage(1);
                    break;
            case 1:
                    switch (urand(0,2)) 
                    {
                        case 0:  DoScriptText(-1631210,m_creature); break;
                        case 1:  DoScriptText(-1631211,m_creature); break;
                        case 2:  DoScriptText(-1631212,m_creature); break;
                    }
                    doCast(SPELL_INHALE_BLIGHT);
                    setStage(2);
                    break;
            case 2:
                    if (m_creature->IsNonMeleeSpellCasted(false)) return;
                    if (pBlightTarget)
                    {
                        doRemove(SPELL_GASEOUS_BLIGHT_1);
                        doRemove(SPELL_BLIGHT_VISUAL_1,pBlightTarget);
                        doRemove(SPELL_BLIGHT_VISUAL_1,m_creature);
                        doCast(SPELL_GASEOUS_BLIGHT_2);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_3);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_2);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_1);
                    }
                    setStage(3);
                    break;
            case 3:
                    if (timedQuery(SPELL_GASEOUS_BLIGHT_3, diff))
                        setStage(4);
                    break;
            case 4:
                    switch (urand(0,2))
                    {
                        case 0:  DoScriptText(-1631210,m_creature); break;
                        case 1:  DoScriptText(-1631211,m_creature); break;
                        case 2:  DoScriptText(-1631212,m_creature); break;
                    }
                    doCast(SPELL_INHALE_BLIGHT);
                    setStage(5);
                    break;
            case 5:
                    if (m_creature->IsNonMeleeSpellCasted(false)) return;
                    if (pBlightTarget)
                    {
                        doRemove(SPELL_GASEOUS_BLIGHT_2);
                        doRemove(SPELL_BLIGHT_VISUAL_2,pBlightTarget);
                        doRemove(SPELL_BLIGHT_VISUAL_2,m_creature);
                        doCast(SPELL_GASEOUS_BLIGHT_3);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_3);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_2);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_1);
                    }
                    setStage(6);
                    break;
            case 6:
                    if (timedQuery(SPELL_GASEOUS_BLIGHT_3, diff))
                        setStage(7);
                    break;
            case 7:
                    switch (urand(0,2)) 
                    {
                        case 0:  DoScriptText(-1631210,m_creature); break;
                        case 1:  DoScriptText(-1631211,m_creature); break;
                        case 2:  DoScriptText(-1631212,m_creature); break;
                    }
                    doCast(SPELL_INHALE_BLIGHT);
                    setStage(8);
                    break;
            case 8:
                    if (m_creature->IsNonMeleeSpellCasted(false)) return;
                    if (pBlightTarget)
                    {
                        doRemove(SPELL_GASEOUS_BLIGHT_3);
                        doRemove(SPELL_BLIGHT_VISUAL_3,pBlightTarget);
                        doRemove(SPELL_BLIGHT_VISUAL_3,m_creature);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_3);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_2);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_1);
                    }
                    setStage(9);
                    break;
            case 9:
                    if (timedQuery(SPELL_PUNGENT_BLIGHT, diff))
                    {
                        DoScriptText(-1631208,m_creature);
                        doCast(SPELL_PUNGENT_BLIGHT);
                        setStage(10);
                    }
                    break;
            case 10:
                    if (m_creature->IsNonMeleeSpellCasted(false)) return;
                    if (pBlightTarget)
                    {
                        doCast(SPELL_BLIGHT_VISUAL_1,pBlightTarget);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_3);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_2);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_1);
                    }
                    m_creature->RemoveAurasDueToSpell(SPELL_INHALED_BLIGHT);
                    setStage(0);
                    break;
        }


        timedCast(SPELL_GAS_SPORE, diff);

        timedCast(SPELL_GASTRIC_BLOAT, diff);

        if (timedQuery(SPELL_VILE_GAS, diff))
        {
                       float fPosX, fPosY, fPosZ;
                       m_creature->GetPosition(fPosX, fPosY, fPosZ);
                       m_creature->GetRandomPoint(fPosX, fPosY, fPosZ, 30.0f, fPosX, fPosY, fPosZ);
                       if (Unit* pTemp = doSummon(NPC_VILE_GAS_STALKER,fPosX, fPosY, fPosZ))
                            doCast(SPELL_VILE_GAS, pTemp);
                       DoScriptText(-1631213,m_creature);
        };

        if (timedQuery(SPELL_BERSERK, diff))
        {
            doCast(SPELL_BERSERK);
            DoScriptText(-1631207,m_creature);
        };

        DoMeleeAttackIfReady();
    }
void FireTower::fireAtCreep(Creep *creep)
{
	if (m_fTimeSinceLastShot > m_fCooldownTime)
	{
		float radians = DEGREES_TO_RADIANS(m_fAngle);
		float cos = cosf(radians);
		float sin = sinf(radians);
		
		World::getInstance()->getFireBolts().push_back(std::unique_ptr<FireBolt>(new FireBolt(m_position->getX() + (cos * 0.275f), m_position->getY() + (sin * 0.275f), m_fProjectileWidth, m_fProjectileHeight, m_fProjectileSpeed, m_fAngle, 4.0f + getStage(), m_iProjectileDamage)));
		m_fTimeSinceLastShot = 0;
        
        GameListener::getInstance()->playSound(SOUND_FIRE_BOLT);
	}
}
Exemple #15
0
 TransitionQuads::~TransitionQuads()
 {
     getStage()->removeEventListeners(this);
 }
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch (getStage())
        {
            case 0: //GROUND
                 timedCast(SPELL_FLAME_BREATH, diff);
                 timedCast(SPELL_ENRAGE, diff);
                 if ( m_creature->GetHealthPercent() <= 80.0f) setStage(1);
                 break;

            case 1: //Air phase start
                 SetCombatMovement(false);
                 m_creature->InterruptNonMeleeSpells(true);
                 SetFly(true);
                 doBeacon(true);
                 StartMovement(1);
                 setStage(2);
                 break;

            case 2: // Wait for movement
                 if (MovementStarted) return;
                 doCast(SPELL_CONFLAGATION);
                 DoScriptText(SAY_SPECIAL,m_creature);
                 setStage(3);
                 break;

            case 3: // Wait for cast finish
                 if (!m_creature->IsNonMeleeSpellCasted(false))
                 {
                     doBeacon(false);
                     setStage(4);
                 };
                 break;

            case 4: // Air phase
                 timedCast(SPELL_FLAME_BREATH, diff);
                 if (timedQuery(SPELL_BEACON, diff))
                     {
                         doBeacon(true);
                         doCast(SPELL_CONFLAGATION);
                     };
                 if (conflagated && timedQuery(SPELL_CONFLAGATION_1, diff))
                     {
                         doBeacon(false);
                     };
                 if ( m_creature->GetHealthPercent() <= 60.0f) setStage(5);
                 break;

            case 5: //Air phase end
                 StartMovement(0);
                 setStage(6);
                 break;

            case 6: // Wait for movement
                 if (MovementStarted) return;
                 SetFly(false);
                 SetCombatMovement(true);
                 m_creature->GetMotionMaster()->Clear();
                 m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                 setStage(7);
                 break;

            case 7: //GROUND
                 timedCast(SPELL_FLAME_BREATH, diff);
                 timedCast(SPELL_ENRAGE, diff);
                 if ( m_creature->GetHealthPercent() <= 40.0f) setStage(8);
                 break;

            case 8: //Air phase start
                 SetCombatMovement(false);
                 m_creature->InterruptNonMeleeSpells(true);
                 SetFly(true);
                 doBeacon(true);
                 StartMovement(1);
                 setStage(9);
                 break;

            case 9: // Wait for movement
                 if (MovementStarted) return;
                 doCast(SPELL_CONFLAGATION);
                 DoScriptText(SAY_SPECIAL,m_creature);
                 setStage(10);
                 break;

            case 10: // Wait for cast finish
                 if (!m_creature->IsNonMeleeSpellCasted(false))
                 {
                     doBeacon(false);
                     setStage(11);
                 };
                 break;

            case 11: // Air phase
                 timedCast(SPELL_FLAME_BREATH, diff);
                 if (timedQuery(SPELL_BEACON, diff))
                     {
                         doBeacon(true);
                         doCast(SPELL_CONFLAGATION);
                     };
                 if (conflagated && timedQuery(SPELL_CONFLAGATION_1, diff))
                     {
                         doBeacon(false);
                     };
                 if ( m_creature->GetHealthPercent() <= 20.0f) setStage(12);
                 break;

            case 12: //Air phase end
                 StartMovement(0);
                 setStage(13);
                 break;

            case 13: // Wait for movement
                 if (MovementStarted) return;
                 SetFly(false);
                 SetCombatMovement(true);
                 m_creature->GetMotionMaster()->Clear();
                 m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                 setStage(14);
                 break;

            case 14: //GROUND
                 timedCast(SPELL_FLAME_BREATH, diff);
                 timedCast(SPELL_ENRAGE, diff*2);
                 break;

            default:
                break;
        }

        DoMeleeAttackIfReady();
    }
Exemple #17
0
 void TransitionQuads::clicked(Event* ev)
 {
     TouchEvent* te = (TouchEvent*)ev;
     _center = getStage()->local2global(te->localPosition);
 }
Exemple #18
0
void MainWindowContent::reloadStage(int number) {
	controller->createStage(number);
	getStage(number)->reloadValuesFromStage();
}
Exemple #19
0
bool LBDbWorkEntry::createRecord( LQuery cluster, String reason )
{
	int machine = limits.getAnalyserID();
	if( machine == 0 )
	{
		// QCs should stay on the same analyser; others on cluster
		machine = LCDbAnalysers::getCurrentID();
		const LCDbAnalyser * an = LCDbAnalysers::records().findByID( machine );
		if( an != NULL && !isQC() )
		{
			std::set< int > machineIDs = an -> getClusterIDs();
			if( !machineIDs.empty() )
				machine = *(machineIDs.begin());
		}
		limits.setAnalyserID( machine );
	}

	if( reason.IsEmpty() && getProfileID() != 0 )
	{
		const LPDbProfiles & profiles = LPDbProfiles::records( getProjectID() );
		const LPDbProfile * pp = profiles.findByID( getProfileID() );
		if( pp != NULL )
			reason = pp -> getName();
	}

	setTimeStamp( Now() );
	char fromCentral = LCDbWorkEntry::NEW_RECORD;
	switch( getStage() )
	{
		case NEW_ENTRY:
			break;

		case RE_RUN:
			resultID = nextRerun --;
			break;

		case TRIGGERED:
			resultID = TRIGGER_ID;
			break;

		default:
			fromCentral = LCDbWorkEntry::COPIED;
	}

	cluster.setSQL( "Insert into buddy_worklist (machine_cid, barcode, duplicate, test_name, test_id,"
					" sample_id, range_set, min_value, max_value, status, project_cid, profile_name,"
					" buddy_read, in_date, time_stamp, lower_warning, upper_warning, trigger_id,"
					" trigger_lower_limit, trigger_upper_limit, private_result, delete_status, category_id)"
				   " values ( :mid, :bar, :dup, :tnm, :tid, :aid, :rs, :min, :max, :sts, :prj,"
							" :prn, :brd, :ind, :dts, :wlo, :wup, :trd, :tlo, :tup, :prv, 0, :cat )" );
	cluster.setParam( "mid", machine );
	cluster.setParam( "bar", getBarcode() );
	cluster.setParam( "dup", resultID );

	std::pair< int, int > specimen = getSpecimen();
	cluster.setParam( "prj", specimen.first );
	cluster.setParam( "aid", specimen.second );

	const LCDbTest & test = LCDbTests::records().get( limits.getID() );
	cluster.setParam( "tid", test.getID() );
	cluster.setParam( "tnm", test.getName() );
	cluster.setParam( "prn", reason );

	std::pair< double, double > range = limits.getRange().asDoubles();
	cluster.setParam( "min", range.first );
	cluster.setParam( "max", range.second );
	cluster.setParam( "rs", (range.first == 0 && range.second == 0) ? 'N' : 'Y' );

	cluster.setParam( "sts", makeStatus( getStage() ) );
	cluster.setParam( "brd", fromCentral );
	cluster.setParam( "ind", getInDate() );
	cluster.setParam( "dts", getTimeStamp() );

	cluster.setParam( "trd", limits.getTriggerProfile() );
	if( limits.getTriggerProfile() == 0 )
	{
		cluster.setParam( "tup", "0" );
		cluster.setParam( "tlo", "0" );
	}
	else
	{	range = limits.getTriggerLimits().asDoubles();
		cluster.setParam( "tlo", range.first );
		cluster.setParam( "tup", range.second );
	}

	range = limits.getWarnLevels().asDoubles();
	cluster.setParam( "wlo", range.first );
	cluster.setParam( "wup", range.second );
	cluster.setParam( "prv", limits.isPrivate() ? 'Y' : 'N' );
	cluster.setParam( "cat", getCategoryID() );

	if( cluster.execSQL() != 1 ) {
		return false;
	}
	duplicate = resultID;
	LBDbWorkList::records().insert( *this );
	return true;
}
Exemple #20
0
void MainWindowContent::refreshStage(int number) {
	getStage(number)->refresh();
}
    void DebugActor::doUpdate(const UpdateState& us)
    {
        static int fps = 0;
        ++_frames;
        if (_frames > 50)
        {
            timeMS this_time = getTimeMS();
            if (this_time != _startTime)
            {
                fps = int(((float)_frames / (this_time - _startTime)) * 1000);
            }
            _startTime = this_time;
            _frames = 0;
        }

        std::stringstream s;
        s << "fps=" << fps << std::endl;



#ifdef __S3E__
        int mem_used = -1;
        int mem_free = -1;

        mem_used = s3eMemoryGetInt(S3E_MEMORY_USED);
        mem_free = s3eMemoryGetInt(S3E_MEMORY_FREE);

        s << "mfree=" << mem_free << " mem=" << mem_used << std::endl;
#endif



#ifdef OXYGINE_DEBUG_TRACE_LEAKS
        s << "objects=" << (int)ObjectBase::__getCreatedObjects().size() << std::endl;
#endif
#ifdef OXYGINE_TRACE_VIDEO_STATS
        s << "batches=" << _videoStats.batches << " triangles=" << _videoStats.triangles << std::endl;
#endif
        s << "update=" << getStage()->_statUpdate << "ms ";
        s << "render=" << getStage()->_statRender << "ms ";
        s << "textures=" << NativeTexture::created << " ";
        s << "\nlisteners=" << getStage()->getListenersCount() << "";

        if (!_debugText.empty())
        {
            s << "\n";
            s << _debugText;
        }
        _debugText = "";

        _text->setText(s.str());


        setHeight(_text->getTextRect().size.y + _text->getY() + 3);
        _bg->setSize(getSize());


        float scale = getScaleX();
        Vector2 parentSize = getParent()->getSize();
        Vector2 realSize = getSize() * scale;

        setX(0);
        setY(0);

        switch (_corner)
        {
            case 1:
                setX(parentSize.x - realSize.x);
                setY(0);
                break;
            case 2:
                setPosition(parentSize - realSize);
                break;
            case 3:
                setX(0);
                setY(parentSize.y - realSize.y);
                break;
        }

        setScale(1.0f / getStage()->getScaleX());
    }
Exemple #22
0
void MainWindowContent::commitStage(int number) {
	getStage(number)->saveValuesToStage();
}
Exemple #23
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!pInstance) return;

        if (!inCombat && !m_creature->IsNonMeleeSpellCasted(false))
        {
            if (Creature *pDummyTarget = pInstance->GetSingleCreatureFromStorage(NPC_BALTHARUS_TARGET))
                timedCast(SPELL_CHANNEL_SPELL, uiDiff, pDummyTarget);
        }

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

        switch (getStage())
        {
            case 0:
                 if ( m_creature->GetHealthPercent() <= 66.0f) setStage(1);
                 break;

            case 1:
                 m_creature->InterruptNonMeleeSpells(true);
                 if (is25())
                     doCast(SPELL_SUMMON_CLONE);
                   //  DoScriptText(SAY_BALTHARUS_SPECIAL_1,m_creature);
                 setStage(2);
                 break;

            case 2:
                 if (m_creature->IsNonMeleeSpellCasted(false)) return;
                 doCast(SPELL_REPELLING_WAVE);
                 setStage(3);

            case 3:
                 if ( m_creature->GetHealthPercent() <= 50.0f) setStage(4);
                 break;

            case 4:
                 m_creature->InterruptNonMeleeSpells(true);
                 if (!is25())
                        doCast(SPELL_SUMMON_CLONE);
                        DoScriptText(SAY_BALTHARUS_SPECIAL_1,m_creature);
                 setStage(5);
                 break;

            case 5:
                 if (m_creature->IsNonMeleeSpellCasted(false)) return;
                 doCast(SPELL_REPELLING_WAVE);
                 setStage(6);

            case 6:
                 if ( m_creature->GetHealthPercent() <= 33.0f) setStage(7);
                 break;

            case 7:
                 m_creature->InterruptNonMeleeSpells(true);
                 if (is25())
                     doCast(SPELL_SUMMON_CLONE);
                  //   DoScriptText(SAY_BALTHARUS_SPECIAL_1,m_creature);
                 setStage(8);
                 break;

            case 8:
                 if (m_creature->IsNonMeleeSpellCasted(false)) return;
                 doCast(SPELL_REPELLING_WAVE);
                 setStage(9);

            case 9:
            default:
                 break;
        }

        timedCast(SPELL_BLADE_TEMPEST, uiDiff);
        timedCast(SPELL_ENERVATING_BRAND, uiDiff);
        timedCast(SPELL_SABER_LASH, uiDiff);

        DoMeleeAttackIfReady();
    }
        void UpdateAI(uint32 const diff)
        {
            if (!UpdateVictim())
                return;

            switch (getStage())
            {
                case 0: //GROUND
                     if (m_uiFlameBreathTimer <= diff)
                     {
                         DoCast(SPELL_FLAME_BREATH);
                         m_uiFlameBreathTimer = urand(5*IN_MILLISECONDS,15*IN_MILLISECONDS);
                     } else m_uiFlameBreathTimer -= diff;

                     if (m_uiEnrage <= diff)
                     {
                         DoCast(SPELL_ENRAGE);
                         m_uiEnrage = urand(20*IN_MILLISECONDS,40*IN_MILLISECONDS);
                         DoScriptText(-1666405,me);
                     } else m_uiEnrage -= diff;

                     if ( HealthBelowPct(81) ) setStage(1);
                     break;

                case 1: //Air phase start
                     SetCombatMovement(false);
                     me->InterruptNonMeleeSpells(true);
                     SetFly(true);
                     doBeacon(true);
                     StartMovement(1);
                     setStage(2);
                     break;

                case 2: // Wait for movement
                     if (MovementStarted) return;
                     DoCast(SPELL_CONFLAGATION);
                     DoScriptText(-1666404,me);
                     setStage(3);
                     break;

                case 3: // Wait for cast finish
                     if (!me->IsNonMeleeSpellCasted(false))
                     {
                         doBeacon(false);
                         setStage(4);
                     }
                     break;

                case 4: // Air phase
                     if (m_uiFlameBreathTimer <= diff)
                     {
                         DoCast(SPELL_FLAME_BREATH);
                         m_uiFlameBreathTimer = urand(5*IN_MILLISECONDS,15*IN_MILLISECONDS);
                     } else m_uiFlameBreathTimer -= diff;

                     if (m_uiBeakonTimer <= diff)
                     {
                         doBeacon(true);
                         DoCast(SPELL_CONFLAGATION);
                         m_uiBeakonTimer = urand(12*IN_MILLISECONDS,22*IN_MILLISECONDS);
                     } else m_uiBeakonTimer -= diff;

                     if (m_uiConflagrateTimer <= diff)
                     {
                         if (conflagated)
                         {
                             //DoCast(SPELL_CONFLAGATION_1);
                             doBeacon(false);
                         }
                         m_uiConflagrateTimer = 5*IN_MILLISECONDS;
                     } else m_uiConflagrateTimer -= diff;

                     if ( HealthBelowPct(61) ) setStage(5);
                     break;

                case 5: //Air phase end
                     StartMovement(0);
                     setStage(6);
                     break;

                case 6: // Wait for movement
                     if (MovementStarted) return;
                     SetFly(false);
                     SetCombatMovement(true);
                     me->GetMotionMaster()->Clear();
                     me->GetMotionMaster()->MoveChase(me->getVictim());
                     setStage(7);
                     break;

                case 7: //GROUND
                     if (m_uiFlameBreathTimer <= diff)
                     {
                         DoCast(SPELL_FLAME_BREATH);
                         m_uiFlameBreathTimer = urand(5*IN_MILLISECONDS,15*IN_MILLISECONDS);
                     } else m_uiFlameBreathTimer -= diff;

                     if (m_uiEnrage <= diff)
                     {
                         DoCast(SPELL_ENRAGE);
                         m_uiEnrage = urand(20*IN_MILLISECONDS,40*IN_MILLISECONDS);
                         DoScriptText(-1666405,me);
                     } else m_uiEnrage -= diff;

                     if ( HealthBelowPct(41) ) setStage(8);
                     break;

                case 8: //Air phase start
                     SetCombatMovement(false);
                     me->InterruptNonMeleeSpells(true);
                     SetFly(true);
                     doBeacon(true);
                     StartMovement(1);
                     setStage(9);
                     break;

                case 9: // Wait for movement
                     if (MovementStarted) return;
                     DoCast(SPELL_CONFLAGATION);
                     DoScriptText(-1666404,me);
                     setStage(10);
                     break;

                case 10: // Wait for cast finish
                     if (!me->IsNonMeleeSpellCasted(false))
                     {
                         doBeacon(false);
                         setStage(11);
                     };
                     break;

                case 11: // Air phase
                     if (m_uiFlameBreathTimer <= diff)
                     {
                         DoCast(SPELL_FLAME_BREATH);
                         m_uiFlameBreathTimer = urand(5*IN_MILLISECONDS,15*IN_MILLISECONDS);
                     } else m_uiFlameBreathTimer -= diff;

                     if (m_uiBeakonTimer <= diff)
                     {
                         doBeacon(true);
                         DoCast(SPELL_CONFLAGATION);
                         m_uiBeakonTimer = urand(12*IN_MILLISECONDS,22*IN_MILLISECONDS);
                     } else m_uiBeakonTimer -= diff;

                     if (m_uiConflagrateTimer <= diff)
                     {
                         if (conflagated)
                         {
                              //DoCast(SPELL_CONFLAGATION_1);
                              doBeacon(false);
                         }
                         m_uiConflagrateTimer = 5*IN_MILLISECONDS;
                     } else m_uiConflagrateTimer -= diff;

                     if ( HealthBelowPct(21) ) setStage(12);
                     break;

                case 12: //Air phase end
                     StartMovement(0);
                     setStage(13);
                     break;

                case 13: // Wait for movement
                     if (MovementStarted) return;
                     SetFly(false);
                     SetCombatMovement(true);
                     me->GetMotionMaster()->Clear();
                     me->GetMotionMaster()->MoveChase(me->getVictim());
                     setStage(14);
                     break;

                case 14: //GROUND
                     if (m_uiFlameBreathTimer <= diff)
                     {
                         DoCast(SPELL_FLAME_BREATH);
                         m_uiFlameBreathTimer = urand(5*IN_MILLISECONDS,15*IN_MILLISECONDS);
                     } else m_uiFlameBreathTimer -= diff;

                     if (m_uiEnrage <= diff)
                     {
                         DoCast(SPELL_ENRAGE);
                         m_uiEnrage = urand(15*IN_MILLISECONDS,30*IN_MILLISECONDS);
                         DoScriptText(-1666405,me);
                     } else m_uiEnrage -= diff;
                     break;

                default:
                    break;
            }

            DoMeleeAttackIfReady();
        }