Exemplo n.º 1
0
        public static void Effect( Mobile attacker, Mobile defender, int featlevel )
        {
            IKhaerosMobile featuser = attacker as IKhaerosMobile;
            ArrayList list = new ArrayList();

            foreach( Mobile m in defender.GetMobilesInRange( featlevel + 2 ) )
            {
                if( m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee( m ) || !attacker.CanBeHarmful( m ) || featuser.IsAllyOf( m ) )
                    continue;

                if( !attacker.InRange( m, ((BaseWeapon)attacker.Weapon).MaxRange ) )
                    continue;

                if( m != attacker && Spells.SpellHelper.ValidIndirectTarget( attacker, m ) )
                {
                    if( attacker.InLOS( m ) )
                        list.Add( m );
                }
            }

            for( int i = 0; i < Math.Min( list.Count, featlevel + 1 ); ++i )
            {
                int random = Utility.Random( list.Count );
                Mobile m = (Mobile)list[random];

                featuser.CleaveAttack = true;
                ((BaseWeapon)attacker.Weapon).OnSwing( attacker, m, 0.5, true );

            }
        }
Exemplo 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.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();
                        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!
                }
            }
Exemplo n.º 3
0
        public static bool CheckSnoopAllowed( Mobile from, Mobile to )
        {
            Map map = from.Map;

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

            return false;
        }
Exemplo n.º 4
0
        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 );
                    }
                }
            }
        }
Exemplo n.º 5
0
			protected override void OnTarget( Mobile from, object obj )
			{
				if ( m_BaseThrowingItem.Deleted || m_BaseThrowingItem.Map == Map.Internal)
					return;

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

					if ( !from.CanBeHarmful( to ) )
					{
					}
					else
					{	from.Direction = from.GetDirectionTo( to );
						from.Animate( 11, 5, 1, true, false, 0 );
						from.MovingEffect( to, m_BaseThrowingItem.ItemID, 10, 0, false, false );

						Timer.DelayCall<ThrowInfo>( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback<ThrowInfo>( FinishThrow ), new ThrowInfo( from, to, m_DamageMin, m_DamageMax, m_Break, m_BaseThrowingItem ) );

						if ( m_DeleteOnThrow || m_Break )
							m_BaseThrowingItem.Delete();
					}
				}
				else
				{
					IPoint3D p = obj as IPoint3D;

					if ( p == null )
						return;

					Map map = from.Map;

					if ( map == null )
						return;

					IEntity to;

					to = new Entity( Serial.Zero, new Point3D( p ), map );

					from.Direction = from.GetDirectionTo( to );
					Effects.SendMovingEffect( from, to, m_BaseThrowingItem.ItemID & 0x3FFF, 7, 0, false, false, m_BaseThrowingItem.Hue, 0 );
					from.Animate( 11, 5, 1, true, false, 0 );

					if ( m_DeleteOnThrow )
					{
						m_BaseThrowingItem.Delete();
						from.SendMessage( "You miss the target and the {0} is wasted", m_BaseThrowingItem.Name );
					}
					else
					{
						Timer.DelayCall<object[]>( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback<object[]>( FinishMiss ), new object[]{ to, map, m_BaseThrowingItem } );
						from.SendMessage( "You miss the target" );
					}
				}
			}
Exemplo n.º 6
0
        public override void OnHit( Mobile attacker, Mobile defender, int damage )
        {
            if ( !Validate( attacker ) || !CheckMana( attacker, true ) )
                return;

            ClearCurrentAbility( attacker );

            Map map = attacker.Map;

            if ( map != null )
            {
                defender.PlaySound( 0x5BF );

                ArrayList targets = new ArrayList();

                foreach ( Mobile m in defender.GetMobilesInRange( 5 ) )
                {
                    if ( SpellHelper.ValidIndirectTarget( attacker, m ) && attacker.CanBeHarmful( m, false ) && defender.InLOS( m ) && defender.CanSee( m ) )
                        targets.Add( m );
                }

                double dm;

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

                    if ( attacker.CanBeHarmful( m ) && attacker != m )
                    {
                        attacker.DoHarmful( m );

                        Effects.SendBoltEffect( m, false, 0 );

                        // TODO: Revisar formula del daño

                        dm = Utility.RandomMinMax( 25, 30 );

                        SpellHelper.Damage( TimeSpan.Zero, m, attacker, dm, 0, 0, 0, 0, 100 );
                    }
                }
            }
        }
Exemplo n.º 7
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;
		}
Exemplo n.º 8
0
		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 );

			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 );
				}
			}
		}
