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 );
                    }
                }
            }
Example #2
0
		public static void Shoot(Mobile from, Mobile target, INinjaWeapon weapon)
		{
			if (from != target && (!(from is PlayerMobile) || CanUseWeapon((PlayerMobile)from, weapon)) && from.CanBeHarmful(target))
			{
				if (weapon.WeaponMinRange == 0 || !from.InRange(target, weapon.WeaponMinRange))
				{
                    if(from is PlayerMobile)
					    ((PlayerMobile)from).NinjaWepCooldown = true;

					from.Direction = from.GetDirectionTo(target);

					from.RevealingAction();

					weapon.AttackAnimation(from, target);

					ConsumeUse(weapon);

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

                    if(from is PlayerMobile)
					    Timer.DelayCall(TimeSpan.FromSeconds(2.5), new TimerStateCallback<PlayerMobile>(ResetUsing), (PlayerMobile)from);
				}
				else
				{
					from.SendLocalizedMessage(1063303); // Your target is too close!
				}
			}
		}
Example #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( !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]));
            }
Example #4
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!
                }
            }
		public virtual void DoDoubleShot( Mobile attacker, Mobile defender )
		{
			if ( !attacker.CanBeHarmful( defender, false ) )
				return;

			bowSpeed = 350;
			attacker.SendMessage( "The bow strikes again with lightning speed!" );
		}
		public static void OnPickedInstrument( Mobile from, BaseInstrument instrument )
		{
			from.RevealingAction();

      if ( !BaseInstrument.CheckMusicianship( from ) )
      { 
        from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
        instrument.PlayInstrumentBadly( from );
        instrument.ConsumeUse( from );
      }
      else if ( !from.CheckSkill( SkillName.Peacemaking, 0.0, 100.0 ) )
      {
        from.SendLocalizedMessage( 500613 ); // You attempt to calm everyone, but fail.
        instrument.PlayInstrumentBadly( from );
        instrument.ConsumeUse( from );
      }
      else
      {
        instrument.PlayInstrumentWell( from );
        instrument.ConsumeUse( from );

        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 == 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.Now + TimeSpan.FromSeconds( 1.0 ) );
          }

          if ( !calmed )
            from.SendLocalizedMessage( 1049648 ); // You play hypnotic music, but there is nothing in range...
          else
            from.SendLocalizedMessage( 500615 ); // You play your hypnotic music, stopping the battle.
            
        }
      }
		}
		public void DoFlamestrike( Mobile attacker, Mobile defender )
		{
			if ( !attacker.CanBeHarmful( defender, false ) )
				return;

			attacker.DoHarmful( defender );

			double damage = GetAosDamage( attacker, 48, 1, 5 );
			
			defender.FixedParticles( 0x3709, 10, 30, 5052, EffectLayer.LeftFoot );
			defender.PlaySound( 0x208 );

			SpellHelper.Damage( TimeSpan.FromSeconds( 1.0 ), defender, attacker, damage, 0, 100, 0, 0, 0 );
		}
		public override void OnDoubleClick( Mobile from )
		{
			if ( !IsChildOf( from.Backpack ) ) from.SendLocalizedMessage( 1042001 );
			else if ( from.Region is TownRegion ) { from.SendMessage( "You are not allowed to do that in town" ); }
			else if ( from.Region.Name == "Tele Center Tram" || from.Region.Name == "Tele Center Fel" ) { from.SendMessage( "You are not allowed to do that in the Tele Center" ); }
			else
			{
				from.SendMessage("You throw the pumpkin at your feet lett off a clound of smoke through out the area");
				foreach ( Mobile mobile in from.GetMobilesInRange( 12 ) )
				{
					if ( mobile != null && mobile.AccessLevel < AccessLevel.GameMaster && from.CanBeHarmful(mobile) )
					{
						mobile.Say("*cough cough*");
						mobile.Poison = Poison.Greater;
					}
				}
				this.Delete();
			}
		}
Example #9
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
                    {
                        from.RevealingAction();
                        from.Target = new InternalSecondTarget( from, m_Instrument, creature );
                    }
                }
            }
