예제 #1
0
// 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);
        }
    }
}
예제 #2
0
            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 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);
        }
    }
예제 #4
0
        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);
                        }
                    }
                }
            }
        }
예제 #5
0
            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();
					}
				}
			}
		}