Exemplo n.º 9
0
	public void Explode( Mobile from, Point3D loc, Map map )
		{

			if ( map == null )
				return;

			Effects.PlaySound( loc, map, 0x207 );
			Effects.SendLocationEffect( loc, map, 0x36BD, 20 );


			IPooledEnumerable eable = map.GetObjectsInRange( loc, 2 ) ;
			ArrayList toExplode = new ArrayList();

			int toDamage = 0;

			foreach ( object o in eable )
			{
				if ( o is Mobile )
				{
					toExplode.Add( o );
					++toDamage;
				}
				else if ( o is BaseExplosionPotion && o != this )
				{
					toExplode.Add( o );
				}
				else if ( o is ICannonDamage )
				{
					toExplode.Add( o );
				}
			}

			eable.Free();
			int d = 0; // Damage scalar
			int damage = 0;
			for ( int i = 0; i < toExplode.Count; ++i )
			{
				object o;
				o = toExplode[i];
				
				if ( o is Mobile )
				{
					Mobile m = (Mobile)o;
					if ( m.InRange( loc, 0 ) )
						d = 1;
					else if ( m.InRange( loc, 1 ) )
						d = 2;
					else if ( m.InRange( loc, 2 ) )
						d = 3;
					if ( from != null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) )
					{
						if ( from != null )
							from.DoHarmful( m );
						damage = Utility.RandomMinMax( (MinDamage / d), (MaxDamage / d) );
						if( d == 1 )
							AOS.Damage( m, from, damage, 50, 50, 0, 0, 0 ); // Same tile 50% physical 50% fire
						else
							AOS.Damage( m, from, damage, 0, 100, 0, 0, 0 ); // 2 tile radius 100% fire damage
					}
				}
				else if ( o is BaseExplosionPotion )
				{
					BaseExplosionPotion pot = (BaseExplosionPotion)o;
					pot.Explode( from, true, pot.GetWorldLocation(), pot.Map );
				}
				else if ( o is ICannonDamage )
				{
					//((ICannonDamage)o).Hits -=  Utility.RandomMinMax(MinDamage/3,MaxDamage/3);
					((ICannonDamage)o).Damage(from,Utility.RandomMinMax(MinDamage/3,MaxDamage/3));
				}
			}
		}
Exemplo n.º 10
0
		public void OnHit(Mobile from, ISiegeWeapon weapon, IEntity target, Point3D targetloc)
		{
			if (weapon == null || from == null) return;

			// play explosion sound at target

			Effects.PlaySound(targetloc, weapon.Map, 0x11D);

			ArrayList damagelist = new ArrayList();

			// deal with the fact that for multis, the targetloc and the actual multi location may differ
			// so deal the multi damage first
			if (target is BaseMulti)
			{
				XmlSiege a = (XmlSiege)XmlAttach.FindAttachment(target, typeof(XmlSiege));

				if (a != null)
				{
					damagelist.Add(a);
				}
			}

			// apply splash damage to objects with a siege attachment
			IPooledEnumerable itemlist = from.Map.GetItemsInRange(targetloc, Area);

			if (itemlist != null)
			{
				foreach (Item item in itemlist)
				{
					if (item == null || item.Deleted) continue;

					XmlSiege a = (XmlSiege)XmlAttach.FindAttachment(item, typeof(XmlSiege));

					if (a != null && !damagelist.Contains(a))
					{
						damagelist.Add(a);
					}
					else
						// if it had no siege attachment and the item is an addoncomponent, then check the parent addon
						if (item is AddonComponent)
						{
							a = (XmlSiege)XmlAttach.FindAttachment(((AddonComponent)item).Addon, typeof(XmlSiege));

							if (a != null && !damagelist.Contains(a))
							{
								damagelist.Add(a);
							}
						}
				}
			}

			int scaledfiredamage = (int)(FireDamage * StructureDamageMultiplier * weapon.WeaponDamageFactor);
			int scaledphysicaldamage = (int)(PhysicalDamage * StructureDamageMultiplier * weapon.WeaponDamageFactor);

			foreach (XmlSiege a in damagelist)
			{
				// apply siege damage
				a.ApplyScaledDamage(from, scaledfiredamage, scaledphysicaldamage);
			}

			// apply splash damage to mobiles
			ArrayList mobdamage = new ArrayList();

			IPooledEnumerable moblist = from.Map.GetMobilesInRange(targetloc, Area);
			if (moblist != null)
			{
				foreach (Mobile m in moblist)
				{
					if (m == null || m.Deleted || !from.CanBeHarmful(m, false)) continue;

					mobdamage.Add(m);
				}
			}

			int totaldamage = FireDamage + PhysicalDamage;
			if (totaldamage > 0)
			{
				int scaledmobdamage = (int)(totaldamage * MobDamageMultiplier * weapon.WeaponDamageFactor);
				int phys = 100 * PhysicalDamage / totaldamage;
				int fire = 100 * FireDamage / totaldamage;
				foreach (Mobile m in mobdamage)
				{
					// AOS.Damage( Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy )
					AOS.Damage(m, from, scaledmobdamage, phys, fire, 0, 0, 0);
				}
			}

			// consume the ammunition
			Consume(1);
			weapon.Projectile = this;
		}
Exemplo n.º 11
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;
            }
