public static void OnPickedInstrument( Mobile from, BaseInstrument instrument )
 {
     from.RevealingAction();
     from.SendLocalizedMessage( 1049525 ); // Whom do you wish to calm?
     from.Target = new InternalTarget( from, instrument );
     from.NextSkillTime = DateTime.Now + TimeSpan.FromHours( 6.0 );
 }
Esempio n. 2
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                from.RevealingAction();

                if( targeted is BaseCreature && from.CanBeHarmful((Mobile)targeted, true) )
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    if( !m_Instrument.IsChildOf(from.Backpack) )
                    {
                        from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
                    }
                    else if( creature.Controlled && from.Skills.Provocation.Value < 120.0)
                    {
                        from.SendLocalizedMessage(501590); // They are too loyal to their master to be provoked.
                    }
                    else
                    {
                        from.RevealingAction();
                        m_Instrument.PlayInstrumentWell(from);
                        from.SendLocalizedMessage(1008085); // You play your music and your target becomes angered.  Whom do you wish them to attack?
                        from.Target = new InternalSecondTarget(from, m_Instrument, creature);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501589); // You can't incite that!
                }

                EventSink.InvokeSkillUsed(new SkillUsedEventArgs(from, from.Skills[SkillName.Provocation]));
            }
Esempio n. 3
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                from.RevealingAction();

                if ( targeted is BaseCreature && from.CanBeHarmful( (Mobile)targeted, true ) )
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    if ( creature.Controled )
                    {
                        from.SendLocalizedMessage( 501590 ); // They are too loyal to their master to be provoked.
                    }
                    else if ( creature.IsParagon )
                    {
                        from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures.
                    }
                    else
                    {
                        from.RevealingAction();
                        m_Instrument.PlayInstrumentWell( from );
                        from.SendLocalizedMessage( 1008085 ); // You play your music and your target becomes angered.  Whom do you wish them to attack?
                        from.Target = new InternalSecondTarget( from, m_Instrument, creature );
                    }
                }
            }
Esempio n. 4
0
		public static TimeSpan OnUse( Mobile m )
		{
			if ( !m.Hidden )
			{
				m.SendLocalizedMessage( 502725 ); // You must hide first
			}
			else if ( m.Skills[SkillName.Hiding].Base < HidingRequirement )
			{
				m.SendLocalizedMessage( 502726 ); // You are not hidden well enough.  Become better at hiding.
				m.RevealingAction();
			}
			else if( !m.CanBeginAction( typeof( Stealth ) ) )
			{
				m.SendLocalizedMessage( 1063086 ); // You cannot use this skill right now.
				m.RevealingAction();
			}
			else
			{
				int armorRating = GetArmorRating( m );

				if( armorRating >= (Core.AOS ? 42 : 26) ) //I have a hunch '42' was chosen cause someone's a fan of DNA
				{
					m.SendLocalizedMessage( 502727 ); // You could not hope to move quietly wearing this much armor.
					m.RevealingAction();
				}
				else if( m.CheckSkill( SkillName.Stealth, -20.0 + (armorRating * 2), (Core.AOS ? 60.0 : 80.0) + (armorRating * 2) ) )
				{
					int steps = (int)(m.Skills[SkillName.Stealth].Value / (Core.AOS ? 5.0 : 10.0));

					if( steps < 1 )
						steps = 1;

					m.AllowedStealthSteps = steps;

// ------ NERUN's DISTRO - Orc Scout bug fix -----
					if ( m is PlayerMobile )
					{
						PlayerMobile pm = m as PlayerMobile; // IsStealthing should be moved to Server.Mobiles
						pm.IsStealthing = true;
					}
/*
					PlayerMobile pm = m as PlayerMobile; // IsStealthing should be moved to Server.Mobiles

					if( pm != null )
    						pm.IsStealthing = true;
*/
// ------ END
					m.SendLocalizedMessage( 502730 ); // You begin to move quietly.

					return TimeSpan.FromSeconds( 10.0 );
				}
				else
				{
					m.SendLocalizedMessage( 502731 ); // You fail in your attempt to move unnoticed.
					m.RevealingAction();
				}
			}

			return TimeSpan.FromSeconds( 10.0 );
		}
Esempio n. 5
0
		public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
		{
			// Make sure we've been standing still for .25/.5/1 second depending on Era
			if ( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( 1.0 )) )
			{
				if ( attacker.HarmfulCheck( defender ) )
				{
					attacker.DisruptiveAction();
					attacker.Send( new Swing( 0, attacker, defender ) );

					if ( OnFired( attacker, defender ) )
					{
						if ( CheckHit( attacker, defender ) )
							OnHit( attacker, defender );
						else
							OnMiss( attacker, defender );
					}
				}

				attacker.RevealingAction();

				return GetDelay( attacker );
			}
			else
			{
				attacker.RevealingAction();

				return TimeSpan.FromSeconds( 0.25 );
			}
		}
Esempio n. 6
0
        public static void HandleThrow(BaseBeverage beverage, WaterElemental elemental, Mobile thrower)
        {
            if (!beverage.IsFull)
            {
                thrower.SendLocalizedMessage(1113038);
            }
            else if (!thrower.InRange(elemental.Location, 5))   // It is not full. 
            {
                thrower.SendLocalizedMessage(500295);   // You are too far away to do that.
            }
            else if (!elemental.HasDecanter)
            {
                thrower.SendLocalizedMessage(1115895);  // It seems that this water elemental no longer has a magical decanter...
            }
            else if (0.1 > Utility.RandomDouble())
            {
                thrower.RevealingAction();
                elemental.Damage(1, thrower);

                elemental.HasDecanter = false;
                beverage.Delete();
                thrower.AddToBackpack(new EndlessDecanter());
                thrower.SendLocalizedMessage(1115897);  // The water elemental has thrown a magical decanter back to you!
            }
            else
            {
                thrower.RevealingAction();
                elemental.Damage(1, thrower);

                beverage.Delete();
                thrower.PlaySound(0x040);
                thrower.SendLocalizedMessage(1115896);  // The water pitcher has shattered.
            }
        }
Esempio n. 7
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is BaseCreature && from.CanBeHarmful((Mobile)targeted, true))
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    if (!this.m_Instrument.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
                    }
                    else if (creature.Controlled)
                    {
                        from.SendLocalizedMessage(501590); // They are too loyal to their master to be provoked.
                    }
                    else if (creature.IsParagon && BaseInstrument.GetBaseDifficulty(creature) >= 160.0)
                    {
                        from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
                    }
                    else
                    {
                        from.RevealingAction();
                        this.m_Instrument.PlayInstrumentWell(from);
                        from.SendLocalizedMessage(1008085); // You play your music and your target becomes angered.  Whom do you wish them to attack?
                        from.Target = new InternalSecondTarget(from, this.m_Instrument, creature);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501589); // You can't incite that!
                }
            }
Esempio n. 8
0
        public static TimeSpan OnUse( Mobile m )
        {
            if( !m.Hidden )
            {
                m.SendLocalizedMessage(502725); // You must hide first
            }
            else if( m.Skills[SkillName.Hiding].Base < HidingRequirement )
            {
                m.SendLocalizedMessage(502726); // You are not hidden well enough.  Become better at hiding.
                m.RevealingAction();
            }
            else if( !Hiding.CheckLighting(m))
            {
                m.SendMessage("You cannot stay hidden near so much light.");
                m.RevealingAction();
            }
            else
            {
                int armorRating = GetArmorRating(m);
                DesignContext context = DesignContext.Find(m);

                if( context != null )
                {
                }
                else if( armorRating >= (Core.AOS ? 42 : 26) )	//I have a hunch '42' was chosen cause someone's a fan of DNA
                {
                    m.SendLocalizedMessage(502727); // You could not hope to move quietly wearing this much armor.
                    m.RevealingAction();
                }
                else if( m.CheckSkill(SkillName.Stealth, -20.0 + (armorRating * 2), (Core.AOS ? 60.0 : 80.0) + (armorRating * 2)) )
                {
                    int steps = (int)(m.Skills[SkillName.Stealth].Value / (Core.SE ? 5.0 : 10.0));

                    if( steps < 1 )
                        steps = 1;

                    m.AllowedStealthSteps = steps;
                    //PlayerMobile pm = m as PlayerMobile; // IsStealthing should be moved to Server.Mobiles
                    //pm.IsStealthing = true;

                    m.SendLocalizedMessage(502730); // You begin to move quietly.

                    return TimeSpan.FromSeconds(10.0);
                }
                else
                {
                    m.SendLocalizedMessage(502731); // You fail in your attempt to move unnoticed.
                    m.RevealingAction();
                }
            }

            EventSink.InvokeSkillUsed(new SkillUsedEventArgs(m, m.Skills[SkillName.Stealth]));

            return TimeSpan.FromSeconds(10.0);
        }
Esempio n. 9
0
		public static TimeSpan OnUse(Mobile m)
		{
			m.RevealingAction();

			m.Target = new InternalTarget();
			m.RevealingAction();

			m.SendLocalizedMessage(500397); // To whom do you wish to grovel?

			return TimeSpan.FromHours(6.0);
		}
Esempio n. 10
0
        public static TimeSpan OnUse(Mobile m)
        {
            m.RevealingAction();

            m.Target = new InternalTarget();
            m.RevealingAction();

            if (!m_DisableMessage)
                m.SendLocalizedMessage(502789); // Tame which animal?

            return TimeSpan.FromHours(6.0);
        }
Esempio n. 11
0
		public static TimeSpan OnUse( Mobile m )
		{
			if ( !m.Hidden )
			{
				m.SendLocalizedMessage( 502725 ); // You must hide first
			}
			else if ( m.Skills[SkillName.Hiding].Base < HidingRequirement )
			{
				m.SendLocalizedMessage( 502726 ); // You are not hidden well enough.  Become better at hiding.
				m.RevealingAction();
			}
			else if( !m.CanBeginAction( typeof( Stealth ) ) )
			{
				m.SendLocalizedMessage( 1063086 ); // You cannot use this skill right now.
				m.RevealingAction();
			}
			else
			{
				int armorRating = GetArmorRating( m );

				if( armorRating >= 26 )
				{
					m.SendLocalizedMessage( 502727 ); // You could not hope to move quietly wearing this much armor.
					m.RevealingAction();
				}
				else if( m.CheckSkill( SkillName.Stealth, -20.0 + (armorRating * 2), 80.0 + (armorRating * 2) ) )
				{
					int steps = (int)(m.Skills[SkillName.Stealth].Value / 10.0);

					if( steps < 1 )
						steps = 1;

					m.AllowedStealthSteps = steps;

					PlayerMobile pm = m as PlayerMobile; // IsStealthing should be moved to Server.Mobiles

					if( pm != null )
						pm.IsStealthing = true;

					m.SendLocalizedMessage( 502730 ); // You begin to move quietly.

					return TimeSpan.FromSeconds( 10.0 );
				}
				else
				{
					m.SendLocalizedMessage( 502731 ); // You fail in your attempt to move unnoticed.
					m.RevealingAction();
				}
			}

			return TimeSpan.FromSeconds( 10.0 );
		}
Esempio n. 12
0
		public static TimeSpan OnUse( Mobile m )
		{
            if (m.BeginAction(typeof(IAction)))
            {
                m.RevealingAction();
                m.Target = new InternalTarget();
                m.RevealingAction();
                m.SendLocalizedMessage(500397); // To whom do you wish to grovel?
            }
            else
                m.SendAsciiMessage("You must wait to perform another action.");

            return TimeSpan.Zero;
        }
Esempio n. 13
0
		public static TimeSpan OnUse( Mobile m )
		{
			m.RevealingAction();

			if ( m.CheckSkill( SkillName.SpiritSpeak, 0, 100 ) )
			{	
				if ( !m.CanHearGhosts )
				{
					Timer t = new SpiritSpeakTimer( m );
					double secs = m.Skills[SkillName.SpiritSpeak].Base / 50;
					secs *= 90;
					if ( secs < 15 )
						secs = 15;

					t.Delay = TimeSpan.FromSeconds( secs );//15seconds to 3 minutes
					t.Start();
					m.CanHearGhosts = true;
				}

				m.PlaySound( 0x24A );
				m.SendLocalizedMessage( 502444 );//You contact the neitherworld.
			}
			else
			{
				m.SendLocalizedMessage( 502443 );//You fail to contact the neitherworld.
				m.CanHearGhosts = false;
			}

			return TimeSpan.FromSeconds( 1.0 );
		}
