Пример #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);
        }
Пример #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);
        }
Пример #3
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);
        }
Пример #4
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);
        }
Пример #5
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);
        }
Пример #6
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);
        }