Exemplo n.º 12
0
        public void Use( Mobile from, IPoint3D loc )
        {
            if ( !CheckUse( from ) )
                return;

            from.BeginAction( typeof( FireHorn ) );
            Timer.DelayCall( Core.AOS ? TimeSpan.FromSeconds( 6.0 ) : TimeSpan.FromSeconds( 12.0 ), new TimerStateCallback( EndAction ), from );

            int music = from.Skills[SkillName.Musicianship].Fixed;

            int sucChance = 500 + ( music - 775 ) * 2;
            double dSucChance = ((double)sucChance) / 1000.0;

            if ( !from.CheckSkill( SkillName.Musicianship, dSucChance ) )
            {
                from.SendLocalizedMessage( 1049618 ); // The horn emits a pathetic squeak.
                from.PlaySound( 0x18A );
                return;
            }

            int sulfAsh = Core.AOS ? 4 : 15;
            from.Backpack.ConsumeUpTo( typeof( SulfurousAsh ), sulfAsh );

            from.PlaySound( 0x15F );
            Effects.SendPacket( from, from.Map, new HuedEffect( EffectType.Moving, from.Serial, Serial.Zero, 0x36D4, from.Location, loc, 5, 0, false, true, 0, 0 ) );

            ArrayList targets = new ArrayList();
            bool playerVsPlayer = false;

            IPooledEnumerable eable = from.Map.GetMobilesInRange( new Point3D( loc ), 2 );

            foreach ( Mobile m in eable )
            {
                if ( from != m && SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false ) )
                {
                    if ( Core.AOS && !from.InLOS( m ) )
                        continue;

                    targets.Add( m );

                    if ( m.Player )
                        playerVsPlayer = true;
                }
            }

            eable.Free();

            if ( targets.Count > 0 )
            {
                int prov = from.Skills[SkillName.Provocation].Fixed;
                int disc = from.Skills[SkillName.Discordance].Fixed;
                int peace = from.Skills[SkillName.Peacemaking].Fixed;

                int minDamage, maxDamage;

                if ( Core.AOS )
                {
                    int musicScaled = music + Math.Max( 0, music - 900 ) * 2;
                    int provScaled = prov + Math.Max( 0, prov - 900 ) * 2;
                    int discScaled = disc + Math.Max( 0, disc - 900 ) * 2;
                    int peaceScaled = peace + Math.Max( 0, peace - 900 ) * 2;

                    int weightAvg = ( musicScaled + provScaled * 3 + discScaled * 3 + peaceScaled ) / 80;

                    int avgDamage;
                    if ( playerVsPlayer )
                        avgDamage = weightAvg / 3;
                    else
                        avgDamage = weightAvg / 2;

                    minDamage = ( avgDamage * 9 ) / 10;
                    maxDamage = ( avgDamage * 10 ) / 9;
                }
                else
                {
                    int total = prov + disc / 5 + peace / 5;

                    if ( playerVsPlayer )
                        total /= 3;

                    maxDamage = ( total * 2 ) / 30;
                    minDamage = ( maxDamage * 7 ) / 10;
                }

                double damage = Utility.RandomMinMax( minDamage, maxDamage );

                if ( Core.AOS && targets.Count > 1 )
                    damage = (damage * 2) / targets.Count;
                else if ( !Core.AOS )
                    damage /= targets.Count;

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

                    double toDeal = damage;

                    if ( !Core.AOS && m.CheckSkill( SkillName.MagicResist, 0.0, 120.0 ) )
                    {
                        toDeal *= 0.5;
                        m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
                    }

                    from.DoHarmful( m );
                    SpellHelper.Damage( TimeSpan.Zero, m, from, toDeal, 0, 100, 0, 0, 0 );

                    Effects.SendTargetEffect( m, 0x3709, 10, 30 );
                }
            }

            double breakChance = Core.AOS ? 0.01 : 0.16;
            if ( Utility.RandomDouble() < breakChance )
            {
                from.SendLocalizedMessage( 1049619 ); // The fire horn crumbles in your hands.
                this.Delete();
            }
        }
Exemplo n.º 13
0
		public void Shoot( Mobile from, Mobile target )
		{
			if ( from == target )
				return;

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

				from.Direction = from.GetDirectionTo( target );

				from.RevealingAction();

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

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

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

				Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerCallback( ResetUsing ) );
			}
		}
