void OnApply(constAuraEffectPtr aurEff, AuraEffectHandleModes /*mode*/) { AuraPtr aura = aurEff->GetBase(); uint32 duration = urand(3000, 45000); aura->SetDuration(duration); aura->SetMaxDuration(duration); }
// Update rank for player void BattlefieldWG::PromotePlayer(Player* killer) { if (!m_isActive) return; // Updating rank of player AuraPtr aur = killer->GetAura(SPELL_RECRUIT); if (aur != NULLAURA) { if (aur->GetStackAmount() >= 5) { killer->RemoveAura(SPELL_RECRUIT); killer->CastSpell(killer, SPELL_CORPORAL, true); SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_FIRSTRANK); } else killer->CastSpell(killer, SPELL_RECRUIT, true); } else { AuraPtr aur = killer->GetAura(SPELL_CORPORAL); if (aur != NULLAURA) { if (aur->GetStackAmount() >= 5) { killer->RemoveAura(SPELL_CORPORAL); killer->CastSpell(killer, SPELL_LIEUTENANT, true); SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_SECONDRANK); } else killer->CastSpell(killer, SPELL_CORPORAL, true); } } }
void HandleScript(SpellEffIndex /*effIndex*/) { constAuraPtr aura = GetHitUnit()->GetAura(GetSpellInfo()->Id); if (!(aura && aura->GetStackAmount() == 10)) return; GetHitUnit()->RemoveAurasDueToSpell(GetSpellInfo()->Id); GetHitUnit()->CastSpell(GetHitUnit(), SPELL_GASTRIC_EXPLOSION, true); }
void SmartAI::RemoveAuras() { // Only loop throught the applied auras, because here is where all auras on the current unit are stored Unit::AuraApplicationMap appliedAuras = me->GetAppliedAuras(); for (Unit::AuraApplicationMap::iterator iter = appliedAuras.begin(); iter != appliedAuras.end(); ++iter) { constAuraPtr aura = iter->second->GetBase(); if (!aura->GetSpellInfo()->IsPassive() && !aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE) && !aura->HasEffectType(SPELL_AURA_CLONE_CASTER) && aura->GetCaster() != me) me->RemoveAurasDueToSpell(aura->GetId()); } }
void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; if(_defeated) return; if (buffTimer <= uiDiff) { AuraPtr defend = me->GetAura(SPELL_SHIELD); if (!defend || defend->GetStackAmount() < 3) { DoCast(SPELL_SHIELD); buffTimer = urand(4000, 5000); } else buffTimer = urand(1000, 2000); }else buffTimer -= uiDiff; if (chargeTimer <= uiDiff) { if(Unit* target = SelectTarget(SELECT_TARGET_FARTHEST)) { DoResetThreat(); me->AddThreat(target, 5.0f); DoCast(target, SPELL_CHARGE, true); } chargeTimer = 5000; }else chargeTimer -= uiDiff; if (shieldBreakerTimer <= uiDiff) { if(Unit* target = SelectTarget(SELECT_TARGET_FARTHEST)) DoCast(target, SPELL_SHIELD_BREAKER, true); shieldBreakerTimer = 7000; }else shieldBreakerTimer -= uiDiff; // Use Thrust instead of melee attack if (me->isAttackReady() && me->IsWithinMeleeRange(me->getVictim())) { me->AddUnitState(UNIT_STATE_ONVEHICLE); DoCast(me->getVictim(), SPELL_THRUST); me->resetAttackTimer(); me->ClearUnitState(UNIT_STATE_ONVEHICLE); } }
void JustDied(Unit* /*killer*/) override { if (Creature* immersius = Instance->instance->GetCreature(Instance->GetData64(DATA_IMMERSUS))) { if (!immersius->isInCombat()) return; immersius->AI()->DoAction(ACTION_COUNT_SPLIT_PHASE); immersius->AI()->DoAction(ACTION_REMOVE_ENERGY); std::list<Player*> players; players.clear(); me->GetPlayerListInGrid(players, 300.0f); if (players.empty()) return; for (auto itr : players) { if (!itr->HasAura(SPELL_SHA_RESIUDE)) { itr->AddAura(SPELL_SHA_RESIUDE, itr); } else { AuraPtr aura = itr->GetAura(SPELL_SHA_RESIUDE); if (aura) { aura->SetStackAmount(aura->GetStackAmount() + 1); } } } } }
void UpdateAI(uint32 const diff) { if (!UpdateVictim()) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_FREEZE: DoCastAOE(SPELL_FREEZE); events.ScheduleEvent(EVENT_FREEZE, urand(30000, 45000)); break; case EVENT_ICICLE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) DoCast(target, SPELL_ICICLE); events.ScheduleEvent(EVENT_ICICLE, RAID_MODE(5500, 3500)); break; case EVENT_FLASH_FREEZE: DoScriptText(SAY_FLASH_FREEZE, me); DoScriptText(EMOTE_FREEZE, me); for (uint8 n = 0; n < RAID_MODE(2, 3); ++n) if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) target->CastSpell(target, SPELL_ICICLE_SNOWDRIFT, true); DoCast(SPELL_FLASH_FREEZE); events.ScheduleEvent(EVENT_FLASH_FREEZE_EFFECT, 500); break; case EVENT_FLASH_FREEZE_EFFECT: { std::list<Creature*> IcicleSnowdriftList; GetCreatureListWithEntryInGrid(IcicleSnowdriftList, me, NPC_SNOWPACKED_ICICLE, 100.0f); for (std::list<Creature*>::iterator itr = IcicleSnowdriftList.begin(); itr != IcicleSnowdriftList.end(); ++itr) (*itr)->CastSpell(me, SPELL_FLASH_FREEZE_VISUAL, true); FlashFreeze(); events.CancelEvent(EVENT_FLASH_FREEZE_EFFECT); events.ScheduleEvent(EVENT_FLASH_FREEZE, urand(25000, 35000)); break; } case EVENT_BLOWS: DoScriptText(SAY_STALACTITE, me); DoScriptText(EMOTE_BLOWS, me); DoCast(me, SPELL_FROZEN_BLOWS); events.ScheduleEvent(EVENT_BLOWS, urand(60000, 65000)); break; case EVENT_RARE_CACHE: DoScriptText(SAY_HARD_MODE_FAILED, me); iCouldSayThatThisCacheWasRare = false; instance->SetData(DATA_HODIR_RARE_CACHE, 0); events.CancelEvent(EVENT_RARE_CACHE); break; case EVENT_BERSERK: DoScriptText(SAY_BERSERK, me); DoCast(me, SPELL_BERSERK, true); events.CancelEvent(EVENT_BERSERK); break; } } if (gettingColdInHereTimer <= diff && gettingColdInHere) { std::list<HostileReference*> ThreatList = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) { AuraPtr BitingColdAura = target->GetAura(SPELL_BITING_COLD_TRIGGERED); if (BitingColdAura != NULLAURA) if ((target->GetTypeId() == TYPEID_PLAYER) && (BitingColdAura->GetStackAmount() > 2)) me->AI()->SetData(DATA_GETTING_COLD_IN_HERE, 0); } gettingColdInHereTimer = 1000; } else gettingColdInHereTimer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(uint32 const diff) { events.Update(diff); std::list<Player*> PL_list; std::list<Creature*> Cr_list; if (pre) { JadeCore::AnyPlayerInObjectRangeCheck check(me, 1.0f); JadeCore::PlayerListSearcher<JadeCore::AnyPlayerInObjectRangeCheck> searcher(me, PL_list, check); me->VisitNearbyObject(1.0f, searcher); for (std::list<Player*>::const_iterator it = PL_list.begin(); it != PL_list.end(); ++it) { if (!(*it)) return; if ((*it)->HasAura(STICKY_RESIN_DOT)) { (*it)->RemoveAura(STICKY_RESIN_DOT); if (!me->HasAura(AMBER_TRAP_STACKS_PRE_FROZEN)) { me->AddAura(AMBER_TRAP_STACKS_PRE_FROZEN, me); } else { AuraPtr aura_B = me->GetAura(AMBER_TRAP_STACKS_PRE_FROZEN); if (aura_B) { aura_B->SetStackAmount(aura_B->GetStackAmount() + 1); } } } } if (me->HasAura(AMBER_TRAP_STACKS_PRE_FROZEN)) { AuraPtr aur = me->GetAura(AMBER_TRAP_STACKS_PRE_FROZEN); if (pre) { if (aur) { if (aur->GetStackAmount() >= 5) { me->SetObjectScale(1.5f); pre = false; post = true; } } } } } if (post) { JadeCore::AnyCreatureInObjectRangeCheck check(me, 3.0f); JadeCore::CreatureListSearcher<JadeCore::AnyCreatureInObjectRangeCheck> searcher(me, Cr_list, check); me->VisitNearbyObject(3.0f, searcher); for (std::list<Creature*>::const_iterator it = Cr_list.begin(); it != Cr_list.end(); ++it) { if (!(*it)) return; if ((*it)->GetEntry() == 63591) { (*it)->AddAura(AMBER_TRAP, (*it)); me->DespawnOrUnsummon(); } } } }
void UpdateAI(uint32 const diff) { events.Update(diff); if (!UpdateVictim()) return; if (phase1_timer) { if (phase1 <= diff) { phase1_timer = false; phase2_timer = true; deadvanced = true; me->CastSpell(me, ADVANCE); if (me->HasAura(ADVANCE)) { AuraPtr Advance = me->GetAura(ADVANCE); if (Advance) { Advance->SetDuration(10000000); } } me->MonsterSay("Power.. I must have more power.. Guards, Protect your empress!", LANG_UNIVERSAL, me->GetGUID()); DoPlaySoundToSet(me, 29270); events.ScheduleEvent(EVENT_SUMMON_MOBS, 500); events.ScheduleEvent(EVENT_ADVANCE, 500); } else phase1 -= diff; } if (phase2_timer) { if (phase2 <= diff) { phase2_timer = false; if (deadvanced) { deadvanced = false; me->RemoveAura(ADVANCE); events.ScheduleEvent(EVENT_DEADVANCE, 500); } } else phase2 -= diff; } if (thirdphase) { if (Unit* victim = me->getVictim()) { if (!me->IsWithinDistInMap(victim, 2.0f)) { events.ScheduleEvent(EVENT_MOVE_FIX, 1000); } } } if (SayCharmed) { SayCharmed = false; me->MonsterYell("You are mine now!", LANG_UNIVERSAL, me->GetGUID()); DoPlaySoundToSet(me, 29282); } // Introduction RP while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_SUMMON_MOBS: // side a me->SummonCreature(MOB_REAVER, -2453.20f, 989.60f, 569.630f, 3.498173f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(MOB_WIND, -2448.70f, 992.45f, 569.630f, 3.407852f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(MOB_WIND, -2445.68f, 989.26f, 569.630f, 3.407852f, TEMPSUMMON_MANUAL_DESPAWN); // side b me->SummonCreature(MOB_REAVER, -2504.68f, 987.24f, 569.630f, 0.295318f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(MOB_WIND, -2508.52f, 981.49f, 569.630f, 0.295318f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(MOB_WIND, -2510.62f, 992.30f, 569.630f, 0.295318f, TEMPSUMMON_MANUAL_DESPAWN); break; case EVENT_ADVANCE: me->SetDisplayId(11686); // invis if (MotionMaster* motion = me->GetMotionMaster()) motion->MovePoint(1, -2476.62f, 1035.45f, 572.818f); me->SetReactState(REACT_PASSIVE); me->AddUnitState(UNIT_STATE_CANNOT_AUTOATTACK); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); events.CancelEvent(EVENT_DEAD_SCREECH); events.CancelEvent(EVENT_CRY_TERROR); events.CancelEvent(EVENT_EYE_OF_THE_EMPRESS); events.CancelEvent(EVENT_DISSONANCE_SHIELD); me->DespawnCreaturesInArea(DISSONANCE_SHIELD_TRIGGER); me->SetSpeed(MOVE_RUN, 0.0f); break; case EVENT_DEADVANCE: me->SetDisplayId(42730); // originial dis events.ScheduleEvent(EVENT_CRY_TERROR, 7500); events.ScheduleEvent(EVENT_DEAD_SCREECH, 10000); events.ScheduleEvent(EVENT_EYE_OF_THE_EMPRESS, 8000); events.ScheduleEvent(EVENT_DISSONANCE_SHIELD, 30000); me->Attack(me->getVictim(), true); me->SetReactState(REACT_AGGRESSIVE); me->ClearUnitState(UNIT_STATE_CANNOT_AUTOATTACK); me->SetSpeed(MOVE_RUN, 1.13f); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); break; case EVENT_CRY_TERROR: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true)) { me->AddAura(123788, target); } events.ScheduleEvent(EVENT_CRY_TERROR, 7500); break; case EVENT_DEAD_SCREECH: for (int i = 0; i <= 1; i++) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true)) { me->CastSpell(target, DEAD_SCREECH_DMG); } } events.ScheduleEvent(EVENT_DEAD_SCREECH, 10000); break; case EVENT_EYE_OF_THE_EMPRESS: if (!me->getVictim()->HasAura(EYE_OF_THE_EMPRESS)) { me->getVictim()->CastSpell(me->getVictim(), EYE_OF_THE_EMPRESS); } else { AuraPtr aura_B = me->getVictim()->GetAura(EYE_OF_THE_EMPRESS); if (aura_B && aura_B->GetStackAmount() <= 5) { aura_B->SetStackAmount(aura_B->GetStackAmount() + 1); } } events.ScheduleEvent(EVENT_EYE_OF_THE_EMPRESS, 6000); break; case EVENT_DISSONANCE_SHIELD: if (!me->FindNearestCreature(DISSONANCE_SHIELD_TRIGGER, 100.0f, true)) { me->SummonCreature(DISSONANCE_SHIELD_TRIGGER, dis_1, TEMPSUMMON_MANUAL_DESPAWN, 0); me->SummonCreature(DISSONANCE_SHIELD_TRIGGER, dis_2, TEMPSUMMON_MANUAL_DESPAWN, 0); } events.ScheduleEvent(EVENT_DISSONANCE_SHIELD, 65000); break; // phase 3 case EVENT_SHA_ENERGY: int count; if (Is25ManRaid()) count = 4; else count = 1; for (int i = 0; i <= count; i++) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true)) { me->CastSpell(target, SHA_ENERGY); } } events.ScheduleEvent(EVENT_SHA_ENERGY, 10000); break; case EVENT_AMASSING_DARKNESS: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true)) { if (!target->HasAura(AMASSING_DARKNESS_AURA)) { me->CastSpell(target, AMASSING_DARKNESS); me->AddAura(AMASSING_DARKNESS_AURA, target); } UnitList targets; JadeCore::AnyUnitHavingBuffInObjectRangeCheck u_check(target, target, 100, AMASSING_DARKNESS_AURA, true); JadeCore::UnitListSearcher<JadeCore::AnyUnitHavingBuffInObjectRangeCheck> searcher(target, targets, u_check); target->VisitNearbyObject(100, searcher); for (UnitList::const_iterator it = targets.begin(); it != targets.end(); ++it) { if (!(*it)) return; if ((*it)->GetGUID() != target->GetGUID()) me->CastSpell((*it), AMASSING_DARKNESS); } if (Is25ManRaid()) events.ScheduleEvent(EVENT_AMASSING_DARKNESS, 2500); else events.ScheduleEvent(EVENT_AMASSING_DARKNESS, 6500); } break; case EVENT_CONSUMING_TERROR: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true)) { // cancel first phase abilities events.CancelEvent(EVENT_SHA_ENERGY); events.CancelEvent(EVENT_AMASSING_DARKNESS);; events.CancelEvent(EVENT_VISIONS_OF_DEMISE); events.CancelEvent(EVENT_CALAMITY); // scehdule new abilities third phase events.ScheduleEvent(EVENT_SHA_ENERGY, 10000); events.ScheduleEvent(EVENT_AMASSING_DARKNESS, 10000); events.ScheduleEvent(EVENT_CONSUMING_TERROR, 40000); events.ScheduleEvent(EVENT_VISIONS_OF_DEMISE, urand(29000, 35000)); events.ScheduleEvent(EVENT_CALAMITY, urand(15000, 20000)); me->CastSpell(target, CONSUMING_TERROR); events.ScheduleEvent(EVENT_CONSUMING_TERROR, 40000); } break; case EVENT_CALAMITY: DoCastAOE(CALAMITY); events.ScheduleEvent(EVENT_CALAMITY, 20000); break; case EVENT_VISIONS_OF_DEMISE: for (int i = 0; i <= 1; i++) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true)) { me->AddAura(124862, target); } } events.ScheduleEvent(EVENT_VISIONS_OF_DEMISE, urand(29000, 35000)); break; case EVENT_MOVE_FIX: if (Unit* victim = me->getVictim()) { if (!me->IsWithinDistInMap(victim, 2.0f)) { if (MotionMaster* motion = me->GetMotionMaster()) { motion->MovePoint(1, victim->GetPositionX(), victim->GetPositionY(), victim->GetPositionZ()); } events.ScheduleEvent(EVENT_MOVE_FIX, 2000); } } break; } } DoMeleeAttackIfReady(); }