Ejemplo n.º 1
0
        public virtual bool OnFired(Mobile attacker, Mobile defender)
        {
            if (attacker.Player)
            {
                BaseQuiver quiver = attacker.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
                Container  pack   = attacker.Backpack;

                if (quiver == null || Utility.Random(100) >= quiver.LowerAmmoCost)
                {
                    // consume ammo
                    if (quiver != null && quiver.ConsumeTotal(AmmoType, 1))
                    {
                        quiver.InvalidateWeight();
                    }
                    else if (pack == null || !pack.ConsumeTotal(AmmoType, 1))
                    {
                        return(false);
                    }
                }
                else if (quiver.FindItemByType(AmmoType) == null && (pack == null || pack.FindItemByType(AmmoType) == null))
                {
                    // lower ammo cost should not work when we have no ammo at all
                    return(false);
                }
            }

            attacker.MovingEffect(defender, EffectID, 18, 1, false, false);

            return(true);
        }
Ejemplo n.º 2
0
        public virtual bool OnFired(Mobile attacker, IDamageable damageable)
        {
            WeaponAbility ability = WeaponAbility.GetCurrentAbility(attacker);

            //Type type = (Color)Enum.Parse(typeof(Enumeration.ArrowType), m_ArrowType);

            // Respect special moves that use no ammo
            if (ability != null && ability.ConsumeAmmo == false)
            {
                return(true);
            }

            if (attacker.Player)
            {
                BaseQuiver quiver = attacker.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
                Container  pack   = attacker.Backpack;

                int lowerAmmo = AosAttributes.GetValue(attacker, AosAttribute.LowerAmmoCost);

                if (quiver == null || Utility.Random(100) >= lowerAmmo)
                {
                    if (quiver != null && quiver.ConsumeTotal(SpecialAmmoType, 1))
                    {
                        //attacker.SendMessage("1");
                        quiver.InvalidateWeight();
                    }
                    //else if (pack == null || !pack.ConsumeTotal(m_ArrowType, 1))
                    /* UNIVERSAL STORAGE KEY BEGIN */

                    else if (pack == null || !pack.ConsumeTotal(SpecialAmmoType, 1) && !BaseStoreKey.Consume(pack, SpecialAmmoType, 1))
                    {
                        //attacker.SendMessage("2");
                        return(false);
                    }
                }
                // if( ArrowSelection > 0 & (pack == null || pack.FindItemByType(SpecialAmmoType) == null) )
                // {
                // return false;
                // }
                else if (quiver.FindItemByType(SpecialAmmoType) == null && (pack == null || pack.FindItemByType(SpecialAmmoType) == null))
                {
                    // lower ammo cost should not work when we have no ammo at all
                    //attacker.SendMessage("4");
                    return(false);
                }
                // else if( SpecialAmmoType != null && quiver.FindItemByType(SpecialAmmoType) == null && (pack == null || pack.FindItemByType(SpecialAmmoType) == null) )
                // {
                // return false;
                // }
            }

            attacker.MovingEffect(damageable, EffectID, 18, 1, false, false);


            return(true);
        }
Ejemplo n.º 3
0
        public virtual bool OnFired(Mobile attacker, Mobile defender)
        {
            //--<<Advanced Archery Edit>>---------------------[Start 3/4]
            PlayerMobile     a_pm   = attacker as PlayerMobile;
            Container        pack   = attacker.Backpack;
            BaseQuiver       quiver = attacker.FindItemOnLayer(Layer.MiddleTorso) as BaseQuiver;
            BaseRangedModule module = this.BaseRangedModule;

            if (!module.HasBowString)
            {
                if (DateTime.Now >= m_NextStringWarning)
                {
                    m_NextStringWarning = DateTime.Now + StringWarningDelay;
                    attacker.SendMessage("You need a string to use this bow. See a local fletcher to apply the string.");
                    return(false);
                }
                else
                {
                    return(false);
                }
            }

            if (Ammo == null)
            {
                if (DateTime.Now >= m_NextAmmoWarning)
                {
                    m_NextAmmoWarning = DateTime.Now + AmmoWarningDelay;
                    attacker.SendMessage("You are out of ammo.");
                    return(false);
                }
                else
                {
                    return(false);
                }
            }

            if (attacker.Player && quiver != null && quiver.LowerAmmoCost > Utility.Random(100))
            {
                attacker.MovingEffect(defender, EffectID, 18, 1, false, false);
                return(true);
            }

            if (attacker.Player &&
                (quiver == null || !quiver.ConsumeTotal(AmmoType, 1)) &&
                (pack == null || !pack.ConsumeTotal(AmmoType, 1)))
            {
                return(false);
            }

            attacker.MovingEffect(defender, EffectID, 18, 1, false, false);
            return(true);
            //--<<Advanced Archery Edit>>---------------------[End 3/4]
        }