Exemplo n.º 14
0
			protected override void OnTarget( Mobile from, object obj )
			{
				if ( m_NecroCrystal.Deleted )
					return;

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

					if ( !m_NecroCrystal.IsChildOf( from.Backpack ) )
					{
						from.SendMessage( "This must be in your pack" ); // The bola must be in your pack to use it.
					}
					else if ( from.FindItemOnLayer( Layer.OneHanded ) != null || from.FindItemOnLayer( Layer.TwoHanded ) != null )
					{
						from.SendMessage( "Your hands must be free!" ); // Your hands must be free to use this
					}
					//else if ( from.Mounted )
					//{
					//	from.SendLocalizedMessage( 1040016 ); // You cannot use this while riding a mount
					//}
					//else if ( !to.Mounted )
					//{
					//	from.SendLocalizedMessage( 1049628 ); // You have no reason to throw a bola at that.
					//}
					else if ( !from.CanBeHarmful( to ) )
					{
					}
					else if ( from.BeginAction( typeof( NecroCrystal ) ) )
					{
					}
					else if ( to is NecromancerChamp )
					{
					from.SendMessage( "The Crystal weakens the monster!" );
					to.Damage( 50, from );
					}



						m_NecroCrystal.Consume();

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

						Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( FinishThrow ), new object[]{ from, to } );
					}
					else
					{
						from.SendMessage( "You have to wait a few moments before you can use another Crystal!" ); // You have to wait a few moments before you can use another bola!
					}
				//else
				//{
				//	from.SendMessage( "You cannot throw a crystal at that!" ); // You cannot throw a bola at that.
				//}
			}
Exemplo n.º 15
0
		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 );
			}
		}
Exemplo n.º 16
0
            protected override void OnTarget( Mobile from, object obj )
            {
                if( from == null || water == null || !( obj is BaseCreature || obj is BaseWeapon) || !( from is PlayerMobile ) || from.Deleted || !from.Alive || from.Frozen || from.Paralyzed )
                    return;

                Container pack = from.Backpack;

                if( obj is BaseWeapon )
                {
                    BaseWeapon weapon = obj as BaseWeapon;

                    if( weapon.RootParentEntity == null || weapon.RootParentEntity != from )
                        from.SendMessage( "The weapon needs to be in your possession to be consecrated." );

                    else if( weapon.Resource == CraftResource.Silver )
                    {
                        XmlHolyWater hwatt = XmlAttach.FindAttachment( weapon, typeof(XmlHolyWater) ) as XmlHolyWater;

                        if( hwatt != null )
                            from.SendMessage( "That weapon has already been consecrated." );

                        else if( pack != null && water.ParentEntity == pack )
                        {
                            XmlHolyWater newatt = new XmlHolyWater( Math.Max( 1, (int)(water.Power * 0.1) ), 600.0 );
                            XmlAttach.AttachTo( weapon, newatt );
                            from.SendMessage( "This weapon will remain consecrated for the next ten minutes." );
                            water.Delete();
                            Pitcher pitcher = new Pitcher();
                            weapon.InvalidateProperties();
                            pack.DropItem( pitcher );
                        }
                    }

                    else
                        from.SendMessage( "Only silver weapons can be consecrated with holy water." );

                    return;
                }

                if( !( obj is IAbyssal ) && !( obj is IUndead ) && (!(obj is PlayerMobile) && !((PlayerMobile)obj).IsVampire) )
                {
                    from.SendMessage( "Holy Water is only effective against demons and the undead." );
                    return;
                }

                BaseCreature bc = obj as BaseCreature;

                if( bc.Deleted || from.Map != bc.Map || !bc.Alive || !from.CanSee( bc ) || !from.InLOS( bc ) || !from.CanBeHarmful( bc ) )
                    return;

                PlayerMobile m = from as PlayerMobile;

                if( pack != null && water.ParentEntity == pack )
                {
                    if( BaseWeapon.CheckStam( m, 6 ) )
                    {
                        new BaseCustomSpell.SpellDamageTimer( m, bc, 0.5, water.Power ).Start();
                        from.Emote( "*throws a vial of holy water on " + bc.Name + "*" );
                        Effects.SendLocationParticles( EffectItem.Create(   bc.Location, bc.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 5023 );
                        bc.PlaySound( 868 );
                        water.Delete();
                        Pitcher pitcher = new Pitcher();
                        pack.DropItem( pitcher );
                    }
                }

                else
                    from.SendMessage( "That needs to be in your backpack for you to use it." );
            }
Exemplo n.º 17
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.SendAsciiMessage( "The bola must be in your pack to use it." );
                    }
                    else if ( !Core.AOS && (from.FindItemOnLayer( Layer.OneHanded ) != null || from.FindItemOnLayer( Layer.TwoHanded ) != null) )
                    {
                        from.SendAsciiMessage( "Your hands must be free to use this." );
                    }
                    else if ( from.Mounted )
                    {
                        from.SendAsciiMessage( "You cannot use this while riding a mount." );
                    }
                    else if ( !to.Mounted )
                    {
                        from.SendAsciiMessage( "You have no reason to throw a bola at that." );
                    }
                    else if ( !from.CanBeHarmful( to ) )
                    {
                    }
                    else if ( from.BeginAction( typeof( Bola ) ) )
                    {
                        EtherealMount.StopMounting( from );

                        Item one = from.FindItemOnLayer( Layer.OneHanded );
                        Item two = from.FindItemOnLayer( Layer.TwoHanded );

                        if ( one != null )
                            from.AddToBackpack( one );

                        if ( two != null )
                            from.AddToBackpack( two );

                        from.DoHarmful( to );

                        if ( Core.AOS )
                        {
                            Timer timer = new BolaTimer( from );
                            timer.Start();

                            AddContext( from, new BolaContext( timer ) );
                        }

                        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.SendAsciiMessage( "You have to wait a few moments before you can use another bola!" );
                    }
                }
                else
                {
                    from.SendAsciiMessage( "You cannot throw a bola at that." );
                }
            }
