Exemplo n.º 1
0
			protected override void OnTarget( Mobile from, object targeted )
			{
                bool releaselock = true;

                if (!m_Item.Deleted)
                {
                    if (targeted is ILockpickable)
                    {
                        Item item = (Item)targeted;
                        from.Direction = from.GetDirectionTo(item);

                        if (((ILockpickable)targeted).Locked)
                        {
                            from.PlaySound(0x241);
                            releaselock = false;

                            new InternalTimer(from, (ILockpickable)targeted, m_Item).Start();
                        }
                        else
                        {
                            // The door is not locked
                            from.SendLocalizedMessage(502069); // This does not appear to be locked
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501666); // You can't unlock that!
                    }
                }

                if (releaselock && from is PlayerMobile)
                    ((PlayerMobile)from).EndPlayerAction();
			}
Exemplo n.º 2
0
		public static void Shoot(Mobile from, Mobile target, INinjaWeapon weapon)
		{
			if (from != target && (!(from is PlayerMobile) || CanUseWeapon((PlayerMobile)from, weapon)) && from.CanBeHarmful(target))
			{
				if (weapon.WeaponMinRange == 0 || !from.InRange(target, weapon.WeaponMinRange))
				{
                    if(from is PlayerMobile)
					    ((PlayerMobile)from).NinjaWepCooldown = true;

					from.Direction = from.GetDirectionTo(target);

					from.RevealingAction();

					weapon.AttackAnimation(from, target);

					ConsumeUse(weapon);

					if (CombatCheck(from, target))
					{
						Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback<object[]>(OnHit), new object[] { from, target, weapon });
					}

                    if(from is PlayerMobile)
					    Timer.DelayCall(TimeSpan.FromSeconds(2.5), new TimerStateCallback<PlayerMobile>(ResetUsing), (PlayerMobile)from);
				}
				else
				{
					from.SendLocalizedMessage(1063303); // Your target is too close!
				}
			}
		}
Exemplo n.º 3
0
		public override void OnDoubleClick(Mobile from) 
		{ 
			if ( from == null || !from.Alive ) return;

			// lumbervalue = 100; will give 100% sucsess in picking
			mageValue = from.Skills[SkillName.Magery].Value + 20;

			if ( DateTime.Now > lastpicked.AddSeconds(1) ) // 3 seconds between picking changed to 1 sec
			{
				lastpicked = DateTime.Now;
				if ( from.InRange( this.GetWorldLocation(), 1 ) ) 
				{ 
					if ( mageValue > Utility.Random( 100 ) )
					{
						from.Direction = from.GetDirectionTo( this );
						from.Animate( 32, 5, 1, true, false, 0 ); // Bow

						from.SendMessage("You pull the plant up by the root."); 
						this.Delete(); 

						from.AddToBackpack( new MandrakeUprooted() );
					}
					else from.SendMessage("The plant is hard to pull up."); 
				} 
				else 
				{ 
					from.SendMessage( "You are too far away to harvest anything." ); 
				} 
			}
		} 
Exemplo n.º 4
0
			protected override void OnTarget( Mobile from, object targeted ) {
				if( m_Item.Deleted )
					return;

				if( targeted is ILockpickable ) {
					Item item = (Item)targeted;
					from.Direction = from.GetDirectionTo( item );

                    Rogue rge = Perk.GetByType<Rogue>((Player)from);

					if( ((ILockpickable)targeted).Locked ) 
                    {
                        if (rge == null || !rge.SafeCracker())                       
                            from.PlaySound(0x241);                       

						new InternalTimer( from, (ILockpickable)targeted, m_Item ).Start();
					} 

                    else if( targeted is BaseDoor && ((BaseDoor)targeted).Picker == from ) 
                    {
						if( from.CheckTargetSkill( SkillName.Lockpicking, targeted, ((ILockpickable)targeted).LockLevel, ((ILockpickable)targeted).MaxLockLevel ) ) 
                        {
							from.SendMessage( "You quickly relock the door." );
							((BaseDoor)targeted).Relock();

                            if (rge == null || !rge.SafeCracker())
                            from.PlaySound(0x4A);

						} else
							from.SendMessage( "You are unable to relock the door." );
					} else
						from.SendLocalizedMessage( 502069 ); // This does not appear to be locked
				} else
					from.SendLocalizedMessage( 501666 ); // You can't unlock that!
			}
Exemplo n.º 5
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( targeted is Mobile )
                {
                    from.SendLocalizedMessage( 502816 ); // You feel that such an action would be inappropriate
                }
                else if ( targeted is TrapableContainer )
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo( targ );

                    if ( !targ.Trapped )
                    {
                        from.SendLocalizedMessage( 502373 ); // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound( 0x241 );

                    if ( from.CheckTargetSkill( SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30 ) )
                    {
                        targ.Trapped = false;
                        from.SendLocalizedMessage( 502377 ); // You successfully render the trap harmless
                    }
                    else
                    {
                        from.SendLocalizedMessage( 502372 ); // You fail to disarm the trap... but you don't set it off
                    }
                }
                else
                {
                    from.SendLocalizedMessage( 502373 ); // That does'nt appear to be trapped
                }
            }
Exemplo n.º 6
0
		public override void OnDoubleClick( Mobile from )
		{
			Direction dir;
			if ( from.Location != this.Location )
				dir = from.GetDirectionTo( this );
			else if ( this.East )
				dir = Direction.West;
			else
				dir = Direction.North;

			from.Direction = dir;

			bool canThrow = true;

			if ( !from.InRange( this, 4 ) || !from.InLOS( this ) )
				canThrow = false;
			else if ( this.East )
				canThrow = ( dir == Direction.Left || dir == Direction.West || dir == Direction.Up );
			else
				canThrow = ( dir == Direction.Up || dir == Direction.North || dir == Direction.Right );

			if ( canThrow )
				Throw( from );
			else
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
		}
Exemplo n.º 7
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( m_Item.Deleted )
					return;

				if ( targeted is ILockpickable )
				{
					Item item = (Item)targeted;
					from.Direction = from.GetDirectionTo( item );

					if ( ((ILockpickable)targeted).Locked )
					{
						from.PlaySound( 0x241 );

						new InternalTimer( from, (ILockpickable)targeted, m_Item ).Start();
					}
					else
					{
						// The door is not locked
						from.SendLocalizedMessage( 502069 ); // This does not appear to be locked
					}
				}
				else
				{
					from.SendLocalizedMessage( 501666 ); // You can't unlock that!
				}
			}
Exemplo n.º 8
0
		public override void OnDoubleClick(Mobile from) 
		{ 
			if ( from == null || !from.Alive ) return;

			// lumbervalue = 100; will give 100% sucsess in picking
			lumberValue = from.Skills[SkillName.Lumberjacking].Value / 5;

			if ( DateTime.Now > lastpicked.AddSeconds(3) ) // 3 seconds between picking
			{
				lastpicked = DateTime.Now;
				if ( from.InRange( this.GetWorldLocation(), 2 ) ) 
				{ 
					if ( lumberValue > Utility.Random( 100 ) )
					{
						from.Direction = from.GetDirectionTo( this );
						from.Animate( 32, 5, 1, true, false, 0 ); // Bow

						from.SendMessage(AgriTxt.PullRoot); 
						this.Delete(); 

						from.AddToBackpack( new NightshadeUprooted() );
					}
					else from.SendMessage(AgriTxt.HardPull); 
				} 
				else 
				{ 
					from.SendMessage(AgriTxt.HardPull); 
				} 
			}
		} 
