Example #1
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 );
		}
		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);
		}
Example #3
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);
		}
Example #4
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;
		}
Example #5
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);
        }
			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 );
						}
				
					}
				}
			}
Example #7
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;
		}
		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;
		}
        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();
        }
Example #10
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.
                }
            }
Example #11
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;
        }
Example #12
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;
		}
		public virtual bool OnFired( Mobile attacker, Mobile defender )
		{
			attacker.MovingEffect( defender, EffectID, 18, 1, false, false );

			return true;
		}
        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;
        }
Example #15
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;
		}
        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));
            }
        }
Example #17
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." );
                        }
                    }
                }
            }
Example #18
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;
        }
		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]
		}
Example #20
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.
				}
			}
Example #21
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);
        }
Example #22
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));
        }
Example #23
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;
		}
Example #24
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;
		}
Example #25
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;
		}
Example #26
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;
                    }
                    
                }
            }
Example #27
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;
		}