Exemplo n.º 18
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 BaseVendor || ( 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.IsPlayer )
                    {
                        from.NextSkillTime = DateTime.Now + BaseInstrument.GetBardSkillTimeout( SkillName.Discordance, from );

                        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 ( m_Table.Contains( targ ) )
                        {
                            from.SendLocalizedMessage( 1049537 ); // Your target is already in discord.
                            from.NextSkillTime = DateTime.Now;
                        }
                        else if ( BaseInstrument.CheckBardSkillChance( from, 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 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 ( BaseInstrument.GetBaseDifficulty( targ ) >= 160.0 )
                                    effect /= 2;

                                if ( AltarPeerless.IsPeerlessBoss( targ ) )
                                {
                                    from.SendLocalizedMessage( 1075212 ); // Your target shrugs off some of the effects of your song.
                                    effect /= 10;
                                }

                                double 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 ) );
                                }

                                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;

                                PlayerMobile pm = from as PlayerMobile;

                                if ( pm != null )
                                    QuestHelper.OnDiscorded( pm, targ );
                            }
                        }
                        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.
                }
            }
Exemplo n.º 19
0
        public void Shoot( Mobile from, Mobile target )
        {
            if ( from == target )
                return;

            if ( m_UsesRemaining < 1 )
            {
                // You have no AzhuranBlowGun darts!
                from.SendMessage( "You have no blow gun darts in the weapon." );
            }
            else if ( m_Using )
            {
                // You are already using that AzhuranBlowGun.
                from.SendMessage( "You are already using that blow gun." );
            }
            else if ( !BasePotion.HasFreeHand( from ) )
            {
                // You must have a free hand to use a AzhuranBlowGun.
                from.SendMessage( "You must have a free hand to use a blow gun." );
            }
            else if ( from.CanBeHarmful( target ) )
            {
                m_Using = true;

                from.Direction = from.GetDirectionTo( target );

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

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

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

                Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerCallback( ResetUsing ) );
            }
        }
Exemplo n.º 20
0
		public static bool ValidIndirectTarget( Mobile from, Mobile to )
		{
			if( from == to )
				return true;

			if( to.Hidden && to.AccessLevel > from.AccessLevel )
				return false;

			Guild fromGuild = GetGuildFor( from );
			Guild toGuild = GetGuildFor( to );

			if( fromGuild != null && toGuild != null && (fromGuild == toGuild || fromGuild.IsAlly( toGuild )) )
				return false;

			Party p = Party.Get( from );

			if( p != null && p.Contains( to ) )
				return false;

			if( to is BaseCreature )
			{
				BaseCreature c = (BaseCreature)to;

				if( c.Controlled || c.Summoned )
				{
					if( c.ControlMaster == from || c.SummonMaster == from )
						return false;

					if( p != null && (p.Contains( c.ControlMaster ) || p.Contains( c.SummonMaster )) )
						return false;
				}
			}

			if( from is BaseCreature )
			{
				BaseCreature c = (BaseCreature)from;

				if( c.Controlled || c.Summoned )
				{
					if( c.ControlMaster == to || c.SummonMaster == to )
						return false;

					p = Party.Get( to );

					if( p != null && (p.Contains( c.ControlMaster ) || p.Contains( c.SummonMaster )) )
						return false;
				}

				if( to is BaseCreature )
				{
					BaseCreature tc = (BaseCreature) to;
					Mobile master = tc.GetMaster();

					if( master != null && master != from && !ValidIndirectTarget( from, master ) )
						return false;

					if( !c.IsEnemy( tc ) )
						return false;
				}

				return from.CanBeHarmful( to );
			}

			if( to is BaseCreature && !((BaseCreature)to).Controlled && ((BaseCreature)to).InitialInnocent )
				return true;

			int noto = Notoriety.Compute( from, to );

			return (noto != Notoriety.Innocent || from.Kills >= 5);
		}
Exemplo n.º 21
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.SendLocalizedMessage( 1062488 ); // The instrument you are trying to play is no longer in your backpack!
                    }
                    else if ( m_Creature.Unprovokable || creature.Unprovokable )
                    {
                        from.SendLocalizedMessage( 1049446 ); // 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.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 != creature )
                    {
                        from.NextSkillTime = DateTime.Now + BaseInstrument.GetBardSkillTimeout( SkillName.Provocation, from );

                        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.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 ( !BaseInstrument.CheckBardSkillChance( from, SkillName.Provocation, creature, diff - 25.0, diff + 25.0 ) )
                                {
                                    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, creature, true );

                                    PlayerMobile pm = from as PlayerMobile;

                                    if ( pm != null )
                                        QuestHelper.OnProvoked( pm, m_Creature, creature );
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage( 501593 ); // You can't tell someone to attack themselves!
                    }
                }
                else
                {
                    from.SendLocalizedMessage( 501589 ); // You can't incite that!
                }
            }
