コード例 #1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile iArmor = targeted as Mobile;

                    if (iArmor is BaseCreature)
                    {
                        BaseCreature xArmor = (BaseCreature)iArmor;

                        if ((xArmor is Horse || xArmor is ZebraRiding) && xArmor.ControlMaster == from && xArmor is BaseMount)
                        {
                            BaseMount mArmor = (BaseMount)xArmor;

                            if (MyServerSettings.ClientVersion())
                            {
                                mArmor.Body   = 587;
                                mArmor.ItemID = 587;
                            }
                            else
                            {
                                mArmor.Body   = 0xE2;
                                mArmor.ItemID = 0x3EA0;
                            }

                            int mod = 5;

                            if (xArmor.Hue == MaterialInfo.GetMaterialColor("dull copper", "classic", 0))
                            {
                                mod = mod - 1;
                            }
                            else if (xArmor.Hue == MaterialInfo.GetMaterialColor("shadow iron", "classic", 0))
                            {
                                mod = mod - 2;
                            }
                            else if (xArmor.Hue == MaterialInfo.GetMaterialColor("copper", "classic", 0))
                            {
                                mod = mod - 3;
                            }
                            else if (xArmor.Hue == MaterialInfo.GetMaterialColor("bronze", "classic", 0))
                            {
                                mod = mod - 4;
                            }
                            else if (xArmor.Hue == MaterialInfo.GetMaterialColor("gold", "classic", 0))
                            {
                                mod = mod - 5;
                            }
                            else if (xArmor.Hue == MaterialInfo.GetMaterialColor("agapite", "classic", 0))
                            {
                                mod = mod - 6;
                            }
                            else if (xArmor.Hue == MaterialInfo.GetMaterialColor("verite", "classic", 0))
                            {
                                mod = mod - 7;
                            }
                            else if (xArmor.Hue == MaterialInfo.GetMaterialColor("valorite", "classic", 0))
                            {
                                mod = mod - 8;
                            }
                            else if (xArmor.Hue == MaterialInfo.GetMaterialColor("nepturite", "classic", 0))
                            {
                                mod = mod - 9;
                            }
                            else if (xArmor.Hue == MaterialInfo.GetMaterialColor("obsidian", "classic", 0))
                            {
                                mod = mod - 10;
                            }
                            else if (xArmor.Hue == MaterialInfo.GetMaterialColor("steel", "classic", 0))
                            {
                                mod = mod - 11;
                            }
                            else if (xArmor.Hue == MaterialInfo.GetMaterialColor("brass", "classic", 0))
                            {
                                mod = mod - 12;
                            }
                            else if (xArmor.Hue == MaterialInfo.GetMaterialColor("mithril", "classic", 0))
                            {
                                mod = mod - 13;
                            }
                            else if (xArmor.Hue == MaterialInfo.GetMaterialColor("xormite", "classic", 0))
                            {
                                mod = mod - 14;
                            }
                            else if (xArmor.Hue == MaterialInfo.GetMaterialColor("dwarven", "classic", 0))
                            {
                                mod = mod - 15;
                            }
                            else if (xArmor.Hue == MaterialInfo.GetMaterialColor("silver", "classic", 0))
                            {
                                mod = mod - 0;
                            }

                            if (m_ArmorMaterial == "Dull Copper")
                            {
                                mod = mod + 1;              xArmor.Hue = MaterialInfo.GetMaterialColor("dull copper", "classic", 0);
                            }
                            else if (m_ArmorMaterial == "Shadow Iron")
                            {
                                mod = mod + 2;              xArmor.Hue = MaterialInfo.GetMaterialColor("shadow iron", "classic", 0);
                            }
                            else if (m_ArmorMaterial == "Copper")
                            {
                                mod = mod + 3;              xArmor.Hue = MaterialInfo.GetMaterialColor("copper", "classic", 0);
                            }
                            else if (m_ArmorMaterial == "Bronze")
                            {
                                mod = mod + 4;              xArmor.Hue = MaterialInfo.GetMaterialColor("bronze", "classic", 0);
                            }
                            else if (m_ArmorMaterial == "Gold")
                            {
                                mod = mod + 5;              xArmor.Hue = MaterialInfo.GetMaterialColor("gold", "classic", 0);
                            }
                            else if (m_ArmorMaterial == "Agapite")
                            {
                                mod = mod + 6;              xArmor.Hue = MaterialInfo.GetMaterialColor("agapite", "classic", 0);
                            }
                            else if (m_ArmorMaterial == "Verite")
                            {
                                mod = mod + 7;              xArmor.Hue = MaterialInfo.GetMaterialColor("verite", "classic", 0);
                            }
                            else if (m_ArmorMaterial == "Valorite")
                            {
                                mod = mod + 8;              xArmor.Hue = MaterialInfo.GetMaterialColor("valorite", "classic", 0);
                            }
                            else if (m_ArmorMaterial == "Nepturite")
                            {
                                mod = mod + 9;              xArmor.Hue = MaterialInfo.GetMaterialColor("nepturite", "classic", 0);
                            }
                            else if (m_ArmorMaterial == "Obsidian")
                            {
                                mod = mod + 10;     xArmor.Hue = MaterialInfo.GetMaterialColor("obsidian", "classic", 0);
                            }
                            else if (m_ArmorMaterial == "Steel")
                            {
                                mod = mod + 11;     xArmor.Hue = MaterialInfo.GetMaterialColor("steel", "classic", 0);
                            }
                            else if (m_ArmorMaterial == "Brass")
                            {
                                mod = mod + 12;     xArmor.Hue = MaterialInfo.GetMaterialColor("brass", "classic", 0);
                            }
                            else if (m_ArmorMaterial == "Mithril")
                            {
                                mod = mod + 13;     xArmor.Hue = MaterialInfo.GetMaterialColor("mithril", "classic", 0);
                            }
                            else if (m_ArmorMaterial == "Xormite")
                            {
                                mod = mod + 14;     xArmor.Hue = MaterialInfo.GetMaterialColor("xormite", "classic", 0);
                            }
                            else if (m_ArmorMaterial == "Dwarven")
                            {
                                mod = mod + 15;     xArmor.Hue = MaterialInfo.GetMaterialColor("dwarven", "classic", 0);
                            }
                            else
                            {
                                mod = mod + 0;              xArmor.Hue = MaterialInfo.GetMaterialColor("silver", "classic", 0);
                            }

                            xArmor.SetStr(xArmor.RawStr + mod);
                            xArmor.SetDex(xArmor.RawDex + mod);
                            xArmor.SetInt(xArmor.RawInt + mod);

                            xArmor.SetHits(xArmor.HitsMax + mod);

                            xArmor.SetDamage(xArmor.DamageMin + mod, xArmor.DamageMax + mod);

                            xArmor.SetResistance(ResistanceType.Physical, xArmor.PhysicalResistance + mod);

                            xArmor.SetSkill(SkillName.MagicResist, xArmor.Skills[SkillName.MagicResist].Base + mod);
                            xArmor.SetSkill(SkillName.Tactics, xArmor.Skills[SkillName.Tactics].Base + mod);
                            xArmor.SetSkill(SkillName.Wrestling, xArmor.Skills[SkillName.Wrestling].Base + mod);

                            from.RevealingAction();
                            from.PlaySound(0x0AA);

                            m_Horse.Consume();
                        }
                        else
                        {
                            from.SendMessage("This armor is only for horses you own.");
                        }
                    }
                    else
                    {
                        from.SendMessage("This armor is only for horses you own.");
                    }
                }
            }
コード例 #2
0
        // disable the default use of the target
        public override bool BlockDefaultOnUse(Mobile from, object target)
        {
            ConfiguredPetXML c = new ConfiguredPetXML();

            if (c.EnableLvLMountChkonPetAtt == false)
            {
                return(false);
            }

            var mount2 = ((BaseCreature)this.AttachedTo);
            XMLPlayerLevelAtt xmlplayer = (XMLPlayerLevelAtt)XmlAttach.FindAttachment(from, typeof(XMLPlayerLevelAtt));

            if (xmlplayer == null)
            {
                return(false);
            }

            if (mount2 is BaseMount)
            {
                BaseMount mount = (BaseMount)mount2;
                if (mount is Beetle)
                {
                    if (xmlplayer.Levell >= c.Beetle)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Beetle);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is DesertOstard)
                {
                    if (xmlplayer.Levell >= c.DesertOstard)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.DesertOstard);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is FireSteed)
                {
                    if (xmlplayer.Levell >= c.FireSteed)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.FireSteed);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is ForestOstard)
                {
                    if (xmlplayer.Levell >= c.ForestOstard)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.ForestOstard);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is FrenziedOstard)
                {
                    if (xmlplayer.Levell >= c.FrenziedOstard)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.FrenziedOstard);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is HellSteed)
                {
                    if (xmlplayer.Levell >= c.HellSteed)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.HellSteed);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Hiryu)
                {
                    if (xmlplayer.Levell >= c.Hiryu)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Hiryu);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Horse)
                {
                    if (xmlplayer.Levell >= c.Horse)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Horse);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Kirin)
                {
                    if (xmlplayer.Levell >= c.Kirin)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Kirin);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is LesserHiryu)
                {
                    if (xmlplayer.Levell >= c.LesserHiryu)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.LesserHiryu);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Nightmare)
                {
                    if (xmlplayer.Levell >= c.Nightmare)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Nightmare);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is RidableLlama)
                {
                    if (xmlplayer.Levell >= c.RidableLlama)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.RidableLlama);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Ridgeback)
                {
                    if (xmlplayer.Levell >= c.Ridgeback)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Ridgeback);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is SavageRidgeback)
                {
                    if (xmlplayer.Levell >= c.SavageRidgeback)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.SavageRidgeback);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is ScaledSwampDragon)
                {
                    if (xmlplayer.Levell >= c.ScaledSwampDragon)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.ScaledSwampDragon);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is SeaHorse)
                {
                    if (xmlplayer.Levell >= c.SeaHorse)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.SeaHorse);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is SilverSteed)
                {
                    if (xmlplayer.Levell >= c.SilverSteed)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.SilverSteed);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is SkeletalMount)
                {
                    if (xmlplayer.Levell >= c.SkeletalMount)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.SkeletalMount);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is SwampDragon)
                {
                    if (xmlplayer.Levell >= c.SwampDragon)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.SwampDragon);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Unicorn)
                {
                    if (xmlplayer.Levell >= c.Unicorn)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Unicorn);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Reptalon)
                {
                    if (xmlplayer.Levell >= c.Reptalon)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Reptalon);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is WildTiger)
                {
                    if (xmlplayer.Levell >= c.WildTiger)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.WildTiger);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Windrunner)
                {
                    if (xmlplayer.Levell >= c.Windrunner)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Windrunner);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Lasher)
                {
                    if (xmlplayer.Levell >= c.Lasher)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Lasher);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is Eowmu)
                {
                    if (xmlplayer.Levell >= c.Eowmu)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.Eowmu);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is DreadWarhorse)
                {
                    if (xmlplayer.Levell >= c.DreadWarhorse)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.DreadWarhorse);
                        return(BlockDefaultUse);
                    }
                }
                else if (mount is CuSidhe)
                {
                    if (xmlplayer.Levell >= c.CuSidhe)
                    {
                        from.SendMessage("Your level allows you to ride {0}.", mount.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("You must be Level {0} to ride me!", c.CuSidhe);
                        return(BlockDefaultUse);
                    }
                }
                else
                {
                    /*	If mount isn't on the list and has an attachment it will hit this return
                     *      statement. Add it to this list and also add an entry to configuration file. */
                    return(false);
                }
            }
            if (mount2 is BaseCreature)
            {
                return(false);
            }

            from.SendMessage("You are not at the right Level to ride me!");
            return(BlockDefaultUse);  //Fail catch for Creatures on this list but have the attachment
        }
