Example #1
0
        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( source != to )
                source.DoHarmful( to );
            int chance = Utility.RandomMinMax( 1, 8 );
            string sundname = "";

            BaseArmor sundered = null;
            Layer layer = Layer.FirstValid;

            switch( chance )
            {
                case 1: layer = Layer.InnerTorso; sundname = "armour"; break;
                case 2: layer = Layer.InnerLegs; sundname = "leggings"; break;
                case 3: layer = Layer.TwoHanded; sundname = "shield"; break;
                case 4: layer = Layer.Neck; sundname = "gorget"; break;
                case 5: layer = Layer.Gloves; sundname = "gauntlets"; break;
                case 6: layer = Layer.Helm; sundname = "helm"; break;
                case 7: layer = Layer.Arms; sundname = "arm pads"; break;
                case 8: layer = Layer.OneHanded; sundname = "weapon"; break;
            }

            if( to.FindItemOnLayer( layer ) != null && to.FindItemOnLayer( layer ) is BaseArmor )
                sundered = to.FindItemOnLayer( layer ) as BaseArmor;

            if( sundered != null )
            {
                int amt = (int)(intensity * Divisor);
                if ( amt <= 0 )
                    amt = 0;

                sundered.HitPoints -= Utility.Random( amt ) + 1;

                if( sundered.HitPoints < 0 )
                {
                    sundered.MaxHitPoints += sundered.HitPoints;
                    sundered.HitPoints = 0;

                    if( sundered.MaxHitPoints < 0 )
                    {
                        sundered.Delete();
                        to.Emote( "*got {0} {1} destroyed by {2}*", to.Female == true ? "her" : "his", sundname, source.Name );
                    }
                }

                to.Emote( "*got {0} {1} damaged by {2}*", to.Female == true ? "her" : "his", sundname, source.Name );
            }
        }
        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            bool curse = false;
            if ( intensity < 0 )
            {
                if ( source != to )
                    source.DoHarmful( to );

                curse = true;
                intensity*=-1;
            }

            int offset = (int)( intensity * Divisor );
            TimeSpan duration = TimeSpan.FromSeconds( (int)( ( Math.Abs( intensity ) * 15) * Divisor ) );
            if ( !Spells.SpellHelper.AddStatOffset( to, StatType.Dex, ( curse ? -1 : 1 ) * ( BasePotion.Scale( to, Math.Abs( offset ) ) ), duration ) )
                to.SendLocalizedMessage( 502173 ); // You are already under a similar effect.
        }
Example #3
0
        public void ComboAttack(Mobile attacker, Mobile defender, BaseWeapon weapon)
        {
            if (Level >= PerkLevel.Fifth)
            {
                if (weapon is Fists)
                {
                    int hitChance = (attacker.Dex / 8);
                    if (hitChance > Utility.RandomMinMax(0, 100))
                    {
                        int hits = Utility.RandomMinMax(1, 2);
                        int damage = Utility.RandomMinMax(1, 3) + (attacker.Str / 10);

                        for (int i = 1; i <= hits; i++)
                        {
                            attacker.DoHarmful(defender);
                            defender.Damage(damage);

                            int sound = Utility.RandomMinMax(1, 3);

                            switch (sound)
                            {
                                case 1:
                                    {
                                        attacker.PlaySound(0x13E);
                                        break;
                                    }
                                case 2:
                                    {
                                        attacker.PlaySound(0x145);
                                        break;
                                    }
                                case 3:
                                    {
                                        attacker.PlaySound(0x142);
                                        break;
                                    }
                            }
                        }

                        attacker.SendMessage("You strike your opponent multiple times in a combination-attack!");
                    }
                }
            }
        }
        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( source != to && intensity < 0 )
                source.DoHarmful( to );

            if ( intensity > 0 )
            {
                if ( to.CanBeginAction( typeof( StaminaRegenerationEffect ) ) )
                {
                    to.BeginAction( typeof( StaminaRegenerationEffect ) );
                    Timer.DelayCall( TimeSpan.FromSeconds( 20 ), new TimerStateCallback( ReleaseStamRegenLock ), to ); // 20 sec delay
                }

                else
                    return;
            }

            BeginRegenerating( to, intensity, source );
        }
        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( intensity > 0 )
            {
                if ( to.CanBeginAction( typeof( StaminaRestorationEffect ) ) && to.Stam < to.StamMax )
                {
                    to.Stam += BasePotion.Scale( to, (int)(intensity * Divisor) );
                    to.BeginAction( typeof( StaminaRestorationEffect ) );
                    Timer.DelayCall( TimeSpan.FromSeconds( 10 ), new TimerStateCallback( ReleaseStamLock ), to ); // 10 sec delay
                }
            }
            else
            {
                to.Stam -= BasePotion.Scale( to, (int)(-1 * intensity * Divisor) );

                if ( source != to ) // if it was thrown or something
                    source.DoHarmful( to );
            }
        }