Exemplo n.º 22
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 ( !Core.AOS && (from.FindItemOnLayer( Layer.OneHanded ) != null || from.FindItemOnLayer( Layer.TwoHanded ) != null) )
					{
						from.SendLocalizedMessage( 1040015 ); // Your hands must be free to use this
					}
					else if ( from.Mounted )
					{
						from.SendLocalizedMessage( 1040016 ); // You cannot use this while riding a mount
					}
					else if ( Server.Spells.Ninjitsu.AnimalForm.UnderTransformation( from ) )
					{
						from.SendLocalizedMessage( 1070902 ); // You can't use this while in an animal form!
					}
					else if ( !to.Mounted )
					{
						from.SendLocalizedMessage( 1049628 ); // You have no reason to throw a bola at that.
					}
					else if ( !from.CanBeHarmful( to ) )
					{
					}
					else if ( from.BeginAction( typeof( Bola ) ) )
					{
						EtherealMount.StopMounting( from );

						Item one = from.FindItemOnLayer( Layer.OneHanded );
						Item two = from.FindItemOnLayer( Layer.TwoHanded );

						if ( one != null )
							from.AddToBackpack( one );

						if ( two != null )
							from.AddToBackpack( two );

						from.DoHarmful( to );

						if ( Core.AOS )
							BaseMount.SetMountPrevention( from, BlockMountType.BolaRecovery, TimeSpan.FromSeconds( 3.0 ) );

						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.
				}
			}
Exemplo n.º 23
0
        public static void Cleave( Mobile mob, Mobile killed )
        {
            if ( mob == null || killed == null || ((IKhaerosMobile)mob).CleaveAttack )
                return;

            CombatSystemAttachment csa = CombatSystemAttachment.GetCSA( mob );
            if ( csa.Charging || (csa.AttackTimer != null && csa.AttackTimer.Type == AttackType.Throw) ) // does not trigger from charge/throw
                return;
            BaseWeapon weapon = mob.Weapon as BaseWeapon;
            IKhaerosMobile attacker = mob as IKhaerosMobile;
            ArrayList list = new ArrayList();

            if ( attacker.Feats.GetFeatLevel(FeatList.Cleave) > 0 && !( mob.Weapon is BaseRanged ) )
            {
                foreach( Mobile m in mob.GetMobilesInRange( 2 ) )
                    list.Add( m );

                ArrayList targets = new ArrayList();

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

                    if( m != killed && m != mob && Spells.SpellHelper.ValidIndirectTarget( mob, m ) )
                    {
                        if( m == null || m.Deleted || m.Map != mob.Map || !m.Alive || !mob.CanSee( m ) || !mob.CanBeHarmful( m ) || BaseAI.AreAllies( mob, m ) )
                            continue;

                        if( !mob.InRange( m, weapon.MaxRange ) )
                            continue;

                        if (mob.InLOS(m))
                        {
                            bool govAlly = false;
                            if (m is Soldier && (m as Soldier).Government != null && !(m as Soldier).Government.Deleted)
                            {
                                if (attacker is Soldier && (attacker as Soldier).Government != null && !(attacker as Soldier).Government.Deleted)
                                {
                                    if ((attacker as Soldier).Government == (m as Soldier).Government)
                                        govAlly = true;
                                    else if ((attacker as Soldier).Government.AlliedGuilds.Contains((m as Soldier).Government))
                                        govAlly = true;
                                }
                                else if (attacker is PlayerMobile)
                                {
                                    foreach (CustomGuildStone g in CustomGuildStone.Guilds)
                                    {
                                        if (CustomGuildStone.IsGuildMember(attacker as PlayerMobile, g))
                                            govAlly = (g == (m as Soldier).Government || g.AlliedGuilds.Contains((m as Soldier).Government));

                                        if (govAlly)
                                            break;
                                    }

                                    if (govAlly)
                                        continue;
                                }
                            }
                            else if (m is PlayerMobile && attacker is Soldier)
                            {
                                if ((attacker as Soldier).Government.Members.Contains(m))
                                    govAlly = true;
                                else
                                {
                                    foreach (CustomGuildStone g in CustomGuildStone.Guilds)
                                    {
                                        if (CustomGuildStone.IsGuildMember(m as PlayerMobile, g))
                                            govAlly = (attacker as Soldier).Government.AlliedGuilds.Contains(g);

                                        if(govAlly)
                                            break;
                                    }
                                }
                            }

                            if(!govAlly)
                                targets.Add(m);
                        }
                    }
                }

                if( targets.Count > 0 )
                {
                    mob.RevealingAction();
                    Mobile m = (Mobile)targets[0];
                    mob.Emote( "*unleashes a cleave attack on {0}*", m.Name );
                    attacker.CleaveAttack = true;
                    weapon.OnSwing( mob, m, ((attacker.Feats.GetFeatLevel(FeatList.Cleave) * 0.25) + 0.25), true );
                }
            }
        }