コード例 #3
0
        public static MorphResult Morph(Mobile m, int entryID)
        {
            if (entryID < 0 || entryID >= m_Entries.Length)
            {
                return(MorphResult.Fail);
            }

            AnimalFormEntry entry = m_Entries[entryID];

            AddLastAnimalForm(m, entryID); //On OSI, it's the last /attempted/ one not the last succeeded one

            if (m.Skills.Ninjitsu.Value < entry.ReqSkill)
            {
                string args = String.Format("{0}\t{1}\t ", entry.ReqSkill.ToString("F1"), SkillName.Ninjitsu);
                m.SendLocalizedMessage(1063013, args);
                // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
                return(MorphResult.NoSkill);
            }

            /*
             * if( !m.CheckSkill( SkillName.Ninjitsu, entry.ReqSkill, entry.ReqSkill + 37.5 ) )
             * return MorphResult.Fail;
             *
             * On OSI,it seems you can only gain starting at '0' using Animal form.
             */

            double ninjitsu = m.Skills.Ninjitsu.Value;

            if (ninjitsu < entry.ReqSkill + 37.5)
            {
                double chance = (ninjitsu - entry.ReqSkill) / 37.5;

                if (chance < Utility.RandomDouble())
                {
                    return(MorphResult.Fail);
                }
            }

            m.CheckSkill(SkillName.Ninjitsu, 0.0, 37.5);

            if (!BaseFormTalisman.EntryEnabled(m, entry.Type))
            {
                return(MorphResult.Success); // Still consumes mana, just no effect
            }

            BaseMount.Dismount(m);

            int bodyMod = entry.BodyMod;
            int hueMod  = entry.HueMod;

            m.BodyMod = bodyMod;
            m.HueMod  = hueMod;

            if (entry.SpeedBoost)
            {
                m.SendSpeedControl(SpeedControlType.MountSpeed);
            }

            SkillMod mod = null;

            if (entry.StealthBonus)
            {
                mod         = new DefaultSkillMod(SkillName.Stealth, true, 20.0);
                mod.ObeyCap = true;
                m.AddSkillMod(mod);
            }

            SkillMod stealingMod = null;

            if (entry.StealingBonus)
            {
                stealingMod         = new DefaultSkillMod(SkillName.Stealing, true, 10.0);
                stealingMod.ObeyCap = true;
                m.AddSkillMod(stealingMod);
            }

            Timer timer = new AnimalFormTimer(m, bodyMod, hueMod);

            timer.Start();

            AddContext(m, new AnimalFormContext(timer, mod, entry.SpeedBoost, entry.Type, stealingMod));
            return(MorphResult.Success);
        }
コード例 #4
0
		public override void OnAfterDelete()
		{
			if ( m_Mount != null )
				m_Mount.Delete();

			m_Mount = null;

			base.OnAfterDelete();
		}
コード例 #5
0
        public static void EventSink_Movement(MovementEventArgs e)
        {
            Mobile from = e.Mobile;

            if (!from.Player || !from.Alive || from.AccessLevel >= AccessLevel.GameMaster)
            {
                return;
            }

            int       maxWeight  = GetMaxWeight(from) + OverloadAllowance;
            int       overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight;
            bool      mounted    = from.Mount as BaseMount != null;
            BaseMount mount      = from.Mount as BaseMount;

            if (overWeight > 0)
            {
                from.Stam -= GetStamLoss(from, overWeight, (e.Direction & Direction.Running) != 0);

                if (from.Stam == 0)
                {
                    from.SendLocalizedMessage(500109);                     // You are too fatigued to move, because you are carrying too much weight!
                    e.Blocked = true;
                    return;
                }
            }

            if (!Core.UOAI && !Core.UOAR && !Core.UOMO && !mounted)
            {                   // not mounted on siege
                if (((from.Stam * 100) / Math.Max(from.StamMax, 1)) < 10)
                {
                    --from.Stam;
                }
            }
            else if (Core.UOAI || Core.UOAR || Core.UOMO)
            {                                               // mounted ot not on ai/mo
                if ((e.Direction & Direction.Running) != 0) //if you're running
                {
                    if (((from.Stam * 100) / Math.Max(from.StamMax, 1)) < 10)
                    {
                        --from.Stam;
                    }
                }
            }

            if (!Core.UOAI && !Core.UOAR && !Core.UOMO && mounted)
            {                   // mounted on siege
                if (mount.Stam == 0)
                {
                    from.SendLocalizedMessage(500108);                     // Your mount is too fatigued to move.
                    e.Blocked = true;
                    return;
                }
            }

            if (from.Stam == 0)
            {
                if (mounted && (!Core.UOAI && !Core.UOAR && !Core.UOMO))
                {
                    from.SendLocalizedMessage(500108);                     // Your mount is too fatigued to move.
                }
                else
                {
                    from.SendLocalizedMessage(500110);                     // You are too fatigued to move.
                }
                e.Blocked = true;
                return;
            }

            if (from is PlayerMobile)
            {
                PlayerMobile pm = from as PlayerMobile;
                ++pm.StepsTaken;

                if (Core.UOAI || Core.UOAR || Core.UOMO || !mounted)
                {                       // ai, mo, or not mounted on siege
                    int amt = (from.Mounted ? 48 : 16);
                    if ((pm.StepsTaken % amt) == 0)
                    {
                        --from.Stam;
                    }
                }
                else if (!Core.UOAI && !Core.UOAR && !Core.UOMO && mounted)
                {                       //mounted on siege
                    if (((pm.StepsTaken % 6) == 0) && ((e.Direction & Direction.Running) != 0))
                    {
                        // scale riders stamina loss relative to mount so that the status bar reflects something close
                        //	to the stamina available to you right now. I believe this is how old school UO looked
                        mount.RiderStamAccumulator += ((from.StamMax * 100.0) / mount.StamMax) / 100;                         // mount stam to player stam
                        int whole = (int)mount.RiderStamAccumulator;
                        mount.RiderStamAccumulator -= whole;

                        if (whole > 0)
                        {
                            from.Stam -= whole;
                        }

                        --mount.Stam;

                        if (mount.Stam <= 12 && mount.Stam > 1)
                        {
                            if (NoSpamMessage.Recall(from) == false)
                            {                                      // NoSpamMessage just keeps this message and horse sound from spamming
                                NoSpamMessage.Remember(from, 2.8);
                                from.SendLocalizedMessage(500133); // Your mount is very fatigued.
                                Effects.PlaySound(from, from.Map, mount.GetAngerSound());
                            }
                        }
                    }
                }
            }
        }
コード例 #6
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (sender == null ||
                sender.Mobile == null || sender.Mobile.Deleted ||
                info == null || info.ButtonID == 0)
            {
                return;
            }

            if (info.ButtonID < 0 &&
                sender.Mobile.AccessLevel < AccessLevel.GameMaster)
            {
                return;
            }

            Mobile pet;
            int    todo;
            int    petID;

            if (info.ButtonID < 51)
            {
                todo  = (info.ButtonID - 1) % 4;
                petID = (info.ButtonID - 1) / 4;

                if (petID < 0 || petID > m_Pets.Count - 1)
                {
                    sender.Mobile.SendMessage("The pets have changed after gump creation. Please try again.");
                    return;
                }
                pet = m_Pets[petID];

                if (pet == null || pet.Deleted)
                {
                    return;
                }

                switch (todo)
                {
                case 0:
                    //get
                    if (pet is BaseMount && ((BaseMount)pet).Rider != null)
                    {
                        BaseMount bm = (BaseMount)pet;
                        bm.Rider = null;
                        sender.Mobile.SendMessage("That creature was ridden. The rider has been dismouned.");
                    }

                    pet.MoveToWorld(sender.Mobile.Location, sender.Mobile.Map);
                    break;

                case 1:
                    //goto
                    if (pet is BaseMount && ((BaseMount)pet).Rider != null)
                    {
                        BaseMount bm = (BaseMount)pet;
                        if (bm.Rider != bm.ControlMaster)
                        {
                            sender.Mobile.SendMessage("The rider of the pet is not the owner of it. GM fun? Or something strange is going on here. Request cancelled.");
                            //return;
                        }
                        sender.Mobile.MoveToWorld(bm.Rider.Location, bm.Rider.Map);
                        sender.Mobile.SendMessage("The owner of this pet is riding it atm. You have been moved to the owner.");
                    }
                    else
                    {
                        sender.Mobile.MoveToWorld(pet.Location, pet.Map);
                    }
                    break;

                case 2:
                    //props
                    sender.Mobile.SendGump(new PropertiesGump(sender.Mobile, pet));
                    break;

                case 3:
                    //stable
                    if (pet is BaseCreature)
                    {
                        Followers.StablePet(sender.Mobile, (BaseCreature)pet);
                    }
                    break;
                }
            }
            else
            {
                int tmp = info.ButtonID - 50;
                petID = (tmp - 1) / 2;
                todo  = (tmp - 1) % 2;

                if (petID < 0 || petID > m_StabledPets.Count - 1)
                {
                    sender.Mobile.SendMessage("The pets have changed after gump creation. Please try again.");
                    return;
                }
                pet = m_StabledPets[petID];

                if (pet == null || pet.Deleted)
                {
                    return;
                }

                switch (todo)
                {
                case 0:
                    // props
                    sender.Mobile.SendGump(new PropertiesGump(sender.Mobile, pet));
                    break;

                case 1:
                    // unstable
                    if (pet is BaseCreature)
                    {
                        Followers.UnStablePet(m_Master, (BaseCreature)pet, sender.Mobile);
                    }
                    break;
                }
            }
        }