Exemplo n.º 9
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                if( targeted is Mobile )
                {
                    from.SendLocalizedMessage(502816); // You feel that such an action would be inappropriate
                }
                else if( targeted is TrapableContainer )
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if( targ.TrapType == TrapType.None )
                    {
                        from.SendLocalizedMessage(502373); // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x241);

                    if( from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30) )
                    {
                        targ.TrapPower = 0;
                        targ.TrapLevel = 0;
                        targ.TrapType = TrapType.None;
                        from.SendLocalizedMessage(502377); // You successfully render the trap harmless
                    }
                    else
                    {
                        from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off
                    }
                }
                else if( targeted is BaseDoor && ((BaseDoor)targeted).TrapAvailable )
                {
                    if( from.CheckTargetSkill(SkillName.RemoveTrap, targeted, (targeted is BaseHouseDoor ? 95.0 : 75.0), (targeted is BaseHouseDoor ? 120.0 : 100.0)) )
                    {
                        from.SendLocalizedMessage(502377); //You successfully render the trap harmless.
                        ((BaseDoor)targeted).RemoveTrap();
                    }
                    else
                    {
                        if( 0.20 >= Utility.RandomDouble() )
                        {
                            from.SendMessage("You fail to disarm the trap, and accidentally set it off!");
                            ((BaseDoor)targeted).DoorTrap.Trigger(from);
                        }
                        else
                            from.SendLocalizedMessage(502372);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373); // That does'nt appear to be trapped
                }

                EventSink.InvokeSkillUsed(new SkillUsedEventArgs(from, from.Skills[SkillName.RemoveTrap]));
            }
Exemplo n.º 10
0
		public void Use( Mobile from, BaseWeapon weapon )
		{
			BeginSwing();

			from.Direction = from.GetDirectionTo( GetWorldLocation() );
			weapon.PlaySwingAnimation( from );

			from.CheckSkill( weapon.Skill, m_MinSkill, m_MaxSkill );
		}
Exemplo n.º 11
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				from.RevealingAction();
                bool releaseLock = true;

				int number = -1;

				if ( targeted is Mobile )
				{
					Mobile targ = (Mobile)targeted;

					if ( targ.Player ) // We can't beg from players
					{
						number = 500398; // Perhaps just asking would work better.
					}
					else if ( !targ.Body.IsHuman ) // Make sure the NPC is human
					{
						number = 500399; // There is little chance of getting money from that!
					}
					else if ( !from.InRange( targ, 2 ) )
					{
						if ( !targ.Female )
							number = 500401; // You are too far away to beg from him.
						else
							number = 500402; // You are too far away to beg from her.
					}
					else if ( from.Mounted ) // If we're on a mount, who would give us money?
					{
						number = 500404; // They seem unwilling to give you any money.
					}
					else
					{
                        releaseLock = false;
						// Face eachother
						from.Direction = from.GetDirectionTo( targ );
						targ.Direction = targ.GetDirectionTo( from );

						from.Animate( 32, 5, 1, true, false, 0 ); // Bow

						new InternalTimer( from, targ ).Start();

						m_SetSkillTime = false;
					}
				}
				else // Not a Mobile
				{
					number = 500399; // There is little chance of getting money from that!
				}

				if ( number != -1 )
					from.SendLocalizedMessage( number );

                if (releaseLock && from is PlayerMobile)
                    ((PlayerMobile)from).EndPlayerAction();
            }
Exemplo n.º 12
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 );
						}
				
					}
				}
			}
Exemplo n.º 13
0
        public override void OnDoubleClick(Mobile from)
        {
            var weapon = from.Weapon as BaseWeapon;

            Direction dir;
            if (from.Location != Location)
            {
                dir = from.GetDirectionTo(this);
            }
            else if (East)
            {
                dir = Direction.West;
            }
            else
            {
                dir = Direction.North;
            }

            from.Direction = dir;

            bool canThrow = true;

            if (!from.InRange(this, 5) || !from.InLOS(this))
            {
                canThrow = false;
            }

            else if (East)
            {
                canThrow = (dir == Direction.Left || dir == Direction.West || dir == Direction.Up);
            }
            else
            {
                canThrow = (dir == Direction.Up || dir == Direction.North || dir == Direction.Right);
            }

            if (canThrow)
            {
                if (from.FindItemOnLayer(Layer.OneHanded) == null)
                {
                    PunchMongbat(from, weapon);
                }
                else if (weapon is BaseKnife)
                {
                    ThrowKnife(from);
                }
            }
            else
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
            }
        }
