Exemplo n.º 1
0
            public void Release()
            {
                m_Grabber.EndAction(typeof(BasePotion));
                m_Grabber.EndAction(typeof(BaseWeapon));
                m_Grabbed.EndAction(typeof(BasePotion));
                m_Grabbed.EndAction(typeof(BaseWeapon));
                m_Grabbed.EndAction(typeof(BaseMount));

                m_Grabbed.CantWalk = false;
                m_Grabbed.Frozen   = false;

                Grabbers.Remove(m_Grabber);
                Stop();
            }
Exemplo n.º 2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (!(targeted is TeiravonMobile))
                {
                    from.SendMessage("You must target another player.");
                }
                else if (!(( TeiravonMobile )targeted).Alive || !from.Alive)
                {
                    from.SendMessage("You must target a living player.");
                }
                else if (( TeiravonMobile )targeted == ( TeiravonMobile )from)
                {
                    from.SendMessage("You must target another player.");
                }
                else if (from.Mounted)
                {
                    from.SendMessage("You must be on foot to initially grab a player.");
                }
                else if ((( TeiravonMobile )targeted).Mounted)
                {
                    from.SendMessage("Your target must be on foot to be grabbed.");
                }
                //else if ( ( ( TeiravonMobile )targeted ).FindItemOnLayer( Layer.OneHanded ) != null || ( ( TeiravonMobile )targeted ).FindItemOnLayer( Layer.TwoHanded ) != null )
                //	from.SendMessage( "You must first disarm your target." );
                else if (Grabbers.Contains(from))                               // Sanity check
                {
                    from.SendMessage("You can only grab one person at a time.");
                }
                else if (Grabbers.Contains((( TeiravonMobile )targeted)))
                {
                    from.SendMessage("You can't get a hold on {0} right now.", (( TeiravonMobile )targeted).Female ? "her" : "him");
                }
                else
                {
                    TeiravonMobile grabbed = ( TeiravonMobile )targeted;

                    foreach (GrabTimer timer in Grabbers.Values)
                    {
                        if (timer.Grabbed == grabbed)
                        {
                            from.SendMessage("{0} is already being held.", grabbed.Name);
                            return;
                        }
                    }

                    int grabvalue   = 0;
                    int defendvalue = 0;

                    GetValues(( TeiravonMobile )from, grabbed, out grabvalue, out defendvalue);

                    // We grabbed them.
                    if (grabvalue > defendvalue || (grabvalue == defendvalue && Utility.RandomBool()))
                    {
                        GrabTimer timer = new GrabTimer(( TeiravonMobile )from, grabbed);

                        Grabbers.Add(( TeiravonMobile )from, timer);
                        timer.Start();

                        from.Emote("*successfully grabs {0}!*", grabbed.Name);
                        BaseWeapon.BlockEquip(from, TimeSpan.FromMinutes(10.0));
                        BasePotion.BlockEquip(from, TimeSpan.FromMinutes(10.0));
                        grabbed.ClearHands();
                        BaseWeapon.BlockEquip(grabbed, TimeSpan.FromMinutes(10.0));
                        BasePotion.BlockEquip(grabbed, TimeSpan.FromMinutes(10.0));
                        grabbed.BeginAction(typeof(BaseMount));
                        grabbed.Freeze(TimeSpan.FromMinutes(10.0));

                        BaseMount.Dismount(grabbed);
                    }
                    else
                    {
                        from.Emote("*fails to grab {0}!*", grabbed.Name);
                    }
                }
            }