コード例 #7
0
        public static MorphResult Morph(Mobile m, int entryID)
        {
            if (entryID < 0 || entryID >= m_Entries.Length)
            {
                return(MorphResult.Fail);
            }

            AnimalFormEntry entry = m_Entries[entryID];

            m_LastAnimalForms[m] = entryID;             // On OSI, it's the last /attempted/ one not the last succeeded one

            if (m.Skills.Ninjitsu.Value < entry.ReqSkill)
            {
                string args = String.Format("{0}\t{1}\t ", entry.ReqSkill.ToString("F1"), SkillName.Ninjitsu);
                m.SendLocalizedMessage(1063013, args);                   // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
                return(MorphResult.NoSkill);
            }

            double minSkill = entry.ReqSkill - 12.5;
            double maxSkill = entry.ReqSkill + 37.5;

            if (!m.CheckSkill(SkillName.Ninjitsu, minSkill, maxSkill))
            {
                return(MorphResult.Fail);
            }

            BaseMount.Dismount(m);

            m.BodyMod = entry.BodyMod;

            if (entry.HueMod >= 0)
            {
                m.HueMod = entry.HueMod;
            }

            if (entry.SpeedBoost)
            {
                m.ForcedRun = true;
            }

            SkillMod mod = null;

            if (entry.StealthBonus)
            {
                mod         = new DefaultSkillMod(SkillName.Stealth, true, 20.0);
                mod.ObeyCap = true;
                m.AddSkillMod(mod);
            }

            #region Heritage Items

            /*
             * else if ( entry.StealingBonus )
             * {
             *      mod = new DefaultSkillMod( SkillName.Stealing, true, 10.0 );
             *      mod.ObeyCap = true;
             *      m.AddSkillMod( mod );
             * }
             */
            #endregion

            Timer timer = new AnimalFormTimer(m, entry.BodyMod, m.HueMod);
            timer.Start();

            AddContext(m, new AnimalFormContext(timer, mod, entry.SpeedBoost, entry.Type));

            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x7F3);

            BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.AnimalForm, 1075822, 1075823, String.Format("{0}\t{1}", entry.ArticleCliloc, entry.FormCliloc)));

            m.Target = null;

            return(MorphResult.Success);
        }
コード例 #8
0
        public virtual void Exit(Mobile fighter)
        {
            if (fighter == null)
            {
                return;
            }

            // teleport fighter
            if (fighter.NetState == null && MobileIsInBossArea(fighter.LogoutLocation))
            {
                fighter.LogoutMap      = this is CitadelAltar ? Map.Tokuno : Map;
                fighter.LogoutLocation = ExitDest;
            }
            else if (MobileIsInBossArea(fighter) && fighter.Map == Map)
            {
                fighter.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                fighter.PlaySound(0x1FE);

                if (this is CitadelAltar)
                {
                    fighter.MoveToWorld(ExitDest, Map.Tokuno);
                }
                else
                {
                    fighter.MoveToWorld(ExitDest, Map);
                }
            }

            // teleport his pets
            if (fighter is PlayerMobile)
            {
                foreach (BaseCreature pet in ((PlayerMobile)fighter).AllFollowers.OfType <BaseCreature>().Where(pet => pet != null &&
                                                                                                                (pet.Alive || pet.IsBonded) &&
                                                                                                                pet.Map != Map.Internal &&
                                                                                                                MobileIsInBossArea(pet)))
                {
                    if (pet is BaseMount)
                    {
                        BaseMount mount = (BaseMount)pet;

                        if (mount.Rider != null && mount.Rider != fighter)
                        {
                            mount.Rider.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                            mount.Rider.PlaySound(0x1FE);

                            if (this is CitadelAltar)
                            {
                                mount.Rider.MoveToWorld(ExitDest, Map.Tokuno);
                            }
                            else
                            {
                                mount.Rider.MoveToWorld(ExitDest, Map);
                            }

                            continue;
                        }
                        else if (mount.Rider != null)
                        {
                            continue;
                        }
                    }

                    pet.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                    pet.PlaySound(0x1FE);

                    if (this is CitadelAltar)
                    {
                        pet.MoveToWorld(ExitDest, Map.Tokuno);
                    }
                    else
                    {
                        pet.MoveToWorld(ExitDest, Map);
                    }
                }
            }

            Fighters.Remove(fighter);
            fighter.SendLocalizedMessage(1072677); // You have been transported out of this room.

            if (MasterKeys.Count == 0 && Fighters.Count == 0 && Owner != null)
            {
                StopTimers();

                Owner = null;

                if (Peerless != null)
                {
                    if (Peerless.Corpse != null && !Peerless.Corpse.Deleted)
                    {
                        Peerless.Corpse.Delete();
                    }

                    if (!Peerless.Deleted)
                    {
                        Peerless.Delete();
                    }
                }

                CleanupHelpers();

                // reset summoner, boss
                Peerless = null;

                Deadline = DateTime.MinValue;
            }
        }
コード例 #9
0
        private static TimeSpan Mobile_StamRegenRate(Mobile from)
        {
            if (from.Skills == null)
            {
                return(Mobile.DefaultStamRate);
            }

            CheckBonusSkill(from, from.Stam, from.StamMax, SkillName.Focus);

            int points = (int)(from.Skills[SkillName.Focus].Value * 0.08);

            int cappedPoints = AosAttributes.GetValue(from, AosAttribute.RegenStam);

            points += cappedPoints;

            if (from.Player)
            {
                if (from.Stam < from.StamMax * 0.15)
                {
                    points += 8;
                }

                if (from.Stam < from.StamMax * 0.25)
                {
                    points += 8;
                }

                bool running = ((Player)from).isRunning && from.Mounted == false;

                if (((Player)from).lastMove < DateTime.Now)
                {
                    running = false;
                }

                if (running)
                {
                    points -= 32;
                }

                Beastmaster bmr = Perk.GetByType <Beastmaster>((Player)from);

                if (bmr != null)
                {
                    points += bmr.BMasterRegenBonus();
                }

                Acrobat acr = Perk.GetByType <Acrobat>((Player)from);

                if (acr != null)
                {
                    points += acr.GetStamRegenBonus();
                }

                Adventurer adv = Perk.GetByType <Adventurer>((Player)from);

                if (adv != null)
                {
                    points += adv.GetStamRegenBonus();
                }

                Scout sct = Perk.GetByType <Scout>((Player)from);

                if (sct != null)
                {
                    points += sct.StamRegenBonus();
                }

                Dragoon drg = Perk.GetByType <Dragoon>((Player)from);

                if (drg != null)
                {
                    points += drg.Symbiosis();
                }

                Monk mk = Perk.GetByType <Monk>((Player)from);

                if (mk != null)
                {
                    points += mk.MeditationMastery();
                }

                int hungerRegen = (int)((from.Hunger + from.Thirst) * 0.10);

                if (hungerRegen != 0)
                {
                    points += hungerRegen;
                }

                if (from.Hits != 0 && from.HitsMax != 0)
                {
                    double hitsratio = (int)((from.HitsMax / from.Hits) / 3);

                    if (hitsratio >= 1.0)
                    {
                        points = (int)(points * hitsratio);
                    }
                }
            }

            if (!(from is Player))
            {
                points += (int)(from.Dex * 0.04);
            }

            if (from is BaseCreature)
            {
                BaseCreature bc = from as BaseCreature;

                if (bc.ControlMaster != null && bc.ControlMaster is Player)
                {
                    Player      master = bc.ControlMaster as Player;
                    Beastmaster bmr    = Perk.GetByType <Beastmaster>((Player)master);

                    if (bmr != null)
                    {
                        points += bmr.PackRegenBonus();
                    }
                }
            }

            if (from is BaseMount)
            {
                BaseMount mount = from as BaseMount;
                if (mount.Rider != null && mount.Rider is Player)
                {
                    Player  rider = mount.Rider as Player;
                    Dragoon drg   = Perk.GetByType <Dragoon>((Player)rider);

                    if (drg != null)
                    {
                        points += drg.Symbiosis();
                    }
                }
            }

            if (points < -1)
            {
                points = -1;
            }

            return(TimeSpan.FromSeconds(1.0 / (0.1 * (2 + points))));
        }