Exemplo n.º 14
0
        public override bool DoActionGuard()
        {
            if (m_Mobile.Language == "skirmish")
            {
                if (m_Mobile.Combatant != null && m_Mobile.GetDistanceToSqrt(m_Mobile.Combatant) < 3)
                {
                    Mobile combatant = m_Mobile.Combatant;

                    if (combatant == null)
                    {
                        WalkRandom(1, 2, 1);
                    }
                    else
                    {
                        if (m_Mobile.GetDistanceToSqrt(m_Mobile.Combatant) >= 3)
                        {
                            m_Mobile.DebugSay("Okay, I got enough distance.");
                            Action = ActionType.Combat;
                            return(true);
                        }
                        Direction d = combatant.GetDirectionTo(m_Mobile);

                        d = (Direction)((int)d + Utility.RandomMinMax(-1, +1));

                        m_Mobile.Direction = d;
                        m_Mobile.Move(d);
                    }
                }
            }
            if (AquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
            {
                if (m_Mobile.Debug)
                {
                    m_Mobile.DebugSay("I have detected {0}, attacking", m_Mobile.FocusMob.Name);
                }

                m_Mobile.Combatant = m_Mobile.FocusMob;
                Action             = ActionType.Combat;
            }
            else
            {
                base.DoActionGuard();
            }

            return(true);
        }
Exemplo n.º 15
0
        public override void OnHit(Mobile attacker, Mobile defender, double damageBonus)
        {
            if (attacker.FindItemOnLayer(Layer.Arms) is ACreedBoneArms)
            {
                if (defender.Hits < (defender.HitsMax / 10))
                {
                    damageBonus += 1.5;                     // +150%
                }
            }

            // Back Attack
            if (attacker.GetDirectionTo(defender.Location) == defender.Direction)
            {
                damageBonus += 1.0;                 // +100%
            }
            base.OnHit(attacker, defender, damageBonus);
        }
Exemplo n.º 16
0
        public virtual void EndSummon(Mobile from)
        {
            if (Chyloth?.Deleted == false)
            {
                from.SendLocalizedMessage(
                    1050010
                    ); // The ferry man has already been summoned.  There is no need to ring for him again.
            }
            else if (Dragon?.Deleted == false)
            {
                from.SendLocalizedMessage(
                    1050017
                    ); // The ferryman has recently been summoned already.  You decide against ringing the bell again so soon.
            }
            else if (Summoning)
            {
                Summoning = false;

                var loc = GetWorldLocation();

                loc.Z -= 16;

                Effects.SendLocationParticles(
                    EffectItem.Create(loc, Map, EffectItem.DefaultDuration),
                    0x3728,
                    10,
                    10,
                    0,
                    0,
                    2023,
                    0
                    );
                Effects.PlaySound(loc, Map, 0x1FE);

                Chyloth = new Chyloth {
                    Direction = (Direction)(7 & (4 + (int)from.GetDirectionTo(loc)))
                };

                Chyloth.MoveToWorld(loc, Map);

                Chyloth.Bell    = this;
                Chyloth.AngryAt = from;
                Chyloth.BeginGiveWarning();
                Chyloth.BeginRemove(TimeSpan.FromSeconds(40.0));
            }
        }
Exemplo n.º 17
0
        public virtual void EndSummon(object state)
        {
            Mobile from = (Mobile)state;

            if (m_SSum != null && !m_SSum.Deleted)
            {
                from.SendMessage("The bell has already been rang, so be patient!");
            }
            else if (m_Fake != null && !m_Fake.Deleted)
            {
                from.SendMessage("This bell has been rung not to long ago, you must wait!");
            }
            else if (m_Summoning)
            {
                m_Summoning = false;

                Point3D loc = GetWorldLocation();

                loc.Z -= 16;

                Effects.SendLocationParticles(EffectItem.Create(loc, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 0, 0, 2023, 0);
                Effects.PlaySound(loc, Map, 0x1FE);

                switch (m_Type)
                {
                case BellType.DarkIron: m_SSum = new SSum(BellType.DarkIron); break;

                case BellType.Wooden: m_SSum = new SSum(BellType.Wooden); break;

                case BellType.Blood: m_SSum = new SSum(BellType.Blood); break;

                case BellType.Beast: m_SSum = new SSum(BellType.Beast); break;

                case BellType.Noxious: m_SSum = new SSum(BellType.Noxious); break;
                }

                m_SSum.Direction = (Direction)(7 & (4 + (int)from.GetDirectionTo(loc)));;
                m_SSum.MoveToWorld(loc, Map);

                m_SSum.Bell    = this;
                m_SSum.AngryAt = from;
                m_SSum.BeginGiveWarning();
                m_SSum.BeginRemove(TimeSpan.FromSeconds(40.0));
            }
        }
Exemplo n.º 18
0
 public override void OnDoubleClick(Mobile from)
 {
     if (from.FindItemOnLayer(Layer.OneHanded) is BaseWeapon && from is Citizens)
     {
         BaseWeapon weapon = ( BaseWeapon )(from.FindItemOnLayer(Layer.OneHanded));
         from.Direction = from.GetDirectionTo(GetWorldLocation());
         if (this.X == from.X)
         {
             this.ItemID = 0xFB0;
         }
         else
         {
             this.ItemID = 0xFAF;
         }
         weapon.PlaySwingAnimation(from);
         from.PlaySound(Utility.RandomList(0x541, 0x2A, 0x2A, 0x2A));
     }
 }
Exemplo n.º 19
0
            protected override void OnTick()
            {
                count++;
                // Face toward the Rocks
                player.Direction = player.GetDirectionTo(rocks.Location);

                if (rocks == null || !rocks.OrePresent || pick == null || !player.InRange(rocks.Location, 1))
                {
                    player.SendMessage("You stop mining.");
                    Stop();
                }

                // Do Mining animation
                player.Animate(Utility.RandomBool() ? 11 : 12, 4, 2, true, true, 1);

                // Chance to find a Gem
                BaseRunescapeGem gem = Utilities.FindGem(player, rocks.OreType, pick);

                if (gem != null)
                {
                    //give player a gem
                    if (player.AddToBackpack(gem))
                    {
                        player.SendMessage("You have found an {0}!", gem.Name);
                    }

                    return;
                }

                // Keep doing it until successful
                successful = Utility.Random(100) - (40 - count) > Utilities.MiningLevelNeeded(rocks.OreType); // This will be replaced once Levels are implemented.

                // Better picks mine faster
                // Higher level rocks mine slower

                if (successful)
                {
                    rocks.GiveOreTo(player);
                    rocks.ResetOreSpawn();
                    player.Animate(4, 1, 1, true, false, 0);
                    player.InvalidateProperties();
                    Stop();
                }
            }
Exemplo n.º 20
0
		public void Use( Mobile from )
		{
			from.Direction = from.GetDirectionTo( GetWorldLocation() );

			Effects.PlaySound( GetWorldLocation(), Map, 0x4F );

			if ( from.CheckSkill( SkillName.Stealing, m_MinSkill, m_MaxSkill ) )
			{
				SendLocalizedMessageTo( from, 501834 ); // You successfully avoid disturbing the dip while searching it.
			}
			else
			{
				Effects.PlaySound( GetWorldLocation(), Map, 0x390 );

				BeginSwing();
				ProcessDelta();
				SendLocalizedMessageTo( from, 501831 ); // You carelessly bump the dip and start it swinging.
			}
		}
Exemplo n.º 21
0
        public override void OnDoubleClick(Mobile from)
        {
            Direction dir;

            if (from.Location != this.Location)
            {
                dir = from.GetDirectionTo(this);
            }
            else if (this.East)
            {
                dir = Direction.West;
            }
            else
            {
                dir = Direction.North;
            }

            from.Direction = dir;

            bool canThrow = true;

            if (!from.InRange(this, 4) || !from.InLOS(this))
            {
                canThrow = false;
            }
            else if (this.East)
            {
                canThrow = (dir == Direction.Left || dir == Direction.West || dir == Direction.Up);
            }
            else
            {
                canThrow = (dir == Direction.Up || dir == Direction.North || dir == Direction.Right);
            }

            if (canThrow)
            {
                Throw(from);
            }
            else
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                   // I can't reach that.
            }
        }
Exemplo n.º 22
0
        protected override void OnTarget(Mobile from, object o)
        {
            if (!from.Alive || !(o is Mobile) || !(o as Mobile).Alive)
            {
                return;
            }

            if (from.Karma < 50)
            {
                from.SendLocalizedMessage(502129);                   // no grant occurs--you are at less than 50 karma
            }
            else if (!(o is PlayerMobile))
            {
                from.SendLocalizedMessage(502127);                   // You can only honor players.
            }
            else if (o == from)
            {
                from.SendLocalizedMessage(502128);                   // You flatter yourself.
            }
            else
            {
                PlayerMobile honored = o as PlayerMobile;

                int maxKarma = Server.Misc.Titles.MaxKarma;

                if (honored.Karma < maxKarma)
                {
                    Direction dir = from.GetDirectionTo(honored.Location);
                    from.Direction = dir;

                    if (from.Body.IsHuman)
                    {
                        from.Animate(32, 5, 1, true, false, 0);
                    }

                    from.Karma -= 50;
                    from.SendLocalizedMessage(1019064);                       // You have lost some karma.

                    honored.Karma = Math.Min(maxKarma, honored.Karma + 10);
                    honored.SendLocalizedMessage(1019059);                       // You have gained a little karma.
                }
            }
        }
Exemplo n.º 23
0
        public void Use(Mobile from)
        {
            from.Direction = from.GetDirectionTo(GetWorldLocation());

            Effects.PlaySound(GetWorldLocation(), Map, 0x4F);

            if (from.CheckSkill(SkillName.Stealing, MinSkill, MaxSkill))
            {
                SendLocalizedMessageTo(from, 501834); // You successfully avoid disturbing the dip while searching it.
            }
            else
            {
                Effects.PlaySound(GetWorldLocation(), Map, 0x390);

                BeginSwing();
                ProcessDelta();
                SendLocalizedMessageTo(from, 501831); // You carelessly bump the dip and start it swinging.
            }
        }
Exemplo n.º 24
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(this, 2))
            {
                from.SendLocalizedMessage(CommonLocs.YouTooFar);
                return;
            }

            if (m_Timer != null && m_Timer.Running)
            {
                m_Timer.Stop();
            }

            from.Direction = from.GetDirectionTo(this);
            from.Animate(32, 5, 1, true, false, 0);
            from.SendMessage("You uproot the seedling with ease.");

            this.Delete();
        }
Exemplo n.º 25
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 && (!Core.ML || !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 (CheckHit(to, from))
                {
                    to.Damage(Utility.RandomMinMax(10, 20), from);
                    //    Dismount(from, to, BlockMountType.BolaRecovery, TimeSpan.FromSeconds(10.0), true);
                    Server.Items.Dismount.DoDismount(from, to, BlockMountType.BolaRecovery, TimeSpan.FromSeconds(10.0), true);
                }
            }
        }
Exemplo n.º 26
0
		public void Chop( Mobile from )
		{
			if ( from.InRange( this.GetWorldLocation(), 1 ) )
			{
				if ( from == m_sower )
				{
					from.Direction = from.GetDirectionTo( this );
					double lumberValue = from.Skills[SkillName.Lumberjacking].Value / 100;
					if ( ( lumberValue > .5 ) && ( Utility.RandomDouble() <= lumberValue ) )
					{
						OatSheath fruit = new OatSheath( Utility.Random( m_yield +1 ) );
						from.AddToBackpack( fruit );
					}
						this.Delete();
						from.SendMessage( "You chop the plant up" );
				}
				else from.SendMessage( "You do not own this plant !!!" );
			}
			else from.SendLocalizedMessage( 500446 );
		}
Exemplo n.º 27
0
        public static void FocusTo(Mobile who, Mobile to)
        {
            if (Utility.RandomBool())
            {
                who.Animate(17, 7, 1, true, false, 0);
            }
            else
            {
                switch (Utility.Random(3))
                {
                case 0: who.Animate(32, 7, 1, true, false, 0); break;

                case 1: who.Animate(33, 7, 1, true, false, 0); break;

                case 2: who.Animate(34, 7, 1, true, false, 0); break;
                }
            }

            who.Direction = who.GetDirectionTo(to);
        }