Example #10
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				from.RevealingAction();

                IEntity entity = targeted as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.Provocation, from.Skills[SkillName.Provocation].Value))
                {
                    return;
                }

				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.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 if ( creature.Unprovokable )
					{
						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 );
					}
				}
				else
				{
					from.SendLocalizedMessage( 501589 ); // You can't incite that!
				}
			}
Example #11
0
        public static bool CheckSnoopAllowed(Mobile from, Mobile to)
        {
            Map map = from.Map;

            if (to.Player)
                return from.CanBeHarmful(to, false, true); // normal restrictions

            if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0)
                return true; // felucca you can snoop anybody

            GuardedRegion reg = (GuardedRegion)to.Region.GetRegion(typeof(GuardedRegion));

            if (reg == null || reg.IsDisabled())
                return true; // not in town? we can snoop any npc

            BaseCreature cret = to as BaseCreature;

            if (to.Body.IsHuman && (cret == null || (!cret.AlwaysAttackable && !cret.AlwaysMurderer)))
                return false; // in town we cannot snoop blue human npcs

            return true;
        }
		public virtual void DoFireball(Mobile attacker, Mobile defender)
		{
			if (!attacker.CanBeHarmful(defender, false))
			{
				return;
			}

			attacker.DoHarmful(defender);

			double damage = GetAosDamage(attacker, 19, 1, 5);

			attacker.MovingParticles(defender, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
			attacker.PlaySound(0x15E);

			SpellHelper.Damage(TimeSpan.FromSeconds(1.0), defender, attacker, damage, 0, 100, 0, 0, 0);
		}
		public virtual void DoLightning(Mobile attacker, Mobile defender)
		{
			if (!attacker.CanBeHarmful(defender, false))
			{
				return;
			}

			attacker.DoHarmful(defender);

			double damage = GetAosDamage(attacker, 23, 1, 4);

			defender.BoltEffect(0);

			SpellHelper.Damage(TimeSpan.Zero, defender, attacker, damage, 0, 0, 0, 0, 100);
		}
		public virtual void DoMagicArrow(Mobile attacker, Mobile defender)
		{
			if (!attacker.CanBeHarmful(defender, false))
			{
				return;
			}

			attacker.DoHarmful(defender);

			double damage = GetAosDamage(attacker, 10, 1, 4);

			attacker.MovingParticles(defender, 0x36E4, 5, 0, false, true, 3006, 4006, 0);
			attacker.PlaySound(0x1E5);

			SpellHelper.Damage(TimeSpan.FromSeconds(1.0), defender, attacker, damage, 0, 100, 0, 0, 0);
		}
		public virtual void DoHarm(Mobile attacker, Mobile defender)
		{
			if (!attacker.CanBeHarmful(defender, false))
			{
				return;
			}

			attacker.DoHarmful(defender);

			double damage = GetAosDamage(attacker, 17, 1, 5);

			if (!defender.InRange(attacker, 2))
			{
				damage *= 0.25; // 1/4 damage at > 2 tile range
			}
			else if (!defender.InRange(attacker, 1))
			{
				damage *= 0.50; // 1/2 damage at 2 tile range
			}

			defender.FixedParticles(0x374A, 10, 30, 5013, 1153, 2, EffectLayer.Waist);
			defender.PlaySound(0x0FC);

			SpellHelper.Damage(TimeSpan.Zero, defender, attacker, damage, 0, 0, 100, 0, 0);
		}
Example #16
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( !m_Charmed.DeathAdderCharmable || m_Charmed.Combatant != null || !from.CanBeHarmful( m_Charmed, false ) )
					return;

				DeathAdder da = Spells.Necromancy.SummonFamiliarSpell.Table[from] as DeathAdder;
				if ( da == null || da.Deleted )
					return;

				Mobile targ = targeted as Mobile;
				if ( targ == null || !from.CanBeHarmful( targ, false ) )
					return;

				from.RevealingAction();
				from.DoHarmful( targ, true );

				m_Charmed.Combatant = targ;

				if ( m_Charmed.AIObject != null )
					m_Charmed.AIObject.Action = ActionType.Combat;
			}
