예제 #1
0
        public override void EnterCombat(Unit victim)
        {
            if (Spells.Empty())
            {
                return;
            }

            int  spell = (int)(RandomHelper.Rand32() % Spells.Count);
            uint count = 0;

            foreach (var id in Spells)
            {
                AISpellInfoType info = GetAISpellInfo(id, me.GetMap().GetDifficultyID());
                if (info.condition == AICondition.Aggro)
                {
                    me.CastSpell(victim, id, false);
                }
                else if (info.condition == AICondition.Combat)
                {
                    uint cooldown = info.realCooldown;
                    if (count == spell)
                    {
                        DoCast(Spells[spell]);
                        cooldown += (uint)me.GetCurrentSpellCastTime(id);
                    }
                    _events.ScheduleEvent(id, cooldown);
                }
            }
        }
예제 #2
0
        public override void UpdateAI(uint diff)
        {
            if (!UpdateVictim())
            {
                return;
            }

            _events.Update(diff);

            if (me.GetVictim().HasBreakableByDamageCrowdControlAura(me))
            {
                me.InterruptNonMeleeSpells(false);
                return;
            }

            if (me.HasUnitState(UnitState.Casting))
            {
                return;
            }

            uint spellId = _events.ExecuteEvent();

            if (spellId != 0)
            {
                DoCast(spellId);
                uint            casttime = (uint)me.GetCurrentSpellCastTime(spellId);
                AISpellInfoType info     = GetAISpellInfo(spellId, me.GetMap().GetDifficultyID());
                _events.ScheduleEvent(spellId, (casttime != 0 ? casttime : 500) + info.realCooldown);
            }
        }
예제 #3
0
        public override void InitializeAI()
        {
            base.InitializeAI();

            _attackDist = 30.0f;
            foreach (var id in Spells)
            {
                AISpellInfoType info = GetAISpellInfo(id, me.GetMap().GetDifficultyID());
                if (info.condition == AICondition.Combat && _attackDist > info.maxRange)
                {
                    _attackDist = info.maxRange;
                }
            }

            if (_attackDist == 30.0f)
            {
                _attackDist = SharedConst.MeleeRange;
            }
        }