Exemplo n.º 28
0
        public virtual void doHarvestEffect(Mobile from, Item tool)
        {
            from.Direction = from.GetDirectionTo(Location);

            int sound = Utility.RandomList(new int[] { 0x125, 0x126 });
            int anim  = 11;

            if (tool is BaseAxe)
            {
                sound = 0x13E;
                anim  = 13;
            }

            from.PlaySound(sound);

            if (!from.Mounted)
            {
                from.Animate(anim, 5, 1, true, false, 0);
            }
        }
Exemplo n.º 29
0
        public void Use(Mobile from, BaseWeapon weapon)
        {
            BeginSwing();

            from.Direction = from.GetDirectionTo(GetWorldLocation());
            weapon.Strategy.AttaqueAnimation(from);

            Random       rand = new Random();
            PlayerMobile pm   = from as PlayerMobile;

            if (pm != null)
            {
                if (pm.Experience.XP < m_MaxExpReq)
                {
                    pm.Experience.XP += rand.Next(1, 5);
                }
            }

            from.CheckSkill(weapon.Skill, m_MinSkill, m_MaxSkill);
        }
Exemplo n.º 30
0
        public static bool CheckSurroundings(Mobile searcher, Mobile hidden)
        {
            double    Value        = 20 + searcher.Skills.DetectHidden.Value / 5.0;
            bool      found        = false;
            IPoint2D  point        = (IPoint2D)hidden;
            Direction SerDirection = searcher.Direction;
            Direction SertoObj     = searcher.GetDirectionTo(point.X, point.Y);

            double Dist = searcher.GetDistanceToSqrt(point) + ((Mobile)hidden).Skills.Stealth.Value * .005;

            Dist = Dist / (int)1;
            if (searcher is TeiravonMobile && ((TeiravonMobile)searcher).IsDrow())
            {
                Dist -= 1.0;
            }

            if (IsFacing((int)SerDirection, (int)SertoObj))
            {
                Value *= 2.0;
            }

            if (searcher is TeiravonMobile && ((TeiravonMobile)searcher).IsDrow())
            {
                Dist -= 1.0;
            }

            if (Dist == 0)
            {
                Dist = .01;
            }

            Value = Value / Dist;

            if (searcher.CheckSkill(SkillName.DetectHidden, Value * .01))
            {
                found = true;
            }

            //searcher.SendMessage("Awareness Value : " + Value + "Dist : " + Dist);
            return(found);
        }
Exemplo n.º 31
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                if (targeted is ILockpickable)
                {
                    ILockpickable item = (ILockpickable)targeted;
                    from.Direction = from.GetDirectionTo(item);

                    if (targeted is Item)
                    {
                        Item targetedItem = (Item)targeted;
                        if (!from.InRange((IPoint2D)targeted, 2))
                        {
                            if (targetedItem.RootParentEntity != from)
                            {
                                from.SendLocalizedMessage(500446);
                            }
                        }
                    }

                    if (item.Locked)
                    {
                        from.PlaySound(0x241);

                        new InternalTimer(from, item, m_Item).Start();
                    }
                    else
                    {
                        // The door is not locked
                        from.SendLocalizedMessage(502069);                           // This does not appear to be locked
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501666);                       // You can't unlock that!
                }
            }
Exemplo n.º 32
0
        public void Use(Mobile from)
        {
            from.Direction = from.GetDirectionTo(GetWorldLocation());

            Effects.PlaySound(GetWorldLocation(), Map, 0x4F);

            if (from.CheckSkill(SkillName.Stealing, m_MinSkill, m_MaxSkill))
            {
                from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You successfully avoid disturbing the dip while searching it."));
                //SendLocalizedMessageTo( from, 501834 ); // You successfully avoid disturbing the dip while searching it.
            }
            else
            {
                Effects.PlaySound(GetWorldLocation(), Map, 0x390);

                BeginSwing();
                ProcessDelta();
                from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You carelessly bump the dip and start it swinging."));
                //SendLocalizedMessageTo( from, 501831 ); // You carelessly bump the dip and start it swinging.
            }
        }
Exemplo n.º 33
0
 public override void OnDoubleClick(Mobile from)
 {
     if (!from.InRange(GetWorldLocation(), 1))
     {
         from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);
     }
     else if (!from.CanBeginAction(typeof(AppleBobbinBarrel)))
     {
         from.SendMessage("You already have your head under the water");
     }
     else
     {
         from.BeginAction(typeof(AppleBobbinBarrel));
         Timer.DelayCall(TimeSpan.FromSeconds(6.0), new TimerStateCallback(EndBobbing), from);
         from.SendMessage("You dunk your head in the water trying frantically to sink your teeth into an apple!");
         from.CantWalk  = true;
         from.Direction = from.GetDirectionTo(this);
         from.Animate(32, 5, 1, true, true, 0);
         from.PlaySound(37);
     }
 }
Exemplo n.º 34
0
            protected override void OnTick()
            {
                farm.SendoColhida = true;
                from.Direction    = from.GetDirectionTo(loc);

                if (ct == 2)
                {
                    farm.Colhe(from, loc, map);
                }
                else
                {
                    if (from.GetDistanceToSqrt(loc) > 2)
                    {
                        from.SendMessage("Voce esta muito longe para colher");
                        cancel            = true;
                        farm.SendoColhida = false;
                        return;
                    }
                    if (ct == 0)
                    {
                        if (!roubo)
                        {
                            from.Emote("* colhendo a planta *");
                        }
                        else
                        {
                            from.Emote("* roubando a planta *");
                        }
                    }

                    if (ct != 2)
                    {
                        ((PlayerMobile)from).HarvestAnimation();
                    }


                    Timer.DelayCall(TimeSpan.FromMilliseconds(150), b => Effects.PlaySound(loc, map, 0x12E), null);
                    ct++;
                }
            }
Exemplo n.º 35
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( m_Item.Deleted )
					return;

				if ( targeted is ILockpickable )
				{
					ILockpickable item = (ILockpickable)targeted;
					from.Direction = from.GetDirectionTo( item );

                    if (targeted is Item)
                    {
                        Item targetedItem = (Item)targeted;
                        if (!from.InRange((IPoint2D)targeted, 2))
                        {
                            if (targetedItem.RootParentEntity != from)
                            {
                                from.SendLocalizedMessage(500446);
                            }
                        }
                    }

					if ( item.Locked )
					{
						from.PlaySound( 0x241 );

						new InternalTimer( from, item, m_Item ).Start();
					}
					else
					{
						// The door is not locked
						from.SendLocalizedMessage( 502069 ); // This does not appear to be locked
					}
				}
				else
				{
					from.SendLocalizedMessage( 501666 ); // You can't unlock that!
				}
			}
Exemplo n.º 36
0
        private void DoPushes(Mobile from)
        {
            Direction dir;
            int       dist;

            if (Push > 0)
            {
                foreach (Mobile m_target in GetMobilesInRange(Push))
                {
                    if ((m_target != from) && (SpellHelper.ValidIndirectTarget(from, (Mobile)m_target) && from.CanBeHarmful((Mobile)m_target, false)))
                    {
                        if (m_target.Spell != null)
                        {
                            m_target.Spell.OnCasterHurt();
                        }

                        m_target.Direction = from.GetDirectionTo(m_target);
                        m_target.Move(m_target.Direction);
                    }
                }
            }
        }
Exemplo n.º 37
0
        protected virtual void OnBeforeThrownAt(Mobile m, TEntity target)
        {
            if (m == null || m.Deleted || target == null || !CanThrowAt(m, target, false))
            {
                return;
            }

            if (m.Spell != null)
            {
                m.Spell.OnCasterUsingObject(this);
            }

            if (DismountUser)
            {
                EtherealMount.StopMounting(m);
            }

            if (ClearHands)
            {
                m.ClearHands();
            }

            if (DismountUser && m.Mounted)
            {
                BaseMount.Dismount(m);
            }

            if ((m.Direction & Direction.Running) != Direction.Running)
            {
                m.Direction = m.GetDirectionTo(target.Location);
            }

            m.Animate(11, 5, 1, true, false, 0);

            if (ThrowSound >= 0)
            {
                m.PlaySound(ThrowSound);
            }
        }