Exemplo n.º 24
0
        public void Explode( Mobile from, bool direct, Point3D loc, Map map )
        {
            if ( Deleted )
                return;

            Consume();

            for ( int i = 0; m_Users != null && i < m_Users.Count; ++i )
            {
                Mobile m = (Mobile)m_Users[i];
                ThrowTarget targ = m.Target as ThrowTarget;

                if ( targ != null && targ.Potion == this )
                    Target.Cancel( m );
            }

            if ( map == null )
                return;

            Effects.PlaySound( loc, map, 0x207 );
            Effects.SendLocationEffect( loc, map, 0x36BD, 20 );

            int alchemyBonus = 0;

            if ( direct )
                alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));

            IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange( loc, ExplosionRange ) : map.GetMobilesInRange( loc, ExplosionRange );
            ArrayList toExplode = new ArrayList();

            int toDamage = 0;

            foreach ( object o in eable )
            {
                if ( o is Mobile )
                {
                    toExplode.Add( o );
                    ++toDamage;
                }
                else if ( o is BaseExplosionPotion && o != this )
                {
                    toExplode.Add( o );
                }
            }

            eable.Free();

            int min = Scale( from, MinDamage );
            int max = Scale( from, MaxDamage );

            for ( int i = 0; i < toExplode.Count; ++i )
            {
                object o = toExplode[i];

                if ( o is Mobile )
                {
                    Mobile m = (Mobile)o;

                    if ( from == null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) )
                    {
                        if ( from != null )
                            from.DoHarmful( m );

                        int damage = Utility.RandomMinMax( min, max );

                        damage += alchemyBonus;

                        if ( !Core.AOS && damage > 40 )
                            damage = 40;
                        else if ( Core.AOS && toDamage > 2 )
                            damage /= toDamage - 1;

                        AOS.Damage( m, from, damage, 0, 100, 0, 0, 0 );
                    }
                }
                else if ( o is BaseExplosionPotion )
                {
                    BaseExplosionPotion pot = (BaseExplosionPotion)o;

                    pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
                }
            }
        }
Exemplo n.º 25
0
            protected override void OnTarget( Mobile from, object obj )
            {
                if ( m_Bola.Deleted )
                    return;

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

                    if ( !m_Bola.IsChildOf( from.Backpack ) )
                    {
                        from.SendLocalizedMessage( 1040019 ); // The bola must be in your pack to use it.
                    }
                    else if ( from.FindItemOnLayer( Layer.OneHanded ) != null || from.FindItemOnLayer( Layer.TwoHanded ) != null )
                    {
                        from.SendLocalizedMessage( 1040015 ); // Your hands must be free to use this
                    }
                    else if ( from.Mounted )
                    {
                        from.SendLocalizedMessage( 1040016 ); // You cannot use this while riding a mount
                    }
                    else if ( !to.Mounted )
                    {
                        from.SendLocalizedMessage( 1049628 ); // You have no reason to throw a bola at that.
                    }
                    else if ( !from.CanBeHarmful( to ) )
                    {
                    }
                    else if ( from.BeginAction( typeof( Bola ) ) )
                    {
                        from.DoHarmful( to );

                        m_Bola.Consume();

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

                        Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback( FinishThrow ), new object[]{ from, to } );
                    }
                    else
                    {
                        from.SendLocalizedMessage( 1049624 ); // You have to wait a few moments before you can use another bola!
                    }
                }
                else
                {
                    from.SendLocalizedMessage( 1049629 ); // You cannot throw a bola at that.
                }
            }