Example #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 );
                    }
                }
            }
        }
        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( intensity < 0 || to.Paralyzed )
                return;

            if ( source != to )
                source.DoHarmful( to );

            to.SendMessage( "You are rendered helpless by the substance." );
            if( to is PlayerMobile )
            {
                ( (PlayerMobile)to ).m_PetrifiedTimer = new GeneralizedParalyzeTimer( to, TimeSpan.FromMilliseconds( BasePotion.Scale( to, (int)( intensity * Divisor ) ) ) );
                ( (PlayerMobile)to ).m_PetrifiedTimer.Start();
            }

            else if( to is BaseCreature )
            {
                ( (BaseCreature)to ).m_PetrifiedTimer = new GeneralizedParalyzeTimer( to, TimeSpan.FromMilliseconds( BasePotion.Scale( to, (int)( intensity * Divisor ) ) ) );
                ( (BaseCreature)to ).m_PetrifiedTimer.Start();
            }
        }
Example #8
0
        public static void DismountAttack( Mobile from, Mobile target )
        {
            target.Damage( 1, from );

            IMount mt = target.Mount;

            if ( mt != null )
            {
                mt.Rider = null;
            }

            if ( target.IsPlayer )
            {
                target.BeginAction( typeof( BaseMount ) );

                target.SendLocalizedMessage( 1040023 ); // You have been knocked off of your mount!

                target.EndAction( typeof( BaseMount ) );
            }

            from.DoHarmful( target );
        }
		public static void LowerResistanceAttack( Mobile from, ref ExpireTimer timer, TimeSpan duration, Mobile target, ResistanceMod[] mod, Hashtable hashtbl )
		{
			target.PlaySound( 0x1E9 );
			target.FixedParticles( 0x376A, 9, 32, 5008, EffectLayer.Waist );

			timer = new ExpireTimer( target, mod, duration, hashtbl );
			timer.Start();

			hashtbl[target] = timer;

			for (int i=0;i<mod.Length;i++)
				target.AddResistanceMod( mod[i] );		

			if ( hashtbl == m_RuneBeetleRMT )
				target.SendLocalizedMessage( 1070845 ); // The creature continues to corrupt your armor!

			if ( hashtbl == m_FanDancerRMT )
				target.SendLocalizedMessage( 1070835 ); // The creature surrounds you with fire, reducing your resistance to fire attacks.

			from.DoHarmful( target );

			return;
		}
Example #10
0
        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( source != to && intensity < 0 )
                source.DoHarmful( to );

            if ( intensity < 0 )
            {
                int amount = (int)(BasePotion.Scale( to, intensity*-1 ) * Divisor);
                if ( amount <= 0)
                    amount = 1;

                int tmp = to.Thirst - amount;
                if ( tmp < 0 )
                {
                    to.Thirst = 0;
                    tmp*=-1;
                    to.Hits-=(int)(tmp*1.5);
                    to.SendMessage( "You're dehydrated!" );
                }
                else
                    to.Thirst -= amount;
            }
            else if ( to.Thirst >= 20 )
                return;
            else
            {
                int amount = (int)(BasePotion.Scale( to, intensity ) * Divisor);
                if ( amount <= 0)
                    amount = 1;
                if ( to.Thirst + amount > 20 )
                    to.Thirst = 20;
                else
                    to.Thirst += amount;
            }

            FoodDecayTimer.CalculatePenalty( to );
        }