Exemplo n.º 38
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816);                       // You feel that such an action would be inappropriate
                }
                else if (targeted is IEntity)
                {
                    from.Direction = from.GetDirectionTo(((IEntity)targeted).Location);

                    if (targeted is ITrapable)
                    {
                        ITrapable targ = (ITrapable)targeted;

                        if (!targ.Trap_IsTrapped)
                        {
                            from.SendLocalizedMessage(502373);                           // That doesn't appear to be trapped
                            return;
                        }

                        from.PlaySound(0x241);

                        if (from.CheckTargetSkill(SkillName.Pieges, targ, targ.Trap_DisarmDifficulty, targ.Trap_DisarmDifficulty + 20))
                        {
                            targ.Trap_Disarm();
                            from.SendLocalizedMessage(502377);                           // You successfully render the trap harmless
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372);                           // You fail to disarm the trap... but you don't set it off
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373);                       // That does'nt appear to be trapped
                }
            }
Exemplo n.º 39
0
        public override void Abrir(Mobile from)
        {
            PlagueBeastLord m = RootParent as PlagueBeastLord;

            if (m == null)
            {
                return;
            }

            from.Direction = from.GetDirectionTo(m);
            if (Abierto)
            {
                from.LocalOverheadMessage(MessageType.Emote, 0x66B, false, Plague_Texts.Line[21]);
            }
            else
            {
                from.LocalOverheadMessage(MessageType.Emote, 0x66B, false, Plague_Texts.Line[22]);
                from.PlaySound(0x248);
                from.PlaySound(0x2AC);
                Gland_Recpt.Visible = true;
                Glandula.Visible    = true;
            }
        }
Exemplo n.º 40
0
        public void Shoot(Mobile from)
        {
            BaseRanged bow = from.Weapon as BaseRanged;

            if (bow == null)
            {
                return;
            }

            m_LastUse = DateTime.Now;

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

            if (Utility.RandomBool())
            {
                from.PlaySound(bow.MissSound);
                return;
            }

            Effects.PlaySound(Location, Map, 0x2B1);
        }
Exemplo n.º 41
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Skey.Deleted || m_Skey.UsesRemaining <= 0)
                {
                    from.SendMessage("This master skeleton key can only be used once");                       // You have used up your powder of temperament.
                    return;
                }

                if (targeted is ILockpickable)
                {
                    Item item = (Item)targeted;
                    from.Direction = from.GetDirectionTo(item);

                    if (item is TreasureMapChest)
                    {
                        if (((ILockpickable)targeted).Locked)
                        {
                            from.PlaySound(0x241);

                            new InternalTimer(from, (ILockpickable)targeted, m_Skey).Start();
                        }
                        else
                        {
                            // The door is not locked
                            from.SendLocalizedMessage(502069); // This does not appear to be locked
                        }
                    }
                    else
                    {
                        from.SendMessage("This Skeleton Key is specifically designed for use on Treasure Chests");
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501666);                       // You can't unlock that!
                }
            }
Exemplo n.º 42
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816);                       // You feel that such an action would be inappropriate
                }
                else if (targeted is TrapableContainer)
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == TrapType.None)
                    {
                        from.SendLocalizedMessage(502373);                           // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x241);

                    if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30))
                    {
                        targ.TrapPower = 0;
                        targ.TrapLevel = 0;
                        targ.TrapType  = TrapType.None;
                        from.SendLocalizedMessage(502377);                           // You successfully render the trap harmless
                    }
                    else
                    {
                        from.SendLocalizedMessage(502372);                           // You fail to disarm the trap... but you don't set it off
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373);                       // That does'nt appear to be trapped
                }
            }
Exemplo n.º 43
0
        public override void OnGaveMeleeAttack(Mobile from)
        {
            base.OnGaveMeleeAttack(from);

            if (0.5 > Utility.RandomDouble())
            {
                if (from == null)
                {
                    return;
                }

                Mobile target = from.Combatant;

                if (target == null)
                {
                    return;
                }
                else if (!target.Mounted)
                {
                    return;
                }

                from.NonlocalOverheadMessage(MessageType.Emote, 0x3B2, 1049633, from.Name);                 // ~1_NAME~ begins to menacingly swing a bola...
                from.Direction = from.GetDirectionTo(target);
                from.Animate(11, 5, 1, true, false, 0);
                from.MovingEffect(target, 0x26AC, 10, 0, false, false);

                IMount mt = target.Mount;

                if (mt != null)
                {
                    mt.Rider = null;
                    target.SendLocalizedMessage(1040023);                     // You have been knocked off of your mount!
                    BaseMount.SetMountPrevention(target, BlockMountType.Dazed, TimeSpan.FromSeconds(3.0));
                }
            }
        }
Exemplo n.º 44
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                if (targeted is ILockpickable)
                {
                    Item item = (Item)targeted;
                    from.Direction = from.GetDirectionTo(item);

                    if (((ILockpickable)targeted).Locked)
                    {
                        if (m_Table[from] != null)
                        {
                            from.SendLocalizedMessage(500119);                               // You must wait to perform another action.
                            return;
                        }

                        from.PlaySound(0x241);

                        InternalTimer t = new InternalTimer(from, (ILockpickable)targeted, m_Item);
                        m_Table[from] = t;
                        t.Start();
                    }
                    else
                    {
                        // The door is not locked
                        from.SendLocalizedMessage(502069);                           // This does not appear to be locked
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501666);                       // You can't unlock that!
                }
            }
Exemplo n.º 45
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from == null || !from.Alive)
            {
                return;
            }

            // lumbervalue = 100; will give 100% sucsess in picking
            lumberValue = from.Skills[SkillName.Lumberjacking].Value + 20;

            if (DateTime.Now > lastpicked.AddSeconds(3))               // 3 seconds between picking
            {
                lastpicked = DateTime.Now;
                if (from.InRange(this.GetWorldLocation(), 1))
                {
                    if (lumberValue > Utility.Random(100))
                    {
                        from.Direction = from.GetDirectionTo(this);
                        from.Animate(32, 5, 1, true, false, 0);                           // Bow

                        from.SendMessage("You pull the plant up by the root.");
                        this.Delete();

                        from.AddToBackpack(new GinsengUprooted());
                    }
                    else
                    {
                        from.SendMessage("The plant is hard to pull up.");
                    }
                }
                else
                {
                    from.SendMessage("You are too far away to harvest anything.");
                }
            }
        }
