void phaseTester() { _unit->Root(); GetAllowMelee(); SetBehavior(Behavior_Spell); if ((HandOfTheDeceiver1 && HandOfTheDeceiver2 && HandOfTheDeceiver3) && (HandOfTheDeceiver1->isDead() && HandOfTheDeceiver2->isDead() && HandOfTheDeceiver3->isDead()) && (GetPhase() != 1) && (GetPhase() != 2) && (starter == 0)) { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, SAY_KJ_EMERGE); _unit->PlaySoundToSet(SOUND_KJ_EMERGE); RemoveAura(42866); _unit->m_invisible = false; starter = 1; } switch(GetPhase()) { case 1: { if(GetHealthPercent()<=85 && phase == 2) { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, SAY_KJ_PHASE3); _unit->PlaySoundToSet(SOUND_KJ_PHASE3); AddPhaseSpell(1, AddSpell(SPELL_SINISTER_REFLECTION, Target_RandomPlayer, 10, 1.5f, 4, 0, 35)); AddPhaseSpell(1, AddSpell(SPELL_SHADOW_SPIKE, Target_RandomDestination, 10, 2.0f, 6, 0, 35)); AddPhaseSpell(1, AddSpell(SPELL_FLAME_DART, Target_RandomPlayer, 10, 1.3f, 4, 0, 35)); ShieldOrb2 = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_SHIELD_ORB, 1712.00f, 604.00f, 48.00f, 0.00f, true, true, 0, 0); phase++; } if(GetHealthPercent()<=55 && phase == 3) { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, SAY_KJ_PHASE4); _unit->PlaySoundToSet(SOUND_KJ_PHASE4); ShieldOrb3 = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_SHIELD_ORB, 1684.00f, 651.00f, 48.00f, 0.00f, true, true, 0, 0); dtimmer = 0; phase++; } if(GetHealthPercent()<=25 && phase == 4 && (dtimmer > 54 || dtimmer == 0)) { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, SAY_KJ_PHASE5); _unit->PlaySoundToSet(SOUND_KJ_PHASE5); ShieldOrb4 = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_SHIELD_ORB, 1720.00f, 642.00f, 48.00f, 0.00f, true, true, 0, 0); CastSpellOnTarget(_unit, Target_Self, dbcSpell.LookupEntry(SPELL_SACRIFICE_OF_ANVEENA), true); dtimmer = 0; phase++; } }break; } }
bool MoonScriptCreatureAI::CastSpellInternal(SpellDesc* pSpell, uint32 pCurrentTime) { if( pSpell == NULL) return false; //Do not cast if we are already casting if( IsCasting() ) return false; //We do not cast in special states such as : stunned, feared, silenced, charmed, asleep, confused and if they are not ignored if ( ( ~pSpell->mTargetType.mTargetFilter & TargetFilter_IgnoreSpecialStates ) && _unit->m_special_state & ( UNIT_STATE_STUN | UNIT_STATE_FEAR | UNIT_STATE_SLEEP | UNIT_STATE_SILENCE | UNIT_STATE_CHARM | UNIT_STATE_CONFUSE ) ) return false; //Do not cast if we are in cooldown uint32 CurrentTime = ( pCurrentTime == 0 ) ? (uint32)time(NULL) : pCurrentTime; if( pSpell->mLastCastTime + pSpell->mCooldown > CurrentTime ) return false; //Check range before casting Unit *Target = GetTargetForSpell( pSpell ); if( Target ) { RangeStatusPair Status; if( pSpell->mTargetType.mTargetFilter & TargetFilter_InRangeOnly || ( Status = GetSpellRangeStatusToUnit( Target, pSpell ) ).first == RangeStatus_Ok ) { //Safe-delay if we got special state flag before DelayNextAttack( CalcSpellAttackTime( pSpell ) ); //If we were running to a target, stop because we're in range now PopRunToTargetCache(); //Do emote associated with this spell RandomEmote(pSpell->mEmotes); //Cast spell now if( pSpell->mInfo ) CastSpellOnTarget(Target, pSpell->mTargetType, pSpell->mInfo, ( pSpell->mCastTime == 0 ) ? true : false); else if( pSpell->mSpellFunc ) pSpell->mSpellFunc(pSpell, this, Target, pSpell->mTargetType); else sLog.outDebug("MoonScriptCreatureAI::CastSpellInternal() : Invalid spell!\n"); //Store cast time for cooldown pSpell->mLastCastTime = CurrentTime; return true; } else if( !pSpell->mStrictRange ) //Target is out of range, run to it { PushRunToTargetCache( Target, pSpell, Status ); return false; } } //If we get here, its because the RunToTarget changed type, so its no longer valid, clear it PopRunToTargetCache(); DelayNextAttack(0); //Cancel attack delay return true; //No targets possible? Consider spell casted nonetheless }
void AIUpdate() { if (!IsInCombat()) CastSpellOnTarget(_unit, Target_Self, dbcSpell.LookupEntry(SPELL_SHADOW_CHANNELING), false); if (timmer == 6 && IsInCombat()) { SpawnCreature(CN_VOLATILE_FELFIRE_FIEND, _unit->GetPositionX()+1, _unit->GetPositionY()+1, _unit->GetPositionZ(), 0, true); timmer = 0; } if(GetHealthPercent()<=25 && infusion == false) { ApplyAura(SPELL_SHADOW_INFUSION); infusion = true; } timmer++; ParentClass::AIUpdate(); }
bool ArcScriptCreatureAI::CastSpellInternal(SpellDesc* pSpell, uint32 pCurrentTime) { //Do not cast if we are already casting if( IsCasting() ) return false; //Do not cast if we are in cooldown uint32 CurrentTime = ( pCurrentTime == 0 ) ? (uint32)time(NULL) : pCurrentTime; if( pSpell->mLastCastTime + pSpell->mCooldown > CurrentTime ) return false; //Check range before casting Unit* Target = GetTargetForSpell(pSpell); if( Target ) { if( IsUnitInRange(Target, pSpell) ) { //If we were running to a target, stop because we're in range now PopRunToTargetCache(); //Do emote associated with this spell RandomEmote(pSpell->mEmotes); //Cast spell now if( pSpell->mInfo ) CastSpellOnTarget(Target, pSpell->mTargetType, pSpell->mInfo, ( pSpell->mCastTime == 0 ) ? true : false); else if( pSpell->mSpellFunc ) pSpell->mSpellFunc(pSpell, this, Target, pSpell->mTargetType); else sLog.outDebug("ArcScriptCreatureAI::CastSpellInternal() : Invalid spell!\n"); //Store cast time for cooldown pSpell->mLastCastTime = CurrentTime; return true; } else if( !pSpell->mStrictRange ) //Target is out of range, run to it { PushRunToTargetCache(Target, pSpell); return false; } } //If we get here, its because the RunToTarget changed type, so its no longer valid, clear it PopRunToTargetCache(); DelayNextAttack(0); //Cancel attack delay return true; //No targets possible? Consider spell casted nonetheless }
void AIUpdate() { _unit->Root(); GetAllowMelee(); SetBehavior(Behavior_Spell); phaseTester(); switch (starter) { case 3: { _unit->CastSpell(_unit, dbcSpell.LookupEntry(35177), true); }break; case 16: { SetPhase(1); _unit->SetUInt64Value(UNIT_FIELD_FLAGS, ( true ) ? 0 : UNIT_FLAG_NOT_ATTACKABLE_9); _unit->GetAIInterface()->SetAllowedToEnterCombat(true); ShieldOrb1 = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_SHIELD_ORB, 1678.00f, 610.00f, 48.00f, 0.00f, true, true, 0, 0); //BlueDragon = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CREATURE_POWER_OF_THE_BLUE_DRAGONFLIGHT, 1720.00f, 642.00f, 28.00f, 0.00f, true, true, 0, 0); phase = 2; starter++; }break; } if (starter > 0 && starter < 16) starter++; if (phase == 4) { switch (dtimmer) { case 2: { ArmageddonSpawn(); dtimmer++; }break; case 10: { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL,LANG_UNIVERSAL,"Who can you trust?"); _unit->PlaySoundToSet(12503); SinisterReflect(); dtimmer++; }break; case 104: { SetPhase(2); ClearHateList(); SetAllowMelee(true); _unit->Root(); _unit->SetUInt64Value(UNIT_FIELD_FLAGS, ( false ) ? 0 : UNIT_FLAG_NOT_ATTACKABLE_9); _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, SAY_KJ_DARKNESS1); _unit->PlaySoundToSet(SOUND_KJ_DARKNESS1); _unit->SetUInt32Value(UNIT_NPC_EMOTESTATE, 407); dtimmer++; }break; case 112: { SetAllowMelee(true); BlueShild(); dtimmer++; }break; case 120: { CastSpellOnTarget(_unit, Target_RandomPlayer, Darkness, true); _unit->Root(); SetAllowMelee(true); dtimmer++; }break; case 122: { SetPhase(1); _unit->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); _unit->SetUInt64Value(UNIT_FIELD_FLAGS, ( true ) ? 0 : UNIT_FLAG_NOT_ATTACKABLE_9); ClearHateList(); dtimmer = 0; }break; default: { _unit->Root(); dtimmer++; }break; } } if (phase == 5) { switch (dtimmer) { case 10: { SinisterReflect(); dtimmer++; }break; case 54: { SetPhase(2); ClearHateList(); SetAllowMelee(true); _unit->Root(); _unit->SetUInt64Value(UNIT_FIELD_FLAGS, ( false ) ? 0 : UNIT_FLAG_NOT_ATTACKABLE_9); _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, SAY_KJ_DARKNESS2); _unit->PlaySoundToSet(SOUND_KJ_DARKNESS2); _unit->SetUInt32Value(UNIT_NPC_EMOTESTATE, 407); dtimmer++; }break; case 62: { BlueShild(); SetAllowMelee(true); dtimmer++; }break; case 70: { CastSpellOnTarget(_unit, Target_RandomPlayer, Darkness, true); SetAllowMelee(true); _unit->Root(); dtimmer++; }break; case 72: { SetPhase(1); _unit->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); _unit->SetUInt64Value(UNIT_FIELD_FLAGS, ( true ) ? 0 : UNIT_FLAG_NOT_ATTACKABLE_9); ClearHateList(); dtimmer = 0; }break; default: { SetAllowMelee(true); _unit->Root(); dtimmer++; }break; } } ParentClass::AIUpdate(); }
void AIUpdate() { if ((HandOfTheDeceiver1 && HandOfTheDeceiver2 && HandOfTheDeceiver3 && HandOfTheDeceiver4) && (HandOfTheDeceiver1->isDead() || HandOfTheDeceiver2->isDead() || HandOfTheDeceiver3->isDead() || HandOfTheDeceiver4->isDead()) && (GetPhase() != 1)) { RemoveAura(46410); } if ((HandOfTheDeceiver1 && HandOfTheDeceiver2 && HandOfTheDeceiver3 && HandOfTheDeceiver4) && (HandOfTheDeceiver1->isDead() && HandOfTheDeceiver2->isDead() && HandOfTheDeceiver3->isDead() && HandOfTheDeceiver4->isDead()) && (GetPhase() != 1) && (GetPhase() != 2)) { SetPhase(1); _unit->SetUInt64Value(UNIT_FIELD_FLAGS, ( true ) ? 0 : UNIT_FLAG_NOT_ATTACKABLE_9); _unit->GetAIInterface()->SetAllowedToEnterCombat(true); RemoveAura(46367); ShieldOrb1 = _unit->GetMapMgr()->GetInterface()->SpawnGameObject(CN_SHIELD_ORB, 1678.00f, 610.00f, 28.00f, 0.00f, false, 0, 0); } if (ShieldOrb1) { //ShieldOrb1->CastSpell(ShShadowbolt); } if (ShieldOrb2) { //ShieldOrb2->CastSpell(ShShadowbolt); } if (ShieldOrb3) { //ShieldOrb3->CastSpell(ShShadowbolt); } if (ShieldOrb4) { //ShieldOrb4->CastSpell(ShShadowbolt); } switch (dtimmer) { case 100: { dtimmer++; if (GetHealthPercent()<=85) { SetPhase(2); SetAllowMelee(false); SetCanMove(false); _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Kil'jaeden begins to channel dark energy"); } }break; case 120: { dtimmer++; if (GetPhase() == 2) CastSpellOnTarget(_unit, Target_RandomPlayer, Darkness_explosion, true); //CastSpellOnTarget(_unit, Target_RandomPlayer, Darkness, true); //this is the correct, but the dragon doesn't work. SetAllowMelee(false); SetCanMove(false); }break; case 128: { SetPhase(1); SetAllowMelee(false); SetCanMove(false); dtimmer = 1; }break; default: { SetCanMove(false); SetAllowMelee(false); dtimmer++; }break; } switch(GetPhase()) { case 1: { if(GetHealthPercent()<=85) { AddPhaseSpell(1, AddSpell(SINISTER_REFLECTION, Target_RandomPlayer, 10, 1.5f, 4, 0, 35)); AddPhaseSpell(1, AddSpell(SHADOW_SPIKE, Target_RandomDestination, 10, 2.0f, 6, 0, 35)); AddPhaseSpell(1, AddSpell(FLAME_DART_EXPLOSION, Target_RandomPlayer, 10, 1.3f, 4, 0, 35)); ShieldOrb1 = _unit->GetMapMgr()->GetInterface()->SpawnGameObject(CN_SHIELD_ORB, 1678.00f, 610.00f, 28.00f, -1.72788f, false, 0, 0); } if(GetHealthPercent()<=55) { ShieldOrb1 = _unit->GetMapMgr()->GetInterface()->SpawnGameObject(CN_SHIELD_ORB, 1684.00f, 651.00f, 28.00f, 0.00f, false, 0, 0); } if(GetHealthPercent()<=25) { //Armageddon ShieldOrb1 = _unit->GetMapMgr()->GetInterface()->SpawnGameObject(CN_SHIELD_ORB, 1720.00f, 642.00f, 28.00f, 0.00f, false, 0, 0); AddPhaseSpell(1, AddSpell(SACRIFICE_OF_ANVEENA, Target_RandomPlayer, 50, 0.5f, 10, 0, 35)); } }break; } ParentClass::AIUpdate(); }