Beispiel #1
0
        protected override void ProcessFriend()
        {
            if (!CanCast)
            {
                return;
            }
            UserMagic        magic;
            List <MapObject> TargetList = new List <MapObject>()
            {
                this,
                Owner
            };

            for (int i = 0; i < TargetList.Count; i++)
            {
                MapObject target = TargetList[i];
                if (target.Dead)
                {
                    continue;
                }

                MirDirection direction = Functions.DirectionFromPoint(CurrentLocation, target.CurrentLocation);

                if (target.Buffs.Any(b => b.Properties.HasFlag(BuffProperty.Debuff)) || target.PoisonList.Count > 0)
                {
                    magic = GetMagic(Spell.Purification);
                    if (CanUseMagic(magic))
                    {
                        BeginMagic(magic.Spell, direction, target.ObjectID, target.CurrentLocation);
                        return;
                    }
                }

                if (target.PercentHealth < 90)
                {
                    magic = GetMagic(Spell.MassHealing);
                    if (CanUseMagic(magic))
                    {
                        BeginMagic(magic.Spell, direction, target.ObjectID, target.CurrentLocation);
                        return;
                    }

                    magic = GetMagic(Spell.Healing);
                    if (CanUseMagic(magic))
                    {
                        BeginMagic(magic.Spell, direction, target.ObjectID, target.CurrentLocation);
                        return;
                    }
                }

                UserItem item = GetAmulet(1);

                if (Target != null)
                {
                    magic = GetMagic(Spell.SoulShield);
                    if (CanUseMagic(magic) && item != null && !target.HasBuff(BuffType.SoulShield))
                    {
                        BeginMagic(magic.Spell, direction, target.ObjectID, target.CurrentLocation);
                        return;
                    }

                    magic = GetMagic(Spell.BlessedArmour);
                    if (CanUseMagic(magic) && item != null && !target.HasBuff(BuffType.BlessedArmour))
                    {
                        BeginMagic(magic.Spell, direction, target.ObjectID, target.CurrentLocation);
                        return;
                    }

                    magic = GetMagic(Spell.UltimateEnhancer);
                    if (CanUseMagic(magic) && item != null && !target.HasBuff(BuffType.UltimateEnhancer))
                    {
                        BeginMagic(magic.Spell, direction, target.ObjectID, target.CurrentLocation);
                        return;
                    }
                }
            }
        }