Exemplo n.º 46
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( from.Mounted && !TreeHelper.CanPickMounted )
            {
                from.SendMessage( "You cannot pick fruit while mounted." );
                return;
            }

            if ( DateTime.Now > lastpicked.AddSeconds(3) ) // 3 seconds between picking
            {
                lastpicked = DateTime.Now;

                int lumberValue = (int)(from.Skills[SkillName.Peacemaking].Base * 0.1);
                if ( from.Mounted )
                    ++lumberValue;

                if ( lumberValue < 0 ) 								//Changed lumberValue == 0 to lv < 0
                {
                    from.SendMessage( "You have no idea how to pick this fruit." );
                    return;
                }

                if ( from.InRange( this.GetWorldLocation(), 2 ) )
                {
                    if ( m_yield < 1 )
                    {
                        from.SendMessage( "There is nothing here to harvest." );
                    }
                    else //check skill
                    {
                        from.Direction = from.GetDirectionTo( this );

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

                        if ( lumberValue < m_yield ) 									//Changed lumberValue > to lv < 0
                            lumberValue = m_yield + 1;

                        int pick = Utility.Random( lumberValue );
                        if ( pick == 0 || ((PlayerMobile)from).Feats.GetFeatLevel(FeatList.Farming) < 1 )
                        {
                            from.SendMessage( "You do not manage to gather any fruit." );
                            return;
                        }

                        m_yield -= pick;
                        from.SendMessage( "You pick {0} Blueberry{1}!", pick, ( pick == 1 ? "" : "s" ) );
                        Seed.PickCropSeed(from, "BlueberryTree");

                        if( from is PlayerMobile )
                        {
                            ( (PlayerMobile)from ).Crafting = true;
                            Misc.LevelSystem.AwardMinimumXP( (PlayerMobile)from, 1 );
                            ( (PlayerMobile)from ).Crafting = false;
                        }

                        //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield ));

                        Blueberries crop = new Blueberries( pick );
                        from.AddToBackpack( crop );

                        if ( !regrowTimer.Running )
                        {
                            regrowTimer.Start();
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage( 500446 ); // That is too far away.
                }
            }
        }
Exemplo n.º 47
0
		/*
        *  Walk at range distance from mobile
        * 
        *	iSteps : Number of steps
        *	bRun   : Do we run
        *	iWantDistMin : The minimum distance we want to be
        *  iWantDistMax : The maximum distance we want to be
        * 
        */

		public virtual bool WalkMobileRange(Mobile m, int iSteps, bool bRun, int iWantDistMin, int iWantDistMax)
		{
			if (m_Mobile.Deleted || m_Mobile.DisallowAllMoves)
			{
				return false;
			}

			if (m != null)
			{
				for (int i = 0; i < iSteps; i++)
				{
					// Get the curent distance
					int iCurrDist = (int)m_Mobile.GetDistanceToSqrt(m);

					if (iCurrDist < iWantDistMin || iCurrDist > iWantDistMax)
					{
						bool needCloser = (iCurrDist > iWantDistMax);
						bool needFurther = !needCloser;

						if (needCloser && m_Path != null && m_Path.Goal == m)
						{
							if (m_Path.Follow(bRun, 1))
							{
								m_Path = null;
							}
						}
						else
						{
							Direction dirTo;

							if (iCurrDist > iWantDistMax)
							{
								dirTo = m_Mobile.GetDirectionTo(m);
							}
							else
							{
								dirTo = m.GetDirectionTo(m_Mobile);
							}

							// Add the run flag
							if (bRun)
							{
								dirTo = dirTo | Direction.Running;
							}

							if (!DoMove(dirTo, true) && needCloser)
							{
								m_Path = new PathFollower(m_Mobile, m);
								m_Path.Mover = DoMoveImpl;

								if (m_Path.Follow(bRun, 1))
								{
									m_Path = null;
								}
							}
							else
							{
								m_Path = null;
							}
						}
					}
					else
					{
						return true;
					}
				}

				// Get the curent distance
				int iNewDist = (int)m_Mobile.GetDistanceToSqrt(m);

				if (iNewDist >= iWantDistMin && iNewDist <= iWantDistMax)
				{
					return true;
				}
				else
				{
					return false;
				}
			}

			return false;
		}
		public override void OnDoubleClick( Mobile from )
		{
			if ( from.Mounted && !TreeHelper.CanPickMounted )
			{
				from.SendMessage( "You cannot pick fruit while mounted." ); 
				return; 
			}

			if ( DateTime.Now > lastpicked.AddSeconds(3) ) // 3 seconds between picking
			{
				lastpicked = DateTime.Now;
			
				int lumberValue = (int)from.Skills[SkillName.Lumberjacking].Value / 20; 
				if ( from.Mounted ) 
					++lumberValue;

				if ( lumberValue < 0 ) 								//Changed lumberValue == 0 to lv < 0
				{
					from.SendMessage( "You have no idea how to pick this fruit." ); 
					return;
				}

				if ( from.InRange( this.GetWorldLocation(), 2 ) ) 
				{ 
					if ( m_yield < 1 )
					{
						from.SendMessage( "There is nothing here to harvest." ); 
					}
					else //check skill
					{
						from.Direction = from.GetDirectionTo( this );

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

						if ( lumberValue < m_yield ) 									//Changed lumberValue > to lv < 0
							lumberValue = m_yield + 1;

						int pick = Utility.Random( lumberValue );
						if ( pick == 0 )
						{
							from.SendMessage( "You do not manage to gather any fruit." ); 
							return;
						}
					
						m_yield -= pick;
						from.SendMessage( "You pick {0} BlackRaspberry{1}!", pick, ( pick == 1 ? "" : "s" ) ); 

						//PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield )); 

						BlackRaspberry crop = new BlackRaspberry( pick ); 
						from.AddToBackpack( crop );

						if ( !regrowTimer.Running )
						{
							regrowTimer.Start();
						}
					}
				} 
				else 
				{ 
					from.SendLocalizedMessage( 500446 ); // That is too far away. 
				} 
			}
		}
Exemplo n.º 49
0
        public void Chop( Mobile from )
        {
            if ( from.InRange( this.GetWorldLocation(), 1 ) )
            {
                if ( ( chopTimer == null ) || ( !chopTimer.Running ) )
                {
                    if ( ( TreeHelper.TreeOrdinance ) && ( from.AccessLevel == AccessLevel.Player ) )
                    {
                        if ( from.Region is Regions.GuardedRegion )
                            from.CriminalAction( true );
                    }

                    chopTimer = new TreeHelper.ChopAction( from );

                    Point3D pnt = this.Location;
                    Map map =  this.Map;

                    from.Direction = from.GetDirectionTo( this );
                    chopTimer.Start();

                    double lumberValue = from.Skills[SkillName.Lumberjacking].Value / 100;
                    if ( ( lumberValue > .5 ) && ( Utility.RandomDouble() <= lumberValue ) )
                    {
                        Blueberries fruit = new Blueberries( (int)Utility.Random( 13 ) + m_yield );
                        from.AddToBackpack( fruit );

                        int cnt = Utility.Random( (int)( lumberValue * 10 ) + 1 );
                        Log logs = new Log( cnt ); // Fruitwood Logs ??
                        from.AddToBackpack( logs );

                        FruitTreeStump i_stump = new FruitTreeStump( typeof( BlueberryTree ) );
                        Timer poof = new StumpTimer( this, i_stump, from );
                        poof.Start();
                    }
                    else from.SendLocalizedMessage( 500495 ); // You hack at the tree for a while, but fail to produce any useable wood.
                    //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", lumberValue ));
                }
            }
            else from.SendLocalizedMessage( 500446 );  // That is too far away.
        }
Exemplo n.º 50
0
		public bool OnSpeech( Mobile mob, Mobile speaker, string text )
		{
			if ( (m_Flags & IHSFlags.OnSpeech) == 0 || m_Keywords == null || m_Responses == null || m_KeywordHash == null )
				return false; // not enabled

			if ( !speaker.Alive )
				return false;

			if ( !speaker.InRange( mob, 3 ) )
				return false;

			if ( (speaker.Direction & Direction.Mask) != speaker.GetDirectionTo( mob ) )
				return false;

			if ( (mob.Direction & Direction.Mask) != mob.GetDirectionTo( speaker ) )
				return false;

			string[] split = text.Split( ' ' );
			List<string> keywordsFound = new List<string>();

			for ( int i = 0; i < split.Length; ++i )
			{
				string keyword;
				m_KeywordHash.TryGetValue( split[i], out keyword );

				if ( keyword != null )
					keywordsFound.Add( keyword );
			}

			if ( keywordsFound.Count > 0 )
			{
				string responseWord;

				if ( Utility.RandomBool() )
					responseWord = GetRandomResponseWord( keywordsFound );
				else
					responseWord = keywordsFound[Utility.Random( keywordsFound.Count )];

				string secondResponseWord = GetRandomResponseWord( keywordsFound );

				StringBuilder response = new StringBuilder();

				switch ( Utility.Random( 6 ) )
				{
					default:
					case 0:
					{
						response.Append( "Me " ).Append( responseWord ).Append( '?' );
						break;
					}
					case 1:
					{
						response.Append( responseWord ).Append( " thee!" );
						response.Replace( responseWord[0], Char.ToUpper( responseWord[0] ), 0, 1 );
						break;
					}
					case 2:
					{
						response.Append( responseWord ).Append( '?' );
						response.Replace( responseWord[0], Char.ToUpper( responseWord[0] ), 0, 1 );
						break;
					}
					case 3:
					{
						response.Append( responseWord ).Append( "! " ).Append( secondResponseWord ).Append( '.' );
						response.Replace( responseWord[0], Char.ToUpper( responseWord[0] ), 0, 1 );
						response.Replace( secondResponseWord[0], Char.ToUpper( secondResponseWord[0] ), responseWord.Length + 2, 1 );
						break;
					}
					case 4:
					{
						response.Append( responseWord ).Append( '.' );
						response.Replace( responseWord[0], Char.ToUpper( responseWord[0] ), 0, 1 );
						break;
					}
					case 5:
					{
						response.Append( responseWord ).Append( "? " ).Append( secondResponseWord ).Append( '.' );
						response.Replace( responseWord[0], Char.ToUpper( responseWord[0] ), 0, 1 );
						response.Replace( secondResponseWord[0], Char.ToUpper( secondResponseWord[0] ), responseWord.Length + 2, 1 );
						break;
					}
				}

				int maxWords = (split.Length / 2) + 1;

				if ( maxWords < 2 )
					maxWords = 2;
				else if ( maxWords > 6 )
					maxWords = 6;

				SaySentance( mob, Utility.RandomMinMax( 2, maxWords ) );
				mob.Say( response.ToString() );

				return true;
			}

			return false;
		}
Exemplo n.º 51
0
 public void PunchMongbat(Mobile from, BaseWeapon weapon)
 {
     if (!from.InRange(this, 1))
     {
         from.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You are too far away to punch that thing.");
         return;
     }
     else
     {
         from.Direction = from.GetDirectionTo(GetWorldLocation());
         weapon.PlaySwingAnimation(from);
         Timer.DelayCall(TimeSpan.FromSeconds(0.75), new TimerCallback(OnMongbatPunch));
     }
 }
Exemplo n.º 52
0
            protected override void OnTarget(Mobile from, object targ)
            {
                if (targ is FarmSoil)
                {
                    FarmSoil t = (FarmSoil)targ;
                    from.Direction = from.GetDirectionTo(t);

                    if (t.getOccupied())
                        from.SendMessage("That has already been seeded.");
                    else
                    {
                        t.SeedSoil(from, thisSeed);
                        thisSeed.Consume();
                    }
                }
                else
                    from.SendMessage("You can only plant a seed in tilled soil.");
            }
Exemplo n.º 53
0
		public override void OnDoubleClick( Mobile from ) 
		{ 
			if ( m_sower == null || m_sower.Deleted ) 
				m_sower = from;

			if ( from.Mounted && !CropHelper.CanWorkMounted )
			{
				from.SendMessage( "You cannot harvest a crop while mounted." ); 
				return; 
			}

			if ( DateTime.Now > lastpicked.AddSeconds(3) ) // 3 seconds between picking
			{
				lastpicked = DateTime.Now;
			
				int cookValue = (int)from.Skills[SkillName.Cooking].Value / 20;
				if ( cookValue == 0 )
				{
					from.SendMessage( "You have no idea how to harvest this crop." ); 
					return;
				}

				if ( from.InRange( this.GetWorldLocation(), 1 ) ) 
				{ 
					if ( m_yield < 1 )
					{
						from.SendMessage( "There is nothing here to harvest." ); 

						if ( PlayerCanDestroy && !( m_sower.AccessLevel > AccessLevel.Counselor ) )
						{  
							UpRootGump g = new UpRootGump( from, this );
							from.SendGump( g );
						}
					}
					else //check skill and sower
					{
						from.Direction = from.GetDirectionTo( this );

						from.Animate( from.Mounted ? 29:32, 5, 1, true, false, 0 ); 

						if ( from == m_sower ) 
						{
							cookValue *= 2;
							m_lastvisit = DateTime.Now;
						}

						if ( cookValue > m_yield ) 
							cookValue = m_yield + 1;

						int pick = Utility.Random( cookValue );
						if ( pick == 0 )
						{
							from.SendMessage( "You do not manage to harvest any crops." ); 
							return;
						}
					
						m_yield -= pick;
						from.SendMessage( "You harvest {0} crop{1}!", pick, ( pick == 1 ? "" : "s" ) ); 

						//PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield )); 
						((Item)this).ItemID = pickedGraphic;

						BitterHops crop = new BitterHops( pick ); 
						from.AddToBackpack( crop );

						if ( SowerPickTime != TimeSpan.Zero && m_lastvisit + SowerPickTime < DateTime.Now && !( m_sower.AccessLevel > AccessLevel.Counselor ) )
						{
							this.UpRoot( from );
							return;
						}

						if ( !regrowTimer.Running )
						{
							regrowTimer.Start();
						}
					}
				} 
				else 
				{ 
					from.SendMessage( "You are too far away to harvest anything." ); 
				} 
			}
		} 
Exemplo n.º 54
0
        public virtual bool CheckHit( Mobile attacker, Mobile defender )
        {
            BaseWeapon atkWeapon = attacker.Weapon as BaseWeapon;
            BaseWeapon defWeapon = defender.Weapon as BaseWeapon;

            Skill atkSkill = attacker.Skills[atkWeapon.Skill];

            double atkValue = atkWeapon.GetAttackSkillValue(attacker, defender);
            double defValue = defWeapon.GetDefendSkillValue(attacker, defender);
            double ourValue, theirValue;

            int bonus = GetHitChanceBonus();

            if( Core.AOS )
            {
                if( atkValue <= -20.0 )
                    atkValue = -19.9;

                if( defValue <= -20.0 )
                    defValue = -19.9;

                // Hit Chance Increase = 45%
                int atkChance = AosAttributes.GetValue(attacker, AosAttribute.AttackChance);
                if( atkChance > 45 )
                    atkChance = 45;

                bonus += atkChance;

                if( HitLower.IsUnderAttackEffect(attacker) )
                    bonus -= 25; // Under Hit Lower Attack effect -> 25% malus

                ourValue = (atkValue + 20.0) * (100 + bonus);

                // Defense Chance Increase = 45%
                bonus = AosAttributes.GetValue(defender, AosAttribute.DefendChance);
                if( bonus > 45 )
                    bonus = 45;

                if( HitLower.IsUnderDefenseEffect(defender) )
                    bonus -= 25; // Under Hit Lower Defense effect -> 25% malus

                int blockBonus = 0;

                if( Block.GetBonus(defender, ref blockBonus) )
                    bonus += blockBonus;

                int discordanceEffect = 0;

                // Defender loses -0/-28% if under the effect of Discordance.
                if( SkillHandlers.Discordance.GetEffect(attacker, ref discordanceEffect) )
                    bonus -= discordanceEffect;

                theirValue = (defValue + 20.0) * (100 + bonus);

                bonus = 0;
            }
            else
            {
                //if( atkValue <= -50.0 )
                //    atkValue = -49.9;

                //if( defValue <= -50.0 )
                //    defValue = -49.9;

                //ourValue = (atkValue + 50.0);
                //theirValue = (defValue + 50.0);
                ourValue = ((atkValue + 20.0) * 100);
                theirValue = ((defValue + 20.0) * 100);
            }

            double chance = ourValue / (theirValue * 1.4);

            chance *= 1.0 + ((double)bonus / 100);

            if( Core.AOS && chance < 0.02 )
                chance = 0.02;

            WeaponAbility ability = WeaponAbility.GetCurrentAbility(attacker);

            if( ability != null )
                chance += ability.AccuracyBonus;

            SpecialMove move = SpecialMove.GetCurrentMove(attacker);

            if( move != null )
                chance += move.GetAccuracyBonus(attacker);

            if( attacker.Player )
            {
                Acrobat acr = Perk.GetByType<Acrobat>((Player)attacker);
                if( acr != null )
                    chance += acr.GetHitChanceBonus();

                Dragoon drg = Perk.GetByType<Dragoon>((Player)attacker);
                if (drg != null)
                    chance += drg.LongArm(this);

                Marksman mm = Perk.GetByType<Marksman>((Player)attacker);
                if (mm != null)
                    chance += mm.DeadAim(attacker, defender);
            }

            if( defender.Player )
            {
                Pugilist pug = Perk.GetByType<Pugilist>((Player)defender);
                if (pug != null && pug.TryDodge())
                    chance = 0;

                Legionnaire leg = Perk.GetByType<Legionnaire>((Player)defender);
                if( leg != null && leg.TryDodge(this) )
                    chance = 0;

                Acrobat acr = Perk.GetByType<Acrobat>((Player)defender);
                if( acr != null && acr.TryDodge() )
                    chance = 0;

                Rogue rge = Perk.GetByType<Rogue>((Player)defender);
                if (rge != null && rge.CloakAndDagger(attacker))
                     chance = 0;
            }

                Direction atkDirection = attacker.Direction;
                Direction defDirection = defender.Direction;

                Direction directionToDefender = attacker.GetDirectionTo(((IPoint2D)defender.Location));
                Direction directionToAttacker = defender.GetDirectionTo(((IPoint2D)attacker.Location));

                if (atkDirection != directionToDefender)
                    chance -= 0.66;

                if (defDirection != directionToAttacker)
                    chance += 0.66;

            return attacker.CheckSkill(atkSkill.SkillName, chance);
        }
Exemplo n.º 55
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));
        }