Esempio n. 14
0
		public override void OnHit(Mobile attacker, Mobile defender, int damage)
		{
			ClearCurrentAbility(attacker);

			attacker.SendLocalizedMessage(1060084); // You attack with lightning speed!
			defender.SendLocalizedMessage(1060085); // Your attacker strikes with lightning speed!

			defender.PlaySound(0x3BB);
			defender.FixedEffect(0x37B9, 244, 25);

			// Swing again:

			// If no combatant, wrong map, one of us is a ghost, or cannot see, or deleted, then stop combat
			if (defender == null || defender.Deleted || attacker.Deleted || defender.Map != attacker.Map || !defender.Alive || !attacker.Alive || !attacker.CanSee(defender))
			{
				attacker.Combatant = null;
				return;
			}

			IWeapon weapon = attacker.Weapon;

			if (weapon == null)
				return;

			if (!attacker.InRange(defender, weapon.MaxRange))
				return;

			if (attacker.InLOS(defender))
			{
				BaseWeapon.InDoubleStrike = true;
				attacker.RevealingAction();
				attacker.NextCombatTime = DateTime.Now + weapon.OnSwing(attacker, defender);
				BaseWeapon.InDoubleStrike = false;
			}
		}
Esempio n. 15
0
        public override void Drink(Mobile from)
        {
            if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)))
            {
                from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed.
                return;
            }

            ThrowTarget targ = from.Target as ThrowTarget;
            this.Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode.

            if (targ != null && targ.Potion == this)
                return;

            from.RevealingAction();

            if (this.m_Users == null)
                this.m_Users = new ArrayList();

            if (!this.m_Users.Contains(from))
                this.m_Users.Add(from);

            from.Target = new ThrowTarget(this);

            if (this.m_Timer == null)
            {
                from.SendLocalizedMessage(500236); // You should throw it now!

                if (Core.ML)
                    this.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 5, new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); // 3.6 seconds explosion delay
                else
                    this.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4, new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); // 2.6 seconds explosion delay
            }
        }
Esempio n. 16
0
			protected override void OnTarget( Mobile from, object targ )
			{
				if ( targ is BaseCreature )
				{
					BaseCreature bc = (BaseCreature)targ;

					if ( IsHerdable( bc ) )
					{
						if ( bc.Controlled )
						{
							bc.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 502467, from.NetState ); // That animal looks tame already.
						}
						else
						{
                            from.RevealingAction();
							from.SendLocalizedMessage( 502475 ); // Click where you wish the animal to go.
							from.Target = new InternalTarget( bc );
						}
					}
					else
					{
						from.SendLocalizedMessage( 502468 ); // That is not a herdable animal.
					}
				}
				else
				{
					from.SendLocalizedMessage( 502472 ); // You don't seem to be able to persuade that to move.
				}
			}
Esempio n. 17
0
		public static void OnPickedInstrument(Mobile from, BaseInstrument instrument)
		{
			from.RevealingAction();
			from.SendLocalizedMessage(1049525); // Whom do you wish to calm?
			from.Target = new InternalTarget(from, instrument);
			from.NextSkillTime = Core.TickCount + 21600000;
		}
Esempio n. 18
0
		public static void OnPickedInstrument(Mobile from, BaseInstrument instrument)
		{
			from.RevealingAction();
			from.SendLocalizedMessage(1049541); // Choose the target for your song of discordance.
			from.Target = new DiscordanceTarget(from, instrument);
			from.NextSkillTime = Core.TickCount + 6000;
		}
Esempio n. 19
0
        public override void Drink(Mobile from)
        {
            if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)))
            {
                from.SendLocalizedMessage(1062725); // You can not use that potion while paralyzed.
                return;
            }

            int delay = GetDelay(from);

            if (delay > 0)
            {
                from.SendLocalizedMessage(1072529, String.Format("{0}\t{1}", delay, delay > 1 ? "seconds." : "second.")); // You cannot use that for another ~1_NUM~ ~2_TIMEUNITS~
                return;
            }

            ThrowTarget targ = from.Target as ThrowTarget;

            if (targ != null && targ.Potion == this)
                return;

            from.RevealingAction();

            if (!this.m_Users.Contains(from))
                this.m_Users.Add(from);

            from.Target = new ThrowTarget(this);
        }
Esempio n. 20
0
 public static void OnPickedInstrument( Mobile from, BaseInstrument instrument )
 {
     from.RevealingAction();
     //from.SendLocalizedMessage( 501587 ); // Whom do you wish to incite?
     from.SendAsciiMessage("Whom do you wish to incite?");
     from.Target = new InternalFirstTarget( from, instrument );
 }
Esempio n. 21
0
 public static void OnPickedInstrument( Mobile from, BaseInstrument instrument )
 {
     from.RevealingAction();
     from.SendLocalizedMessage( 1049541 ); // Choose the target for your song of discordance.
     from.Target = new DiscordanceTarget( from, instrument );
     from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 );
 }
Esempio n. 22
0
		public override void Drink( Mobile from )
		{
			ThrowTarget targ = from.Target as ThrowTarget;
			this.Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode.

			if ( targ != null && targ.Potion == this )
				return;

			from.RevealingAction();

			if ( m_Users == null )
				m_Users = new ArrayList();

			if ( !m_Users.Contains( from ) )
				m_Users.Add( from );

			from.Target = new ThrowTarget( this );

			if ( m_Timer == null )
			{
				from.SendLocalizedMessage( 500236 ); // You should throw it now!

				m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 0.75 ), TimeSpan.FromSeconds( 1.0 ), 4, new TimerStateCallback( Detonate_OnTick ), new object[]{ from, 3 } ); // 2.6 seconds explosion delay
			}
		}
Esempio n. 23
0
		public static TimeSpan OnUse( Mobile m )
		{
			if ( !m.Hidden )
			{
				m.SendLocalizedMessage( 502725 ); // You must hide first
			}
			else if ( m.Skills[SkillName.Hiding].Base < 80.0 )
			{
				m.SendLocalizedMessage( 502726 ); // You are not hidden well enough.  Become better at hiding.
			}
			else if ( m.CheckSkill( SkillName.Stealth, 0.0, 100.0 ) )
			{
				int steps = (int)(m.Skills[SkillName.Stealth].Value / (Core.AOS ? 100.0 : 5.0));

				if ( steps < 1 )
					steps = 1;

				m.AllowedStealthSteps = steps;

				m.SendLocalizedMessage( 502730 ); // You begin to move quietly.

				return TimeSpan.FromSeconds( 10.0 );
			}
			else
			{
				m.SendLocalizedMessage( 502731 ); // You fail in your attempt to move unnoticed.
				m.RevealingAction();
			}

			return TimeSpan.FromSeconds( 10.0 );
		}
Esempio n. 24
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!
				}
			}
		}
Esempio n. 25
0
        public static TimeSpan OnUse( Mobile m )
        {
            if ( !m.Hidden )
            {
                m.SendLocalizedMessage( 502725 ); // You must hide first
            }
            else if ( m.Skills[SkillName.Hiding].Base < ((Core.SE) ? 50.0 : 80.0) )
            {
                m.SendLocalizedMessage( 502726 ); // You are not hidden well enough.  Become better at hiding.
                m.RevealingAction();
            }
            else if( !m.CanBeginAction( typeof( Stealth ) ) )
            {
                m.SendLocalizedMessage( 1063086 ); // You cannot use this skill right now.
                m.RevealingAction();
            }
            else
            {
                int armorRating = GetArmorRating( m );

                if( armorRating >= (Core.AOS ? 42 : 26) )	//I have a hunch '42' was chosen cause someone's a fan of DNA
                {
                    m.SendLocalizedMessage( 502727 ); // You could not hope to move quietly wearing this much armor.
                    m.RevealingAction();
                }
                else if( m.CheckSkill( SkillName.Stealth, -20.0 + (armorRating * 2), (Core.AOS ? 60.0 : 80.0) + (armorRating * 2) ) )
                {
                    int steps = (int)(m.Skills[SkillName.Stealth].Value / (Core.AOS ? 5.0 : 10.0));

                    if( steps < 1 )
                        steps = 1;

                    m.AllowedStealthSteps = steps;

                    m.SendLocalizedMessage( 502730 ); // You begin to move quietly.

                    return TimeSpan.FromSeconds( 10.0 );
                }
                else
                {
                    m.SendLocalizedMessage( 502731 ); // You fail in your attempt to move unnoticed.
                    m.RevealingAction();
                }
            }

            return TimeSpan.FromSeconds( 10.0 );
        }
Esempio n. 26
0
        public static TimeSpan OnUse( Mobile m )
        {
            if ( !m.Hidden )
            {
                m.SendLocalizedMessage( 502725 ); // You must hide first
            }
            else if ( m.Skills[SkillName.Hiding].Base < ((Core.SE) ? 50.0 : 80.0) )
            {
                m.SendLocalizedMessage( 502726 ); // You are not hidden well enough.  Become better at hiding.
                m.RevealingAction();
            }
            else if( m is PlayerMobile )
            {
                PlayerMobile pm = m as PlayerMobile;

                if( pm.HeavyPenalty > 0 || ((pm.Feats.GetFeatLevel(FeatList.ArmouredStealth) * 3) < pm.TotalPenalty) ||
                   (pm.Feats.GetFeatLevel(FeatList.ArmouredStealth) < 1 && (pm.MediumPieces > 0 || pm.LightPieces > 0)) )
                {
                    m.SendLocalizedMessage( 502727 ); // You could not hope to move quietly wearing this much armor.
                    m.RevealingAction();
                }
                else if ( m.CheckSkill( SkillName.Stealth, -20.0 + (pm.TotalPenalty * 3), (Core.AOS ? 60.0 : 80.0) + (pm.TotalPenalty * 3) ) )
                {
                    int steps = (int)(m.Skills[SkillName.Stealth].Value / (Core.AOS ? 5.0 : 10.0));

                    if ( steps < 1 )
                        steps = 1;

                    m.AllowedStealthSteps = steps;

                    foreach( Mobile mob in m.GetMobilesInRange( 3 ) )
                        if( mob.Hidden && (mob is Wolf || mob is Dog) && ((BaseCreature)mob).ControlMaster == m )
                            mob.AllowedStealthSteps = steps;

                    //m.SendLocalizedMessage( 502730 ); // You begin to move quietly.

                    return TimeSpan.FromSeconds( 10.0 );
                }
                else
                {
                    m.SendLocalizedMessage( 502731 ); // You fail in your attempt to move unnoticed.
                    m.RevealingAction();
                }
            }

            return TimeSpan.FromSeconds( 10.0 );
        }
Esempio n. 27
0
		public static TimeSpan OnUse( Mobile m )
		{
			m.RevealingAction();

			BaseInstrument.PickInstrument( m, new InstrumentPickedCallback( OnPickedInstrument ) );

			return TimeSpan.FromSeconds( 1.0 ); // Cannot use another skill for 1 second
		}
		public override void OnMiss( Mobile attacker, Mobile defender )
		{
			ClearCurrentMove( attacker );

			attacker.SendLocalizedMessage( 1063161 ); // You failed to properly use the element of surprise.

			attacker.RevealingAction();
		}
Esempio n. 29
0
        public static TimeSpan OnUse( Mobile src )
        {
            src.SendLocalizedMessage( 500819 );//Where will you search?
            src.Target = new InternalTarget();
            src.RevealingAction();

            return TimeSpan.FromSeconds( 7.5 );
        }
Esempio n. 30
0
		public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
		{
			WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker );

			// Make sure we've been standing still for .25/.5/1 second depending on Era
			if ( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0) )) || (Core.AOS && WeaponAbility.GetCurrentAbility( attacker ) is MovingShot) )
			{
				bool canSwing = true;

				if ( Core.AOS )
				{
					canSwing = ( !attacker.Paralyzed && !attacker.Frozen );

					if ( canSwing )
					{
						Spell sp = attacker.Spell as Spell;

						canSwing = ( sp == null || !sp.IsCasting || !sp.BlocksMovement );
					}
				}

				if ( canSwing && attacker.HarmfulCheck( defender ) )
				{
					attacker.DisruptiveAction();
					attacker.Send( new Swing( 0, attacker, defender ) );

					if ( OnFired( attacker, defender ) )
					{
						if ( CheckHit( attacker, defender ) )
							OnHit( attacker, defender );
						else
							OnMiss( attacker, defender );
					}
				}

				attacker.RevealingAction();

				return GetDelay( attacker );
			}
			else
			{
				attacker.RevealingAction();

				return TimeSpan.FromSeconds( 0.25 );
			}
		}
