Ejemplo n.º 1
0
        public virtual bool OnFired(Mobile attacker, Mobile defender)           // TODO: Maybe check only primary container? Then it could done with less code.
        {
            Container cont = attacker.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
            Container pack = attacker.Backpack;

            if (cont != null)
            {
                if (((BaseQuiver)cont).LowerAmmoCost > Utility.Random(100))                     //Crashes if not BaseQuiver Container
                {
                    attacker.MovingEffect(defender, EffectID, 18, 1, false, false);
                    return(true);
                }
                else if (cont.ConsumeTotal(AmmoType, 1))
                {
                    attacker.MovingEffect(defender, EffectID, 18, 1, false, false);
                    return(true);
                }
            }
            cont = attacker.Backpack;
            if (cont != null && cont.ConsumeTotal(AmmoType, 1))
            {
                attacker.MovingEffect(defender, EffectID, 18, 1, false, false);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile m = (Mobile)targeted;

                    if (m != from && from.HarmfulCheck(m))
                    {
                        Direction to = from.GetDirectionTo(m);

                        from.Direction = to;

                        from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);

                        if (Utility.RandomDouble() <= (Math.Sqrt(from.Dex / 100.0) * 1.0))
                        {
                            from.MovingEffect(m, 0x10E5, 7, 1, false, false, 0x481, 0);
                            AOS.Damage(m, from, Utility.Random(5, from.Str / 10), 100, 0, 0, 0, 0);
                            m.Paralyze(TimeSpan.FromSeconds(10));
                            Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(ReleasecastLock), from);
                        }
                        else
                        {
                            int x = 0, y = 0;

                            switch (to & Direction.Mask)
                            {
                            case Direction.North: --y; break;

                            case Direction.South: ++y; break;

                            case Direction.West: --x; break;

                            case Direction.East: ++x; break;

                            case Direction.Up: --x; --y; break;

                            case Direction.Down: ++x; ++y; break;

                            case Direction.Left: --x; ++y; break;

                            case Direction.Right: ++x; --y; break;
                            }

                            x += Utility.Random(-1, 3);
                            y += Utility.Random(-1, 3);

                            x += m.X;
                            y += m.Y;

                            from.MovingEffect(m_Boomerang, 0x10E5, 7, 1, false, false, 0x481, 0);

                            from.SendMessage("You miss.");
                            Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(ReleasecastLock), from);
                        }
                    }
                }
            }
Ejemplo n.º 3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Spear.Deleted)
                {
                    return;
                }
                else if (!from.Items.Contains(m_Spear))
                {
                    from.SendMessage("You must be holding that weapon to use it.");
                }
                else if (targeted is Mobile)
                {
                    Mobile m = (Mobile)targeted;

                    if (m != from && from.HarmfulCheck(m))
                    {
                        Direction to = from.GetDirectionTo(m);
                        from.Direction = to;
                        from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);
                        if (Utility.RandomDouble() >= (Math.Sqrt(m.Dex / 100.0) * 0.8))
                        {
                            from.MovingEffect(m, 0x1BFE, 7, 1, false, false, 0x481, 0);
                            AOS.Damage(m, from, Utility.Random(5, from.Str * 4), 100, 0, 0, 0, 0);
                            m_Spear.MoveToWorld(m.Location, m.Map);
                        }
                        else
                        {
                            int x = 0, y = 0;
                            switch (to & Direction.Mask)
                            {
                            case Direction.North: --y; break;

                            case Direction.South: ++y; break;

                            case Direction.West: --x; break;

                            case Direction.East: ++x; break;

                            case Direction.Up: --x; --y; break;

                            case Direction.Down: ++x; ++y; break;

                            case Direction.Left: --x; ++y; break;

                            case Direction.Right: ++x; --y; break;
                            }
                            x += Utility.Random(-1, 3);
                            y += Utility.Random(-1, 3);
                            x += m.X;
                            y += m.Y;
                            m_Spear.MoveToWorld(new Point3D(x, y, m.Z), m.Map);
                            from.MovingEffect(m_Spear, 0x1BFE, 7, 1, false, false, 0x481, 0);
                            from.SendMessage("You miss.");
                        }
                    }
                }
            }
Ejemplo n.º 4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_fukiya.Deleted)
                {
                    return;
                }
                else if (targeted is Mobile)
                {
                    Mobile m = (Mobile)targeted;

                    double dist = from.GetDistanceToSqrt(m.Location);

                    if (m.Map != from.Map || dist > 5)
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                        return;
                    }

                    if (m != from && from.HarmfulCheck(m))
                    {
                        Direction to = from.GetDirectionTo(m);

                        from.Direction = to;

                        from.RevealingAction();

                        from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);

                        if (CheckHitChance(from, m))
                        {
                            from.MovingEffect(m, 0x2806, 7, 1, false, false, 0x23A, 0);

                            AOS.Damage(m, from, Utility.Random(4, 6), 100, 0, 0, 0, 0);

                            if (m_fukiya.Poison != null && m_fukiya.PoisonCharges > 0)
                            {
                                --m_fukiya.PoisonCharges;

                                m.ApplyPoison(from, m_fukiya.Poison);
                            }
                        }
                        else
                        {
                            FukiyaDart dart = new FukiyaDart();

                            from.MovingEffect(dart, 0x2804, 7, 1, false, false, 0x23A, 0);

                            from.SendMessage("You miss.");

                            dart.Delete();
                        }

                        m_fukiya.UsesRemaining--;
                    }
                }
            }