Ejemplo n.º 4
0
        public virtual bool OnFired(Mobile attacker, Mobile defender)
        {
            BaseQuiver quiver = attacker.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
            Container  pack   = attacker.Backpack;

            if (!EventItem || (EventItem && EventItemConsume))
            {
                if (attacker.Player)
                {
                    if (quiver == null || quiver.LowerAmmoCost == 0 || quiver.LowerAmmoCost > Utility.Random(100))
                    {
                        if (quiver != null && quiver.ConsumeTotal(AmmoType, 1))
                        {
                            quiver.InvalidateWeight();
                        }
                        else if (pack == null || !pack.ConsumeTotal(AmmoType, 1))
                        {
                            return(false);
                        }
                    }
                }
            }

            if (attacker.Mounted)
            {
                if (DefAnimation == WeaponAnimation.ShootBow)
                {
                    attacker.Animate(27, 5, 1, true, false, 0);
                }
                else if (DefAnimation == WeaponAnimation.ShootXBow)
                {
                    attacker.Animate(28, 5, 1, true, false, 0);
                }
            }
            else
            {
                if (DefAnimation == WeaponAnimation.ShootBow)
                {
                    attacker.Animate(18, 5, 1, true, false, 0);
                }
                else if (DefAnimation == WeaponAnimation.ShootXBow)
                {
                    attacker.Animate(19, 5, 1, true, false, 0);
                }
            }

            attacker.MovingEffect(defender, EffectID, 18, 1, false, false);

            return(true);
        }
Ejemplo n.º 5
0
        public virtual bool OnFired(Mobile attacker, Mobile defender)
        {
            Container pack = attacker.Backpack;

            if (Attributes.LowerAmmoCost < Utility.RandomMinMax(1, 100) && attacker.IsPlayer)
            {
                m_IsFalseArrow = false;

                bool success = false;

                Item cloak = attacker.FindItemOnLayer(Layer.Cloak);

                if (cloak is BaseQuiver)
                {
                    BaseQuiver quiver = cloak as BaseQuiver;

                    if (quiver.ConsumeTotal(AmmoType, 1))
                    {
                        success = true;
                        quiver.InvalidateProperties();
                    }
                }

                if (!success)
                {
                    if (pack != null && pack.ConsumeTotal(AmmoType, 1))
                    {
                        success = true;
                    }
                }

                if (!success)
                {
                    return(false);
                }
            }
            else
            {
                m_IsFalseArrow = true;
            }

            attacker.MovingEffect(defender, EffectID, 18, 1, false, false);

            return(true);
        }
Ejemplo n.º 6
0
        public virtual bool OnFired(Mobile attacker, IDamageable damageable)
        {
            WeaponAbility ability = WeaponAbility.GetCurrentAbility(attacker);

            // Respect special moves that use no ammo
            if (ability != null && ability.ConsumeAmmo == false)
            {
                return(true);
            }

            if (attacker.Player)
            {
                BaseQuiver quiver = attacker.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
                Container  pack   = attacker.Backpack;

                int lowerAmmo = AosAttributes.GetValue(attacker, AosAttribute.LowerAmmoCost);

                if (quiver == null || Utility.Random(100) >= lowerAmmo)
                {
                    // consume ammo
                    if (quiver != null && quiver.ConsumeTotal(AmmoType, 1))
                    {
                        quiver.InvalidateWeight();
                    }
                    else if (pack == null || !pack.ConsumeTotal(AmmoType, 1))
                    {
                        return(false);
                    }
                }
                else if (quiver.FindItemByType(AmmoType) == null && (pack == null || pack.FindItemByType(AmmoType) == null))
                {
                    // lower ammo cost should not work when we have no ammo at all
                    return(false);
                }
            }

            attacker.MovingEffect(damageable, EffectID, 18, 1, false, false);

            return(true);
        }