Esempio n. 31
0
        public virtual void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked)
        {
            from.EndAction(locked);
            from.RevealingAction();

            if (!CheckHarvest(from, tool))
            {
                return;
            }

            int     tileID;
            Map     map;
            Point3D loc;

            if (!GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc))
            {
                OnBadHarvestTarget(from, tool, toHarvest);
                return;
            }

            else if (!def.Validate(tileID))
            {
                OnBadHarvestTarget(from, tool, toHarvest);
                return;
            }

            if (!CheckRange(from, tool, def, map, loc, true))
            {
                return;
            }

            else if (!CheckResources(from, tool, def, map, loc, true))
            {
                return;
            }

            else if (!CheckHarvest(from, tool, def, toHarvest))
            {
                return;
            }

            if (SpecialHarvest(from, tool, def, map, loc))
            {
                return;
            }

            HarvestBank bank = def.GetBank(map, loc.X, loc.Y);

            if (bank == null)
            {
                return;
            }

            HarvestVein vein = bank.Vein;

            if (vein != null)
            {
                vein = MutateVein(from, tool, def, bank, toHarvest, vein);
            }

            if (vein == null)
            {
                return;
            }

            HarvestResource primary  = vein.PrimaryResource;
            HarvestResource fallback = vein.FallbackResource;
            HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, primary, fallback);

            double skillBase  = from.Skills[def.Skill].Base;
            double skillValue = from.Skills[def.Skill].Value;

            Type type = null;

            if (skillBase >= resource.ReqSkill && from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill, 1.0))
            {
                type = GetResourceType(from, tool, def, map, loc, resource);

                if (type != null)
                {
                    type = MutateType(type, from, tool, def, map, loc, resource);
                }

                if (type != null)
                {
                    Item item = Construct(type, from, tool, def, bank, resource);

                    if (item == null)
                    {
                        type = null;
                    }

                    else
                    {
                        BaseBoat ownerBoat = BaseBoat.FindBoatAt(from.Location, from.Map);

                        if (item is MessageInABottle)
                        {
                        }

                        else if (item is RawFish || item is RawLargeFish)
                        {
                            if (ownerBoat != null)
                            {
                                if (ownerBoat.IsOwner(from) || ownerBoat.IsCoOwner(from) || ownerBoat.IsFriend(from))
                                {
                                    //ownerBoat.fishCaught++;
                                }
                            }
                        }

                        if (item.Stackable)
                        {
                            int amount        = def.ConsumedPerHarvest;
                            int feluccaAmount = def.ConsumedPerFeluccaHarvest;

                            int racialAmount        = (int)Math.Ceiling(amount * 1.1);
                            int feluccaRacialAmount = (int)Math.Ceiling(feluccaAmount * 1.1);

                            bool eligableForRacialBonus = (def.RaceBonus && from.Race == Race.Human);
                            bool inFelucca = (map == Map.Felucca);

                            if (eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount && 0.1 > Utility.RandomDouble())
                            {
                                item.Amount = feluccaRacialAmount;
                            }

                            else if (inFelucca && bank.Current >= feluccaAmount)
                            {
                                item.Amount = feluccaAmount;
                            }

                            else if (eligableForRacialBonus && bank.Current >= racialAmount && 0.1 > Utility.RandomDouble())
                            {
                                item.Amount = racialAmount;
                            }

                            else
                            {
                                item.Amount = amount;
                            }
                        }

                        bank.Consume(item.Amount, from);

                        if (Give(from, item, def.PlaceAtFeetIfFull))
                        {
                            SendSuccessTo(from, item, resource);
                        }

                        else
                        {
                            SendPackFullTo(from, item, def, resource);
                            item.Delete();
                        }

                        BonusHarvestResource bonus = def.GetBonusResource();

                        if (bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill)
                        {
                            Item bonusItem = Construct(bonus.Type, from, tool, def, bank, resource);

                            if (Give(from, bonusItem, true))
                            {
                                bonus.SendSuccessTo(from);
                            }

                            else
                            {
                                item.Delete();
                            }
                        }

                        WearTool(from, tool, def);
                    }
                }

                if (type == null)
                {
                    if ((def.Skill != SkillName.Mining && def.Skill != SkillName.Lumberjacking) || !Mining.UseMiningCaptcha)
                    {
                        def.SendMessageTo(from, def.FailMessage);

                        FailHarvest(from, def);
                    }
                }
            }

            else
            {
                def.SendMessageTo(from, def.FailMessage);

                FailHarvest(from, def);
            }

            OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest);
        }
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!this.Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            if (!this.CheckMana(attacker, true))
            {
                return;
            }

            attacker.FixedEffect(0x3728, 10, 15);
            attacker.PlaySound(0x2A1);

            ArrayList list = new ArrayList();

            foreach (Mobile m in attacker.GetMobilesInRange(1))
            {
                list.Add(m);
            }

            ArrayList targets = new ArrayList();

            for (int i = 0; i < list.Count; ++i)
            {
                Mobile m = (Mobile)list[i];

                if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m))
                {
                    if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m))
                    {
                        continue;
                    }

                    if (!attacker.InRange(m, weapon.MaxRange))
                    {
                        continue;
                    }

                    if (attacker.InLOS(m))
                    {
                        targets.Add(m);
                    }
                }
            }

            if (targets.Count > 0)
            {
                double bushido     = attacker.Skills.Bushido.Value;
                double damageBonus = 1.0 + Math.Pow((targets.Count * bushido) / 60, 2) / 100;

                if (damageBonus > 2.0)
                {
                    damageBonus = 2.0;
                }

                attacker.RevealingAction();

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = (Mobile)targets[i];

                    attacker.SendLocalizedMessage(1060161); // The whirling attack strikes a target!
                    m.SendLocalizedMessage(1060162);        // You are struck by the whirling attack and take damage!

                    weapon.OnHit(attacker, m, damageBonus);
                }
            }
        }
Esempio n. 33
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is Mobile)
                {
                    if (targeted is BaseCreature)
                    {
                        BaseCreature creature = (BaseCreature)targeted;

                        if (!creature.Tamable)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, from.NetState); // That creature cannot be tamed.
                        }
                        else if (creature.Controlled)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, from.NetState); // That animal looks tame already.
                        }
                        else if (from.Female && !creature.AllowFemaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049653, from.NetState); // That creature can only be tamed by males.
                        }
                        else if (!from.Female && !creature.AllowMaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049652, from.NetState); // That creature can only be tamed by females.
                        }
                        else if (from.Followers + creature.ControlSlots > from.FollowersMax)
                        {
                            from.SendLocalizedMessage(1049611); // You have too many followers to tame that creature.
                        }
                        else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, from.NetState); // This animal has had too many owners and is too upset for you to tame.
                        }
                        else if (MustBeSubdued(creature))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, from.NetState); // You must subdue this creature before you can tame it!
                        }
                        else if (CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.MinTameSkill)
                        {
                            Beastmaster bmr = Perk.GetByType <Beastmaster>((Player)from);

                            if (m_BeingTamed.Contains(targeted))
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502802, from.NetState); // Someone else is already taming this.
                            }

                            else if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble() && bmr != null)
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502805, from.NetState); // You seem to anger the beast!
                                creature.PlaySound(creature.GetAngerSound());
                                creature.Direction = creature.GetDirectionTo(from);

                                if (creature.BardPacified && Utility.RandomDouble() > .24)
                                {
                                    Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(ResetPacify), creature);
                                }
                                else
                                {
                                    creature.BardEndTime = DateTime.Now;
                                }

                                creature.BardPacified = false;

                                if (creature.AIObject != null)
                                {
                                    creature.AIObject.DoMove(creature.Direction);
                                }

                                if (from is PlayerMobile && !(((PlayerMobile)from).HonorActive))
                                {
                                    creature.Combatant = from;
                                }
                            }
                            else
                            {
                                m_BeingTamed[targeted] = from;

                                from.LocalOverheadMessage(MessageType.Emote, 0x59, 1010597);    // You start to tame the creature.
                                from.NonlocalOverheadMessage(MessageType.Emote, 0x59, 1010598); // *begins taming a creature.*

                                new InternalTimer(from, creature, Utility.Random(3, 2)).Start();

                                m_SetSkillTime = false;
                            }
                        }
                        else
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502806, from.NetState); // You have no chance of taming this creature.
                        }
                    }
                    else
                    {
                        ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502469, from.NetState); // That being cannot be tamed.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502801); // You can't tame that!
                }

                EventSink.InvokeSkillUsed(new SkillUsedEventArgs(from, from.Skills[SkillName.AnimalTaming]));
            }
Esempio n. 34
0
            protected override void OnTarget(Mobile from, object objTarget)
            {
                from.RevealingAction();

                BaseCreature bc_Target = objTarget as BaseCreature;

                if (bc_Target == null)
                {
                    from.SendLocalizedMessage(1049528); // You cannot calm that!
                    return;
                }

                if (BaseBoat.FindBoatAt(bc_Target.Location, bc_Target.Map) != null)
                {
                    from.SendMessage("You may not calm targets in sea vessels.");
                }

                else if (from.Region.IsPartOf(typeof(Engines.ConPVP.SafeZone)))
                {
                    from.SendMessage("You may not peacemake in this area.");
                }

                else if (bc_Target.Region.IsPartOf(typeof(Engines.ConPVP.SafeZone)))
                {
                    from.SendMessage("You may not peacemake there.");
                }

                else if (!m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
                }
                else
                {
                    if (!from.CanBeHarmful(bc_Target, false))
                    {
                        from.SendMessage("That cannot be pacified.");
                        return;
                    }

                    if (bc_Target != null)
                    {
                        if (bc_Target.Uncalmable)
                        {
                            from.SendMessage("That creature cannot be pacified.");
                            return;
                        }

                        if (bc_Target.NextBardingEffectAllowed > DateTime.UtcNow)
                        {
                            string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.NextBardingEffectAllowed, false, true, true, true, true);

                            from.SendMessage("That target is not vulnerable to barding attempts for another " + timeRemaining + ".");
                            return;
                        }
                    }

                    if (!BaseInstrument.CheckMusicianship(from))
                    {
                        from.SendMessage("You struggle with basic musicianship and your song has no effect.");

                        m_Instrument.PlayInstrumentBadly(from);
                        m_Instrument.ConsumeUse(from);

                        from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.PeacemakingFailureCooldown * 1000);
                    }

                    else
                    {
                        double creatureDifficulty = bc_Target.InitialDifficulty;
                        double effectiveBardSkill = from.Skills[SkillName.Peacemaking].Value + BaseInstrument.GetBardBonusSkill(from, bc_Target, m_Instrument);

                        double   successChance  = BaseInstrument.GetBardSuccessChance(effectiveBardSkill, creatureDifficulty);
                        TimeSpan effectDuration = BaseInstrument.GetBardDuration(bc_Target, creatureDifficulty);

                        if (BaseInstrument.CheckSkillGain(successChance))
                        {
                            from.CheckSkill(SkillName.Peacemaking, 0.0, 120.0, 1.0);
                        }

                        if (from.AccessLevel > AccessLevel.Player)
                        {
                            from.SendMessage("Chance of success was: " + Math.Round(successChance * 100, 3).ToString() + "%");
                        }

                        if (Utility.RandomDouble() <= successChance)
                        {
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.PeacemakingSuccessCooldown * 1000);

                            if (bc_Target.Spell != null)
                            {
                                bc_Target.Spell = null;
                            }

                            from.SendLocalizedMessage(1049532); // You play hypnotic music, calming your target.

                            bc_Target.Pacify(from, effectDuration, true);
                        }

                        else
                        {
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.PeacemakingFailureCooldown * 1000);

                            string failureMessage = BaseInstrument.GetFailureMessage(successChance, SkillName.Peacemaking);

                            from.SendMessage(failureMessage);
                        }
                    }
                }
            }
Esempio n. 35
0
        public static TimeSpan OnUse(Mobile m)
        {
            m.RevealingAction();

            if (m.Target != null)
            {
                m.SendLocalizedMessage(501845); // You are busy doing something else and cannot focus.

                return(TimeSpan.FromSeconds(5.0));
            }
            else if (!Core.AOS && m.Hits < (m.HitsMax / 10)) // Less than 10% health
            {
                m.SendLocalizedMessage(501849);              // The mind is strong but the body is weak.

                return(TimeSpan.FromSeconds(5.0));
            }
            else if (m.Mana >= m.ManaMax)
            {
                m.SendLocalizedMessage(501846); // You are at peace.

                return(TimeSpan.FromSeconds(Core.AOS ? 10.0 : 5.0));
            }
            else if (Core.AOS && Server.Misc.RegenRates.GetArmorOffset(m) > 0)
            {
                m.SendLocalizedMessage(500135); // Regenative forces cannot penetrate your armor!

                return(TimeSpan.FromSeconds(10.0));
            }
            else
            {
                Item oneHanded = m.FindItemOnLayer(Layer.OneHanded);
                Item twoHanded = m.FindItemOnLayer(Layer.TwoHanded);

                if (Core.AOS && m.Player)
                {
                    if (!CheckOkayHolding(oneHanded))
                    {
                        m.AddToBackpack(oneHanded);
                    }

                    if (!CheckOkayHolding(twoHanded))
                    {
                        m.AddToBackpack(twoHanded);
                    }
                }
                else if (!CheckOkayHolding(oneHanded) || !CheckOkayHolding(twoHanded))
                {
                    m.SendLocalizedMessage(502626); // Your hands must be free to cast spells or meditate.

                    return(TimeSpan.FromSeconds(2.5));
                }

                double skillVal = m.Skills[SkillName.Meditation].Value;
                double chance   = (50.0 + ((skillVal - (m.ManaMax - m.Mana)) * 2)) / 100;

                if (chance > Utility.RandomDouble())
                {
                    m.CheckSkill(SkillName.Meditation, 0.0, 100.0);

                    m.SendLocalizedMessage(501851); // You enter a meditative trance.
                    m.Meditating = true;
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.ActiveMeditation, 1075657));

                    if (m.Player || m.Body.IsHuman)
                    {
                        m.PlaySound(0xF9);
                    }
                }
                else
                {
                    m.SendLocalizedMessage(501850); // You cannot focus your concentration.
                }

                return(TimeSpan.FromSeconds(10.0));
            }
        }