Ejemplo n.º 5
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.º 6
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.º 7
0
    public virtual void Return(Mobile thrower, Mobile target, WorldLocation worldLocation)
    {
        if (thrower == null)
        {
            return;
        }

        if (target != null)
        {
            target.MovingEffect(thrower, EffectID, 18, 1, false, false, Hue, 0);
        }
        else
        {
            Effects.SendMovingParticles(
                new Entity(Serial.Zero, worldLocation.Location, worldLocation.Map),
                thrower,
                ItemID,
                18,
                0,
                false,
                false,
                Hue,
                0,
                9502,
                1,
                0,
                (EffectLayer)255,
                0x100
                );
        }
    }
Ejemplo n.º 8
0
        public virtual bool OnFired(Mobile attacker, Mobile defender)
        {
            var pm     = attacker as PlayerMobile;
            var battle = AutoPvP.FindBattleI <IUOFBattle>(pm);

            if ((attacker.Player && battle == null) || (battle != null && !battle.NoConsume) ||
                (attacker is BaseCreature && ((BaseCreature)attacker).Pseu_ConsumeReagents))
            {
                var       quiver = attacker.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
                Container pack   = attacker.Backpack;

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

            if (defender != null)
            {
                attacker.MovingEffect(defender, EffectID, 18, 1, false, false);
            }

            return(true);
        }
Ejemplo n.º 9
0
            protected override void OnTick()
            {
                if (m_From == null || !m_From.Alive || (m_NPC.DartBoard == null || m_NPC.DartBoard.Deleted))
                {
                    m_NPC.Say("Hmm...minor detail...");

                    Stop();
                }
                else if (++count > 2)
                {
                    m_NPC.Gamer = null;
                    m_NPC.Say("Game over! NEXT!");

                    Stop();
                }
                else
                {
                    m_From.Direction = m_From.GetDirectionTo(m_NPC.DartBoard.GetWorldLocation());

                    m_From.Animate(m_From.Mounted ? 26 : 9, 7, 1, true, false, 0);
                    m_From.MovingEffect(m_NPC.DartBoard, 0xF51, 7, 1, false, false);
                    Effects.PlaySound(m_From.Location, m_From.Map, 0x238);

                    m_NPC.CheckThrow(m_From);
                }
            }
Ejemplo n.º 10
0
		public void Throw( Mobile from )
		{
			BaseKnife knife = from.Weapon as BaseKnife;

			if ( knife == null )
			{
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500751 ); // Try holding a knife...
				return;
			}

			from.Animate( from.Mounted ? 26 : 9, 7, 1, true, false, 0 );
			from.MovingEffect( this, knife.ItemID, 7, 1, false, false );
			from.PlaySound( 0x238 );

			double rand = Utility.RandomDouble();

			int message;
			if ( rand < 0.05 )
				message = 500752; // BULLSEYE! 50 Points!
			else if ( rand < 0.20 )
				message = 500753; // Just missed the center! 20 points.
			else if ( rand < 0.45 )
				message = 500754; // 10 point shot.
			else if ( rand < 0.70 )
				message = 500755; // 5 pointer.
			else if ( rand < 0.85 )
				message = 500756; // 1 point.  Bad throw.
			else
				message = 500757; // Missed.

			PublicOverheadMessage( MessageType.Regular, 0x3B2, message );
		}
Ejemplo n.º 11
0
        public override bool OnFired(Mobile attacker, Mobile defender)
        {
            if (!m_PBGI.Active)
            {
                attacker.SendMessage("The game has not started yet!");
                return(false);
            }

            if (defender.ChestArmor != null && defender.ChestArmor is PBArmor)
            {
                if (defender.FindItemOnLayer(Layer.Cloak) != null && defender.FindItemOnLayer(Layer.Cloak).Hue == Hue)
                {
                    attacker.SendMessage("Do not attack your own team!");
                    return(false);
                }
            }
            else
            {
                attacker.SendMessage("You cannot attack someone that is not playing!");
                defender.SendMessage("You are not playing Paintball, please leave the area.");
                return(false);
            }

            Container pack = attacker.Backpack;

            if (attacker.Player && (pack == null || !pack.ConsumeTotal(AmmoType, 1)))
            {
                attacker.SendMessage("You are out of paintballs!");
                return(false);
            }

            attacker.MovingEffect(defender, EffectID, 18, 1, false, false, Hue, 3);
            return(true);
        }
Ejemplo n.º 12
0
        private static void FinishThrow(object state)
        {
            object[] states = (object[])state;

            Mobile from = (Mobile)states[0];
            Mobile to   = (Mobile)states[1];
            Item   bola = (Item)states[2];

            if (!from.Alive)
            {
                return;
            }
            if (!bola.IsChildOf(from.Backpack))
            {
                bola.PrivateOverheadMessage(MessageType.Regular, 946, 1040019, from.NetState); // The bola must be in your pack to use it.
            }
            else if (!from.InRange(to, 15) || !from.InLOS(to) || !from.CanSee(to))
            {
                from.PrivateOverheadMessage(MessageType.Regular, 946, 1042060, from.NetState); // You cannot see that target!
            }
            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
            {
                bola.Consume();

                from.Direction = from.GetDirectionTo(to);
                from.Animate(AnimationType.Attack, 4);
                from.MovingEffect(to, 0x26AC, 10, 0, false, false);

                new Bola().MoveToWorld(to.Location, to.Map);

                if (to is Neira || to is ChaosDragoon || to is ChaosDragoonElite)
                {
                    to.PrivateOverheadMessage(MessageType.Regular, 946, 1042047, from.NetState); // You fail to knock the rider from its mount.
                }
                else
                {
                    if (CheckHit(to, from))
                    {
                        to.Damage(Utility.RandomMinMax(10, 20), from);

                        if (from.Flying)
                        {
                            to.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1113590, from.Name); // You have been grounded by ~1_NAME~!
                        }
                        else
                        {
                            to.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1049623, from.Name); // You have been knocked off of your mount by ~1_NAME~!
                        }
                        BaseMount.Dismount(to);

                        BaseMount.SetMountPrevention(to, BlockMountType.Dazed, TimeSpan.FromSeconds(10.0));
                    }
                }
            }
        }