Exemplo n.º 56
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( targeted is Mobile )
                {
                    from.SendAsciiMessage("You feel that such an action would be inappropriate."); // You feel that such an action would be inappropriate
                }
                else if ( targeted is TrapableContainer )
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo( targ );

                    if ( targ.TrapType == TrapType.None )
                    {
                        from.SendAsciiMessage("That doesn't appear to be trapped"); // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound( 0x241 );

                    if ( from.CheckTargetSkill( SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30 ) )
                    {
                        targ.TrapPower = 0;
                        targ.TrapLevel = 0;
                        targ.TrapType = TrapType.None;
                        from.SendAsciiMessage("You successfully render the trap harmless"); // You successfully render the trap harmless
                    }
                    else
                    {
                        from.SendAsciiMessage("You fail to disarm the trap... but you don't set it off."); // You fail to disarm the trap... but you don't set it off
                    }
                }
                else if ( targeted is BaseFactionTrap )
                {
                    BaseFactionTrap trap = (BaseFactionTrap) targeted;
                    Faction faction = Faction.Find( from );

                    FactionTrapRemovalKit kit = ( from.Backpack == null ? null : from.Backpack.FindItemByType( typeof( FactionTrapRemovalKit ) ) as FactionTrapRemovalKit );

                    bool isOwner = ( trap.Placer == from || ( trap.Faction != null && trap.Faction.IsCommander( from ) ) );

                    if ( faction == null )
                    {
                        from.SendLocalizedMessage( 1010538 ); // You may not disarm faction traps unless you are in an opposing faction
                    }
                    else if ( faction == trap.Faction && trap.Faction != null && !isOwner )
                    {
                        from.SendLocalizedMessage( 1010537 ); // You may not disarm traps set by your own faction!
                    }
                    else if ( !isOwner && kit == null )
                    {
                        from.SendLocalizedMessage( 1042530 ); // You must have a trap removal kit at the base level of your pack to disarm a faction trap.
                    }
                    else
                    {
                        if ( from.CheckTargetSkill( SkillName.RemoveTrap, trap, 80.0, 100.0 ) && from.CheckTargetSkill( SkillName.Tinkering, trap, 80.0, 100.0 ) )
                        {
                            from.PrivateOverheadMessage( MessageType.Regular, trap.MessageHue, trap.DisarmMessage, from.NetState );

                            if ( !isOwner )
                            {
                                int silver = faction.AwardSilver( from, trap.SilverFromDisarm );

                                if ( silver > 0 )
                                    from.SendLocalizedMessage( 1008113, true, silver.ToString( "N0" ) ); // You have been granted faction silver for removing the enemy trap :
                            }

                            trap.Delete();
                        }
                        else
                        {
                            from.SendLocalizedMessage( 502372 ); // You fail to disarm the trap... but you don't set it off
                        }

                        if ( !isOwner && kit != null )
                            kit.ConsumeCharge( from );
                    }
                }
                else
                {
                    from.SendAsciiMessage( "That doesn't appear to be trapped." ); // That does'nt appear to be trapped
                }
            }