Example #17
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                from.RevealingAction();

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

                    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 ( m_Creature.Unprovokable || creature.Unprovokable )
                    {
                        from.SendAsciiMessage("You have no chance of provoking those creatures."); // You have no chance of provoking those creatures.
                    }
                    else if ( m_Creature.Map != creature.Map || !m_Creature.InRange( creature, BaseInstrument.GetBardRange( from, SkillName.Provocation ) ) )
                    {
                        from.SendAsciiMessage("The creatures you are trying to provoke are too far away from each other for your music to have an effect."); // 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 != creature )
                    {
                        from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 );

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

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

                        if ( from.CanBeHarmful( m_Creature, true ) && from.CanBeHarmful( creature, true ) )
                        {
                            if ( !BaseInstrument.CheckMusicianship( from ) )
                            {
                                from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 );
                                //from.SayTo(from, true, "You play poorly, and there is no effect.");
                                from.SendAsciiMessage("You play poorly, and there is no effect."); // You play poorly, and there is no effect.
                                m_Instrument.PlayInstrumentBadly( from );
                                m_Instrument.ConsumeUse( from );
                            }
                            else
                            {
                                if ( !from.CheckTargetSkill(SkillName.Provocation, creature, 0, 100))
                                {
                                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 );
                                    //creature.SayTo(from, true, "Your music fails to incite enough anger.");
                                    from.SendAsciiMessage("Your music fails to incite enough anger."); // Your music fails to incite enough anger.
                                    m_Instrument.PlayInstrumentBadly( from );
                                    m_Instrument.ConsumeUse( from );
                                }
                                else
                                {
                                    //creature.SayTo(from, true, "Your music succeeds, as you start a fight.");
                                    from.SendAsciiMessage("Your music succeeds, as you start a fight."); // Your music succeeds, as you start a fight.
                                    m_Instrument.PlayInstrumentWell( from );
                                    m_Instrument.ConsumeUse( from );
                                    m_Creature.Provoke( from, creature, true );
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendAsciiMessage("You can't tell someone to attack themselves!"); // You can't tell someone to attack themselves!
                    }
                }
                else if ( targeted is Mobile )
                {
                    Mobile m = (Mobile)targeted;

                    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 ( m_Creature.Unprovokable )
                    {
                        from.SendAsciiMessage( "You have no chance of provoking those creatures." ); // You have no chance of provoking those creatures.
                    }
                    else if ( m_Creature.Map != m.Map || !m_Creature.InRange( m, BaseInstrument.GetBardRange( from, SkillName.Provocation ) ) )
                    {
                        from.SendAsciiMessage( "The creatures you are trying to provoke are too far away from each other for your music to have an effect." ); // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
                    }
                    else
                    {
                        from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 );

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

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

                        if ( from.CanBeHarmful( m_Creature, true ) && from.CanBeHarmful( m, true ) )
                        {
                            if ( !BaseInstrument.CheckMusicianship( from ) )
                            {
                                from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 );
                                //from.SayTo(from, true, "You play poorly, and there is no effect.");
                                from.SendAsciiMessage( "You play poorly, and there is no effect." ); // You play poorly, and there is no effect.
                                m_Instrument.PlayInstrumentBadly( from );
                                m_Instrument.ConsumeUse( from );
                            }
                            else
                            {
                                if ( !from.CheckTargetSkill( SkillName.Provocation, m, 0, 100 ) )
                                {
                                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 );
                                    //creature.SayTo(from, true, "Your music fails to incite enough anger.");
                                    from.SendAsciiMessage( "Your music fails to incite enough anger." ); // Your music fails to incite enough anger.
                                    m_Instrument.PlayInstrumentBadly( from );
                                    m_Instrument.ConsumeUse( from );
                                }
                                else
                                {
                                    //creature.SayTo(from, true, "Your music succeeds, as you start a fight.");
                                    from.SendAsciiMessage( "Your music succeeds, as you start a fight." ); // Your music succeeds, as you start a fight.
                                    m_Instrument.PlayInstrumentWell( from );
                                    m_Instrument.ConsumeUse( from );
                                    m_Creature.Provoke( from, m, true );
                                }
                            }
                        }
                    }
                }
                else
                {
                    from.SendAsciiMessage( "You can't incite that!" ); // You can't incite that!
                }
            }
		public override void OnHit( Mobile attacker, Mobile defender, int damage )
		{
			if( !Validate( attacker ) )	//Mana check after check that there are targets
				return;

			ClearCurrentAbility( attacker );

			Map map = attacker.Map;

			if( map == null )
				return;

			BaseWeapon weapon = attacker.Weapon as BaseWeapon;

			if( weapon == null )
				return;

			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 )
			{
				if( !CheckMana( attacker, true ) )
					return;

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

				// 5-15 damage
				int amount = (int)(10.0 * ((Math.Max( attacker.Skills[SkillName.Bushido].Value, attacker.Skills[SkillName.Ninjitsu].Value ) - 50.0) / 70.0 + 5));

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

					Timer t = Registry[m] as Timer;

					if( t != null )
					{
						t.Stop();
						Registry.Remove( m );
					}

					t = new InternalTimer( attacker, m, amount );
					t.Start();
					Registry.Add( m, t );
				}

				Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), new TimerStateCallback( RepeatEffect ), attacker );
			}
		}