Ejemplo n.º 13
0
Archivo: Bola.cs Proyecto: jaedan/runuo
            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 (!HasFreeHands(from))
                    {
                        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 && !Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(to))
                    {
                        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);

                        from.DoHarmful(to);

                        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.
                }
            }
Ejemplo n.º 14
0
            protected override void OnTarget(Mobile from, object obj)
            {
                if (m_NecroCrystal.Deleted)
                {
                    return;
                }

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

                    if (!m_NecroCrystal.IsChildOf(from.Backpack))
                    {
                        from.SendMessage("This must be in your pack");                           // The bola must be in your pack to use it.
                    }
                    else if (from.FindItemOnLayer(Layer.OneHanded) != null || from.FindItemOnLayer(Layer.TwoHanded) != null)
                    {
                        from.SendMessage("Your hands must be free!");                           // 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 ( !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(NecroCrystal)))
                    {
                    }
                    else if (to is NecromancerChamp)
                    {
                        from.SendMessage("The Crystal weakens the monster!");
                        to.Damage(50, from);
                    }



                    m_NecroCrystal.Consume();

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

                    Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(FinishThrow), new object[] { from, to });
                }
                else
                {
                    from.SendMessage("You have to wait a few moments before you can use another Crystal!");                               // You have to wait a few moments before you can use another bola!
                }
                //else
                //{
                //	from.SendMessage( "You cannot throw a crystal at that!" ); // You cannot throw a bola at that.
                //}
            }
Ejemplo n.º 15
0
    public override bool OnFired(Mobile attacker, Mobile defender)
    {
        if (!attacker.InRange(defender, 1))
        {
            attacker.MovingEffect(defender, EffectID, 18, 1, false, false, Hue, 0);
        }

        return(true);
    }
Ejemplo n.º 16
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.º 17
0
        public void AttackAnimation(Mobile from, Mobile to)
        {
            if (from.Body.IsHuman && !from.Mounted)
            {
                from.Animate(33, 2, 1, true, true, 0);
            }

            from.PlaySound(0x223);
            from.MovingEffect(to, 0x2804, 5, 0, false, false);
        }
Ejemplo n.º 18
0
		public virtual bool OnFired( Mobile attacker, Mobile defender ) {
			Container pack = attacker.Backpack;

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

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

			return true;
		}
Ejemplo n.º 19
0
		public void AttackAnimation(Mobile from, Mobile to)
		{
			if (from.Body.IsHuman)
			{
				from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);
			}

			from.PlaySound(0x23A);
			from.MovingEffect(to, 0x27AC, 1, 0, false, false);
		}
Ejemplo n.º 20
0
		public void AttackAnimation(Mobile from, Mobile to)
		{
			if (from.Body.IsHuman && !from.Mounted)
			{
				from.Animate(33, 2, 1, true, true, 0);
			}

			from.PlaySound(0x223);
			from.MovingEffect(to, 0x2804, 5, 0, false, false);
		}
        public void AttackAnimation(Mobile from, Mobile to)
        {
            if (from.Body.IsHuman)
            {
                from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);
            }

            from.PlaySound(0x23A);
            from.MovingEffect(to, 0x27AC, 1, 0, false, false);
        }
Ejemplo n.º 22
0
        public void AttackAnimation(Mobile from, Mobile to)
        {
            if (from.Body.IsHuman)
            {
                from.Animate(AnimationType.Attack, 4);
            }

            from.PlaySound(0x23A);
            from.MovingEffect(to, 0x27AC, 1, 0, false, false);
        }
Ejemplo n.º 23
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!this.CheckMana(attacker, true) && defender != null)
                return;

            BaseThrown weapon = attacker.Weapon as BaseThrown;

            if (weapon == null)
                return;

            List<Mobile> targets = new List<Mobile>();

            foreach (Mobile m in attacker.GetMobilesInRange(weapon.MaxRange))
            {
                if (m == defender)
                    continue;

                if (m.Combatant != attacker)
                    continue;

                targets.Add(m);
            }

            if (targets.Count > 0)
                this.m_Target = targets[Utility.Random(targets.Count)];

            /*
            Mobile m = null;

            foreach( DamageEntry de in attacker.DamageEntries )
            {
            m = Mobile.GetDamagerFrom( de );

            if ( m != null )
            {
            if ( defender != m && defender.InRange( m, 3 ) )
            {
            m_Target = m;
            break;
            }
            }
            }
            */

            AOS.Damage(defender, attacker, this.m_Damage, 0, 0, 0, 0, 100);

            if (this.m_Target != null)
            {
                defender.MovingEffect(this.m_Target, weapon.ItemID, 18, 1, false, false);
                Timer.DelayCall(TimeSpan.FromMilliseconds(333.0), new TimerCallback(ThrowAgain));
                this.m_Mobile = attacker;
            }

            ClearCurrentAbility(attacker);
        }
Ejemplo n.º 24
0
        public override bool OnFired(Mobile attacker, Mobile defender)
        {
            if (attacker.Mana <= ManaReq)
            {
                return(false);
            }
            attacker.Mana -= ManaReq;
            attacker.MovingEffect(defender, EffectID, 18, 1, false, false);

            return(true);
        }