コード例 #10
0
        public static MorphResult Morph(Mobile m, int entryID)
        {
            if (entryID < 0 || entryID >= m_Entries.Length)
            {
                return(MorphResult.Fail);
            }

            AnimalFormEntry entry = m_Entries[entryID];

            m_LastAnimalForms[m] = entryID;             //On OSI, it's the last /attempted/ one not the last succeeded one

            if (m.Skills.Ninjitsu.Value < entry.ReqSkill)
            {
                string args = String.Format("{0}\t{1}\t ", entry.ReqSkill.ToString("F1"), SkillName.Ninjitsu);
                m.SendLocalizedMessage(1063013, args);                   // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
                return(MorphResult.NoSkill);
            }

            /*
             * if( !m.CheckSkill( SkillName.Ninjitsu, entry.ReqSkill, entry.ReqSkill + 37.5 ) )
             *      return MorphResult.Fail;
             *
             * On OSI,it seems you can only gain starting at '0' using Animal form.
             */

            double ninjitsu = m.Skills.Ninjitsu.Value;

            if (ninjitsu < entry.ReqSkill + 37.5)
            {
                double chance = (ninjitsu - entry.ReqSkill) / 37.5;

                if (chance < Utility.RandomDouble())
                {
                    return(MorphResult.Fail);
                }
            }

            m.CheckSkill(SkillName.Ninjitsu, 0.0, 37.5);

            BaseMount.Dismount(m);
            m.Flying = false;

            m.BodyMod = entry.BodyMod;

            if (entry.HueMod > 0)
            {
                m.HueMod = entry.HueMod;
            }

            if (entry.SpeedBoost)
            {
                m.Send(SpeedControl.MountSpeed);
            }

            SkillMod mod = null;

            if (entry.StealthBonus)
            {
                mod         = new DefaultSkillMod(SkillName.Stealth, true, 20.0);
                mod.ObeyCap = true;
                m.AddSkillMod(mod);
            }

            #region Heritage Items
            else if (entry.StealingBonus)
            {
                mod         = new DefaultSkillMod(SkillName.Stealing, true, 10.0);
                mod.ObeyCap = true;
                m.AddSkillMod(mod);
            }

            m.Target = null;
            #endregion

            Timer timer = new AnimalFormTimer(m, entry.BodyMod, entry.HueMod);
            timer.Start();

            AddContext(m, new AnimalFormContext(timer, mod, entry.SpeedBoost, entry.Type, entry.StealingBonus));
            m.CheckStatTimers();
            return(MorphResult.Success);
        }
コード例 #11
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

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

            ClearCurrentAbility(attacker);

            if (defender is Neira || defender is ChaosDragoon || defender is ChaosDragoonElite)
            {
                attacker.SendLocalizedMessage(1042047);                   // You fail to knock the rider from its mount.
                return;
            }

            if (AnimalForm.UnderEffect(attacker))
            {
                attacker.SendLocalizedMessage(1070902);                   // You can't use this while in an animal form!
                return;
            }

            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);

            mount.Rider = null;

            BaseMount.SetMountPrevention(defender, BlockMountType.Dazed, DefenderRemountDelay);
            BaseMount.SetMountPrevention(attacker, BlockMountType.DismountRecovery, AttackerRemountDelay);

            if (!attacker.Mounted)
            {
                AOS.Damage(defender, attacker, Utility.RandomMinMax(15, 25), 100, 0, 0, 0, 0);
            }
        }
コード例 #12
0
            protected override void OnTarget(Mobile from, object obj)
            {
                if (m_Bola.Deleted)
                {
                    return;
                }

                if ((obj is Item))
                {
                    ((Item)obj).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049628, from.NetState); // You have no reason to throw a bola at that.
                    return;
                }

                if (obj is Mobile)
                {
                    Mobile to = (Mobile)obj;

                    if (!m_Bola.IsChildOf(from.Backpack))
                    {
                        m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1040019, from.NetState); // The bola must be in your pack to use it.
                    }
                    else if (from.Mounted)
                    {
                        m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1042053, from.NetState); // You can't use this while on a mount!
                    }
                    else if (from.Flying)
                    {
                        m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1113414, from.NetState); // You can't use this while flying!
                    }
                    else if (from == to)
                    {
                        from.SendLocalizedMessage(1005576); // You can't throw this at yourself.
                    }
                    else if (AnimalForm.UnderTransformation(from))
                    {
                        from.PrivateOverheadMessage(MessageType.Regular, 946, 1070902, from.NetState); // You can't use this while in an animal form!
                    }
                    else if (!to.Mounted && !to.Flying && !AnimalForm.UnderTransformation(to))
                    {
                        to.PrivateOverheadMessage(MessageType.Regular, 946, 1049628, from.NetState); // You have no reason to throw a bola at that.
                    }
                    else if (!from.CanBeHarmful(to))
                    {
                    }
                    else if (from.BeginAction(typeof(Bola)))
                    {
                        from.RevealingAction();

                        EtherealMount.StopMounting(from);

                        Item one = from.FindItemOnLayer(Layer.OneHanded);
                        Item two = from.FindItemOnLayer(Layer.TwoHanded);

                        if (one != null)
                        {
                            from.AddToBackpack(one);
                        }

                        if (two != null)
                        {
                            from.AddToBackpack(two);
                        }

                        from.DoHarmful(to);

                        BaseMount.SetMountPrevention(from, BlockMountType.BolaRecovery, TimeSpan.FromSeconds(10.0));
                        Timer.DelayCall(TimeSpan.FromSeconds(10.0), new TimerStateCallback(ReleaseBolaLock), from);
                        Timer.DelayCall(TimeSpan.FromSeconds(3.0), new TimerStateCallback(FinishThrow), new object[] { from, to, m_Bola });
                    }
                    else
                    {
                        m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1049624, from.NetState); // You have to wait a few moments before you can use another bola!
                    }
                }
            }
コード例 #13
0
        protected override void OnTarget(Mobile from, object target)
        {
            if (target is BaseChampion)
            {
                from.SendMessage("You cannot extract DNA from a champion.");
            }
            else if (target is BaseVendor)
            {
                from.SendMessage("You cannot extract DNA from a vendor.");
            }
            else if (target is PlayerVendor)
            {
                from.SendMessage("You cannot extract DNA from a vendor.");
            }
            else if (target is DemonKnight || target is AbysmalHorror || target is DarknightCreeper || target is FleshRenderer || target is ShadowKnight || target is Impaler)
            {
                from.SendMessage("You cannot extract DNA from a doom boss.");
            }
            else if (target is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)target;
                if (!from.InRange(((Mobile)bc).Location, 1))
                {
                    from.SendMessage("You are to far away to do that.");
                }
                else if (bc.Blessed != false)
                {
                    from.SendMessage("They cannot be harmed.");
                    //}
                    //else if ( bc.BodyValue == 400 || bc.BodyValue == 401 )
                    //{
                    //from.SendMessage( "You cannot extract DNA from a human. " );
                }
                else if (bc.Controlled != true)
                {
                    DNAItem dna = new DNAItem();
                    dna.DNAName      = bc.Name;
                    dna.DNAType      = DNAType.Mimic;
                    dna.DNABodyValue = bc.BodyValue;
                    dna.DNASoundID   = bc.BaseSoundID;

                    if (bc is BaseMount)
                    {
                        BaseMount bm = (BaseMount)bc;
                        dna.MountID = bm.ItemID;
                    }

                    if (Utility.Random(100) < 15)
                    {
                        switch (Utility.Random(3))
                        {
                        case 0:
                            dna.DNABluntAttack = true;
                            break;

                        case 1:
                            dna.DNAHealAttack = true;
                            break;

                        case 2:
                            dna.DNAPoisonAttack = true;
                            break;
                        }
                    }

                    if (Utility.Random(100) < 15)
                    {
                        switch (Utility.Random(5))
                        {
                        case 0:
                            dna.DNATrialByFire = true;
                            break;

                        case 1:
                            dna.DNAIceBlast = true;
                            break;

                        case 2:
                            dna.DNACometAttack = true;
                            break;

                        case 3:
                            dna.DNACallOfNature = true;
                            break;

                        case 4:
                            dna.DNAAcidRain = true;
                            break;
                        }
                    }

                    from.AddToBackpack(dna);

                    from.PlaySound(0x240);

                    switch (Utility.Random(3))
                    {
                    case 0:
                        bc.Combatant   = from;
                        from.Combatant = bc;
                        from.SendMessage("You successfully sample the creatures dna, but anger the creature in the progress.");
                        bc.Emote("You have angered the creature");
                        break;

                    case 1:
                        from.SendMessage("You successfully sample the creatures dna, but the tramua of the sample was to great for the creature.");
                        bc.Kill();

                        if (bc.Corpse != null)
                        {
                            bc.Corpse.Delete();
                        }

                        break;

                    case 2:
                        from.SendMessage("You successfully sample the creatures dna.");
                        break;
                    }

                    if (m_Vial.Amount >= 1)
                    {
                        m_Vial.Amount -= 1;

                        if (m_Vial.Amount == 0)
                        {
                            m_Vial.Delete();
                        }
                    }
                }
                else
                {
                    switch (Utility.Random(2))
                    {
                    case 0:
                        from.SendMessage("You fail to sample this creatures dna.");
                        bc.Combatant   = from;
                        from.Combatant = bc;
                        bc.Emote("You have angered the creature");

                        if (Utility.Random(100) < 35)
                        {
                            if (m_Vial.Amount >= 1)
                            {
                                m_Vial.Amount -= 1;

                                if (m_Vial.Amount == 0)
                                {
                                    m_Vial.Delete();
                                }
                            }

                            from.PlaySound(Utility.RandomList(62, 63));
                            from.SendMessage("The vial has broken.");
                        }

                        break;

                    case 1:
                        from.SendMessage("You fail to sample this creatures dna.");
                        from.SendMessage("The creature has died due to the tramua from the dna sample.");
                        bc.Kill();

                        if (bc.Corpse != null)
                        {
                            bc.Corpse.Delete();
                        }

                        if (Utility.Random(100) < 35)
                        {
                            if (m_Vial.Amount >= 1)
                            {
                                m_Vial.Amount -= 1;

                                if (m_Vial.Amount == 0)
                                {
                                    m_Vial.Delete();
                                }
                            }

                            from.PlaySound(Utility.RandomList(62, 63));
                            from.SendMessage("The vial has broken.");
                        }

                        break;
                    }
                }
            }
            else
            {
                from.SendMessage("You cannot sample dna from a tamed creature.");
            }
        }
