コード例 #1
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            Mobile from = e.Mobile;
            Mobile mob  = (Mobile)obj;

            CommandLogging.WriteLine(from, "{0} {1} dismounting {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob));

            bool takenAction = false;

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

                if (item is IMountItem)
                {
                    IMount mount = ((IMountItem)item).Mount;

                    if (mount != null)
                    {
                        mount.Rider = null;
                        if (mob is TeiravonMobile)
                        {
                            TeiravonMobile tm = (TeiravonMobile)mob;
                            tm.Dismounted();
                        }
                        takenAction = true;
                    }

                    if (mob.Items.IndexOf(item) == -1)
                    {
                        --i;
                    }
                }
            }

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

                if (item.Layer == Layer.Mount)
                {
                    takenAction = true;
                    item.Delete();
                    --i;
                }
            }

            if (takenAction)
            {
                AddResponse("They have been dismounted.");
            }
            else
            {
                LogFailure("They were not mounted.");
            }
        }
コード例 #2
0
        public override bool OnMoveOver(Mobile m)
        {
            if (m.LegsArmor != null && m.LegsArmor is PlateLegs)
            {
                m.SendMessage("The caltrops have no effect on you...");
            }
            else if (m.Mounted)
            {
                if (Utility.RandomBool())
                {
                    BaseMount.Dismount(m);
                    if (m is TeiravonMobile)
                    {
                        TeiravonMobile tm = (TeiravonMobile)m;
                        tm.Dismounted();
                    }

                    m.Emote("*You see {0} is thrown from {1} mount!*", m.Name, m.Female ? "her" : "his");
                    m.SendMessage("Your mount stumbles over the caltrops!");

                    m.Freeze(TimeSpan.FromSeconds(3.0));
                }
                else if (Utility.RandomBool())
                {
                    m.Emote("*You see {0}'s mount stumble, but keep its footing.*", m.Name);

                    m.Freeze(TimeSpan.FromSeconds(1.0));
                }
                else
                {
                    m.Emote("The caltrops have no effect on your mount.");
                }
            }
            else
            {
                if (Utility.RandomBool())
                {
                    m.Freeze(TimeSpan.FromSeconds(1.0));
                }

                m.Stam = (int)(m.Stam * .25);

                m.Emote("*You see {0} stumble over the caltrops!*", m.Name);
            }

            if (Utility.RandomBool())
            {
                Delete();
            }

            return(base.OnMoveOver(m));
        }
コード例 #3
0
 protected override void OnTick()
 {
     if (!m_Creature.Deleted)
     {
         if (m_Creature is BaseMount)
         {
             BaseMount bm = (BaseMount)m_Creature;
             if (bm.Rider != null)
             {
                 Mobile mob = (Mobile)bm.Rider;
                 if (mob is TeiravonMobile)
                 {
                     TeiravonMobile tm = (TeiravonMobile)mob;
                     tm.Dismounted();
                 }
             }
         }
         m_Creature.Delete();
     }
 }
コード例 #4
0
        public static readonly TimeSpan BlockMountDuration = TimeSpan.FromSeconds(10.0);           // TODO: Taken from bola script, needs to be verified

        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            if (attacker is TeiravonMobile && defender is TeiravonMobile)
            {
                TeiravonMobile tmd    = (TeiravonMobile)defender;
                TeiravonMobile tma    = (TeiravonMobile)attacker;
                int            dlevel = tmd.PlayerLevel;
                int            alevel = tma.PlayerLevel;
                int            adj    = (dlevel - alevel) * 3;
                switch (tmd.RidingSkill)
                {
                case 0:
                    adj -= 10;
                    break;

                case 2:
                    adj += 5;
                    break;

                case 3:
                    adj += 10;
                    break;

                case 4:
                    adj += 20;
                    break;

                default:
                    break;
                }
                if (Utility.Random(100) < 50 + adj)
                {
                    ClearCurrentAbility(attacker);
                    attacker.SendMessage("Your dismount attempt fails.");
                    return;
                }
            }

//			if ( attacker.Mounted && !(defender.Weapon is Lance) ) // TODO: Should there be a message here?
//				return;

            ClearCurrentAbility(attacker);

            IMount mount = defender.Mount;

            if (mount == null)
            {
                attacker.SendLocalizedMessage(1060848);                   // This attack only works on mounted targets
                return;
            }

            if (!CheckMana(attacker, true))
            {
                return;
            }

            attacker.SendLocalizedMessage(1060082);               // The force of your attack has dislodged them from their mount!

            //if ( attacker.Mounted )
            //	defender.SendLocalizedMessage( 1062315 ); // You fall off your mount!
            //else
            defender.SendLocalizedMessage(1060083);                       // You fall off of your mount and take damage!

            defender.PlaySound(0x140);
            defender.FixedParticles(0x3728, 10, 15, 9955, EffectLayer.Waist);

            if (mount.Rider is TeiravonMobile)
            {
                TeiravonMobile tm = (TeiravonMobile)mount.Rider;
                tm.Dismounted();
            }
            mount.Rider = null;

            defender.BeginAction(typeof(BaseMount));
            Timer.DelayCall(BlockMountDuration, new TimerStateCallback(ReleaseMountLock), defender);
//			if ( !attacker.Mounted )
            AOS.Damage(defender, attacker, Utility.RandomMinMax(15, 25), 100, 0, 0, 0, 0);
        }