Example #19
0
		public virtual void DoAreaAttack( Mobile from, int sound, int hue, int phys, int fire, int cold, int pois, int nrgy )
		{
			Map map = from.Map;

			if ( map == null )
				return;

			ArrayList list = new ArrayList();

			IPooledEnumerable eable = from.GetMobilesInRange( 10 );
			foreach ( Mobile m in eable)
			{
				if ( from != m && SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false ) && from.InLOS( m ) )
					list.Add( m );
			}
			eable.Free();

			if ( list.Count == 0 )
				return;

			Effects.PlaySound( from.Location, map, sound );

			// TODO: What is the damage calculation?

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

				double scalar = (11 - from.GetDistanceToSqrt( m )) / 10;

				if ( scalar > 1.0 )
					scalar = 1.0;
				else if ( scalar < 0.0 )
					continue;

				from.DoHarmful( m, true );
				m.FixedEffect( 0x3779, 1, 15, hue, 0 );
				AOS.Damage( m, from, (int)(GetBaseDamage( from ) * scalar), phys, fire, cold, pois, nrgy );
			}
		}
Example #20
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 = DateTime.Now + TimeSpan.FromHours( 6.0 );
            from.RevealingAction();

            if ( !instrument.IsChildOf( from.Backpack ) )
            {
                from.SendLocalizedMessage( 1062488 ); // The instrument you are trying to play is no longer in your backpack!
            }
            else
            {
                //m_SetSkillTime = false;
                from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 );

                if ( !BaseInstrument.CheckMusicianship( from ) )
                {
                    from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
                    instrument.PlayInstrumentBadly( from );
                    instrument.ConsumeUse( from );
                }
                else if ( !from.CheckSkill( SkillName.Peacemaking, 0.0, 100.0 ) )
                {
                    from.SendLocalizedMessage( 500613 ); // You attempt to calm everyone, but fail.
                    instrument.PlayInstrumentBadly( from );
                    instrument.ConsumeUse( from );
                }
                else
                {
                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 5.0 );
                    instrument.PlayInstrumentWell( from );
                    instrument.ConsumeUse( from );

                    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 == 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.Now + TimeSpan.FromSeconds( 1.0 ) );
                        }

                        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.
                    }
                }
            }
        }
            protected override void OnTarget( Mobile from, object targeted )
            {
                from.RevealingAction();

                if ( !(targeted is Mobile) || ( targeted is PlayerMobile && targeted != from ) ) // PlayerMobile&&!From added by Silver
                {
                    from.SendLocalizedMessage( 1049528 ); // You cannot calm that!
                }
                else if ( !m_Instrument.IsChildOf( from.Backpack ) )
                {
                    from.SendLocalizedMessage( 1062488 ); // The instrument you are trying to play is no longer in your backpack!
                }
                else
                {
                    m_SetSkillTime = false;
                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 );

                    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, Core.AOS ? 120.0 : from.Skills[SkillName.Peacemaking].Cap ) )
                        {
                            from.SendLocalizedMessage( 500613 ); // You attempt to calm everyone, but fail.
                            m_Instrument.PlayInstrumentBadly( from );
                            m_Instrument.ConsumeUse( from );
                        }
                        else
                        {
                            from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 5.0 );
                            m_Instrument.PlayInstrumentWell( from );
                            m_Instrument.ConsumeUse( from );

                            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.Now + TimeSpan.FromSeconds( 3.0 ) );
                                }

                                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 = DateTime.Now + TimeSpan.FromSeconds( 5.0 );
                            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 = DateTime.Now + TimeSpan.FromSeconds( 5.0 );
                                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.Now + 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;
                                }
                            }
                        }
                    }
                }
            }