Esempio n. 36
0
                protected override void OnTick()
                {
                    if (m_Item.Deleted)
                    {
                        return;
                    }

                    if (DateTime.UtcNow > m_Item.m_End)
                    {
                        m_Item.Delete();
                        Stop();
                    }
                    else
                    {
                        Map    map    = m_Item.Map;
                        Mobile caster = m_Item.m_Caster;

                        if (map != null && caster != null)
                        {
                            IPooledEnumerable eable = m_Item.GetMobilesInRange(0);

                            foreach (Mobile m in eable)
                            {
                                if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && (!Core.AOS || m != caster) && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false))
                                {
                                    m_Queue.Enqueue(m);
                                }
                            }

                            eable.Free();

                            while (m_Queue.Count > 0)
                            {
                                Mobile m = (Mobile)m_Queue.Dequeue();

                                if (SpellHelper.CanRevealCaster(m))
                                {
                                    caster.RevealingAction();
                                }

                                caster.DoHarmful(m);

                                int damage = m_Item.m_Damage;

                                if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 30.0))
                                {
                                    damage = 1;

                                    m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
                                }

                                AOS.Damage(m, caster, damage, 0, 100, 0, 0, 0);
                                m.PlaySound(0x208);

                                if (m is BaseCreature)
                                {
                                    ((BaseCreature)m).OnHarmfulSpell(caster);
                                }
                            }
                        }
                    }
                }
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            if (!CheckMana(attacker, true))
            {
                return;
            }

            attacker.FixedEffect(0x3728, 10, 15);
            attacker.PlaySound(0x2A1);

            ArrayList list = new ArrayList();

            foreach (Mobile m in attacker.GetMobilesInRange(1))
            {
                list.Add(m);
            }

            Party p = Party.Get(attacker);

            for (int i = 0; i < list.Count; ++i)
            {
                Mobile m = (Mobile)list[i];

                if (m != defender && m != attacker &&
                    SpellHelper.ValidIndirectTarget(attacker, m) &&
                    attacker.CanBeHarmful(m, false) &&
                    (p == null || !p.Contains(m)))
                {
                    if (m == null || m.Deleted || attacker.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.Alive || !attacker.CanSee(m))
                    {
                        continue;
                    }

                    if (!attacker.InRange(m, weapon.MaxRange))
                    {
                        continue;
                    }

                    if (attacker.InLOS(m))
                    {
                        attacker.RevealingAction();

                        attacker.SendLocalizedMessage(1060161);                    // The whirling attack strikes a target!
                        m.SendLocalizedMessage(1060162);                           // You are struck by the whirling attack and take damage!

                        weapon.OnHit(attacker, m);
                    }
                }
            }
        }
Esempio n. 38
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted == from)
                {
                    from.SayTo(from, true, "You cannot entice yourself!");
                }
                //from.SendAsciiMessage("You cannot entice yourself!");
                else if (!m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendAsciiMessage("The instrument you are trying to play is no longer in your backpack!"); // The instrument you are trying to play is no longer in your backpack!
                }
                else if (targeted is Mobile)
                {
                    Mobile targ = targeted as Mobile;
                    m_SetSkillTime     = false;
                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);

                    if (!BaseInstrument.CheckMusicianship(from))
                    {
                        targ.SayTo(targ, true, "You hear lovely music, and for a moment are drawn towards it.");
                        targ.SayTo(from, true, "Your music fails to attract them.");
                        //targ.LocalOverheadMessage(MessageType.Regular, targ.SpeechHue, true, String.Format("You hear lovely music, and for a moment are drawn towards it."));
                        //targ.NonlocalOverheadMessage(MessageType.Regular, targ.SpeechHue, true, String.Format("You hear lovely music, and for a moment are drawn towards it."));
                        m_Instrument.PlayInstrumentBadly(from);
                        m_Instrument.ConsumeUse(from);
                    }
                    else if (!from.CheckSkill(SkillName.Discordance, 0.0, 100.0))
                    {
                        targ.SayTo(targ, true, "You hear lovely music, and for a moment are drawn towards it.");
                        targ.SayTo(from, true, "Your music fails to attract them.");
                        m_Instrument.PlayInstrumentBadly(from);
                        m_Instrument.ConsumeUse(from);
                    }
                    else
                    {
                        m_Instrument.PlayInstrumentWell(from);
                        m_Instrument.ConsumeUse(from);
                        targ.SayTo(targ, true, "You hear lovely music, and are drawn towards it...");
                        from.SayTo(from, true, "You play your hypnotic music, luring them near.");

                        if (targ is PlayerMobile)
                        {
                            targ.SayTo(from, true, "What am I hearing?");
                            targ.SayTo(from, true, "You might have better luck with sweet words.");
                        }
                        else if (targ is BaseVendor)
                        {
                            targ.SayTo(from, true, "What am I hearing?");
                            targ.SayTo(from, true, "Oh, but I cannot wander too far from my shop!");
                        }
                        else if (targ is BaseCreature)
                        {
                            BaseCreature bc = (BaseCreature)targ;

                            if (bc.EnticeTimer != null)
                            {
                                bc.EnticeTimer.Stop();
                                bc.EnticeTimer = null;
                            }

                            bc.EnticeTimer = new EnticementTimer(from, bc);
                            bc.EnticeTimer.Start();
                        }
                    }
                }
                else
                {
                    from.SendAsciiMessage("You cannot entice that!");
                }
            }
Esempio n. 39
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (!(targeted is Mobile))
                {
                    from.SendLocalizedMessage(1049528);                       // You cannot calm that!
                }
                else if (m_Instrument.Parent != from && !m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062488);                       // The instrument you are trying to play is no longer in your backpack!
                }
                else if (targeted is Mobile)
                {
                    m_SetSkillTime     = false;
                    from.NextSkillTime = Core.TickCount + 10000;

                    if (targeted == from)
                    {
                        // Standard mode : reset combatants for everyone in the area

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                               // You play poorly, and there is no effect.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else if (!from.CheckSkill(SkillName.Peacemaking, 0.0, 120.0))
                        {
                            from.SendLocalizedMessage(500613);                               // You attempt to calm everyone, but fail.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else
                        {
                            from.NextSkillTime = Core.TickCount + 5000;
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            double seconds = (from.Skills[SkillName.Musicianship].Value) / 10;

                            Map map = from.Map;

                            if (map != null)
                            {
                                int range = BaseInstrument.GetBardRange(from, SkillName.Peacemaking);

                                bool calmed = false;

                                foreach (Mobile m in from.GetMobilesInRange(range))
                                {
                                    if ((m is BaseCreature && ((BaseCreature)m).Uncalmable) || (m is BaseCreature && ((BaseCreature)m).AreaPeaceImmune) || m == from || !from.CanBeHarmful(m, false))
                                    {
                                        continue;
                                    }

                                    calmed = true;

                                    m.SendLocalizedMessage(500616);                                       // You hear lovely music, and forget to continue battling!
                                    m.Combatant = null;
                                    m.Warmode   = false;

                                    if (m is BaseCreature && !((BaseCreature)m).BardPacified)
                                    {
                                        ((BaseCreature)m).Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(seconds));
                                    }
                                }

                                if (!calmed)
                                {
                                    from.SendLocalizedMessage(1049648);                                       // You play hypnotic music, but there is nothing in range for you to calm.
                                }
                                else
                                {
                                    from.SendLocalizedMessage(500615);                                       // You play your hypnotic music, stopping the battle.
                                }
                            }
                        }
                    }
                    else
                    {
                        // Target mode : pacify a single target for a longer duration

                        Mobile targ = (Mobile)targeted;

                        if (!from.CanBeHarmful(targ, false))
                        {
                            from.SendLocalizedMessage(1049528);
                            m_SetSkillTime = true;
                        }
                        else if (targ is BaseCreature && ((BaseCreature)targ).Uncalmable)
                        {
                            from.SendLocalizedMessage(1049526);                               // You have no chance of calming that creature.
                            m_SetSkillTime = true;
                        }
                        else if (targ is BaseCreature && ((BaseCreature)targ).BardPacified)
                        {
                            from.SendLocalizedMessage(1049527);                               // That creature is already being calmed.
                            m_SetSkillTime = true;
                        }
                        else if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                               // You play poorly, and there is no effect.
                            from.NextSkillTime = Core.TickCount + 5000;
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else
                        {
                            double diff  = m_Instrument.GetDifficultyFor(targ) - 10.0;
                            double music = from.Skills[SkillName.Musicianship].Value;

                            if (music > 100.0)
                            {
                                diff -= (music - 100.0) * 0.5;
                            }

                            if (!from.CheckTargetSkill(SkillName.Peacemaking, targ, diff - 25.0, diff + 25.0))
                            {
                                from.SendLocalizedMessage(1049531);                                   // You attempt to calm your target, but fail.
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                m_Instrument.PlayInstrumentWell(from);
                                m_Instrument.ConsumeUse(from);

                                from.NextSkillTime = Core.TickCount + 5000;
                                if (targ is BaseCreature)
                                {
                                    BaseCreature bc = (BaseCreature)targ;

                                    from.SendLocalizedMessage(1049532);                                       // You play hypnotic music, calming your target.

                                    targ.Combatant = null;
                                    targ.Warmode   = false;

                                    double seconds = 100 - (diff / 1.5);

                                    if (seconds > 120)
                                    {
                                        seconds = 120;
                                    }
                                    else if (seconds < 10)
                                    {
                                        seconds = 10;
                                    }

                                    bc.Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(seconds));
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1049532);                                      // You play hypnotic music, calming your target.

                                    targ.SendLocalizedMessage(500616);                                       // You hear lovely music, and forget to continue battling!
                                    targ.Combatant = null;
                                    targ.Warmode   = false;
                                }
                            }
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049528);                       // You cannot calm that!
                }
            }
Esempio n. 40
0
 public static void OnPickedInstrument(Mobile from, BaseInstrument instrument)
 {
     from.RevealingAction();
     from.SendLocalizedMessage(501587); // Whom do you wish to incite?
     from.Target = new InternalFirstTarget(from, instrument);
 }
 protected override void OnTick()
 {
     m_Mobile.RevealingAction();
     RemoveTimer(m_Mobile);
 }