Ejemplo n.º 25
0
        public void Shoot(Mobile from, Mobile target)
        {
            if (from == target)
            {
                return;
            }

            if (m_UsesRemaining < 1)
            {
                // You have no shuriken in your ninja belt!
                from.SendLocalizedMessage(1063297);
            }
            else if (m_Using)
            {
                // You cannot throw another shuriken yet.
                from.SendLocalizedMessage(1063298);
            }
            else if (!BasePotion.HasFreeHand(from))
            {
                // You must have a free hand to throw shuriken.
                from.SendLocalizedMessage(1063299);
            }
            else if (from.InRange(target, 2))
            {
                from.SendLocalizedMessage(1063303);                   // Your target is too close!
            }
            else if (from.CanBeHarmful(target))
            {
                m_Using = true;

                from.Direction = from.GetDirectionTo(target);

                from.RevealingAction();

                if (from.Body.IsHuman)
                {
                    from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);
                }

                from.PlaySound(0x23A);
                from.MovingEffect(target, 0x27AC, 1, 0, false, false);

                if (from.CheckSkill(SkillName.Ninjitsu, -10.0, 65.0))
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(OnShurikenHit), new object[] { from, target });
                }
                else
                {
                    ConsumeUse();
                }

                Timer.DelayCall(TimeSpan.FromSeconds(2.5), new TimerCallback(ResetUsing));
            }
        }
Ejemplo n.º 26
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!CheckMana(attacker, true) && defender != null)
            {
                return;
            }

            BaseThrown weapon = attacker.Weapon as BaseThrown;

            if (weapon == null)
            {
                return;
            }

            List <Mobile>     targets = new List <Mobile>();
            IPooledEnumerable eable   = attacker.GetMobilesInRange(weapon.MaxRange);

            foreach (Mobile m in eable)
            {
                if (m == defender)
                {
                    continue;
                }

                if (m.Combatant != attacker)
                {
                    continue;
                }

                targets.Add(m);
            }

            eable.Free();

            if (targets.Count > 0)
            {
                m_Target = targets[Utility.Random(targets.Count)];
            }

            AOS.Damage(defender, attacker, m_Damage, 0, 0, 0, 0, 0, 100);

            if (m_Target != null)
            {
                if (defender != null)
                {
                    defender.MovingEffect(m_Target, weapon.ItemID, 18, 1, false, false);
                }

                Timer.DelayCall(TimeSpan.FromMilliseconds(333.0), ThrowAgain);
                m_Mobile = attacker;
            }

            ClearCurrentAbility(attacker);
        }
Ejemplo n.º 27
0
        public override bool OnFired(Mobile attacker, IDamageable damageable)
        {
            m_Thrower = attacker;

            if (!attacker.InRange(damageable, 1))
            {
                attacker.MovingEffect(damageable, EffectID, 18, 1, false, false, Hue, 0);
            }

            return(true);
        }
Ejemplo n.º 28
0
 public virtual void ThrowBack()
 {
     if (m_Target != null)
     {
         m_Target.MovingEffect(m_Thrower, EffectID, 18, 1, false, false, Hue, 0);
     }
     else if (m_Thrower != null)
     {
         Effects.SendMovingParticles(new Entity(Serial.Zero, m_KillSave, m_Thrower.Map), m_Thrower, ItemID, 18, 0, false, false, Hue, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
     }
 }
Ejemplo n.º 29
0
        public void Shoot(Mobile from, Mobile target)
        {
            if (from == target)
            {
                return;
            }

            if (m_UsesRemaining < 1)
            {
                // You have no fukiya darts!
                from.SendLocalizedMessage(1063325);
            }
            else if (m_Using.Contains(from))
            {
                // You are already using that fukiya.
                from.SendLocalizedMessage(1063326);
            }
            else if (!HasFreeHand(from))
            {
                // You must have a free hand to use a fukiya.
                from.SendLocalizedMessage(1063327);
            }
            else if (from.GetDistanceToSqrt(target) > 5)
            {
                // Your target is too far!
                from.SendLocalizedMessage(1063304);
            }
            else if (from.CanBeHarmful(target))
            {
                m_Using.Add(from);

                from.Direction = from.GetDirectionTo(target);

                from.RevealingAction();

                from.PlaySound(0x223);
                from.MovingEffect(target, 0x2804, 5, 0, false, false);

                if (CheckHitChance(from, target))
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(OnDartHit), new object[] { from, target });
                }
                else
                {
                    ConsumeUse();
                }

                // Shooting a fukiya dart restarts your weapon swing delay
                from.NextCombatTime = DateTime.UtcNow + from.Weapon.GetDelay(from);

                Timer.DelayCall(TimeSpan.FromSeconds(1.0), () => m_Using.Remove(from));
            }
        }
Ejemplo n.º 30
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( targeted is Mobile )
				{
					Mobile m = (Mobile)targeted;
			
					if ( m != from && from.HarmfulCheck( m ) )
					{
						Direction to = from.GetDirectionTo( m );

						from.Direction = to;

						from.Animate( from.Mounted ? 26 : 9, 7, 1, true, false, 0 );

						if ( Utility.RandomDouble() <= (Math.Sqrt( from.Dex / 100.0 ) * 1.0) )
						{
							from.MovingEffect( m, 0x10E5, 7, 1, false, false, 0x481, 0 );
							AOS.Damage( m, from, Utility.Random( 5, from.Str / 10 ), 100, 0, 0, 0, 0 );
							m.Paralyze( TimeSpan.FromSeconds( 10 ) );
							Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerStateCallback( ReleasecastLock ), from );
							
						}
						else
						{
							int x = 0, y = 0;

							switch ( to & Direction.Mask )
							{
								case Direction.North: --y; break;
								case Direction.South: ++y; break;
								case Direction.West: --x; break;
								case Direction.East: ++x; break;
								case Direction.Up: --x; --y; break;
								case Direction.Down: ++x; ++y; break;
								case Direction.Left: --x; ++y; break;
								case Direction.Right: ++x; --y; break;
							}

							x += Utility.Random( -1, 3 );
							y += Utility.Random( -1, 3 );

							x += m.X;
							y += m.Y;

							from.MovingEffect( m_MBoomerang, 0x10E5, 7, 1, false, false, 0x481, 0 );

							from.SendMessage( "You miss." );
							Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerStateCallback( ReleasecastLock ), from );
						}
				
					}
				}
			}