Example #22
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;

                    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))
                    {
                        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;

                        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 (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(target, true))
                        {
                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.NextSkillTime = Core.TickCount + 5000;
                                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 + 5000;
                                    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);
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501593); // You can't tell someone to attack themselves!
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501589); // You can't incite that!
                }
            }
Example #23
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is BaseCreature)
                {
                    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 (this.m_Creature.Unprovokable)
                    {
                        from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
                    }
                    else if (creature.Unprovokable && !(creature is DemonKnight))
                    {
                        from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
                    }
                    else if (this.m_Creature.Map != creature.Map || !this.m_Creature.InRange(creature, 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 (this.m_Creature != creature)
                    {
                        from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);

                        double diff = ((this.m_Instrument.GetDifficultyFor(this.m_Creature) + this.m_Instrument.GetDifficultyFor(creature)) * 0.5) - 5.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

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

                        if (from.CanBeHarmful(this.m_Creature, true) && from.CanBeHarmful(creature, true))
                        {
                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(5.0);
                                from.SendLocalizedMessage(500612); // You play poorly, and there is no effect.
                                this.m_Instrument.PlayInstrumentBadly(from);
                                this.m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                //from.DoHarmful( m_Creature );
                                //from.DoHarmful( creature );
                                if (!from.CheckTargetSkill(SkillName.Provocation, creature, diff - 25.0, diff + 25.0))
                                {
                                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(5.0);
                                    from.SendLocalizedMessage(501599); // Your music fails to incite enough anger.
                                    this.m_Instrument.PlayInstrumentBadly(from);
                                    this.m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    from.SendLocalizedMessage(501602); // Your music succeeds, as you start a fight.
                                    this.m_Instrument.PlayInstrumentWell(from);
                                    this.m_Instrument.ConsumeUse(from);
                                    this.m_Creature.Provoke(from, creature, true);
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501593); // You can't tell someone to attack themselves!
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501589); // You can't incite that!
                }
            }
Example #24
0
			protected override void OnTarget( Mobile from, object obj )
			{
				if ( m_Bola.Deleted )
					return;

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

					if ( !m_Bola.IsChildOf( from.Backpack ) )
					{
						from.SendLocalizedMessage( 1040019 ); // The bola must be in your pack to use it.
					}
					else if ( !HasFreeHands( from ) )
					{
						from.SendLocalizedMessage( 1040015 ); // Your hands must be free to use this
					}
					else if ( from.Mounted )
					{
						from.SendLocalizedMessage( 1040016 ); // You cannot use this while riding a mount
					}
					else if ( Server.Spells.Ninjitsu.AnimalForm.UnderTransformation( from ) )
					{
						from.SendLocalizedMessage( 1070902 ); // You can't use this while in an animal form!
					}
					else if (!to.Mounted && !Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(to))
					{
						from.SendLocalizedMessage( 1049628 ); // You have no reason to throw a bola at that.
					}
					else if ( !from.CanBeHarmful( to ) )
					{
					}
					else if ( from.BeginAction( typeof( Bola ) ) )
					{
						EtherealMount.StopMounting( from );

						from.DoHarmful( to );

						m_Bola.Consume();

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

						Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback( FinishThrow ), new object[]{ from, to } );
					}
					else
					{
						from.SendLocalizedMessage( 1049624 ); // You have to wait a few moments before you can use another bola!
					}
				}
				else
				{
					from.SendLocalizedMessage( 1049629 ); // You cannot throw a bola at that.
				}
			}
		public virtual void DoDispel(Mobile attacker, Mobile defender)
		{
			bool dispellable = false;

			if (defender is BaseCreature)
			{
				dispellable = ((BaseCreature)defender).Summoned && !((BaseCreature)defender).IsAnimatedDead;
			}

			if (!dispellable)
			{
				return;
			}

			if (!attacker.CanBeHarmful(defender, false))
			{
				return;
			}

			attacker.DoHarmful(defender);

			MagerySpell sp = new DispelSpell(attacker, null);

			if (sp.CheckResisted(defender))
			{
				defender.FixedEffect(0x3779, 10, 20);
			}
			else
			{
				Effects.SendLocationParticles(
					EffectItem.Create(defender.Location, defender.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
				Effects.PlaySound(defender, defender.Map, 0x201);

				defender.Delete();
			}
		}
Example #26
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( from.AccessLevel >= AccessLevel.GameMaster && !Body.IsHuman )
			{
				Container pack = this.Backpack;

				if ( pack != null )
					pack.DisplayTo( from );
			}

			if ( this.DeathAdderCharmable && from.CanBeHarmful( this, false ) )
			{
				DeathAdder da = Spells.Necromancy.SummonFamiliarSpell.Table[from] as DeathAdder;

				if ( da != null && !da.Deleted )
				{
					from.SendAsciiMessage( "You charm the snake.  Select a target to attack." );
					from.Target = new DeathAdderCharmTarget( this );
				}
			}

			base.OnDoubleClick( from );
		}
		public virtual void DoAreaAttack(
			Mobile from, Mobile defender, int sound, int hue, int phys, int fire, int cold, int pois, int nrgy)
		{
			Map map = from.Map;

			if (map == null)
			{
				return;
			}

			var list = new List<Mobile>();

			foreach (Mobile m in from.GetMobilesInRange(10))
			{
				if (from != m && defender != m && SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false) &&
					(!Core.ML || from.InLOS(m)))
				{
					list.Add(m);
				}
			}

			if (list.Count == 0)
			{
				return;
			}

			Effects.PlaySound(from.Location, map, sound);

			// TODO: What is the damage calculation?

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

				double scalar = (11 - from.GetDistanceToSqrt(m)) / 10;

				if (scalar > 1.0)
				{
					scalar = 1.0;
				}
				else if (scalar < 0.0)
				{
					continue;
				}

				from.DoHarmful(m, true);
				m.FixedEffect(0x3779, 1, 15, hue, 0);
				AOS.Damage(m, from, (int)(GetBaseDamage(from) * scalar), phys, fire, cold, pois, nrgy);
			}
		}