Esempio n. 42
0
            protected override void OnTarget(Mobile from, object target)
            {
                from.RevealingAction();
                from.NextSkillTime = Core.TickCount + 1000;

                if (!m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062488);                     // The instrument you are trying to play is no longer in your backpack!
                }
                else if (target is Mobile)
                {
                    Mobile targ = (Mobile)target;

                    if (targ == from || !from.CanBeHarmful(targ, false) ||
                        (targ is BaseCreature && ((BaseCreature)targ).BardImmune && ((BaseCreature)targ).ControlMaster != from))
                    {
                        from.SendLocalizedMessage(1049535);                 // A song of discord would have no effect on that.
                    }
                    else if (m_Table.ContainsKey(targ))                     //Already discorded
                    {
                        from.SendLocalizedMessage(1049537);                 // Your target is already in discord.
                    }
                    else if (!targ.Player || (from is BaseCreature && ((BaseCreature)from).CanDiscord) || (Core.EJ && targ.Player && from.Player && CanDiscordPVP(from)))
                    {
                        double diff  = m_Instrument.GetDifficultyFor(targ) - 10.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        if (from is BaseCreature)
                        {
                            music = 120.0;
                        }

                        int masteryBonus = 0;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (from is PlayerMobile)
                        {
                            masteryBonus = Spells.SkillMasteries.BardSpell.GetMasteryBonus((PlayerMobile)from, SkillName.Discordance);
                        }

                        if (masteryBonus > 0)
                        {
                            diff -= (diff * ((double)masteryBonus / 100));
                        }

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                             // You play poorly, and there is no effect.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else if (from.CheckTargetSkill(SkillName.Discordance, target, diff - 25.0, diff + 25.0))
                        {
                            from.SendLocalizedMessage(1049539);                             // You play the song surpressing your targets strength

                            if (targ.Player)
                            {
                                targ.SendLocalizedMessage(1072061); // You hear jarring music, suppressing your strength.
                            }
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            DiscordanceInfo info;

                            if (Core.EJ && targ.Player && from.Player)
                            {
                                info = new DiscordanceInfo(from, targ, 0, null, true, from.Skills.CurrentMastery == SkillName.Discordance ? 6 : 4);
                                from.DoHarmful(targ);
                            }
                            else
                            {
                                ArrayList mods = new ArrayList();
                                int       effect;
                                double    scalar;

                                if (Core.AOS)
                                {
                                    double discord = from.Skills[SkillName.Discordance].Value;

                                    effect = (int)Math.Max(-28.0, (discord / -4.0));

                                    if (Core.SE && BaseInstrument.GetBaseDifficulty(targ) >= 160.0)
                                    {
                                        effect /= 2;
                                    }

                                    scalar = (double)effect / 100;

                                    mods.Add(new ResistanceMod(ResistanceType.Physical, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Fire, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Cold, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Poison, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Energy, effect));

                                    for (int i = 0; i < targ.Skills.Length; ++i)
                                    {
                                        if (targ.Skills[i].Value > 0)
                                        {
                                            mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar));
                                        }
                                    }
                                }
                                else
                                {
                                    effect = (int)(from.Skills[SkillName.Discordance].Value / -5.0);
                                    scalar = effect * 0.01;

                                    mods.Add(new StatMod(StatType.Str, "DiscordanceStr", (int)(targ.RawStr * scalar), TimeSpan.Zero));
                                    mods.Add(new StatMod(StatType.Int, "DiscordanceInt", (int)(targ.RawInt * scalar), TimeSpan.Zero));
                                    mods.Add(new StatMod(StatType.Dex, "DiscordanceDex", (int)(targ.RawDex * scalar), TimeSpan.Zero));

                                    for (int i = 0; i < targ.Skills.Length; ++i)
                                    {
                                        if (targ.Skills[i].Value > 0)
                                        {
                                            mods.Add(new DefaultSkillMod((SkillName)i, true, Math.Max(100, targ.Skills[i].Value) * scalar));
                                        }
                                    }
                                }

                                info = new DiscordanceInfo(from, targ, Math.Abs(effect), mods);

                                #region Bard Mastery Quest
                                if (from is PlayerMobile)
                                {
                                    BaseQuest quest = QuestHelper.GetQuest((PlayerMobile)from, typeof(WieldingTheSonicBladeQuest));

                                    if (quest != null)
                                    {
                                        foreach (BaseObjective objective in quest.Objectives)
                                        {
                                            objective.Update(targ);
                                        }
                                    }
                                }
                                #endregion
                            }

                            info.m_Timer = Timer.DelayCall(TimeSpan.Zero, TimeSpan.FromSeconds(1.25), ProcessDiscordance, info);

                            m_Table[targ]      = info;
                            from.NextSkillTime = Core.TickCount + (8000 - ((masteryBonus / 5) * 1000));
                        }
                        else
                        {
                            if (from is BaseCreature && PetTrainingHelper.Enabled)
                            {
                                from.CheckSkill(SkillName.Discordance, 0, from.Skills[SkillName.Discordance].Cap);
                            }

                            from.SendLocalizedMessage(1049540);                             // You attempt to disrupt your target, but fail.

                            if (targ.Player)
                            {
                                targ.SendLocalizedMessage(1072064); // You hear jarring music, but it fails to disrupt you.
                            }
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + 5000;
                        }
                    }
                    else
                    {
                        m_Instrument.PlayInstrumentBadly(from);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049535);                     // A song of discord would have no effect on that.
                }
            }
Esempio n. 43
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                int number = -1;

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

                    if (targ.Player)                       // We can't beg from players
                    {
                        from.SendAsciiMessage("Perhaps just asking would work better.");
                        number = 500398;                         // Perhaps just asking would work better.
                    }
                    else if (!targ.Body.IsHuman)                 // Make sure the NPC is human
                    {
                        from.SendAsciiMessage("There is little chance of getting money from that!");
                        number = 500399;                         // There is little chance of getting money from that!
                    }
                    else if (!from.InRange(targ, 2))
                    {
                        if (!targ.Female)
                        {
                            from.SendAsciiMessage("You are too far away to beg from him.");
                            number = 500401; // You are too far away to beg from him.
                        }
                        else
                        {
                            from.SendAsciiMessage("You are too far away to beg from her.");
                        }
                        //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?
                    {
                        from.SendAsciiMessage("They seem unwilling to give you any money.");
                        number = 500404;                         // They seem unwilling to give you any money.
                    }
                    else
                    {
                        // 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
                {
                    from.SendAsciiMessage("There is little chance of getting money from that!");
                    //number = 500399; // There is little chance of getting money from that!
                }

                number = -1;
                if (number != -1)
                {
                    from.SendLocalizedMessage(number);
                }
            }
Esempio n. 44
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }
            if (!CheckMana(attacker, true))
            {
                return;
            }
            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            attacker.FixedEffect(0x3728, 10, 15);
            attacker.PlaySound(0x2A1);

            ArrayList list = new ArrayList();

            foreach (Mobile m in attacker.GetMobilesInRange(1))
            {
                list.Add(m);
            }

            Party p = Party.Get(attacker);

            for (int i = 0; i < list.Count; ++i)
            {
                Mobile m = (Mobile)list[i];

                if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m) && (p == null || !p.Contains(m)))
                {
                    if (m == null || m.Deleted || attacker.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.Alive || !attacker.CanSee(m))
                    {
                        continue;
                    }

                    if (!attacker.InRange(m, weapon.MaxRange))
                    {
                        continue;
                    }

                    if (attacker.InLOS(m))
                    {
                        attacker.RevealingAction();

                        BeginFrenzied(m, attacker, damage);

                        weapon.OnHit(attacker, m);
                    }
                }
            }
        }
Esempio n. 45
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is BaseCreature || (from is BaseCreature && ((BaseCreature)from).CanProvoke))
                {
                    BaseCreature creature = targeted as BaseCreature;
                    Mobile       target   = targeted as Mobile;

                    bool questTargets = QuestTargets(creature, from);

                    if (!m_Instrument.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
                    }
                    else if (m_Creature.Unprovokable)
                    {
                        from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
                    }
                    else if (creature != null && creature.Unprovokable && !(creature is DemonKnight) && !questTargets)
                    {
                        from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
                    }
                    else if (m_Creature.Map != target.Map ||
                             !m_Creature.InRange(target, BaseInstrument.GetBardRange(from, SkillName.Provocation)))
                    {
                        from.SendLocalizedMessage(1049450);
                        // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
                    }
                    else if (m_Creature != target)
                    {
                        from.NextSkillTime = Core.TickCount + 10000;

                        double diff         = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(target)) * 0.5) - 5.0;
                        double music        = from.Skills[SkillName.Musicianship].Value;
                        int    masteryBonus = 0;

                        if (from is PlayerMobile)
                        {
                            masteryBonus = Spells.SkillMasteries.BardSpell.GetMasteryBonus((PlayerMobile)from, SkillName.Provocation);
                        }

                        if (masteryBonus > 0)
                        {
                            diff -= (diff * ((double)masteryBonus / 100));
                        }

                        diff += (XmlMobFactions.GetScaledFaction(from, m_Creature, -25, 25, -0.001) +
                                 XmlMobFactions.GetScaledFaction(from, target, -25, 25, -0.001)) * 0.5;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (questTargets || (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(target, true)))
                        {
                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.NextSkillTime = Core.TickCount + (10000 - ((masteryBonus / 5) * 1000));
                                from.SendLocalizedMessage(500612); // You play poorly, and there is no effect.
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                //from.DoHarmful( m_Creature );
                                //from.DoHarmful( creature );
                                if (!from.CheckTargetSkill(SkillName.Provocation, target, diff - 25.0, diff + 25.0))
                                {
                                    from.NextSkillTime = Core.TickCount + (10000 - ((masteryBonus / 5) * 1000));
                                    from.SendLocalizedMessage(501599); // Your music fails to incite enough anger.
                                    m_Instrument.PlayInstrumentBadly(from);
                                    m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    from.SendLocalizedMessage(501602); // Your music succeeds, as you start a fight.
                                    m_Instrument.PlayInstrumentWell(from);
                                    m_Instrument.ConsumeUse(from);
                                    m_Creature.Provoke(from, target, true);

                                    #region Bard Mastery Quest
                                    if (questTargets)
                                    {
                                        BaseQuest quest = QuestHelper.GetQuest((PlayerMobile)from, typeof(IndoctrinationOfABattleRouserQuest));

                                        if (quest != null)
                                        {
                                            foreach (BaseObjective objective in quest.Objectives)
                                            {
                                                objective.Update(creature);
                                            }
                                        }
                                    }
                                    #endregion
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501593); // You can't tell someone to attack themselves!
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501589); // You can't incite that!
                }
            }
Esempio n. 46
0
        public static void HungerDecay(Mobile m)
        {
            if (m != null && m is Player)
            {
                Adventurer adv = Perk.GetByType <Adventurer>((Player)m);

                if (adv != null)
                {
                    if (Utility.RandomDouble() < 0.50 && m.Hunger < 20)
                    {
                        m.Hunger += adv.HungerThirstBonus();
                    }
                }
            }

            if ((m != null && m.Alive && m.Hunger >= 1 && m.AccessLevel == AccessLevel.Player) &&
                ((Player)m).Race != Race.Liche && ((Player)m).Race != Race.Marid)
            {
                m.Hunger--;
            }

            if (m != null && m.Alive)
            {
                if (m.Hunger > 14)
                {
                    return;
                }

                else if (m.Hunger >= 10 && m.Hunger <= 14)
                {
                    m.SendMessage("You feel somewhat hungry.");
                }

                else if (m.Hunger >= 5 && m.Hunger < 10)
                {
                    m.SendMessage("You feel quite hungry.");
                }

                else if (m.Hunger > 0 && m.Hunger < 5)
                {
                    m.SendMessage("You are very hungry, and should find something to eat.");
                }

                else
                {
                    m.SendMessage("Your lack of food is wasting away at your body!");
                    m.Damage(Utility.RandomMinMax(25, 45));
                    m.Stam -= Utility.RandomMinMax(20, 30);
                    m.Mana -= Utility.RandomMinMax(20, 30);
                }

                if (m.Hunger < 10)
                {
                    m.PublicOverheadMessage(MessageType.Regular, m.EmoteHue, true, String.Format("*{0} stomach growls softly*", m.Female ? "her" : "his"));

                    if (m.Hidden)
                    {
                        m.RevealingAction();
                    }
                }
            }
        }
Esempio n. 47
0
 public static void OnPickedInstrument(Mobile from, BaseInstrument instrument)
 {
     from.RevealingAction();
     from.SendAsciiMessage("Whom do you wish to entice?");              // Choose the target for your song of discordance.
     from.Target = new DiscordanceTarget(from, instrument);
 }
Esempio n. 48
0
        protected virtual void FinishEffect(Point3D p, Map map, Mobile from)
        {
            from.RevealingAction();

            int     count   = Utility.RandomMinMax(1, 6);
            int     onBoat  = 0;
            string  monster = "";
            Point3D SpawnAt = p;

            switch (Utility.Random(12))
            {
            case 0: monster = "AquaticGhoul"; SpawnAt = from.Location; onBoat = 1; break;

            case 1: monster = "SeaWeeder"; SpawnAt = from.Location; onBoat = 1; break;

            case 2: monster = "SeaSnake"; break;

            case 3: monster = "WaterBeetle"; break;

            case 4: monster = "WaterStrider"; break;

            case 5: monster = "OilSlick"; break;

            case 6: monster = "FloatingEye"; break;

            case 7: monster = "SeaTroll"; SpawnAt = from.Location; onBoat = 1; break;

            case 8: monster = "WaterElemental"; break;

            case 9: monster = "GiantCrab"; break;

            case 10: monster = "GiantLamprey"; break;

            case 11: monster = "Locathah"; SpawnAt = from.Location; onBoat = 1; break;
            }

            for (int i = 0; map != null && i < count; ++i)
            {
                BaseCreature spawn = new AquaticGhoul();

                if (monster == "AquaticGhoul")
                {
                    spawn = new AquaticGhoul();
                }
                else if (monster == "SeaWeeder")
                {
                    spawn = new SeaWeeder();
                }
                else if (monster == "SeaSnake")
                {
                    spawn = new SeaSnake();
                }
                else if (monster == "WaterBeetle")
                {
                    spawn = new WaterBeetle();
                }
                else if (monster == "WaterStrider")
                {
                    spawn = new WaterStrider();
                }
                else if (monster == "OilSlick")
                {
                    spawn = new OilSlick();
                }
                else if (monster == "FloatingEye")
                {
                    spawn = new FloatingEye();
                }
                else if (monster == "SeaTroll")
                {
                    spawn = new SeaTroll();
                }
                else if (monster == "WaterElemental")
                {
                    spawn = new WaterElemental();
                }
                else if (monster == "GiantCrab")
                {
                    spawn = new GiantCrab();
                }
                else if (monster == "GiantLamprey")
                {
                    spawn = new GiantLamprey();
                }
                else if (monster == "Locathah")
                {
                    spawn = new Locathah();
                }

                Spawn(SpawnAt, map, spawn, onBoat);

                spawn.WhisperHue = 999;                 // SO TASK MANAGER DELETES THEM EVENTUALLY
                spawn.Combatant  = from;
            }

            Delete();
        }