Example #11
0
        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( intensity < 0 )
                return;
            if ( source != to )
                source.DoHarmful( to );

            // check if cant move already...
            if ( to.CantWalk )
                return;
            else
            {
                TimeSpan duration;
                int seconds = (int)( intensity * Divisor );

                if ( seconds < 1 )
                    seconds = 1;

                duration = TimeSpan.FromSeconds( seconds );
                to.CantWalk = true;
                Timer.DelayCall( duration, new TimerStateCallback( ReleaseMobile ), to );
                to.SendMessage( "Your feet have been glued to the ground!" );
            }
        }
Example #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();
            }
        }
Example #13
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 );
                }
            }
        }
Example #14
0
        public override bool DoEffect(Mobile from, Mobile target)
        {
            if ( from.CanSee( target ) && from.CanBeHarmful( target ) && from.InLOS( target ) && target.Alive )
            {
                from.DoHarmful( target );
                SpellHelper.Turn( from, target );

                SpellHelper.CheckReflect( 5, from, ref target );

                target.Paralyzed = false;

                if ( target.CheckSkill( SkillName.MagicResist, 10, 50 ) ) // check resisted easy
                {
                    target.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
                }
                else
                {
                    if ( target.Spell is Spells.Spell )
                        ((Spells.Spell)target.Spell).OnCasterHurt( target.Mana );
                    target.Mana = 0;
                }

                target.FixedParticles( 0x374A, 10, 15, 5032, EffectLayer.Head );
                target.PlaySound( 0x1F8 );

                return true;
            }

            return false;
        }
Example #15
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.
				}
			}
Example #16
0
        public static void LifeforceDrainAttack( Mobile from, Mobile target )
        {
            int toDrain = 6 + (int) ( ( 120 - target.Skills[SkillName.MagicResist].Value ) / 10 );

            target.FixedParticles( 0x3789, 10, 25, 5032, EffectLayer.Head );
            target.PlaySound( 0x1F8 );

            target.SendLocalizedMessage( 1070848 ); // You feel your life force being stolen away!

            target.Damage( toDrain, from );

            from.FixedParticles( 0x376A, 9, 32, 5030, EffectLayer.Waist );
            from.PlaySound( 0x202 );

            from.Heal( toDrain );

            from.DoHarmful( target );

            return;
        }
		public static void ThrowBomb( Mobile m, Mobile bomber )
		{
			m.DoHarmful( m );

			bomber.MovingParticles( m, 0x1AD7, 1, 0, false, true, 0, 0, 9502, 6014, 0x11D, EffectLayer.Waist, 0 );

			new BomberTimer( m, bomber ).Start();
		}
Example #18
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));
				}
			}
		}
 public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
 {
     if ( to != source )
         source.DoHarmful( to );
 }
        public void Explode( Mobile from, Point3D loc, Map map )
        {
            if ( Deleted )
                return;

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

            IPooledEnumerable eable = map.GetObjectsInRange( loc, ExplosionRange );
            ArrayList toExplode = new ArrayList();
            foreach ( object o in eable )
            {
                if ( o is Mobile )
                {
                    toExplode.Add( o );
                    AddPotions( ((Mobile)o).Backpack, toExplode );
                }
                else if ( o is Item )
                {
                    if ( o is BaseExplosionPotion && o != this )
                        toExplode.Add( o );
                    else if ( ((Item)o).Items.Count > 0 )
                        AddPotions( (Item)o, toExplode );
                }
            }

            eable.Free();

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

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

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

                    int dist = (int)m.GetDistanceToSqrt( loc );
                    if ( dist > ExplosionRange )
                        continue;

                    if ( from == null || from.CanBeHarmful( m, false ) )
                    {
                        if ( from != null )
                            from.DoHarmful( m );
                        m.Damage( (int)( Utility.RandomMinMax( min, max ) * 3.0/4.0 ) );
                    }
                }
                else if ( o is BaseExplosionPotion )
                {
                    BaseExplosionPotion pot = (BaseExplosionPotion)o;

                    //pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
                    if ( ( pot.m_Timer == null || !pot.m_Timer.Running ) && !pot.Deleted )
                    {
                        Point3D pp = pot.GetWorldLocation();
                        int x, y, z;
                        double val;
                        x = pp.X - loc.X;
                        y = pp.Y - loc.Y;
                        z = pp.Z - loc.Z;

                        if ( x == 0 && y == 0 && z == 0 )
                        {
                            val = 0;
                        }
                        else
                        {
                            val = Math.Sqrt( x*x + y*y );
                            val = Math.Sqrt( val*val + z*z );
                        }

                        if ( (int)val <= ExplosionRange )
                        {
                            val += Utility.Random( 4 );
                            if ( val < 1 )
                                val = 0;

                            pot.m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 0.75 ), TimeSpan.FromSeconds( 1.0 ), ((int)val)+1, new TimerStateCallback( pot.Detonate_OnTick ), new object[]{from, ((int)val)} );
                        }
                    }
                }
            }

            Delete();
        }
		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);

					from.DoHarmful( m, true );
				}
			}

			// consume the ammunition
			Consume(1);
			weapon.Projectile = this;
		}