コード例 #14
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                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 (defender is HenchmanArcher || defender is HenchmanFighter || defender is HenchmanWizard)
            {
                attacker.SendMessage("That attacks didn't seem to work!");
                return;
            }

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

            if (Core.ML && attacker is YoungRoc && 0.8 >= Utility.RandomDouble())
            {
                return;                 //Lesser Hiryu have an 80% chance of missing this attack
            }

            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);

            mount.Rider = null;

            BaseMount.SetMountPrevention(defender, BlockMountType.Dazed, DefenderRemountDelay);
            if (Core.ML && attacker is BaseCreature && ((BaseCreature)attacker).ControlMaster != null)
            {
                BaseMount.SetMountPrevention(((BaseCreature)attacker).ControlMaster, BlockMountType.DismountRecovery, AttackerRemountDelay);
            }
            else
            {
                BaseMount.SetMountPrevention(attacker, BlockMountType.DismountRecovery, AttackerRemountDelay);
            }

            if (!attacker.Mounted)
            {
                AOS.Damage(defender, attacker, Utility.RandomMinMax(15, 25), 100, 0, 0, 0, 0);
            }
        }
コード例 #15
0
        private bool CloneMobile(Mobile m, PlayercastStatue statue)
        {
            bool success = false;

            try
            {
                statue.Body    = m.Body;
                statue.Female  = m.Female;
                statue.Hue     = m.Hue;
                statue.RawName = String.Format("a statue of {0}", m.RawName);

                statue.RawDex = m.RawDex;
                statue.RawInt = m.RawInt;
                statue.RawStr = m.RawStr;

                statue.Hits = statue.HitsMax;
                statue.Mana = statue.ManaMax;
                statue.Stam = statue.StamMax;

                statue.HairItemID       = m.HairItemID;
                statue.FacialHairItemID = m.FacialHairItemID;

                statue.HairHue       = m.HairHue;
                statue.FacialHairHue = m.FacialHairHue;

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

                    if (item != null && !item.Deleted)
                    {
                        if (item.RootParent == m && item != m.Backpack && item != m.BankBox && item.Layer != Layer.Mount)
                        {
                            Item newItem = new Item(item.ItemID);
                            newItem.Hue     = item.Hue;
                            newItem.Layer   = item.Layer;
                            newItem.Movable = false;
                            newItem.Name    = item.Name;

                            statue.AddItem(newItem);
                        }
                    }
                }

                for (int i = 0; i < SkillInfo.Table.Length; i++)
                {
                    statue.Skills[i].Cap = statue.Skills[i].Base = m.Skills[i].Cap;
                }

                if (m.Mount != null && m.Mount is BaseMount)
                {
                    BaseMount newMount = (BaseMount)Activator.CreateInstance(((BaseMount)m.Mount).GetType());

                    newMount.Direction = statue.Direction;
                    newMount.Hue       = (int)statue.Material;
                    newMount.Rider     = statue;
                }

                success = true;
            }
            catch { success = false; }

            return(success);
        }
コード例 #16
0
ファイル: Bola.cs プロジェクト: slawdis/uoodyssey-scripts
            protected override void OnTarget(Mobile from, object obj)
            {
                if (m_Bola.Deleted)
                {
                    return;
                }

                if (obj is Mobile)
                {
                    Mobile to = (Mobile)obj;

                    if (!m_Bola.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1040019);                           // The bola must be in your pack to use it.
                    }
                    else if (!Core.AOS && (from.FindItemOnLayer(Layer.OneHanded) != null || from.FindItemOnLayer(Layer.TwoHanded) != null))
                    {
                        from.SendLocalizedMessage(1040015);                           // Your hands must be free to use this
                    }
                    else if (from.Mounted)
                    {
                        from.SendLocalizedMessage(1040016);                           // You cannot use this while riding a mount
                    }
                    else if (Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(from))
                    {
                        from.SendLocalizedMessage(1070902);                           // You can't use this while in an animal form!
                    }
                    else if (!to.Mounted)
                    {
                        from.SendLocalizedMessage(1049628);                           // You have no reason to throw a bola at that.
                    }
                    else if (!from.CanBeHarmful(to))
                    {
                    }
                    else if (from.BeginAction(typeof(Bola)))
                    {
                        EtherealMount.StopMounting(from);

                        Item one = from.FindItemOnLayer(Layer.OneHanded);
                        Item two = from.FindItemOnLayer(Layer.TwoHanded);

                        if (one != null)
                        {
                            from.AddToBackpack(one);
                        }

                        if (two != null)
                        {
                            from.AddToBackpack(two);
                        }

                        from.DoHarmful(to);

                        if (Core.AOS)
                        {
                            BaseMount.SetMountPrevention(from, BlockMountType.BolaRecovery, TimeSpan.FromSeconds(3.0));
                        }

                        m_Bola.Consume();

                        from.Direction = from.GetDirectionTo(to);
                        from.Animate(11, 5, 1, true, false, 0);
                        from.MovingEffect(to, 0x26AC, 10, 0, false, false);

                        Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(FinishThrow), new object[] { from, to });
                    }
                    else
                    {
                        from.SendLocalizedMessage(1049624);                           // You have to wait a few moments before you can use another bola!
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049629);                       // You cannot throw a bola at that.
                }
            }
コード例 #17
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target == from)
                {
                    from.SendMessage("You cant shrink yourself!");
                }

                else if (target is PlayerMobile)
                {
                    from.SendMessage("That person gives you a dirty look.");
                }

                else if (target is Item)
                {
                    from.SendMessage("You can only shrink pets that you own");
                }

                else if (target is BaseBioCreature && FSATS.EnableBioShrink == false)
                {
                    from.SendMessage("Unnatural creatures cannot be shrunk");
                }

                else if (Server.Spells.SpellHelper.CheckCombat(from))
                {
                    from.SendMessage("You cannot shrink your pet while your fighting.");
                }

                else if (target is PersonalAttendant)
                {
                    from.SendMessage("Really! Stop that! Can't be done!");
                }

                else if (target is BaseCreature)
                {
                    BaseCreature c = (BaseCreature)target;

                    bool   packanimal = false;
                    Type   typ        = c.GetType();
                    string nam        = typ.Name;

                    foreach (string ispack in FSATS.PackAnimals)
                    {
                        if (ispack == nam)
                        {
                            packanimal = true;
                        }
                    }

                    if (c.BodyValue == 400 || c.BodyValue == 401 && c.Controlled == false)
                    {
                        from.SendMessage("That person gives you a dirty look.");
                    }
                    else if (c.ControlMaster != from && c.Controlled == false)
                    {
                        from.SendMessage("This is not your pet.");
                    }
                    else if (packanimal == true && (c.Backpack != null && c.Backpack.Items.Count > 0))
                    {
                        from.SendMessage("You must unload your pets backpack first.");
                    }
                    else if (c.IsDeadPet)
                    {
                        from.SendMessage("You cannot shrink the dead.");
                    }
                    else if (c.Summoned)
                    {
                        from.SendMessage("You cannot shrink a summoned creature.");
                    }
                    else if (c.Allured == true)
                    {
                        from.SendMessage("You cannot shrink an allured creature!");
                    }
                    else if (c.Combatant != null && c.InRange(c.Combatant, 12) && c.Map == c.Combatant.Map)
                    {
                        from.SendMessage("Your pet is fighting, You cannot shrink it yet.");
                    }
                    else if (c.BodyMod != 0)
                    {
                        from.SendMessage("You cannot shrink your pet while its polymorphed.");
                    }
                    //else if ( Server.Spells.LostArts.CharmBeastSpell.IsCharmed( c ) )
                    //{
                    //	from.SendMessage( "Your hold over this pet is not strong enough to shrink it." );
                    //}
                    else if (c.Controlled == true && c.ControlMaster == from)
                    {
                        Type       type = c.GetType();
                        ShrinkItem si   = new ShrinkItem();
                        si.MobType  = type;
                        si.Pet      = c;
                        si.PetOwner = from;

                        if (c is BaseMount)
                        {
                            BaseMount mount = (BaseMount)c;
                            si.MountID = mount.ItemID;
                        }

                        from.AddToBackpack(si);

                        IEntity p1 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z), from.Map);
                        IEntity p2 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 50), from.Map);

                        Effects.SendMovingParticles(p2, p1, ShrinkTable.Lookup(c), 1, 0, true, false, 0, 3, 1153, 1, 0, EffectLayer.Head, 0x100);
                        from.PlaySound(492);

                        c.Controlled    = true;
                        c.ControlMaster = null;
                        c.Internalize();

                        c.OwnerAbandonTime = DateTime.MinValue;

                        c.IsStabled = true;

                        m_Powder.Consume();
                        from.AddToBackpack(new Bottle());
                    }
                }
            }