Ejemplo n.º 31
0
        public virtual bool OnFired(Mobile attacker, Mobile defender)
        {
            Container pack   = attacker.Backpack;
            Quiver    quiver = attacker.FindItemOnLayer(Layer.Cloak) as Quiver;

            if (quiver != null && quiver.ConsumeTotal(AmmoType, 1))
            {
                quiver.UpdateTotals();
                quiver.InvalidateProperties();

                attacker.MovingEffect(defender, EffectID, 18, 1, false, false);
                return(true);
            }
            else if (pack != null && pack.ConsumeTotal(AmmoType, 1))
            {
                attacker.MovingEffect(defender, EffectID, 18, 1, false, false);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 32
0
    public override void OnHit(Mobile attacker, Mobile defender, int damage)
    {
        if (!CheckMana(attacker, true) && defender != null)
        {
            return;
        }

        BaseThrown weapon = attacker.Weapon as BaseThrown;

        if (weapon == null)
        {
            return;
        }

        using var queue = PooledRefQueue <Mobile> .Create();

        IPooledEnumerable eable = attacker.GetMobilesInRange(weapon.MaxRange);

        foreach (Mobile m in eable)
        {
            if (m == defender)
            {
                continue;
            }

            if (m.Combatant != attacker)
            {
                continue;
            }

            queue.Enqueue(m);
        }

        eable.Free();

        if (queue.Count > 0)
        {
            _target = queue.PeekRandom();
        }

        AOS.Damage(defender, attacker, Damage, 0, 0, 0, 0, 0, 100);

        if (_target != null)
        {
            defender?.MovingEffect(_target, weapon.ItemID, 18, 1, false, false);

            Timer.DelayCall(TimeSpan.FromSeconds(0.3), ThrowAgain);
            _mobile = attacker;
        }

        ClearCurrentAbility(attacker);
    }
Ejemplo n.º 33
0
            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 (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 (!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)))
                    {
                        from.DoHarmful(to);

                        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.
                }
            }
Ejemplo n.º 34
0
        public void Throw(Mobile from)
        {
            BaseKnife knife = from.Weapon as BaseKnife;

            if (knife == null)
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500751); // Try holding a knife...
                return;
            }

            if (Core.SA)
            {
                from.Animate(AnimationType.Attack, 4);
            }
            else
            {
                from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);
            }

            from.MovingEffect(this, knife.ItemID, 7, 1, false, false);
            from.PlaySound(0x238);

            double rand = Utility.RandomDouble();

            int message;

            if (rand < 0.05)
            {
                message = 500752; // BULLSEYE! 50 Points!
            }
            else if (rand < 0.20)
            {
                message = 500753; // Just missed the center! 20 points.
            }
            else if (rand < 0.45)
            {
                message = 500754; // 10 point shot.
            }
            else if (rand < 0.70)
            {
                message = 500755; // 5 pointer.
            }
            else if (rand < 0.85)
            {
                message = 500756; // 1 point.  Bad throw.
            }
            else
            {
                message = 500757; // Missed.
            }
            this.PublicOverheadMessage(MessageType.Regular, 0x3B2, message);
        }
        public void ThrowKnife(Mobile from)
        {
            BaseKnife knife = from.Weapon as BaseKnife;

            if (knife == null)
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500751);                   // Try holding a knife...
                return;
            }

            from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);
            from.MovingEffect(this, knife.ItemID, 7, 1, false, false);
            from.PlaySound(0x238);

            double rand = Utility.RandomDouble();

            if (rand < 0.05)
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "Right between the eyes! 50 Points!");
                Effects.PlaySound(Location, Map, 426);
                OnMongbatHit(from);
            }
            else if (rand < 0.20)
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "A Shot to the neck! 20 points.");
                Effects.PlaySound(Location, Map, Utility.RandomList(424, 425));
                OnMongbatHit(from);
            }
            else if (rand < 0.45)
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "A shot to the body, 10 points.");
                Effects.PlaySound(Location, Map, Utility.RandomList(424, 425));
                OnMongbatHit(from);
            }
            else if (rand < 0.70)
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "Clipped its wing, 5 pointer.");
                Effects.PlaySound(Location, Map, Utility.RandomList(424, 425));
                OnMongbatHit(from);
            }
            else if (rand < 0.85)
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "Bounced off him..  1 point.");
                Effects.PlaySound(Location, Map, Utility.RandomList(424, 425));
                OnMongbatHit(from);
            }
            else
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, 500757);                    // Missed.
                Effects.PlaySound(Location, Map, Utility.RandomList(422, 423));
            }
        }