Ejemplo n.º 7
0
        public virtual bool OnFired(Mobile attacker, Mobile defender)
        {
            BaseQuiver quiver = attacker.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
            Container  pack   = attacker.Backpack;

            if (attacker.Player)
            {
                if (quiver == null || quiver.LowerAmmoCost == 0 || quiver.LowerAmmoCost > Utility.Random(100))
                {
                    if (quiver != null && quiver.ConsumeTotal(AmmoType, 1))
                    {
                        quiver.InvalidateWeight();
                    }
                    else if (pack == null || !pack.ConsumeTotal(AmmoType, 1))
                    {
                        return(false);
                    }
                }
            }

            attacker.MovingEffect(defender, EffectID, 18, 1, false, false);

            return(true);
        }
Ejemplo n.º 8
0
        public virtual bool OnFired(Mobile attacker, Mobile defender)
        {
            if (this is ThrowingGloves && attacker.Player)
            {
                string ammoType = "Throwing Stones";

                ThrowingGloves glove = (ThrowingGloves)this;
                if (glove.GloveType == "Stones")
                {
                    ammoType = "Throwing Stones";
                }
                else if (glove.GloveType == "Axes")
                {
                    ammoType = "Throwing Axes";
                }
                else if (glove.GloveType == "Daggers")
                {
                    ammoType = "Throwing Daggers";
                }
                else if (glove.GloveType == "Darts")
                {
                    ammoType = "Throwing Darts";
                }
                else if (glove.GloveType == "Cards" && Server.Misc.GetPlayerInfo.isJester(attacker))
                {
                    ammoType = "Throwing Cards";
                }
                else if (glove.GloveType == "Tomatoes" && Server.Misc.GetPlayerInfo.isJester(attacker))
                {
                    ammoType = "Throwing Tomatoes";
                }
                else
                {
                    ammoType = "Throwing Stars"; glove.GloveType = "Stones";
                }

                foreach (Item i in attacker.Backpack.FindItemsByType(typeof(ThrowingWeapon), true))
                {
                    if (ammoType == "Throwing Stones")
                    {
                        ((ThrowingWeapon)i).ammo = "Throwing Stones"; i.ItemID = 0x10B6; i.Name = "throwing stone";
                    }
                    else if (ammoType == "Throwing Axes")
                    {
                        ((ThrowingWeapon)i).ammo = "Throwing Axes"; i.ItemID = 0x10B3; i.Name = "throwing axe";
                    }
                    else if (ammoType == "Throwing Daggers")
                    {
                        ((ThrowingWeapon)i).ammo = "Throwing Daggers"; i.ItemID = 0x10B7; i.Name = "throwing dagger";
                    }
                    else if (ammoType == "Throwing Darts")
                    {
                        ((ThrowingWeapon)i).ammo = "Throwing Darts"; i.ItemID = 0x10B5; i.Name = "throwing dart";
                    }
                    else if (ammoType == "Throwing Cards")
                    {
                        ((ThrowingWeapon)i).ammo = "Throwing Cards"; i.ItemID = 0x4C29; i.Name = "throwing card";
                    }
                    else if (ammoType == "Throwing Tomatoes")
                    {
                        ((ThrowingWeapon)i).ammo = "Throwing Tomatoes"; i.ItemID = 0x4C28; i.Name = "throwing tomato";
                    }
                    else
                    {
                        ((ThrowingWeapon)i).ammo = "Throwing Stars"; i.ItemID = 0x10B2; i.Name = "throwing star";
                    }
                    i.InvalidateProperties();
                }
            }

            if (attacker.Player)
            {
                BaseQuiver quiver = attacker.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
                Container  pack   = attacker.Backpack;

                if (quiver == null || Utility.Random(100) >= quiver.LowerAmmoCost)
                {
                    // consume ammo
                    if (quiver != null && quiver.ConsumeTotal(AmmoType, 1))
                    {
                        quiver.InvalidateWeight();
                    }
                    else if (pack == null || !pack.ConsumeTotal(AmmoType, 1))
                    {
                        return(false);
                    }
                }
                else if (quiver.FindItemByType(AmmoType) == null && (pack == null || pack.FindItemByType(AmmoType) == null))
                {
                    // lower ammo cost should not work when we have no ammo at all
                    return(false);
                }
            }

            attacker.MovingEffect(defender, EffectID, 18, 1, false, false);

            Server.Gumps.QuickBar.RefreshQuickBar(attacker);

            return(true);
        }