コード例 #18
0
        public override void OnCast()
        {
            if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
            {
                Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
            }
            else if (TransformationSpellHelper.UnderTransformation(Caster))
            {
                Caster.SendLocalizedMessage(1063219); // You cannot mimic an animal while in that form.
            }
            else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || (Caster.IsBodyMod && AnimalForm.GetContext(Caster) == null))
            {
                DoFizzle();
            }
            else if (CheckSequence())
            {
                AnimalFormContext context = AnimalForm.GetContext(Caster);
                int mana = ScaleMana(RequiredMana);

                AnimalForm.AddLastAnimalForm(Caster, 16);

                if (mana > Caster.Mana)
                {
                    Caster.SendLocalizedMessage(1060174, mana.ToString()); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
                }
                else if (context != null)
                {
                    AnimalForm.RemoveContext(Caster, context, true);
                    Caster.Mana -= mana;

                    BuffInfo.RemoveBuff(Caster, BuffIcon.WhiteTigerForm);

                    FinishSequence();
                    return;
                }
                else
                {
                    double ninjitsu = Caster.Skills.Ninjitsu.Value;

                    if (ninjitsu < RequiredSkill + 37.5)
                    {
                        double chance = (ninjitsu - RequiredSkill) / 37.5;

                        if (chance < Utility.RandomDouble())
                        {
                            DoFizzle();
                            FinishSequence();
                            return;
                        }
                    }
                }

                Caster.FixedParticles(0x3728, 10, 13, 2023, EffectLayer.Waist);
                Caster.Mana -= mana;

                Caster.CheckSkill(SkillName.Ninjitsu, 0.0, 90.0);

                BaseMount.Dismount(Caster);

                int bodyMod = Caster.Female ? 1255 : 1254;
                int hueMod  = 2500;

                Caster.BodyMod = bodyMod;
                Caster.HueMod  = hueMod;

                Caster.SendSpeedControl(SpeedControlType.MountSpeed);

                Timer timer = new AnimalFormTimer(Caster, bodyMod, hueMod);
                timer.Start();

                int skills = (int)((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value + (GetMasteryLevel() * 40)) / 3);

                AnimalForm.AddContext(Caster, new AnimalFormContext(timer, null, true, typeof(WildWhiteTiger), null));
                Caster.CheckStatTimers();

                int bleedMod = (int)(((Caster.Skills[SkillName.Ninjitsu].Value + Caster.Skills[SkillName.Stealth].Value + (GetMasteryLevel() * 40)) / 3) / 10);
                BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.WhiteTigerForm, 1155911, 1156060, String.Format("{0}\t{1}\t{2}\t{3}", "20", "5", "", bleedMod.ToString())));
                // +~1_ARG~ Defense Chance Increase.<br>+~2_ARG~ Max Defense Chance Increase Cap.<br> Chance to evade attacks.<br>Applies bleed to victim with a max damage of ~4_ARG~.

                Caster.Delta(MobileDelta.WeaponDamage);
            }

            FinishSequence();
        }
コード例 #19
0
ファイル: Dismount.cs プロジェクト: zerodowned/UO-Forever
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            if (defender is ChaosDragoon || defender is ChaosDragoonElite)
            {
                return;
            }

            if (defender is BaseCreature)
            {
                var bc = (BaseCreature)defender;
                if (bc.Mounted)
                {
                    attacker.SendLocalizedMessage(1060089);                     // You fail to execute your special move
                }
            }

            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;
            }

            if (attacker.EraML && attacker is LesserHiryu && 0.8 >= Utility.RandomDouble())
            {
                return;                 //Lesser Hiryu have an 80% chance of missing this attack
            }

            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);

            mount.Rider = null;

            BaseMount.SetMountPrevention(defender, BlockMountType.Dazed, DefenderRemountDelay);

            if (attacker.EraML && attacker is BaseCreature && ((BaseCreature)attacker).ControlMaster != null)
            {
                BaseMount.SetMountPrevention(
                    ((BaseCreature)attacker).ControlMaster, BlockMountType.DismountRecovery, AttackerRemountDelay);
            }
            else
            {
                BaseMount.SetMountPrevention(attacker, BlockMountType.DismountRecovery, AttackerRemountDelay);
            }

            if (!attacker.Mounted)
            {
                defender.Damage(Utility.RandomMinMax(15, 25), attacker);
            }
        }
コード例 #20
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!this.CheckMana(attacker, true))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            IMount mount = defender.Mount;

            if (mount != null && !(defender is ChaosDragoon || defender is ChaosDragoonElite))
            {
                defender.SendLocalizedMessage(1062315); // You fall off your mount!

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

                mount.Rider = null;

                BaseMount.SetMountPrevention(defender, BlockMountType.Dazed, TimeSpan.FromSeconds(10.0));

                if (Core.ML && attacker is BaseCreature && ((BaseCreature)attacker).ControlMaster != null)
                {
                    BaseMount.SetMountPrevention(((BaseCreature)attacker).ControlMaster, BlockMountType.DismountRecovery, TimeSpan.FromSeconds(3.0));
                }
                else
                {
                    BaseMount.SetMountPrevention(attacker, BlockMountType.DismountRecovery, TimeSpan.FromSeconds(3.0));
                }
            }
            else
            {
                //if ( WeaponAbility.ParalyzingBlow.IsImmune( defender ) )
                //{
                //attacker.SendLocalizedMessage( 1070804 ); // Your target resists paralysis.
                //defender.SendLocalizedMessage( 1070813 ); // You resist paralysis.
                //}
                //else
                //{
                defender.FixedEffect(0x376A, 9, 32);
                defender.PlaySound(0x204);
                attacker.SendLocalizedMessage(1060163); // You deliver a paralyzing blow!
                defender.SendLocalizedMessage(1060164); // The attack has temporarily paralyzed you!
                TimeSpan duration = defender.Player ? TimeSpan.FromSeconds(3.0) : TimeSpan.FromSeconds(6.0);
                defender.Paralyze(duration);
                //WeaponAbility.ParalyzingBlow.BeginImmunity( defender, duration + TimeSpan.FromSeconds( 8.0 ) );
                //}
            }

            int amount = 15;

            switch (Utility.Random(5))
            {
            case 0:
                AOS.Damage(defender, attacker, amount, 100, 0, 0, 0, 0);
                break;

            case 1:
                AOS.Damage(defender, attacker, amount, 0, 100, 0, 0, 0);
                break;

            case 2:
                AOS.Damage(defender, attacker, amount, 0, 0, 100, 0, 0);
                break;

            case 3:
                AOS.Damage(defender, attacker, amount, 0, 0, 0, 100, 0);
                break;

            case 4:
                AOS.Damage(defender, attacker, amount, 0, 0, 0, 0, 100);
                break;
            }
        }
コード例 #21
0
ファイル: JailCommand.cs プロジェクト: Orion321/unknown-shard
        public static void JailThem(PlayerMobile player, JailOption option)
        {
            if (null == player || player.AccessLevel >= JailConfig.JailImmuneLevel)
            {
                return;
            }

            if (JailOption.Squelch == option)
            {
                player.Squelched = true;
            }

            foreach (Item item in player.Items)
            {
                if (item is JailHammer)                                                     // Jailed while jailed gets them another load of rock to mine
                {
                    if (0 > (((JailHammer)item).UsesRemaining += JailConfig.UsesRemaining)) // handle integer overflow
                    {
                        ((JailHammer)item).UsesRemaining *= -1;
                    }

                    Banker.Withdraw(player, JailConfig.FineAmount);
                    player.SendMessage("Your remaining sentence has been increased!");
                    player.SendMessage("You have been fined {0} gold and are being kicked!", JailConfig.FineAmount);

                    // This gives a nice little delay for the message to be read
                    s_KickProcessingQueue.Enqueue(player);
                    player.Squelched = true;
                    Server.Timer.DelayCall(TimeSpan.FromSeconds(kSecondsTillKick), new Server.TimerCallback(KickPlayerInQueue));
                    return;
                }
            }

            // If mounted, dismount them and stable mount
            if (player.Mounted)
            {
                if (player.Mount is EtherealMount)
                {
                    EtherealMount pet = player.Mount as EtherealMount;
                    pet.Internalize();
                    pet.Rider = null;
                }
                else if (player.Mount is BaseMount)
                {
                    BaseMount pet = player.Mount as BaseMount;
                    pet.Rider = null;
                    Jail.StablePet(player, pet);
                }
            }

            // Stable all other pets
            foreach (Mobile mobile in World.Mobiles.Values)
            {
                if (mobile is BaseCreature)
                {
                    BaseCreature bc = mobile as BaseCreature;

                    if (null != bc && (bc.Controlled && bc.ControlMaster == player) || (bc.Summoned && bc.SummonMaster == player))
                    {
                        Jail.StablePet(player, bc);
                    }
                }
            }

            // Move all items to a bag and move that to the bank
            Container backpack     = player.Backpack;
            Backpack  bag          = new Backpack(); bag.Hue = JailConfig.RobeHue;
            ArrayList equipedItems = new ArrayList(player.Items);

            foreach (Item item in equipedItems)
            {
                if (item.Layer == Layer.Bank || item.Layer == Layer.Backpack || item.Layer == Layer.Hair || item.Layer == Layer.FacialHair || item is DeathShroud)
                {
                    continue;
                }
                bag.DropItem(item);
            }

            ArrayList backpackItems = new ArrayList(backpack.Items);

            foreach (Item item in backpackItems)
            {
                if (item is JailRock)
                {
                    item.Delete();
                }
                else if (item.Movable)                          // Non movable pack items must remain (i.e. skill balls)
                {
                    bag.DropItem(item);
                }
            }

            // Remember their access level and make them a player
            JailHammer hammer = new JailHammer();

            hammer.PlayerAccessLevel = player.AccessLevel;
            player.AccessLevel       = AccessLevel.Player;

            // Bank the bag of belongings, give them a hammer and welcome them
            player.BankBox.DropItem(bag);
            player.AddItem(hammer);

            // Explosively move player to jail
            player.BoltEffect(0);
            player.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Waist);
            player.PlaySound(0x307);
            player.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
            player.PlaySound(0x225);

            // This gives a nice little delay for the effect to complete
            s_JailProcessingQueue.Enqueue(player);
            Server.Timer.DelayCall(TimeSpan.FromSeconds(kSecondsTillJail), new Server.TimerCallback(JailPlayerInQueue));
        }