Example #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.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." );
                }
            }
Example #23
0
		public virtual void ExecuteTrap( Mobile from )
		{
			from.DoHarmful( Owner, true );
			from.RevealingAction();
			from.SendMessage( "You've set off a trap!" );
		}
		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.SendLocationParticles( EffectItem.Create( loc, map, EffectItem.DefaultDuration ), 0x36B0, 1, 14, 63, 7, 9915, 0 );
			Effects.PlaySound( loc, map, 0x229 );

			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 BasePoisonExplosionPotion && o != this )
				{
					toExplode.Add( o );
				}
			}

			eable.Free();

			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 level = 0;
						if( this.PotionEffect == PotionEffect.ExplosionLesser )
						{
							level = 1;
						}
						else if ( this.PotionEffect == PotionEffect.Explosion )
						{
							level = 2;
						}
						else if ( this.PotionEffect == PotionEffect.ExplosionGreater )
						{
							level = 3;
						}
							
						m.ApplyPoison( from, Poison.GetPoison(level) );
					}
				}
				else if ( o is BasePoisonExplosionPotion )
				{
					BasePoisonExplosionPotion pot = (BasePoisonExplosionPotion)o;

					pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
				}
			}
		}
Example #25
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 #26
0
        public override bool DoEffect(Mobile from, Mobile target)
        {
            if (target.Frozen || target.Paralyzed)
            {
                return false; // The target is already frozen.
            }
            else if ( target.Alive && from.CanBeHarmful( target ) && from.CanSee( target ) && from.InLOS( target ) )
            {
                from.DoHarmful( target );
                SpellHelper.Turn( from, target );
                SpellHelper.CheckReflect( 5, from, ref target );

                if ( target.Spell is Spell )
                    ((Spell)target.Spell).OnCasterHurt( 1 );

                double duration = Utility.Random( 10 ) + 15;
                if ( target.CheckSkill( SkillName.MagicResist, 10, 50 ) ) // check resisted easy
                    duration *= 0.5;

                target.Paralyze( TimeSpan.FromSeconds( duration ) );
                target.PlaySound( 0x204 );
                target.FixedEffect( 0x376A, 6, 1 );
                return true;
            }

            return false;
        }
Example #27
0
        public static void IcyWindAttack( Mobile from, Mobile target )
        {
            Effects.PlaySound( from.Location, from.Map, 0x1FB );
            Effects.PlaySound( from.Location, from.Map, 0x10B );
            Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x37CC, 1, 40, 97, 3, 9917, 0 );

            target.FixedParticles( 0x374A, 1, 15, 9502, 97, 3, (EffectLayer) 255 );

            target.SendLocalizedMessage( 1070832 ); // An icy wind surrounds you, freezing your lungs as you breathe!

            int duration = 3 + Utility.Random( 3 );

            target.Paralyze( TimeSpan.FromSeconds( duration ) );

            from.DoHarmful( target );
        }
Example #28
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 );
			}
		}
Example #29
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.
                }
            }
Example #30
0
      private 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();

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

         eable.Free();
         int d = 0;
         for ( int i = 0; i < toExplode.Count; ++i )
         {
            object 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 );

                  int damage = Utility.RandomMinMax( (60 / d), (80 / d) );

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