void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; switch (getStage()) { case 0: //GROUND timedCast(SPELL_FLAME_BREATH, diff); if (m_uiEnrageTimer < diff) { if(DoCastSpellIfCan(m_creature, SPELL_ENRAGE) == CAST_OK) { m_uiEnrageTimer = urand(20000,30000); DoScriptText(SAY_ENRAGE, m_creature); } } else m_uiEnrageTimer -= diff; if (m_uiFlyTimer < diff) { setStage(1); m_uiFlyTimer = 50000; } else m_uiFlyTimer -= diff; DoMeleeAttackIfReady(); break; case 1: //Air phase start SetCombatMovement(false); m_creature->InterruptNonMeleeSpells(true); SetFly(true); StartMovement(1); setStage(2); break; case 2: // Wait for movement if (MovementStarted) return; setStage(3); break; case 3: // Beacons doBeacon(true); if (m_uiWaitTimer < diff) { setStage(4); m_uiWaitTimer = 5000; } else m_uiWaitTimer -= diff; break; case 4: // Conflagate timedCast(SPELL_FLAME_BREATH, diff); if (conflagated) { doBeacon(false); doCast(SPELL_CONFLAGATION); DoScriptText(SAY_SPECIAL, m_creature); goLand = true; }; if (goLand) 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(0); break; default: break; } }
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(); }
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 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(-1666404,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(-1666404,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(); }
//============================================================================= // Base beacon //============================================================================= static RU32 RPAL_THREAD_FUNC thread_beacon ( RPVOID context ) { RU32 status = 0; rList requests = NULL; rList responses = NULL; rIterator ite = NULL; rpcm_tag tag = 0; rpcm_type type = 0; rSequence msg = NULL; RPU8 crashContext = NULL; RU32 crashContextSize = 0; RU8 defaultCrashContext = 1; UNREFERENCED_PARAMETER( context ); // First let's check if we have a crash context already present // which would indicate we did not shut down properly if( !acquireCrashContextPresent( &crashContext, &crashContextSize ) ) { crashContext = NULL; crashContextSize = 0; } // Set a default crashContext to be removed before exiting setCrashContext( &defaultCrashContext, sizeof( defaultCrashContext ) ); while( !rEvent_wait( g_hcpContext.isBeaconTimeToStop, 0 ) ) { if( 0 == g_hcpContext.beaconTimeout ) { // This is the default timeout to re-establish contact home g_hcpContext.beaconTimeout = RP_HCP_CONFIG_DEFAULT_BEACON_TIMEOUT_INIT; requests = assembleRequest( crashContext, crashContextSize ); // If we just sent a crash context, free it so we don't keep sending it if( NULL != crashContext ) { rpal_memory_free( crashContext ); crashContext = NULL; crashContextSize = 0; } if( NULL != requests && doBeacon( RP_HCP_MODULE_ID_HCP, requests, &responses ) && NULL != responses ) { // This is the default beacon timeout when contact is already established g_hcpContext.beaconTimeout = RP_HCP_CONFIG_DEFAULT_BEACON_TIMEOUT; // Go through the response list of messages if( NULL != ( ite = rIterator_new( responses ) ) ) { while( rIterator_next( ite, &tag, &type, &msg, NULL ) ) { // We ignore non-messages for forward compat if( RP_TAGS_MESSAGE == tag && RPCM_SEQUENCE == type ) { processMessage( msg ); } } rIterator_free( ite ); } } // Free resources. IF_VALID_DO( requests, rList_free ); requests = NULL; IF_VALID_DO( responses, rList_free ); responses = NULL; } // Sleep for 1 second, we aproximate beacon times rpal_thread_sleep( 1 * 1000 ); if( 0 != g_hcpContext.beaconTimeout ){ g_hcpContext.beaconTimeout--; } } return status; }