Example #28
0
        public static void ZombieSwingDirection(Mobile mob, Direction direction, int range)
        {
            if (mob == null || mob.Weapon == null)
            {
                return;
            }

            IWeapon weapon = mob.Weapon;

            mob.Direction = direction; // don't do this b/c it kind of causes rubber band to the client

            UpdateNearbyClients(mob, direction);

            Point2D directionVector = Point2D.Zero;

            switch (direction & Direction.Mask)
            {
                case Direction.North:
                    directionVector = new Point2D(0, -1);
                    break;
                case Direction.Right:
                    directionVector = new Point2D(1, -1);
                    break;
                case Direction.East:
                    directionVector = new Point2D(1, 0);
                    break;
                case Direction.Down:
                    directionVector = new Point2D(1, 1);
                    break;
                case Direction.South:
                    directionVector = new Point2D(0, 1);
                    break;
                case Direction.Left:
                    directionVector = new Point2D(-1, 1);
                    break;
                case Direction.West:
                    directionVector = new Point2D(-1, 0);
                    break;
                case Direction.Up:
                    directionVector = new Point2D(-1, -1);
                    break;
            }

            var possibleTargets = new List<Mobile>();
            Point3D currentLoc = mob.Location;

            if (range <= 1 || directionVector == Point2D.Zero)
            {
                //IPooledEnumerable mobsOnHitSpot = mob.Map.GetMobilesInRange(new Point3D(currentLoc.X + directionVector.X, currentLoc.Y + directionVector.Y, mob.Location.Z));

                currentLoc.X += directionVector.X;
                currentLoc.Y += directionVector.Y;

                Sector newSector = mob.Map.GetSector(currentLoc);

                possibleTargets.AddRange(
                    newSector.Mobiles.Where(
                        m =>
                            (m.X == currentLoc.X && m.Y == currentLoc.Y && m != mob && mob.CanBeHarmful(m)) ||
                            m.X == mob.X && m.Y == mob.Y && m != mob));
            }
            else
            {
                for (int i = 0; i < range; i++)
                {
                    currentLoc.X += directionVector.X;
                    currentLoc.Y += directionVector.Y;

                    Sector newSector = mob.Map.GetSector(currentLoc);

                    possibleTargets.AddRange(
                        newSector.Mobiles.Where(
                            m =>
                                m.X == currentLoc.X && m.Y == currentLoc.Y && m != mob && mob.CanBeHarmful(m) &&
                                mob.InLOS(m)));

                    if (possibleTargets.Count > 0)
                    {
                        break; // we found our mark
                    }
                }
            }

            if (possibleTargets.Count > 0)
            {
                // TODO: maybe I should add a check for friends? (less likely to hit a friend?)
                Mobile target = possibleTargets[Utility.Random(possibleTargets.Count)];

                if (weapon is BaseRanged)
                {
                    var ranged = weapon as BaseRanged;
                    bool canSwing = ranged.CanSwing(mob, target);

                    if (mob is PlayerMobile)
                    {
                        var pm = (PlayerMobile) mob;

                        if (pm.DuelContext != null && !pm.DuelContext.CheckItemEquip(mob, ranged))
                        {
                            canSwing = false;
                        }
                    }

                    if (canSwing && mob.HarmfulCheck(target))
                    {
                        mob.DisruptiveAction();
                        mob.Send(new Swing(0, mob, target));

                        if (ranged.OnFired(mob, target))
                        {
                            if (ranged.CheckHit(mob, target))
                            {
                                ranged.OnHit(mob, target);
                            }
                            else
                            {
                                ranged.OnMiss(mob, target);
                            }
                        }
                    }

                    mob.RevealingAction();

                    //GetDelay(mob);
                }
                else
                {
                    weapon.OnSwing(mob, target);
                }
            }
            else
            {
                if (weapon is BaseRanged)
                {
                    if (((BaseRanged) weapon).OnFired(mob, null))
                    {
                        ZombieEffect(mob, ((BaseRanged) weapon).EffectID, 18, mob.X, mob.Y, mob.Z, currentLoc.X,
                            currentLoc.Y, currentLoc.Z, false, false);
                        Effects.PlaySound(mob, mob.Map, Utility.RandomMinMax(0x538, 0x53a));
                        ZombieSwingAnimation(mob);
                    }
                }
                else
                {
                    Effects.PlaySound(mob, mob.Map, Utility.RandomMinMax(0x538, 0x53a));
                    ZombieSwingAnimation(mob);
                }
            }
        }