Esempio n. 49
0
            protected override void OnTick()
            {
                if (!m_Target.Alive)
                {
                    m_Table.Remove(m_Target);
                    Stop();
                }

                if (!m_Target.Alive || DateTime.UtcNow < m_NextHit)
                {
                    return;
                }

                --m_Count;

                if (m_HitDelay > 1)
                {
                    if (m_MaxCount < 5)
                    {
                        --m_HitDelay;
                    }
                    else
                    {
                        int delay = (int)(Math.Ceiling((1.0 + (5 * m_Count)) / m_MaxCount));

                        if (delay <= 5)
                        {
                            m_HitDelay = delay;
                        }
                        else
                        {
                            m_HitDelay = 5;
                        }
                    }
                }

                if (m_Count == 0)
                {
                    m_Target.SendLocalizedMessage(1061687); // You can breath normally again.
                    m_Table.Remove(m_Target);
                    Stop();
                }
                else
                {
                    m_NextHit = DateTime.UtcNow + TimeSpan.FromSeconds(m_HitDelay);

                    double damage = m_MinBaseDamage + (Utility.RandomDouble() * (m_MaxBaseDamage - m_MinBaseDamage));

                    damage *= (3 - (((double)m_Target.Stam / m_Target.StamMax) * 2));

                    if (damage < 1)
                    {
                        damage = 1;
                    }

                    if (!m_Target.Player)
                    {
                        damage *= 1.75;
                    }

                    AOS.Damage(m_Target, m_From, (int)damage, 0, 0, 0, 100, 0);

                    if (0.60 <= Utility.RandomDouble()) // OSI: randomly revealed between first and third damage tick, guessing 60% chance
                    {
                        m_Target.RevealingAction();
                    }
                }
            }
Esempio n. 50
0
            protected override void OnTarget(Mobile from, object target)
            {
                from.RevealingAction();

                Item   stolen = null;
                object root   = null;
                bool   caught = false;

                if (target is Item)
                {
                    root   = ((Item)target).RootParent;
                    stolen = TryStealItem((Item)target, ref caught);
                }
                else if (target is Mobile)
                {
                    Container pack = ((Mobile)target).Backpack;

                    if (pack != null && pack.Items.Count > 0)
                    {
                        int randomIndex = Utility.Random(pack.Items.Count);

                        root   = target;
                        stolen = TryStealItem(pack.Items[randomIndex], ref caught);
                    }
                }
                else
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }

                if (stolen != null)
                {
                    from.AddToBackpack(stolen);

                    if (!(stolen is Container || stolen.Stackable))
                    {                     // do not return stolen containers or stackable items
                        StolenItem.Add(stolen, m_Thief, root as Mobile);
                    }
                }

                if (caught)
                {
                    if (root == null)
                    {
                        m_Thief.CriminalAction(false);
                    }
                    else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief))
                    {
                        m_Thief.CriminalAction(false);
                    }
                    else if (root is Mobile)
                    {
                        Mobile mobRoot = (Mobile)root;

                        if (!IsInGuild(mobRoot) && IsInnocentTo(m_Thief, mobRoot))
                        {
                            m_Thief.CriminalAction(false);
                        }

                        string message = string.Format("You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name);

                        foreach (NetState ns in m_Thief.GetClientsInRange(8))
                        {
                            if (ns.Mobile != m_Thief)
                            {
                                ns.Mobile.SendMessage(message);
                            }
                        }
                    }
                }
                else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief))
                {
                    m_Thief.CriminalAction(false);
                }

                if (root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild((Mobile)root))
                {
                    PlayerMobile pm = (PlayerMobile)m_Thief;

                    pm.PermaFlags.Add((Mobile)root);
                    pm.Delta(MobileDelta.Noto);
                }
            }
Esempio n. 51
0
        public virtual bool Cast()
        {
            m_StartCastTime = Core.TickCount;

            if (Core.AOS && m_Caster.Spell is Spell && ((Spell)m_Caster.Spell).State == SpellState.Sequencing)
            {
                ((Spell)m_Caster.Spell).Disturb(DisturbType.NewCast);
            }

            if (!m_Caster.CheckAlive())
            {
                return(false);
            }
            else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).Peaced)
            {
                m_Caster.SendLocalizedMessage(1072060);                 // You cannot cast a spell while calmed.
            }
            else if (m_Scroll is BaseWand && m_Caster.Spell != null && m_Caster.Spell.IsCasting)
            {
                m_Caster.SendLocalizedMessage(502643);                 // You can not cast a spell while frozen.
            }
            else if (SkillHandlers.SpiritSpeak.IsInSpiritSpeak(m_Caster) || (m_Caster.Spell != null && m_Caster.Spell.IsCasting))
            {
                m_Caster.SendLocalizedMessage(502642);                 // You are already casting a spell.
            }
            else if (BlockedByHorrificBeast && TransformationSpellHelper.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)) ||
                     (BlockedByAnimalForm && AnimalForm.UnderTransformation(m_Caster)))
            {
                m_Caster.SendLocalizedMessage(1061091);                 // You cannot cast that spell in this form.
            }
            else if (!(m_Scroll is BaseWand) && (m_Caster.Paralyzed || m_Caster.Frozen))
            {
                m_Caster.SendLocalizedMessage(502643);                 // You can not cast a spell while frozen.
            }
            else if (CheckNextSpellTime && Core.TickCount - m_Caster.NextSpellTime < 0)
            {
                m_Caster.SendLocalizedMessage(502644);                 // You have not yet recovered from casting a spell.
            }
            else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.UtcNow)
            {
                m_Caster.SendLocalizedMessage(1072060);                 // You cannot cast a spell while calmed.
            }
            else if (m_Caster.Mana >= ScaleMana(GetMana()))
            {
                #region Stygian Abyss
                if (m_Caster.Race == Race.Gargoyle && m_Caster.Flying)
                {
                    if (BaseMount.OnFlightPath(m_Caster))
                    {
                        if (m_Caster.IsPlayer())
                        {
                            m_Caster.SendLocalizedMessage(1113750); // You may not cast spells while flying over such precarious terrain.
                            return(false);
                        }
                        else
                        {
                            m_Caster.SendMessage("Your staff level allows you to cast while flying over precarious terrain.");
                        }
                    }
                }
                #endregion

                if (m_Caster.Spell == null && m_Caster.CheckSpellCast(this) && CheckCast() &&
                    m_Caster.Region.OnBeginSpellCast(m_Caster, this))
                {
                    m_State        = SpellState.Casting;
                    m_Caster.Spell = this;

                    Caster.Delta(MobileDelta.Flags);

                    if (!(m_Scroll is BaseWand) && RevealOnCast)
                    {
                        m_Caster.RevealingAction();
                    }

                    SayMantra();

                    /*
                     * EA seems to use some type of spell variation, of -100 ms + timer resolution.
                     * Using the below millisecond dropoff with a 50ms timer resolution seems to be exact
                     * to EA.
                     */

                    TimeSpan castDelay = GetCastDelay().Subtract(TimeSpan.FromMilliseconds(100));

                    if (ShowHandMovement && !(m_Scroll is SpellStone) && (m_Caster.Body.IsHuman || (m_Caster.Player && m_Caster.Body.IsMonster)))
                    {
                        int count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);

                        if (count != 0)
                        {
                            m_AnimTimer = new AnimTimer(this, count);
                            m_AnimTimer.Start();
                        }

                        if (m_Info.LeftHandEffect > 0)
                        {
                            Caster.FixedParticles(0, 10, 5, m_Info.LeftHandEffect, EffectLayer.LeftHand);
                        }

                        if (m_Info.RightHandEffect > 0)
                        {
                            Caster.FixedParticles(0, 10, 5, m_Info.RightHandEffect, EffectLayer.RightHand);
                        }
                    }

                    if (ClearHandsOnCast)
                    {
                        m_Caster.ClearHands();
                    }

                    if (Core.ML)
                    {
                        WeaponAbility.ClearCurrentAbility(m_Caster);
                    }

                    m_CastTimer = new CastTimer(this, castDelay);
                    //m_CastTimer.Start();

                    OnBeginCast();

                    if (castDelay > TimeSpan.Zero)
                    {
                        m_CastTimer.Start();
                    }
                    else
                    {
                        m_CastTimer.Tick();
                    }

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625, ScaleMana(GetMana()).ToString()); // Insufficient mana. You must have at least ~1_MANA_REQUIREMENT~ Mana to use this spell.
            }

            return(false);
        }
Esempio n. 52
0
        public static TimeSpan OnUse(Mobile m)
        {
            if (m.Spell != null)
            {
                m.SendLocalizedMessage(501238);                   // You are busy doing something else and cannot hide.
                return(TimeSpan.FromSeconds(1.0));
            }

            if (Core.ML && m.Target != null)
            {
                Targeting.Target.Cancel(m);
            }

            double bonus = 0.0;

            BaseHouse house = BaseHouse.FindHouseAt(m);

            if (house != null && house.IsFriend(m))
            {
                bonus = 100.0;
            }
            else if (!Core.AOS)
            {
                if (house == null)
                {
                    house = BaseHouse.FindHouseAt(new Point3D(m.X - 1, m.Y, 127), m.Map, 16);
                }

                if (house == null)
                {
                    house = BaseHouse.FindHouseAt(new Point3D(m.X + 1, m.Y, 127), m.Map, 16);
                }

                if (house == null)
                {
                    house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y - 1, 127), m.Map, 16);
                }

                if (house == null)
                {
                    house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y + 1, 127), m.Map, 16);
                }

                if (house != null)
                {
                    bonus = 50.0;
                }
            }

            //int range = 18 - (int)(m.Skills[SkillName.Hiding].Value / 10);
            int range = Math.Min((int)((100 - m.Skills[SkillName.Hiding].Value) / 2) + 8, 18);                  //Cap of 18 not OSI-exact, intentional difference

            bool badCombat = (!m_CombatOverride && m.Combatant != null && m.InRange(m.Combatant.Location, range) && m.Combatant.InLOS(m));

            if (m.CheckSkill(SkillName.Hiding, 0, 100))
            {
                badCombat = false;
            }                                                                                 // ADDED A LITTLE EXTRA HIDING ABILITY FOR HIGH SKILL
            bool ok = (!badCombat /*&& m.CheckSkill( SkillName.Hiding, 0.0 - bonus, 100.0 - bonus )*/);

            if (ok)
            {
                if (!m_CombatOverride)
                {
                    foreach (Mobile check in m.GetMobilesInRange(range))
                    {
                        if (check.InLOS(m) && check.Combatant == m)
                        {
                            badCombat = true;
                            ok        = false;
                            break;
                        }
                    }
                }

                ok = (!badCombat && m.CheckSkill(SkillName.Hiding, 0.0 - bonus, 100.0 - bonus));
            }

            if (badCombat)
            {
                m.RevealingAction();

                m.LocalOverheadMessage(MessageType.Regular, 0x22, 501237);                   // You can't seem to hide right now.

                return(TimeSpan.FromSeconds(1.0));
            }
            else
            {
                if (ok)
                {
                    m.Hidden  = true;
                    m.Warmode = false;
                    m.LocalOverheadMessage(MessageType.Regular, 0x1F4, 501240);                       // You have hidden yourself well.

                    foreach (Mobile pet in World.Mobiles.Values)
                    {
                        if (pet is BaseCreature)
                        {
                            BaseCreature bc = (BaseCreature)pet;
                            if (bc.Controlled && bc.ControlMaster == m)
                            {
                                pet.Hidden = true;
                            }
                        }
                    }
                }
                else
                {
                    m.RevealingAction();

                    m.LocalOverheadMessage(MessageType.Regular, 0x22, 501241);                       // You can't seem to hide here.
                }

                return(TimeSpan.FromSeconds(2.0));
            }
        }
