Пример #1
0
        public override void UpdateAI(uint diff)
        {
            if (me.ToTotem().GetTotemType() != TotemType.Active)
            {
                return;
            }

            if (!me.IsAlive() || me.IsNonMeleeSpellCast(false))
            {
                return;
            }

            // Search spell
            var spellInfo = Global.SpellMgr.GetSpellInfo(me.ToTotem().GetSpell(), me.GetMap().GetDifficultyID());

            if (spellInfo == null)
            {
                return;
            }

            // Get spell range
            float max_range = spellInfo.GetMaxRange(false);

            // SpellModOp.Range not applied in this place just because not existence range mods for attacking totems

            Unit victim = !_victimGuid.IsEmpty() ? Global.ObjAccessor.GetUnit(me, _victimGuid) : null;

            // Search victim if no, not attackable, or out of range, or friendly (possible in case duel end)
            if (victim == null || !victim.IsTargetableForAttack() || !me.IsWithinDistInMap(victim, max_range) ||
                me.IsFriendlyTo(victim) || !me.CanSeeOrDetect(victim))
            {
                var u_check = new NearestAttackableUnitInObjectRangeCheck(me, me.GetCharmerOrOwnerOrSelf(), max_range);
                var checker = new UnitLastSearcher(me, u_check);
                Cell.VisitAllObjects(me, checker, max_range);
                victim = checker.GetTarget();
            }

            // If have target
            if (victim != null)
            {
                // remember
                _victimGuid = victim.GetGUID();

                // attack
                me.CastSpell(victim, me.ToTotem().GetSpell());
            }
            else
            {
                _victimGuid.Clear();
            }
        }
Пример #2
0
 public AreaTrigger_at_frostgrips_hollow() : base("at_frostgrips_hollow")
 {
     stormforgedMonitorGUID.Clear();
     stormforgedEradictorGUID.Clear();
 }
Пример #3
0
 public virtual void SetUnassigned()
 {
     _assignedTo.Clear();
 }