Ejemplo n.º 36
0
        public void Shoot(Mobile from, Mobile target)
        {
            double ninja = from.Skills[SkillName.Ninjitsu].Value;

            if (from == target)
            {
                return;
            }

            if (m_UsesRemaining < 1)
            {
                // You have no fukiya darts!
                from.SendLocalizedMessage(1063325);
            }
            else if (m_Using)
            {
                // You are already using that fukiya.
                from.SendLocalizedMessage(1063326);
            }
            else if ((ninja < 100) && (!BasePotion.HasFreeHand(from)))
            {
                // You must have a free hand to use a fukiya.
                from.SendLocalizedMessage(1063327);
            }
            else if (from.CanBeHarmful(target))
            {
                m_Using = true;

                from.Direction = from.GetDirectionTo(target);

                from.RevealingAction();

                if (from.Body.IsHuman && !from.Mounted)
                {
                    from.Animate(33, 2, 1, true, true, 0);
                }

                from.PlaySound(0x223);
                from.MovingEffect(target, 0x2804, 5, 0, false, false);

                if (from.CheckSkill(SkillName.Ninjitsu, -10.0, 50.0))
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(OnDartHit), new object[] { from, target });
                }
                else
                {
                    ConsumeUse();
                }

                Timer.DelayCall(TimeSpan.FromSeconds(2.5), new TimerCallback(ResetUsing));
            }
        }
Ejemplo n.º 37
0
		public override bool OnFired( Mobile attacker, Mobile defender )
		{
			m_Thrower = attacker;

			if ( !attacker.InRange( defender, 1 ) )
			{
				//Internalize();
				Visible = false;
				attacker.MovingEffect( defender, EffectID, 18, 1, false, false );
			}

			return true;
		}
Ejemplo n.º 38
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.º 39
0
        public void Fire(Mobile from)
        {
            BaseRanged bow = from.Weapon as BaseRanged;
            BaseThrown trow = from.Weapon as BaseThrown;

            if (bow == null && trow == null)
            {
                this.SendLocalizedMessageTo(from, 500593); // You must practice with ranged weapons on this.
                return;
            }

            if (DateTime.UtcNow < (this.m_LastUse + UseDelay))
                return;

            Point3D worldLoc = this.GetWorldLocation();

            if (this.FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y)
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500596); // You would do better to stand in front of the archery butte.
                return;
            }

            if (this.FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X)
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500597); // You aren't properly lined up with the archery butte to get an accurate shot.
                return;
            }

            if (!from.InRange(worldLoc, 6))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500598); // You are too far away from the archery butte to get an accurate shot.
                return;
            }
            else if (from.InRange(worldLoc, 4))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500599); // You are too close to the target.
                return;
            }

            Container pack = from.Backpack;
            Type ammoType = bow.AmmoType;

            bool isArrow = (ammoType == typeof(Arrow));
            bool isBolt = (ammoType == typeof(Bolt));
            bool isKnown = (isArrow || isBolt);

            if (from.Weapon != trow && (pack == null || !pack.ConsumeTotal(ammoType, 1)))
            {
                if (isArrow)
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500594); // You do not have any arrows with which to practice.
                else if (isBolt)
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500595); // You do not have any crossbow bolts with which to practice.
                else
                    this.SendLocalizedMessageTo(from, 500593); // You must practice with ranged weapons on this.

                return;
            }

            this.m_LastUse = DateTime.UtcNow;

            if (from.Weapon == trow)
            {
                from.MovingEffect(this, trow.EffectID, 18, 1, false, false);
                from.Direction = from.GetDirectionTo(this.GetWorldLocation());
                trow.PlaySwingAnimation(from);
            }

            else
            {
                from.Direction = from.GetDirectionTo(this.GetWorldLocation());
                bow.PlaySwingAnimation(from);
                from.MovingEffect(this, bow.EffectID, 18, 1, false, false);
            }

            ScoreEntry se = this.GetEntryFor(from);

            if (bow !=null && !from.CheckSkill(bow.Skill, this.m_MinSkill, this.m_MaxSkill))
            {
                from.PlaySound(bow.MissSound);

                this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 500604, from.Name); // You miss the target altogether.

                se.Record(0);

                if (se.Count == 1)
                    this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString());
                else
                    this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, String.Format("{0}\t{1}", se.Total, se.Count));

                return;
            }
            
            else if (trow !=null && !from.CheckSkill(trow.Skill, this.m_MinSkill, this.m_MaxSkill))
            {
                from.PlaySound(trow.MissSound);
 
                this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 500604, from.Name); // You miss the target altogether.
 
                se.Record(0);
 
                if (se.Count == 1)
                    this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString());
                else
                    this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, String.Format("{0}\t{1}", se.Total, se.Count));
 
                return;
            }
            Effects.PlaySound(this.Location, this.Map, 0x2B1);

            double rand = Utility.RandomDouble();

            int area, score, splitScore;

            if (0.10 > rand)
            {
                area = 0; // bullseye
                score = 50;
                splitScore = 100;
            }
            else if (0.25 > rand)
            {
                area = 1; // inner ring
                score = 10;
                splitScore = 20;
            }
            else if (0.50 > rand)
            {
                area = 2; // middle ring
                score = 5;
                splitScore = 15;
            }
            else
            {
                area = 3; // outer ring
                score = 2;
                splitScore = 5;
            }

            bool split = (isKnown && ((this.m_Arrows + this.m_Bolts) * 0.02) > Utility.RandomDouble());

            if (split)
            {
                this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1010027 + area, String.Format("{0}\t{1}", from.Name, isArrow ? "arrow" : "bolt"));
            }
            else
            {
                this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1010035 + area, from.Name);

                if (isArrow)
                    ++this.m_Arrows;
                else if (isBolt)
                    ++this.m_Bolts;
            }

            se.Record(split ? splitScore : score);

            if (se.Count == 1)
                this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString());
            else
                this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, String.Format("{0}\t{1}", se.Total, se.Count));
        }