コード例 #22
0
        public virtual bool Cast()
        {
            StartCastTime = Core.TickCount;

            if (Core.AOS && Caster.Spell is Spell && ((Spell)Caster.Spell).State == SpellState.Sequencing)
            {
                ((Spell)Caster.Spell).Disturb(DisturbType.NewCast);
            }

            if (!Caster.CheckAlive())
            {
                return(false);
            }
            else if (Caster is PlayerMobile && ((PlayerMobile)Caster).Peaced)
            {
                Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed.
            }
            else if (Scroll is BaseWand && Caster.Spell != null && Caster.Spell.IsCasting)
            {
                Caster.SendLocalizedMessage(502643); // You can not cast a spell while frozen.
            }
            else if (SkillHandlers.SpiritSpeak.IsInSpiritSpeak(Caster) || (Caster.Spell != null && Caster.Spell.IsCasting))
            {
                Caster.SendLocalizedMessage(502642); // You are already casting a spell.
            }
            else if (BlockedByHorrificBeast && TransformationSpellHelper.UnderTransformation(Caster, typeof(HorrificBeastSpell)) ||
                     (BlockedByAnimalForm && AnimalForm.UnderTransformation(Caster)))
            {
                Caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form.
            }
            else if (!(Scroll is BaseWand) && (Caster.Paralyzed || Caster.Frozen))
            {
                Caster.SendLocalizedMessage(502643); // You can not cast a spell while frozen.
            }
            else if (CheckNextSpellTime && Core.TickCount - Caster.NextSpellTime < 0)
            {
                Caster.SendLocalizedMessage(502644); // You have not yet recovered from casting a spell.
            }
            else if (Caster is PlayerMobile && ((PlayerMobile)Caster).PeacedUntil > DateTime.UtcNow)
            {
                Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed.
            }
            else if (Caster.Mana >= ScaleMana(GetMana()))
            {
                #region Stygian Abyss
                if (Caster.Race == Race.Gargoyle && Caster.Flying)
                {
                    if (BaseMount.OnFlightPath(Caster))
                    {
                        if (Caster.IsPlayer())
                        {
                            Caster.SendLocalizedMessage(1113750); // You may not cast spells while flying over such precarious terrain.
                            return(false);
                        }
                        else
                        {
                            Caster.SendMessage("Your staff level allows you to cast while flying over precarious terrain.");
                        }
                    }
                }
                #endregion

                if (Caster.Spell == null && Caster.CheckSpellCast(this) && CheckCast() &&
                    Caster.Region.OnBeginSpellCast(Caster, this))
                {
                    State        = SpellState.Casting;
                    Caster.Spell = this;

                    Caster.Delta(MobileDelta.Flags);

                    if (!(Scroll is BaseWand) && RevealOnCast)
                    {
                        Caster.RevealingAction();
                    }

                    SayMantra();

                    /*
                     * EA seems to use some type of spell variation, of -100 ms + timer resolution.
                     * Using the below millisecond dropoff with a 50ms timer resolution seems to be exact
                     * to EA.
                     */

                    TimeSpan castDelay = GetCastDelay().Subtract(TimeSpan.FromMilliseconds(100));

                    if (ShowHandMovement && !(Scroll is SpellStone) && (Caster.Body.IsHuman || (Caster.Player && Caster.Body.IsMonster)))
                    {
                        int count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);

                        if (count != 0)
                        {
                            m_AnimTimer = new AnimTimer(this, count);
                            m_AnimTimer.Start();
                        }

                        if (Info.LeftHandEffect > 0)
                        {
                            Caster.FixedParticles(0, 10, 5, Info.LeftHandEffect, EffectLayer.LeftHand);
                        }

                        if (Info.RightHandEffect > 0)
                        {
                            Caster.FixedParticles(0, 10, 5, Info.RightHandEffect, EffectLayer.RightHand);
                        }
                    }

                    if (ClearHandsOnCast)
                    {
                        Caster.ClearHands();
                    }

                    if (Core.ML)
                    {
                        WeaponAbility.ClearCurrentAbility(Caster);
                    }

                    m_CastTimer = new CastTimer(this, castDelay);
                    //m_CastTimer.Start();

                    OnBeginCast();

                    if (castDelay > TimeSpan.Zero)
                    {
                        m_CastTimer.Start();
                    }
                    else
                    {
                        m_CastTimer.Tick();
                    }

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625, ScaleMana(GetMana()).ToString()); // Insufficient mana. You must have at least ~1_MANA_REQUIREMENT~ Mana to use this spell.
            }

            return(false);
        }
コード例 #23
0
ファイル: Dismount.cs プロジェクト: Delphi79/RunUO-Ulmeta
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            if (attacker is Player)
            {
                Dragoon drg = Perk.GetByType <Dragoon>((Player)attacker);

                if (drg != null)
                {
                    if (!drg.MountedRival())
                    {
                        if (attacker.Mounted) // TODO: Should there be a message here?
                        {
                            return;
                        }
                    }
                }
            }

            //else if (attacker.Mounted)
            //return;

            ClearCurrentAbility(attacker);

            IMount mount = defender.Mount;

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

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

            if (defender is Player)
            {
                Dragoon drg = Perk.GetByType <Dragoon>((Player)defender);

                if (drg != null)
                {
                    if (drg.SaddleBound() && Utility.RandomDouble() < 0.80) // 80% chance for the dragoon to resist dismount.
                    {
                        attacker.SendMessage("The rider resist your attempt to dismount.");
                        defender.SendMessage("You resist your attackers attempt to dismount.");
                        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);

            mount.Rider = null;

            BaseMount.SetMountPrevention(defender, BlockMountType.Dazed, DefenderRemountDelay);
            BaseMount.SetMountPrevention(attacker, BlockMountType.DismountRecovery, AttackerRemountDelay);

            if (!attacker.Mounted)
            {
                AOS.Damage(defender, attacker, Utility.RandomMinMax(15, 25), 100, 0, 0, 0, 0);
            }
        }
コード例 #24
0
		public MountItem( BaseMount mount, int itemID ) : base( itemID )
		{
			Layer = Layer.Mount;
			Movable = false;

			m_Mount = mount;
		}
コード例 #25
0
ファイル: PeerlessAltar.cs プロジェクト: bsenyuva/ServUO
        public virtual void Exit(Mobile fighter)
        {
            // teleport fighter
            if (fighter.NetState == null)
            {
                fighter.LogoutLocation = this.m_ExitDest;

                if (this is CitadelAltar)
                {
                    fighter.LogoutMap = Map.Tokuno;
                }
                else
                {
                    fighter.LogoutMap = this.Map;
                }
            }
            else
            {
                fighter.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                fighter.PlaySound(0x1FE);

                if (this is CitadelAltar)
                {
                    fighter.MoveToWorld(this.m_ExitDest, Map.Tokuno);
                }
                else
                {
                    fighter.MoveToWorld(this.m_ExitDest, this.Map);
                }
            }

            // teleport his pets
            if (this.m_Pets.ContainsKey(fighter))
            {
                for (int i = 0; i < this.m_Pets[fighter].Count; i++)
                {
                    BaseCreature pet = this.m_Pets[fighter][i] as BaseCreature;

                    if (pet != null && (pet.Alive || pet.IsBonded) && pet.Map != Map.Internal)
                    {
                        if (pet is BaseMount)
                        {
                            BaseMount mount = (BaseMount)pet;

                            if (mount.Rider != null && mount.Rider != fighter)
                            {
                                mount.Rider.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                                mount.Rider.PlaySound(0x1FE);

                                if (this is CitadelAltar)
                                {
                                    mount.Rider.MoveToWorld(this.m_ExitDest, Map.Tokuno);
                                }
                                else
                                {
                                    mount.Rider.MoveToWorld(this.m_ExitDest, this.Map);
                                }

                                continue;
                            }
                            else if (mount.Rider != null)
                            {
                                continue;
                            }
                        }

                        pet.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                        pet.PlaySound(0x1FE);

                        if (this is CitadelAltar)
                        {
                            pet.MoveToWorld(this.m_ExitDest, Map.Tokuno);
                        }
                        else
                        {
                            pet.MoveToWorld(this.m_ExitDest, this.Map);
                        }
                    }
                }
            }

            this.m_Fighters.Remove(fighter);
            this.m_Pets.Remove(fighter);

            fighter.SendLocalizedMessage(1072677); // You have been transported out of this room.

            if (this.m_Fighters.Count == 0)
            {
                this.FinishSequence();
            }
        }
コード例 #26
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 0:
				{
					m_Mount = reader.ReadMobile() as BaseMount;

					if ( m_Mount == null )
						Delete();

					break;
				}
			}
		}