Exemplo n.º 26
0
        public override void OnDoubleClick( Mobile from )
        {
            Faction faction = Faction.Find( from );

            if ( !IsChildOf( from.Backpack ) )
            {
                // That is not in your backpack.
                from.SendLocalizedMessage( 1042593 );
            }
            else if ( faction == null )
            {
                // You may not use this unless you are a faction member!
                from.SendLocalizedMessage( 1010376, null, 0x25 );
            }
            else if ( m_CooldownTable.ContainsKey( from ) )
            {
                Timer cooldownTimer = m_CooldownTable[from];

                // You must wait ~1_seconds~ seconds before you can use this item.
                from.SendLocalizedMessage( 1079263, ( cooldownTimer.Next - DateTime.Now ).Seconds.ToString() );
            }
            else
            {
                for ( int x = -5; x <= 5; x++ )
                {
                    for ( int y = -5; y <= 5; y++ )
                    {
                        Point3D p = new Point3D( from.Location.X + x, from.Location.Y + y, from.Location.Z );
                        int dist = (int) Utility.GetDistanceToSqrt( from.Location, p );

                        if ( dist <= 5 )
                        {
                            Timer.DelayCall( TimeSpan.FromSeconds( 0.2 * dist ), new TimerCallback(
                                delegate
                                {
                                    Effects.SendPacket( from, from.Map, new HuedEffect( EffectType.FixedXYZ, Serial.Zero, Serial.Zero, 0x3709, p, p, 20, 30, true, false, 1502, 4 ) );
                                }
                            ) );
                        }
                    }
                }

                double alchemy = from.Skills[SkillName.Alchemy].Value;

                int damage = (int) BasePotion.Scale( from, 19 + alchemy / 5 );

                foreach ( Mobile to in from.GetMobilesInRange( 5 ).ToArray() )
                {
                    int distance = (int) from.GetDistanceToSqrt( to );

                    if ( to != from && distance <= 5 && from.CanSee( to ) && from.InLOS( to ) && SpellHelper.ValidIndirectTarget( from, to ) && from.CanBeHarmful( to ) && !to.Hidden )
                        AOS.Damage( to, from, damage - distance, 0, 100, 0, 0, 0 );
                }

                Consume();

                m_CooldownTable[from] = Timer.DelayCall( Cooldown, new TimerCallback( delegate { m_CooldownTable.Remove( from ); } ) );
            }
        }
Exemplo n.º 27
0
        public void Shoot( Mobile from, Mobile target )
        {
            if ( from == target )
                return;

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

                from.Direction = from.GetDirectionTo( target );

                from.RevealingAction();

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

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

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

                Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), () => m_Using.Remove( from ) );
            }
        }
Exemplo n.º 28
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 );
        }
Exemplo n.º 29
0
        public void Explode( Mobile from, bool direct, Point3D loc, Map map )
        {
            if ( Deleted )
                return;

            Delete();

            for ( int i = 0; m_Users != null && i < m_Users.Count; ++i )
            {
                Mobile m = (Mobile)m_Users[i];
                ThrowTarget targ = m.Target as ThrowTarget;

                if ( targ != null && targ.Potion == this )
                    Target.Cancel( m );
            }

            if ( map == null )
            {
                return;
            }

            IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange( loc, m_ExplosionRange ) : map.GetMobilesInRange( loc, m_ExplosionRange );
            ArrayList toExplode = new ArrayList();

            int toDamage = 0;

            foreach ( object o in eable )
            {
                if ( o is Mobile )
                {
                    toExplode.Add( o );
                    ++toDamage;
                }
                else if ( o is BombPotion && o != this )
                {
                    toExplode.Add( o );
                }
            }

            eable.Free();

            foreach ( KeyValuePair<CustomEffect, int> kvp in Effects )
            {
                CustomPotionEffect effect = CustomPotionEffect.GetEffect( kvp.Key );
                if ( effect != null )
                    effect.OnExplode( from, this, kvp.Value, loc, map );
            }

            Point3D eye = new Point3D( loc );
            eye.Z += 14;

            for ( int i = 0; i < toExplode.Count; ++i )
            {
                object o = toExplode[i];

                if ( o is Mobile )
                {
                    Mobile m = (Mobile)o;
                    Point3D target = new Point3D( m.Location );
                    target.Z += 14;

                    if ( from == null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) )
                    {
                        if ( o != null && map.LineOfSight( eye, target ) )
                        {
                            foreach ( KeyValuePair<CustomEffect, int> kvp in Effects )
                            {
                                CustomPotionEffect effect = CustomPotionEffect.GetEffect( kvp.Key );
                                if ( effect != null )
                                    effect.ApplyEffect( m, from, kvp.Value, this );
                            }
                        }
                    }
                }
                else if ( o is BombPotion )
                {
                    BombPotion pot = (BombPotion)o;
                    Point3D target = new Point3D( pot.Location );
                    target.Z += 14;
                    if ( o != null && map.LineOfSight( eye, target ) )
                        pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
                }
            }
        }
Exemplo n.º 30
0
		public void Shoot( Mobile from, Mobile target )
		{
			if ( from == target )
				return;

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

				from.Direction = from.GetDirectionTo( target );

				from.RevealingAction();

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

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

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

				Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerCallback( ResetUsing ) );
			}
		}
Exemplo n.º 31
0
        public static void ScreamOfHell(Mobile from, int range, TimeSpan duration)
        {
            if (from.Map != Map.Internal && from.Map != null && from != null && !from.Blessed && from.Alive)
            {
                IPooledEnumerable eable = from.GetMobilesInRange(range);

                foreach (Mobile m in eable)
                {
                    if (m is BaseCreature && !m.Blessed && m.Alive && ((BaseCreature)from).IsEnemy(m) && from.CanBeHarmful(m))
                    {
                        BaseCreature b = m as BaseCreature;

                        if (b.Controlled && b != from)
                        {
                            b.Combatant = from;
                            b.BeginFlee(duration);
                        }
                    }
                }
            }
        }