Ejemplo n.º 40
0
        public void ThrowKnife(Mobile from)
        {
            var knife = from.Weapon as BaseKnife;

            if (knife == null)
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500751); // Try holding a knife...
                return;
            }

            from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);
            from.MovingEffect(this, knife.ItemID, 7, 1, false, false);
            from.PlaySound(0x238);

            double rand = Utility.RandomDouble();

            if (rand < 0.05)
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "Right between the eyes! 50 Points!");
                Effects.PlaySound(Location, Map, 426);
                OnMongbatHit(from);
            }
            else if (rand < 0.20)
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "A Shot to the neck! 20 points.");
                Effects.PlaySound(Location, Map, Utility.RandomList(424, 425));
                OnMongbatHit(from);
            }
            else if (rand < 0.45)
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "A shot to the body, 10 points.");
                Effects.PlaySound(Location, Map, Utility.RandomList(424, 425));
                OnMongbatHit(from);
            }
            else if (rand < 0.70)
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "Clipped its wing, 5 pointer.");
                Effects.PlaySound(Location, Map, Utility.RandomList(424, 425));
                OnMongbatHit(from);
            }
            else if (rand < 0.85)
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "Bounced off him..  1 point.");
                Effects.PlaySound(Location, Map, Utility.RandomList(424, 425));
                OnMongbatHit(from);
            }
            else
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, 500757); // Missed.
                Effects.PlaySound(Location, Map, Utility.RandomList(422, 423));
            }
        }
Ejemplo n.º 41
0
            protected override void OnTarget(Mobile from, object obj)
            {
                if (this.m_Bola.Deleted)
                    return;

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

                    if (!this.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);

                        if (Core.AOS)
                        {
                            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));

                        this.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.
                }
            }
Ejemplo n.º 42
0
        public virtual bool OnFired( Mobile attacker, Mobile defender )
        {
            Container pack = attacker.Backpack;
            Quiver quiver = attacker.FindItemOnLayer(Layer.Cloak) as Quiver;

            if( quiver != null && quiver.ConsumeTotal(AmmoType, 1) )
            {
                quiver.UpdateTotals();
                quiver.InvalidateProperties();

                attacker.MovingEffect(defender, EffectID, 18, 1, false, false);
                return true;
            }
            else if( pack != null && pack.ConsumeTotal(AmmoType, 1) )
            {
                attacker.MovingEffect(defender, EffectID, 18, 1, false, false);
                return true;
            }

            return false;
        }
Ejemplo n.º 43
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.º 44
0
        public static void WebAttack(Mobile from, Mobile to)
        {
            Map map = from.Map;

            if (map == null)
                return;

            int x = from.X + Utility.RandomMinMax(-1, 1);
            int y = from.Y + Utility.RandomMinMax(-1, 1);
            int z = from.Z;

            SelfDeletingItem web = new SelfDeletingItem(3812, "a web", 5);

            to.MovingEffect(from, 0xee6, 7, 1, false, false, 0x481, 0);
            to.Paralyze(TimeSpan.FromSeconds(6));
            to.SendMessage("You are are caught in a web");
            to.MoveToWorld(new Point3D(x, y, z), map);
            web.MoveToWorld(new Point3D(x, y, z), map);
            to.ApplyPoison(from, Poison.Lethal);
        }
Ejemplo n.º 45
0
		public virtual bool OnFired( Mobile attacker, Mobile defender )
		{
			Container pack = attacker.Backpack;

			#region Mondain's Legacy			
			BaseQuiver quiver = attacker.FindItemOnLayer( Layer.Cloak ) as BaseQuiver;
			
			if ( attacker.Player && (quiver == null || !quiver.ConsumeAmmo( AmmoType )) )
			{				
				if ( pack == null || !pack.ConsumeTotal( AmmoType, 1 ) )
					return false;
			}
			#endregion

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

			return true;
		}
Ejemplo n.º 46
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( m_Dagger.Deleted )
                {
                    return;
                }
                else if ( !from.Items.Contains( m_Dagger ) )
                {
                    from.SendMessage( "You must be holding that weapon to use it." );
                }
                else if ( targeted is Mobile )
                {
                    Mobile m = (Mobile)targeted;

                    if ( m != from && from.HarmfulCheck( m ) )
                    {
                        Direction to = from.GetDirectionTo( m );

                        from.Direction = to;

                        from.Animate( from.Mounted ? 26 : 9, 7, 1, true, false, 0 );

                        if ( Utility.RandomDouble() >= (Math.Sqrt( m.Dex / 100.0 ) * 0.8) )
                        {
                            from.MovingEffect( m, 0x1BFE, 7, 1, false, false, 0x481, 0 );

                            AOS.Damage( m, from, Utility.Random( 5, from.Str / 10 ), 100, 0, 0, 0, 0 );

                            m_Dagger.MoveToWorld( m.Location, m.Map );
                        }
                        else
                        {
                            int x = 0, y = 0;

                            switch ( to & Direction.Mask )
                            {
                                case Direction.North: --y; break;
                                case Direction.South: ++y; break;
                                case Direction.West: --x; break;
                                case Direction.East: ++x; break;
                                case Direction.Up: --x; --y; break;
                                case Direction.Down: ++x; ++y; break;
                                case Direction.Left: --x; ++y; break;
                                case Direction.Right: ++x; --y; break;
                            }

                            x += Utility.Random( -1, 3 );
                            y += Utility.Random( -1, 3 );

                            x += m.X;
                            y += m.Y;

                            m_Dagger.MoveToWorld( new Point3D( x, y, m.Z ), m.Map );

                            from.MovingEffect( m_Dagger, 0x1BFE, 7, 1, false, false, 0x481, 0 );

                            from.SendMessage( "You miss." );
                        }
                    }
                }
            }