Example #29
0
			protected override void OnTarget( Mobile from, object target )
			{
				from.RevealingAction();

				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 || (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 )
					{
						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 ( !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();
								int effect;
								double scalar;

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

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

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

									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
								{
									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, targ.Skills[i].Value * scalar ) );
									}
								}

								DiscordanceInfo info = new DiscordanceInfo( from, targ, len, Math.Abs( effect ), 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 );
					}
				}
				else
				{
					from.SendLocalizedMessage( 1049535 ); // A song of discord would have no effect on that.
				}
			}
Example #30
0
        public virtual void DoAreaAttack( Mobile from, Mobile defender, int sound, int hue, int phys, int fire, int cold, int pois, int nrgy )
        {
            Map map = from.Map;

            if( map == null )
                return;

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

            foreach( Mobile m in from.GetMobilesInRange(10) )
            {
                if( from != m && defender != m && SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false) && (!Core.ML || from.InLOS(m)) )
                    list.Add(m);
            }

            if( list.Count == 0 )
                return;

            Effects.PlaySound(from.Location, map, sound);

            // TODO: What is the damage calculation?

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

                from.DoHarmful(m, true);
                m.FixedEffect(0x3779, 1, 15, hue, 0);
                AOS.Damage(m, from, (int)((GetBaseDamage(from) + 5)), phys, fire, cold, pois, nrgy);
            }
        }