Exemplo n.º 57
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;
                    }
                    
                }
            }
Exemplo n.º 58
0
        public static void FocusTo(Mobile who, Mobile to)
        {
            if (Utility.RandomBool())
            {
                who.Animate(17, 7, 1, true, false, 0);
            }
            else
            {
                switch ( Utility.Random(3) )
                {
                    case 0:
                        who.Animate(32, 7, 1, true, false, 0);
                        break;
                    case 1:
                        who.Animate(33, 7, 1, true, false, 0);
                        break;
                    case 2:
                        who.Animate(34, 7, 1, true, false, 0);
                        break;
                }
            }

            who.Direction = who.GetDirectionTo(to);
        }
Exemplo n.º 59
0
        public static void Turn(Mobile from, object to)
        {
            IPoint3D target = to as IPoint3D;

            if (target == null)
                return;

            if (target is Item)
            {
                Item item = (Item)target;

                if (item.RootParent != from)
                    from.Direction = from.GetDirectionTo(item.GetWorldLocation());
            }
            else if (from != target)
            {
                from.Direction = from.GetDirectionTo(target);
            }
        }
Exemplo n.º 60
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( m_sower == null || m_sower.Deleted )
                m_sower = from;

            if ( from.Mounted && !CropHelper.CanWorkMounted )
            {
                from.SendMessage( "You cannot harvest a crop while mounted." );
                return;
            }

            if ( DateTime.Now > lastpicked.AddSeconds(3) ) // 3 seconds between picking
            {
                lastpicked = DateTime.Now;

                int cookValue = (int)(from.Skills[SkillName.Peacemaking].Base * 0.1);
                if ( cookValue == 0 )
                {
                    from.SendMessage( "You have no idea how to harvest this crop." );
                    return;
                }

                if ( from.InRange( this.GetWorldLocation(), 1 ) )
                {
                    if ( m_yield < 1 )
                    {
                        from.SendMessage( "There is nothing here to harvest." );

                        if ( PlayerCanDestroy && !( m_sower.AccessLevel > AccessLevel.Counselor ) )
                        {
                            UpRootGump g = new UpRootGump( from, this );
                            from.SendGump( g );
                        }
                    }
                    else //check skill and sower
                    {
                        from.Direction = from.GetDirectionTo( this );

                        from.Animate( from.Mounted ? 29:32, 5, 1, true, false, 0 );

                        if ( from == m_sower )
                        {
                            cookValue *= 2;
                            m_lastvisit = DateTime.Now;
                        }

                        if ( cookValue > m_yield )
                            cookValue = m_yield + 1;

                        int pick = Utility.Random( cookValue );
                        if ( pick == 0 || ((PlayerMobile)from).Feats.GetFeatLevel(FeatList.Farming) < 1 )
                        {
                            from.SendMessage( "You do not manage to harvest any crops." );
                            return;
                        }
                        // *** Limit to one yield until we have Tea item ***
                        if ( pick > 1 ) pick = 1;

                        m_yield -= pick;
                        from.SendMessage( "You harvest {0} crop{1}!", pick, ( pick == 1 ? "" : "s" ) );
                        Seed.PickCropSeed(from, "TeaCrop");

                        if( from is PlayerMobile )
                        {
                            ( (PlayerMobile)from ).Crafting = true;
                            Misc.LevelSystem.AwardMinimumXP( (PlayerMobile)from, 1 );
                            ( (PlayerMobile)from ).Crafting = false;
                        }

                        //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield ));
                        ((Item)this).ItemID = pickedGraphic;

                        TeaLeaves crop = new TeaLeaves();
                        from.AddToBackpack( crop );

                        if ( SowerPickTime != TimeSpan.Zero && m_lastvisit + SowerPickTime < DateTime.Now && !( m_sower.AccessLevel > AccessLevel.Counselor ) )
                        {
                            this.UpRoot( from );
                            return;
                        }

                        if ( !regrowTimer.Running )
                        {
                            regrowTimer.Start();
                        }
                    }
                }
                else
                {
                    from.SendMessage( "You are too far away to harvest anything." );
                }
            }
        }