Пример #1
0
        public override void OnThink()
        {
            if (SummonMaster?.Deleted != false)
            {
                Delete();
            }

            /*
             * On OSI, without combatant, they behave as if they have been
             * given "come" command, ie they wander towards their summoner,
             * but never actually "follow".
             */
            else if (!Combat(this))
            {
                AIObject?.MoveTo(SummonMaster, false, 5);
            }

            /*
             * On OSI, if the summon attacks a mobile, the summoner meer also
             * attacks them, regardless of karma, etc. as long as the combatant
             * is a player or controlled/summoned, and the summoner is not already
             * engaged in combat.
             */
            else if (!Combat(SummonMaster))
            {
                if (Combatant.Player || Combatant is BaseCreature bc && (bc.Controlled || bc.SummonMaster != null))
                {
                    SummonMaster.Combatant = Combatant;
                }
            }
            else
            {
                base.OnThink();
            }
        }
Пример #2
0
        public override void OnThink()
        {
            if (Deleted || Map == null)
            {
                return;
            }

            Mobile master = ControlMaster;

            if (master == null || master.Deleted)
            {
                DropPackContents();
                EndRelease(null);
                return;
            }

            if (m_LastHidden != master.Hidden)
            {
                Hidden = m_LastHidden = master.Hidden;
            }

            if (RangeCheck())
            {
                if (AIObject != null && AIObject.WalkMobileRange(master, 5, true, 1, 1))
                {
                    if (master.Combatant != null && master.InRange(master.Combatant, 1) && Core.TickCount > m_NextMove)
                    {
                        IDamageable combatant = master.Combatant;

                        if (!InRange(combatant.Location, 1))
                        {
                            for (int x = combatant.X - 1; x <= combatant.X + 1; x++)
                            {
                                for (int y = combatant.Y - 1; y <= combatant.Y + 1; y++)
                                {
                                    if (x == combatant.X && y == combatant.Y)
                                    {
                                        continue;
                                    }

                                    Point2D p = new Point2D(x, y);

                                    if (InRange(p, 1) && master.InRange(p, 1) && Map != null)
                                    {
                                        CurrentSpeed = .01;
                                        AIObject.MoveTo(new Point3D(x, y, Map.GetAverageZ(x, y)), false, 0);
                                        m_NextMove = Core.TickCount + 500;
                                    }
                                }
                            }
                        }
                        else
                        {
                            CurrentSpeed = .1;
                        }
                    }
                    else if (master.Combatant == null)
                    {
                        CurrentSpeed = .1;
                    }
                }
                else
                {
                    CurrentSpeed = .1;
                }
            }
        }
Пример #3
0
        public override void OnThink()
        {
            if (ControlMaster != null && QuestOverride)
            {
                if (X == 1076 && Y == 450)
                {
                    AIObject.MoveTo(ControlMaster, false, 1);

                    PlayerMobile pm = ControlMaster as PlayerMobile;

                    if (pm != null)
                    {
                        QuestSystem qs = pm.Quest;

                        if (qs is DarkTidesQuest)
                        {
                            QuestObjective obj = qs.FindObjective(typeof(FetchAbraxusScrollObjective));

                            if (obj != null && !obj.Completed)
                            {
                                AddToBackpack(new ScrollOfAbraxus());
                                obj.Complete();

                                CurrentSpeed  = 0.1;
                                QuestOverride = false;
                            }
                        }
                    }
                }

                return;
            }

            base.OnThink();

            if (DateTime.UtcNow < m_NextPickup)
            {
                return;
            }

            m_NextPickup = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(5, 10));

            Container pack = Backpack;

            if (pack == null)
            {
                return;
            }

            ArrayList list = new ArrayList();

            foreach (Item item in GetItemsInRange(2))
            {
                if (item.Movable && item.Stackable)
                {
                    list.Add(item);
                }
            }

            int pickedUp = 0;

            for (int i = 0; i < list.Count; ++i)
            {
                Item item = (Item)list[i];

                if (!pack.CheckHold(this, item, false, true))
                {
                    return;
                }

                bool     rejected;
                LRReason reject;

                NextActionTime = Core.TickCount;

                Lift(item, item.Amount, out rejected, out reject);

                if (rejected)
                {
                    continue;
                }

                Drop(this, Point3D.Zero);

                if (++pickedUp == 3)
                {
                    break;
                }
            }
        }
Пример #4
0
            public override void OnThink()
            {
                base.OnThink();

                if (Deleted || !Alive || Aspect == null || !Aspect.InCombat() || Core.TickCount < _NextHeal)
                {
                    return;
                }

                if (ControlMaster != Aspect)
                {
                    ControlMaster = Aspect;
                }

                if (ControlTarget != Aspect)
                {
                    ControlTarget = Aspect;
                }

                if (ControlOrder != OrderType.Follow)
                {
                    ControlOrder = OrderType.Follow;
                }

                if (!InRange(Aspect, Aspect.RangePerception))
                {
                    AIObject.MoveTo(Aspect, true, Aspect.RangePerception);

                    return;
                }

                _NextHeal = Core.TickCount + 5000;

                var q = new MovingEffectQueue();

                q.Callback = q.Dispose;

                for (var i = 0; i < 5; i++)
                {
                    var fx = new MovingEffectInfo(
                        this,
                        Aspect,
                        Map,
                        0x36F4,
                        1150,
                        10,
                        EffectRender.LightenMore,
                        TimeSpan.FromMilliseconds(200));

                    fx.ImpactCallback += HealAspect;

                    q.Add(fx);
                }

                if (this.PlayAttackAnimation())
                {
                    this.PlayAttackSound();

                    this.TryParalyze(
                        TimeSpan.FromSeconds(1.5),
                        m =>
                    {
                        SpellHelper.Turn(m, Aspect);

                        q.Process();
                    });
                }
                else
                {
                    SpellHelper.Turn(this, Aspect);

                    q.Process();
                }
            }