Esempio n. 53
0
            protected override void OnTarget(Mobile from, object target)
            {
                from.RevealingAction();
                from.ClearHands();

                if (from.Frozen)
                {
                    from.SendMessage("You cannot seem to move your hands.");
                }

                else if (target is Mobile)
                {
                    Mobile targ = (Mobile)target;

                    TeiravonMobile TAV = from as TeiravonMobile;

                    if (targ is BaseCreature && (((BaseCreature)targ).BardImmune || !from.CanBeHarmful(targ, false)))
                    {
                        from.SendLocalizedMessage(1049535);                           // A song of discord would have no effect on that.
                    }
                    else if (!targ.Player || TAV.HasFeat(TeiravonMobile.Feats.CuttingWords))
                    {
                        TimeSpan len   = TimeSpan.FromSeconds(from.Skills[SkillName.Discordance].Value * 2);
                        double   diff  = m_Instrument.GetDifficultyFor(targ) - 10.0;
                        double   music = from.Skills[SkillName.Musicianship].Value;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (from is TeiravonMobile)
                        {
                            diff -= ((TeiravonMobile)from).PlayerLevel;
                        }

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                               // You play poorly, and there is no effect.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else if (from.CheckTargetSkill(SkillName.Discordance, target, diff - 25.0, diff + 25.0))
                        {
                            if (!m_Table.Contains(targ))
                            {
                                from.SendLocalizedMessage(1049539);                                   // You play the song surpressing your targets strength
                                m_Instrument.PlayInstrumentWell(from);
                                m_Instrument.ConsumeUse(from);

                                ArrayList mods = new ArrayList();
                                double    scalar;

                                if (Core.AOS)
                                {
                                    double discord = from.Skills[SkillName.Discordance].Value;
                                    int    effect;

                                    if (discord > 100.0)
                                    {
                                        effect = -20 + (int)((discord - 100.0) / -2.5);
                                    }
                                    else
                                    {
                                        effect = (int)(discord / -5.0);
                                    }

                                    scalar = effect * 0.01;

                                    mods.Add(new ResistanceMod(ResistanceType.Physical, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Fire, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Cold, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Poison, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Energy, effect));

                                    for (int i = 0; i < targ.Skills.Length; ++i)
                                    {
                                        if (targ.Skills[i].Value > 0)
                                        {
                                            mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar));
                                        }
                                    }
                                }
                                else
                                {
                                    scalar = (from.Skills[SkillName.Discordance].Value / -5.0) / 100.0;

                                    mods.Add(new StatMod(StatType.Str, "DiscordanceStr", (int)(targ.RawStr * scalar), TimeSpan.Zero));
                                    mods.Add(new StatMod(StatType.Int, "DiscordanceInt", (int)(targ.RawInt * scalar), TimeSpan.Zero));
                                    mods.Add(new StatMod(StatType.Dex, "DiscordanceDex", (int)(targ.RawDex * scalar), TimeSpan.Zero));

                                    for (int i = 0; i < targ.Skills.Length; ++i)
                                    {
                                        if (targ.Skills[i].Value > 0)
                                        {
                                            mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar));
                                        }
                                    }
                                }

                                DiscordanceInfo info = new DiscordanceInfo(from, targ, len, scalar, mods);
                                info.m_Timer = Timer.DelayCall(TimeSpan.Zero, TimeSpan.FromSeconds(1.25), new TimerStateCallback(ProcessDiscordance), info);

                                m_Table[targ] = info;
                            }
                            else
                            {
                                from.SendLocalizedMessage(1049537);                                  // Your target is already in discord.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1049540);                              // You fail to disrupt your target
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                    }
                    else
                    {
                        m_Instrument.PlayInstrumentBadly(from);
                    }
                }
            }
Esempio n. 54
0
        public static TimeSpan OnUse(Mobile mobile)
        {
            PlayerMobile pm = mobile as PlayerMobile;

            if (pm != null)
            {
                if (pm.TrueHidden == false)
                {
                    pm.SendMessage("You must hide first using the Hiding skill.");
                    pm.RevealingAction();

                    return(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown));
                }
            }

            if (!mobile.Hidden)
            {
                mobile.SendLocalizedMessage(502725); // You must hide first
            }
            else if (mobile.Skills[SkillName.Hiding].Base < HidingRequirement)
            {
                mobile.SendLocalizedMessage(502726); // You are not hidden well enough.  Become better at hiding.
                mobile.RevealingAction();
            }

            else if (!mobile.CanBeginAction(typeof(Stealth)))
            {
                mobile.RevealingAction();
            }

            else
            {
                if (mobile.CheckSkill(SkillName.Stealth, 0, 100, 1.0))
                {
                    int steps = (int)(mobile.Skills[SkillName.Stealth].Value / 10);

                    BaseArmor gorget = mobile.NeckArmor as BaseArmor;
                    BaseArmor gloves = mobile.HandArmor as BaseArmor;
                    BaseArmor arms   = mobile.ArmsArmor as BaseArmor;
                    BaseArmor head   = mobile.HeadArmor as BaseArmor;
                    BaseArmor legs   = mobile.LegsArmor as BaseArmor;
                    BaseArmor chest  = mobile.ChestArmor as BaseArmor;

                    List <BaseArmor> equipment = new List <BaseArmor>();

                    equipment.Add(gorget);
                    equipment.Add(gloves);
                    equipment.Add(arms);
                    equipment.Add(head);
                    equipment.Add(legs);
                    equipment.Add(chest);

                    /*
                     * foreach (BaseArmor armor in equipment)
                     * {
                     *  if (armor != null)
                     *  {
                     *      if (armor.OldMedAllowance == ArmorMeditationAllowance.None)
                     *          steps--;
                     *  }
                     * }
                     */

                    if (steps < 1)
                    {
                        steps = 1;
                    }

                    mobile.AllowedStealthSteps = steps;

                    if (pm != null)
                    {
                        pm.IsStealthing = true;

                        if (pm.Skills[SkillName.Hiding].Value >= 80 && pm.Skills[SkillName.Stealth].Value >= 80)
                        {
                            mobile.StealthAttackReady = true;
                        }
                    }

                    mobile.SendMessage("You begin to move quietly.");

                    mobile.BeginAction((typeof(Hiding)));
                    Timer.DelayCall(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown - .1), delegate { mobile.EndAction(typeof(Hiding)); });

                    mobile.BeginAction((typeof(Stealth)));
                    Timer.DelayCall(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown - .1), delegate { mobile.EndAction(typeof(Stealth)); });

                    mobile.m_StealthMovementTimer = null;
                    mobile.m_StealthMovementTimer = new Mobile.StealthMovementTimer(mobile);
                    mobile.m_StealthMovementTimer.Start();

                    mobile.m_HidingTimer = null;
                    mobile.m_HidingTimer = new Mobile.HidingTimer(mobile, DateTime.UtcNow, true);
                    mobile.m_HidingTimer.Start();

                    return(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown));
                }

                else
                {
                    mobile.SendLocalizedMessage(502731); // You fail in your attempt to move unnoticed.
                    mobile.RevealingAction();
                }
            }

            return(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown));
        }
Esempio n. 55
0
 public static void OnPickedInstrument(Mobile from, BaseInstrument instrument)
 {
     from.RevealingAction();
     from.SendLocalizedMessage(1049525); // Whom do you wish to calm?
     from.Target = new InternalTarget(from, instrument);
 }
Esempio n. 56
0
                protected override void OnTick()
                {
                    m_Count++;

                    DamageEntry de           = m_Creature.FindMostRecentDamageEntry(false);
                    bool        alreadyOwned = m_Creature.Owners.Contains(m_Tamer);

                    if (!m_Tamer.InRange(m_Creature, Core.AOS ? 7 : 6))
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502795, m_Tamer.NetState);
                        // You are too far away to continue taming.
                        Stop();
                    }
                    else if (!m_Tamer.CheckAlive())
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502796, m_Tamer.NetState);
                        // You are dead, and cannot continue taming.
                        Stop();
                    }
                    else if (!m_Tamer.CanSee(m_Creature) || !m_Tamer.InLOS(m_Creature) || !CanPath())
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Tamer.SendLocalizedMessage(1049654);
                        // You do not have a clear path to the animal you are taming, and must cease your attempt.
                        Stop();
                    }
                    else if (!m_Creature.Tamable)
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, m_Tamer.NetState);
                        // That creature cannot be tamed.
                        Stop();
                    }
                    else if (m_Creature.Controlled)
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, m_Tamer.NetState);
                        // That animal looks tame already.
                        Stop();
                    }
                    else if (m_Creature.Owners.Count >= BaseCreature.MaxOwners && !m_Creature.Owners.Contains(m_Tamer))
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, m_Tamer.NetState);
                        // This animal has had too many owners and is too upset for you to tame.
                        Stop();
                    }
                    else if (MustBeSubdued(m_Creature))
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, m_Tamer.NetState);
                        // You must subdue this creature before you can tame it!
                        Stop();
                    }
                    else if (de != null && de.LastDamage > m_StartTime)
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502794, m_Tamer.NetState);
                        // The animal is too angry to continue taming.
                        Stop();
                    }
                    else if (m_Count < m_MaxCount)
                    {
                        m_Tamer.RevealingAction();

                        switch (Utility.Random(3))
                        {
                        case 0:
                            m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(502790, 4));
                            break;

                        case 1:
                            m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1005608, 6));
                            break;

                        case 2:
                            m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1010593, 4));
                            break;
                        }

                        if (!alreadyOwned)                         // Passively check animal lore for gain
                        {
                            m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0);
                        }

                        if (m_Creature.Paralyzed)
                        {
                            m_Paralyzed = true;
                        }
                    }
                    else
                    {
                        m_Tamer.RevealingAction();
                        m_Tamer.NextSkillTime = Core.TickCount;
                        m_BeingTamed.Remove(m_Creature);

                        if (m_Creature.Paralyzed)
                        {
                            m_Paralyzed = true;
                        }

                        if (!alreadyOwned)                         // Passively check animal lore for gain
                        {
                            m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0);
                        }

                        double minSkill = m_Creature.CurrentTameSkill + (m_Creature.Owners.Count * 6.0);

                        if (minSkill > -24.9 && CheckMastery(m_Tamer, m_Creature))
                        {
                            minSkill = -24.9;                             // 50% at 0.0?
                        }

                        minSkill += 24.9;

                        minSkill += XmlMobFactions.GetScaledFaction(m_Tamer, m_Creature, -25, 25, -0.001);

                        if (CheckMastery(m_Tamer, m_Creature) || alreadyOwned ||
                            m_Tamer.CheckTargetSkill(SkillName.AnimalTaming, m_Creature, minSkill - 25.0, minSkill + 25.0))
                        {
                            if (m_Creature.Owners.Count == 0)                             // First tame
                            {
                                if (m_Creature is GreaterDragon)
                                {
                                    ScaleSkills(m_Creature, 0.72, 0.90);                                     // 72% of original skills trainable to 90%
                                    m_Creature.Skills[SkillName.Magery].Base = m_Creature.Skills[SkillName.Magery].Cap;
                                    // Greater dragons have a 90% cap reduction and 90% skill reduction on magery
                                }
                                else if (m_Paralyzed)
                                {
                                    ScaleSkills(m_Creature, 0.86);                                     // 86% of original skills if they were paralyzed during the taming
                                }
                                else
                                {
                                    ScaleSkills(m_Creature, 0.90);                                     // 90% of original skills
                                }

                                if (m_Creature.StatLossAfterTame)
                                {
                                    ScaleStats(m_Creature, 0.50);
                                }
                            }

                            if (alreadyOwned)
                            {
                                m_Tamer.SendLocalizedMessage(502797);                                 // That wasn't even challenging.
                            }
                            else
                            {
                                m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502799, m_Tamer.NetState);
                                // It seems to accept you as master.
                                m_Creature.Owners.Add(m_Tamer);
                            }

                            m_Creature.SetControlMaster(m_Tamer);
                            m_Creature.IsBonded = false;

                            m_Creature.OnAfterTame(m_Tamer);

                            PetTrainingHelper.GetAbilityProfile(m_Creature, true).OnTame();
                        }
                        else
                        {
                            m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502798, m_Tamer.NetState);
                            // You fail to tame the creature.
                        }
                    }
                }
            protected override void OnTick()
            {
                //No Longer Alive
                if (!m_From.Alive)
                {
                    this.Stop();

                    return;
                }

                //No Longer On Ship or Close Enough to the Ship to Repair
                if (!(m_Ship.Contains(m_From) || m_Ship.GetShipToLocationDistance(m_Ship, m_From.Location) <= 6))
                {
                    m_From.SendMessage("You are not close enough to the ship to finish your repairs.");

                    this.Stop();
                    return;
                }

                m_From.RevealingAction();

                //Repair Time Remains
                if ((m_Start + BaseShip.RepairDuration) > DateTime.UtcNow)
                {
                    Effects.PlaySound(m_From.Location, m_From.Map, 0x23D);

                    if (!m_From.Mounted)
                    {
                        m_From.Animate(11, 5, 1, true, false, 0);
                    }
                }

                //Repairs Complete
                else
                {
                    Effects.PlaySound(m_From.Location, m_From.Map, 0x23D);

                    if (!m_From.Mounted)
                    {
                        m_From.Animate(11, 5, 1, true, false, 0);
                    }

                    Stop();

                    m_ShipRepairTools.FinishRepairs(m_Ship, m_From, m_DamageType, true);
                }

                //Henchman Repair Assistance
                List <Mobile> m_MobilesOnShip = m_Ship.GetMobilesOnShip(false, false);

                foreach (Mobile mobile in m_MobilesOnShip)
                {
                    if (mobile is HenchmanNavyCarpenter)
                    {
                        HenchmanNavyCarpenter navyCarpenter = mobile as HenchmanNavyCarpenter;
                        navyCarpenter.AssistRepair();
                    }

                    if (mobile is HenchmanPirateCarpenter)
                    {
                        HenchmanPirateCarpenter pirateCarpenter = mobile as HenchmanPirateCarpenter;
                        pirateCarpenter.AssistRepair();
                    }
                }
            }