コード例 #27
0
            private Item TryStealItem(Item toSteal, ref bool caught)
            {
                //Close bank box on steal attempt -Adam
                BankBox box = m_Thief.FindBankNoCreate();

                if (box != null && box.Opened)
                {
                    box.Close();
                    m_Thief.Send(new MobileUpdate(m_Thief));
                }

                Item stolen = null;

                object root = toSteal.RootParent;

                var contParent = toSteal.Parent as Container;

                StealableArtifactsSpawner.StealableInstance si = null;
                if (toSteal.Parent == null || !toSteal.Movable)
                {
                    si = StealableArtifactsSpawner.GetStealableInstance(toSteal);
                }

                BaseAddon addon = null;

                if (toSteal is AddonComponent)
                {
                    addon = ((AddonComponent)toSteal).Addon;
                }

                bool stealflag = (addon != null && addon.GetSavedFlag(ItemFlags.StealableFlag)) ||
                                 toSteal.GetSavedFlag(ItemFlags.StealableFlag);

                if (!IsEmptyHanded(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005584);                     // Both hands must be free to steal.
                }
                else if (root is Mobile && ((Mobile)root).Player && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005596);                     // You must be in the thieves guild to steal from other players.
                }
                else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0)
                {
                    m_Thief.SendLocalizedMessage(502706);                     // You are currently suspended from the thieves guild.
                }
                else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable)
                {
                    m_Thief.SendLocalizedMessage(1005598);                     // You can't steal from shopkeepers.
                }
                else if (root is PlayerVendor)
                {
                    m_Thief.SendLocalizedMessage(502709);                     // You can't steal from vendors.
                }
                else if (!m_Thief.CanSee(toSteal))
                {
                    m_Thief.SendLocalizedMessage(500237);                     // Target can not be seen.
                }
                else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true))
                {
                    m_Thief.SendLocalizedMessage(1048147);                     // Your backpack can't hold anything else.
                }
                #region Sigils
                else if (toSteal is Sigil)
                {
                    PlayerState pl      = PlayerState.Find(m_Thief);
                    Faction     faction = (pl == null ? null : pl.Faction);

                    var sig = (Sigil)toSteal;

                    if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                    {
                        m_Thief.SendLocalizedMessage(502703);  // You must be standing next to an item to steal it.
                    }
                    else if (root != null)                     // not on the ground
                    {
                        m_Thief.SendLocalizedMessage(502710);  // You can't steal that!
                    }
                    else if (faction != null)
                    {
                        if (!m_Thief.CanBeginAction(typeof(IncognitoSpell)))
                        {
                            m_Thief.SendLocalizedMessage(1010581);                             //	You cannot steal the sigil when you are incognito
                        }
                        else if (DisguiseTimers.IsDisguised(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1010583);                             //	You cannot steal the sigil while disguised
                        }
                        else if (!m_Thief.CanBeginAction(typeof(PolymorphSpell)))
                        {
                            m_Thief.SendLocalizedMessage(1010582);                             //	You cannot steal the sigil while polymorphed
                        }
                        else if (TransformationSpellHelper.UnderTransformation(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1061622);                             // You cannot steal the sigil while in that form.
                        }
                        else if (m_Thief is PlayerMobile && ((PlayerMobile)m_Thief).SavagePaintExpiration > TimeSpan.Zero)
                        {
                            m_Thief.SendLocalizedMessage(1114352);                             // You cannot steal the sigil while disguised in savage paint.
                        }
                        else if (pl.IsLeaving)
                        {
                            m_Thief.SendLocalizedMessage(1005589);                             // You are currently quitting a faction and cannot steal the town sigil
                        }
                        else if (sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction)
                        {
                            m_Thief.SendLocalizedMessage(1005590);                             //	You cannot steal your own sigil
                        }
                        else if (sig.IsPurifying)
                        {
                            m_Thief.SendLocalizedMessage(1005592);                             // You cannot steal this sigil until it has been purified
                        }
                        else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 0.0, 0.0))
                        {
                            if (Sigil.ExistsOn(m_Thief))
                            {
                                m_Thief.SendLocalizedMessage(1010258);
                                //	The sigil has gone back to its home location because you already have a sigil.
                            }
                            else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, sig, false, true))
                            {
                                m_Thief.SendLocalizedMessage(1010259);                                 //	The sigil has gone home because your backpack is full
                            }
                            else
                            {
                                if (sig.IsBeingCorrupted)
                                {
                                    sig.GraceStart = DateTime.UtcNow;                                     // begin grace period
                                }

                                m_Thief.SendLocalizedMessage(1010586);                                 // YOU STOLE THE SIGIL!!!   (woah, calm down now)

                                if (sig.LastMonolith != null && sig.LastMonolith.Sigil != null)
                                {
                                    sig.LastMonolith.Sigil = null;
                                    sig.LastStolen         = DateTime.UtcNow;
                                }

                                switch (PvPController._SigilAnnounceStolen)
                                {
                                case PvPController.SigilStolenAnnouncing.All:
                                {
                                    foreach (Faction factionToBCast in Faction.Factions)
                                    {
                                        List <PlayerState> members = factionToBCast.Members;

                                        if (sig.Corrupted != null)
                                        {
                                            if (sig.Corrupted == factionToBCast)
                                            {
                                                foreach (PlayerState member in members)
                                                {
                                                    member.Mobile.SendMessage(
                                                        factionToBCast.Definition.HueBroadcast,
                                                        "The {0} have stolen the {1} sigil from your faction stronghold!",
                                                        faction.Definition.FriendlyName,
                                                        sig.Town.Definition.FriendlyName);
                                                }
                                            }
                                            else
                                            {
                                                foreach (PlayerState member in members)
                                                {
                                                    member.Mobile.SendMessage(
                                                        factionToBCast.Definition.HueBroadcast,
                                                        "The {0} have stolen the {1} sigil from the {2} stronghold!",
                                                        faction.Definition.FriendlyName,
                                                        sig.Town.Definition.FriendlyName,
                                                        sig.Corrupted.Definition.FriendlyName);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            foreach (PlayerState member in members)
                                            {
                                                member.Mobile.SendMessage(
                                                    factionToBCast.Definition.HueBroadcast,
                                                    "The {0} have stolen the {1} sigil!",
                                                    faction.Definition.FriendlyName,
                                                    sig.Town.Definition.FriendlyName);
                                            }
                                        }
                                    }
                                }
                                break;

                                case PvPController.SigilStolenAnnouncing.Owner:
                                {
                                    if (sig.Corrupted != null)
                                    {
                                        List <PlayerState> members = sig.Corrupted.Members;

                                        foreach (PlayerState member in members)
                                        {
                                            member.Mobile.SendMessage(
                                                sig.Corrupted.Definition.HueBroadcast,
                                                "The {0} have stolen the {1} sigil from your faction stronghold!",
                                                faction.Definition.FriendlyName,
                                                sig.Town.Definition.FriendlyName);
                                        }
                                    }
                                }
                                break;
                                }

                                return(sig);
                            }
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(1005594);                             //	You do not have enough skill to steal the sigil
                        }
                    }
                    else
                    {
                        m_Thief.SendLocalizedMessage(1005588);                         //	You must join a faction to do that
                    }
                }
                #endregion

                else if (!stealflag && si == null && (toSteal.Parent == null || !toSteal.Movable))
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if ((toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) &&
                         !(toSteal.RootParent is FillableContainer) && !stealflag)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (toSteal is Spellbook)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (toSteal.Nontransferable)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (m_Thief.EraAOS && si == null && toSteal is Container)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (toSteal is IEthicsItem && ((IEthicsItem)toSteal).EthicsItemState != null &&
                         !((IEthicsItem)toSteal).EthicsItemState.HasExpired)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                {
                    m_Thief.SendLocalizedMessage(502703);                     // You must be standing next to an item to steal it.
                }
                // Alan: commented this out b/c there shouldn't be a required skill level to steal stealflag stuff
                //else if ( ( si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0 ) || ( stealflag ) && m_Thief.Skills[SkillName.Stealing].Value < 100.0 ) ) //&& m_Thief.Skills[SkillName.Stealing].Value < 90.0 ) )
                //	m_Thief.SendLocalizedMessage( 1060025, "", 0x66D ); // You're not skilled enough to attempt the theft of this item.
                else if (toSteal.Parent is Mobile)
                {
                    m_Thief.SendLocalizedMessage(1005585);           // You cannot steal items which are equipped.
                }
                else if (toSteal.GetSavedFlag(0x01))                 //Not lootable item
                {
                    m_Thief.SendLocalizedMessage(502710);            // You can't steal that!
                }
                else if (root == m_Thief || (root is BaseCreature && ((BaseCreature)root).GetMaster() == m_Thief))
                {
                    m_Thief.SendLocalizedMessage(502704);                     // You catch yourself red-handed.
                }
                else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root))
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (root is Corpse)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (m_Thief.Spell != null)
                {
                    m_Thief.SendMessage("You are too busy concentrating on your spell to steal that item.");
                }
                else
                {
                    double w = toSteal.Weight + toSteal.TotalWeight;

                    if (addon != null)
                    {
                        w = addon.Weight = addon.TotalWeight;
                    }

                    if (w > 10 && !stealflag)
                    {
                        m_Thief.SendMessage("That is too heavy to steal.");
                    }
                    else
                    {
                        m_Thief.BeginAction(typeof(Hiding));

                        Timer.DelayCall(TimeSpan.FromSeconds(SpecialMovesController._StealingRehideDelay), ReleaseHideLock, m_Thief);

                        if (toSteal.Stackable && toSteal.Amount > 1)
                        {
                            var maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);
                            var minAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 25.0) / toSteal.Weight);                             //added a min amount

                            if (minAmount < 1)
                            {
                                minAmount = 1;
                            }

                            if (maxAmount < 1)
                            {
                                maxAmount = 1;
                            }
                            else if (maxAmount > toSteal.Amount)
                            {
                                maxAmount = toSteal.Amount;
                            }

                            int amount = Utility.RandomMinMax(minAmount, maxAmount);                             //(change from 1, maxamount)

                            if (amount >= toSteal.Amount)
                            {
                                var pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = toSteal;
                                }
                            }
                            else
                            {
                                var pileWeight = (int)Math.Ceiling(toSteal.Weight * amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount) ?? toSteal;
                                }
                            }
                        }
                        else
                        {
                            var iw = (int)Math.Ceiling(w);
                            iw *= 10;

                            if (stealflag || m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5))
                            {
                                stolen = toSteal;
                            }
                        }

                        if (stolen is PowerScroll)
                        {
                            var  scroll  = (PowerScroll)stolen;
                            bool success = Utility.RandomBool();

                            if (success || Utility.RandomBool())
                            {
                                BaseMount.Dismount(m_Thief);
                                BaseMount.SetMountPrevention(
                                    m_Thief, BlockMountType.DismountRecovery, TimeSpan.FromSeconds(success ? 60.0 : 5.0));
                            }
                        }

                        if (stolen != null)
                        {
                            m_Thief.SendLocalizedMessage(502724); // You successfully steal the item.

                            if (stolen is Head2)
                            {
                                ((Head2)stolen).Owner = m_Thief as PlayerMobile;
                            }

                            if (si != null)
                            {
                                toSteal.Movable = true;
                                si.Item         = null;
                            }

                            if (stealflag)
                            {
                                //toSteal.SetSavedFlag( 0x04, false );
                                // ARTEGORDONMOD
                                // set the taken flag to trigger release from any controlling spawner
                                ItemFlags.SetTaken(stolen, true);
                                // clear the stealable flag so that the item can only be stolen once if it is later locked down.
                                ItemFlags.SetStealable(stolen, false);

                                if (addon != null)                                 //deed it up!
                                {
                                    Item deed = addon.Deed;

                                    addon.Delete();
                                    stolen = deed;
                                }
                                else                                 // release it if it was locked down
                                {
                                    toSteal.Movable = true;
                                }

                                if (toSteal.Spawner != null)                                 //its not spawned anymore, its STOLEN!
                                {
                                    toSteal.Spawner.Remove(toSteal);
                                    toSteal.Spawner = null;
                                }
                            }

                            Conquests.CheckProgress <StealingConquest>(m_Thief as PlayerMobile, toSteal);
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(502723);                             // You fail to steal the item.
                        }

                        caught = !stealflag && (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150));
                    }
                }

                return(stolen);
            }