Ejemplo n.º 47
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.º 48
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.º 49
0
		public override bool OnFired( Mobile attacker, Mobile defender )
		{
			if( !m_PBGI.Active )
			{
				attacker.SendMessage( "The game has not started yet!" );
				return false;
			}

			if( defender.ChestArmor != null && defender.ChestArmor is PBArmor )
			{
				if( defender.FindItemOnLayer( Layer.Cloak ) != null && defender.FindItemOnLayer( Layer.Cloak ).Hue == Hue )
				{
					attacker.SendMessage( "Do not attack your own team!" );
					return false;
				}
			}
			else
			{
				attacker.SendMessage( "You cannot attack someone that is not playing!" );
				defender.SendMessage( "You are not playing Paintball, please leave the area." );
				return false;
			}

			Container pack = attacker.Backpack;

			if( attacker.Player && (pack == null || !pack.ConsumeTotal( AmmoType, 1 ) ) )
			{
				attacker.SendMessage( "You are out of paintballs!" );
				return false;
			}

			attacker.MovingEffect( defender, EffectID, 18, 1, false, false, Hue, 3 );
			return true;
		}
Ejemplo n.º 50
0
		public virtual bool OnFired(Mobile attacker, Mobile defender)
		{
			var pm = attacker as PlayerMobile;
			var battle = AutoPvP.FindBattleI<IUOFBattle>(pm);

			if ((attacker.Player && battle == null) || (battle != null && !battle.NoConsume) ||
				(attacker is BaseCreature && ((BaseCreature)attacker).Pseu_ConsumeReagents))
			{
				var quiver = attacker.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
				Container pack = attacker.Backpack;

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

			if (defender != null)
			{
				attacker.MovingEffect(defender, EffectID, 18, 1, false, false);
			}

			return true;
		}
Ejemplo n.º 51
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.º 52
0
		public virtual bool OnFired( Mobile attacker, Mobile defender )
		{
			attacker.MovingEffect( defender, EffectID, 18, 1, false, false );

			return true;
		}
Ejemplo n.º 53
0
			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 ( !HasFreeHands( from ) )
					{
						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 && !Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(to))
					{
						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 );

						from.DoHarmful( to );

						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.
				}
			}
Ejemplo n.º 54
0
        public override bool OnFired( Mobile attacker, Mobile defender )
        {
            attacker.MovingEffect( defender, EffectID, 9, 1, false, false );
            defender.MovingEffect( attacker, EffectID, 9, 1, false, false );

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

            if ( ( attacker.Player || attacker is Mercenary ) && (pack == null || !pack.ConsumeTotal( AmmoType, 1 )) )
                return false;

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

            return true;
        }
Ejemplo n.º 56
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Axe.Deleted)
                {
                    return;
                }

                else if (!from.Items.Contains(m_Axe))
                {
                    from.SendMessage("You must be holding that weapon to use it.");
                }


                else if (targeted is Mobile)
                {
                    Mobile m = (Mobile)targeted;

                    if (m != from && from.HarmfulCheck(m))
                    {
                        Direction to = from.GetDirectionTo(m);

                        from.Direction = to;

                        from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);

                        if (from.CheckTargetSkill(SkillName.Throwing, m, 40.0, 100.0))
                        {
                            from.MovingEffect(m, 0x1BFE, 7, 1, false, false, 0x481, 0);

                            int distance = (int)from.GetDistanceToSqrt(m.Location);

                            int mindamage = m_Axe.MinDamage;
                            if (from.Dex > 100)
                                mindamage += 2;

                            distance -= (int)from.Skills[SkillName.Tactics].Value / 20;
                            if (distance < 0)
                                distance = 0;

                            int count = (int)from.Skills[SkillName.Throwing].Value / 10;
                            count += (int)from.Skills[SkillName.Anatomy].Value / 20;
                            if (distance > 6)
                                count -= distance - 5;

                            AOS.Damage(m, from,Utility.Random(mindamage,count) - distance/2, true,0,0,0,0,0,0,100,false,false,false);

                            m_Axe.MoveToWorld(m.Location, m.Map);
                        }
                        else
                        {
                            int x = 0, y = 0;

                            switch (to & Direction.Mask)
                            {
                                case Direction.North: --y; break;
                                case Direction.South: ++y; break;
                                case Direction.West: --x; break;
                                case Direction.East: ++x; break;
                                case Direction.Up: --x; --y; break;
                                case Direction.Down: ++x; ++y; break;
                                case Direction.Left: --x; ++y; break;
                                case Direction.Right: ++x; --y; break;
                            }

                            x += Utility.Random(-1, 3);
                            y += Utility.Random(-1, 3);

                            x += m.X;
                            y += m.Y;

                            m_Axe.MoveToWorld(new Point3D(x, y, m.Z), m.Map);

                            from.MovingEffect(m_Axe, 0x1BFE, 7, 1, false, false, 0x481, 0);

                           
                            

                            from.SendMessage("You miss.");
                        }
                        m_Axe.HitPoints -= 1;
                    }
                    
                }
            }
Ejemplo n.º 57
0
        public virtual void ProduceEffect( Mobile from, bool first )
        {
            if( first && EffectSound > 0 )
                Caster.PlaySound( EffectSound );

            if( EffectID > 0 )
                from.MovingEffect( TargetMobile, EffectID, 5, 0, false, true, EffectHue, 0 );

            DamageDelay = 0.1 * from.GetDistanceToSqrt( TargetMobile.Location );
            new MageChainEffectTimer( this ).Start();
        }