Esempio n. 58
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is Mobile)
                {
                    if (targeted is BaseCreature)
                    {
                        BaseCreature creature = (BaseCreature)targeted;

                        if (!creature.Tamable)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, from.NetState);
                            // That creature cannot be tamed.
                        }
                        else if (creature.Controlled)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, from.NetState);
                            // That animal looks tame already.
                        }
                        else if (from.Female && !creature.AllowFemaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049653, from.NetState);
                            // That creature can only be tamed by males.
                        }
                        else if (!from.Female && !creature.AllowMaleTamer)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049652, from.NetState);
                            // That creature can only be tamed by females.
                        }
                        else if (creature is CuSidhe && from.Race != Race.Elf)
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502801, from.NetState);                             // You can't tame that!
                        }
                        else if (from.Followers + creature.ControlSlots > from.FollowersMax)
                        {
                            from.SendLocalizedMessage(1049611);                             // You have too many followers to tame that creature.
                        }
                        else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, from.NetState);
                            // This animal has had too many owners and is too upset for you to tame.
                        }
                        else if (MustBeSubdued(creature))
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, from.NetState);
                            // You must subdue this creature before you can tame it!
                        }
                        else if (CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.CurrentTameSkill)
                        {
                            FactionWarHorse warHorse = creature as FactionWarHorse;

                            if (warHorse != null)
                            {
                                Faction faction = Faction.Find(from);

                                if (faction == null || faction != warHorse.Faction)
                                {
                                    creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042590, from.NetState);
                                    // You cannot tame this creature.
                                    return;
                                }
                            }

                            if (m_BeingTamed.Contains(targeted))
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502802, from.NetState);
                                // Someone else is already taming this.
                            }
                            else if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble())
                            {
                                creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502805, from.NetState);
                                // You seem to anger the beast!
                                creature.PlaySound(creature.GetAngerSound());
                                creature.Direction = creature.GetDirectionTo(from);

                                if (!Core.SA)
                                {
                                    if (creature.BardPacified && Utility.RandomDouble() > .24)
                                    {
                                        Timer.DelayCall(TimeSpan.FromSeconds(2.0), () => creature.BardPacified = true);
                                    }
                                    else
                                    {
                                        creature.BardEndTime = DateTime.UtcNow;
                                    }

                                    creature.BardPacified = false;
                                }

                                if (creature.AIObject != null)
                                {
                                    creature.AIObject.DoMove(creature.Direction);
                                }

                                if (from is PlayerMobile &&
                                    !(((PlayerMobile)from).HonorActive ||
                                      TransformationSpellHelper.UnderTransformation(from, typeof(EtherealVoyageSpell))))
                                {
                                    creature.Combatant = from;
                                }
                            }
                            else
                            {
                                m_BeingTamed[targeted] = from;

                                from.LocalOverheadMessage(MessageType.Emote, 0x59, 1010597);                                 // You start to tame the creature.
                                from.NonlocalOverheadMessage(MessageType.Emote, 0x59, 1010598);                              // *begins taming a creature.*

                                new InternalTimer(from, creature, Utility.Random(3, 2)).Start();

                                m_SetSkillTime = false;
                            }
                        }
                        else
                        {
                            creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502806, from.NetState);
                            // You have no chance of taming this creature.
                        }
                    }
                    else
                    {
                        ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502469, from.NetState);
                        // That being cannot be tamed.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502801);                     // You can't tame that!
                }
            }
Esempio n. 59
0
        public static TimeSpan OnUse(Mobile m)
        {
            if (m.Spell != null)
            {
                m.SendLocalizedMessage(501238);                   // You are busy doing something else and cannot hide.
                return(TimeSpan.FromSeconds(1.0));
            }

            double bonus = 0.0;

            BaseHouse house = BaseHouse.FindHouseAt(m);

            if (house != null && house.IsFriend(m))
            {
                bonus = 100.0;
            }
            else
            {
                if (house == null)
                {
                    house = BaseHouse.FindHouseAt(new Point3D(m.X - 1, m.Y, 127), m.Map, 16);
                }

                if (house == null)
                {
                    house = BaseHouse.FindHouseAt(new Point3D(m.X + 1, m.Y, 127), m.Map, 16);
                }

                if (house == null)
                {
                    house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y - 1, 127), m.Map, 16);
                }

                if (house == null)
                {
                    house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y + 1, 127), m.Map, 16);
                }

                if (house != null)
                {
                    bonus = 50.0;
                }
            }

            //int range = 18 - (int)(m.Skills[SkillName.Hiding].Value / 10);
            int range = Math.Min((int)((100 - m.Skills[SkillName.Hiding].Value) / 2) + 8, 18);                  //Cap of 18 not OSI-exact, intentional difference

            bool badCombat = !m_CombatOverride && m.Combatant != null && m.InRange(m.Combatant.Location, range) && m.Combatant.InLOS(m);
            bool ok        = !badCombat;

            if (ok)
            {
                if (!m_CombatOverride)
                {
                    foreach (Mobile check in m.GetMobilesInRange(range))
                    {
                        if (check.InLOS(m) && check.Combatant == m)
                        {
                            badCombat = true;
                            ok        = false;
                            break;
                        }
                    }
                }

                ok = !badCombat && m.CheckSkill(SkillName.Hiding, 0.0 - bonus, 100.0 - bonus);
            }

            if (badCombat)
            {
                m.RevealingAction();

                m.LocalOverheadMessage(MessageType.Regular, 0x22, 501237);                   // You can't seem to hide right now.

                return(TimeSpan.FromSeconds(1.0));
            }
            else
            {
                if (ok)
                {
                    m.Hidden  = true;
                    m.Warmode = false;
                    m.LocalOverheadMessage(MessageType.Regular, 0x1F4, 501240);                       // You have hidden yourself well.
                }
                else
                {
                    m.RevealingAction();

                    m.LocalOverheadMessage(MessageType.Regular, 0x22, 501241);                       // You can't seem to hide here.
                }

                return(TimeSpan.FromSeconds(10.0));
            }
        }
Esempio n. 60
0
        public virtual void Open(Mobile from, bool checkSelfLoot)
        {
            if (from.AccessLevel > AccessLevel.Player || from.InRange(this.GetWorldLocation(), 2))
            {
                #region Self Looting
                bool selfLoot = (checkSelfLoot && (from == m_Owner));

                if (selfLoot)
                {
                    if (from is PlayerMobile && from.Client != null && from.Client.Version.IsEnhanced)
                    {
                        PlayerMobile pm = (PlayerMobile)from;

                        pm.Send(new RemoveWaypoint(this.Serial.Value));
                        pm.CheckKRStartingQuestStep(27);
                    }

                    ArrayList items = new ArrayList(this.Items);

                    bool gathered = false;
                    bool didntFit = false;

                    Container pack = from.Backpack;

                    bool checkRobe = true;

                    for (int i = 0; !didntFit && i < items.Count; ++i)
                    {
                        Item    item = (Item)items[i];
                        Point3D loc  = item.Location;

                        if ((item.Layer == Layer.Hair || item.Layer == Layer.FacialHair) || !item.Movable || !GetRestoreInfo(item, ref loc))
                        {
                            continue;
                        }

                        if (checkRobe)
                        {
                            DeathRobe robe = from.FindItemOnLayer(Layer.OuterTorso) as DeathRobe;

                            if (robe != null)
                            {
                                robe.Delete();
                            }
                        }

                        if (m_EquipItems.Contains(item) && from.EquipItem(item))
                        {
                            gathered = true;
                        }
                        else if (pack != null && pack.CheckHold(from, item, false, true))
                        {
                            item.Location = loc;
                            pack.AddItem(item);
                            gathered = true;
                        }
                        else
                        {
                            didntFit = true;
                        }
                    }

                    if (gathered && !didntFit)
                    {
                        SetFlag(CorpseFlag.Carved, true);

                        if (ItemID == 0x2006)
                        {
                            ProcessDelta();
                            SendRemovePacket();
                            ItemID    = Utility.Random(0xECA, 9);                            // bone graphic
                            Hue       = 0;
                            Direction = Direction.North;
                            ProcessDelta();
                        }

                        from.PlaySound(0x3E3);
                        from.SendLocalizedMessage(1062471);                           // You quickly gather all of your belongings.

                        try
                        {
                            if (from is PlayerMobile && m_InsuredItems != null)
                            {
                                ArrayList   bagitems     = new ArrayList(from.Backpack.Items);
                                List <Item> insureditems = m_InsuredItems;

                                foreach (Item item in bagitems)
                                {
                                    if (insureditems.Contains(item))
                                    {
                                        Item move = from.FindItemOnLayer(item.Layer);

                                        if (move == null)
                                        {
                                            from.EquipItem(item);
                                        }
                                    }
                                }

                                m_InsuredItems = null;
                            }
                        }
                        catch
                        {
                        }

                        return;
                    }

                    if (gathered && didntFit)
                    {
                        from.SendLocalizedMessage(1062472);                           // You gather some of your belongings. The rest remain on the corpse.
                    }
                }

                #endregion

                if (!CheckLoot(from))
                {
                    return;
                }

                #region Quests
                PlayerMobile player = from as PlayerMobile;

                if (player != null)
                {
                    QuestSystem qs = player.Quest;

                    if (qs is UzeraanTurmoilQuest)
                    {
                        GetDaemonBoneObjective obj = qs.FindObjective(typeof(GetDaemonBoneObjective)) as GetDaemonBoneObjective;

                        if (obj != null && obj.CorpseWithBone == this && (!obj.Completed || UzeraanTurmoilQuest.HasLostDaemonBone(player)))
                        {
                            Item bone = new QuestDaemonBone();

                            if (player.PlaceInBackpack(bone))
                            {
                                obj.CorpseWithBone = null;
                                player.SendLocalizedMessage(1049341, "", 0x22);                                   // You rummage through the bones and find a Daemon Bone!  You quickly place the item in your pack.

                                if (!obj.Completed)
                                {
                                    obj.Complete();
                                }
                            }
                            else
                            {
                                bone.Delete();
                                player.SendLocalizedMessage(1049342, "", 0x22);                                   // Rummaging through the bones you find a Daemon Bone, but can't pick it up because your pack is too full.  Come back when you have more room in your pack.
                            }

                            return;
                        }
                    }
                    else if (qs is TheSummoningQuest)
                    {
                        VanquishDaemonObjective obj = qs.FindObjective(typeof(VanquishDaemonObjective)) as VanquishDaemonObjective;

                        if (obj != null && obj.Completed && obj.CorpseWithSkull == this)
                        {
                            GoldenSkull sk = new GoldenSkull();

                            if (player.PlaceInBackpack(sk))
                            {
                                obj.CorpseWithSkull = null;
                                player.SendLocalizedMessage(1050022);                                   // For your valor in combating the devourer, you have been awarded a golden skull.
                                qs.Complete();
                            }
                            else
                            {
                                sk.Delete();
                                player.SendLocalizedMessage(1050023);                                   // You find a golden skull, but your backpack is too full to carry it.
                            }
                        }
                    }
                }

                #endregion

                if (m_Owner is WeakSkeleton && from is PlayerMobile)
                {
                    ((PlayerMobile)from).CheckKRStartingQuestStep(20);
                }

                base.OnDoubleClick(from);

                if (from != m_Owner)
                {
                    from.RevealingAction();
                }
            }
            else
            {
                from.SendLocalizedMessage(500446);                   // That is too far away.
                return;
            }
        }