public override bool IsEnemy( Mobile m )
		{
			if ( AssassinControl.IsAssassin( m ) )
			{
				m.DoHarmful( this );

				if ( CanFlag )
				{
					AssassinControl.BecomeNotorious( m );
					//m.CriminalAction( false );

					switch( Utility.Random( 5 ) )
					{
						case 0: Say( "Halt!" ); break;
						case 1: Say( "Stop right there!" ); break;
						case 2: Say( "Hey you!" ); break;
						case 3: Say( "I know you." ); break;
						case 4: Say( "Stop that man!" ); break;
						case 5: Say( "Hey!" ); break;
					}
				}

				return true;
			}
			else
				return false;
		}
Esempio n. 2
0
 public void BreathDamage_Callback(Mobile target)
 {
     if (m_Mobile.CanBeHarmful(target))
     {
         m_Mobile.RevealingAction();
         m_Mobile.DoHarmful(target);
         AOS.Damage(target, m_Mobile, 20, !target.Player, 0, 100, 0, 0, 0);
     }
 }
Esempio n. 3
0
            protected override void OnTarget(Mobile from, object obj)
            {
                if (m_Bola.Deleted)
                {
                    return;
                }

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

                        from.DoHarmful(to);

                        m_Bola.Consume();

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

                        Timer.DelayCall(TimeSpan.FromSeconds(0.5), () => FinishThrow(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.
                }
            }
Esempio n. 4
0
 protected override void OnTick()
 {
     if (m_Mobile.CanBeHarmful(m_Target))
     {
         m_Mobile.DoHarmful(m_Target);
         AOS.Damage(m_Target, m_Mobile, Utility.RandomMinMax(10, 20), 100, 0, 0, 0, 0);
         new UnholyBone().MoveToWorld(m_Target.Location, m_Target.Map);
     }
 }
Esempio n. 5
0
                protected override void OnTick()
                {
                    if (m_Item.Deleted)
                    {
                        return;
                    }

                    if (!m_Item.Visible)
                    {
                        if (m_InLOS && m_CanFit)
                        {
                            m_Item.Visible = true;
                        }
                        else
                        {
                            m_Item.Delete();
                        }

                        if (!m_Item.Deleted)
                        {
                            m_Item.ProcessDelta();
                            Effects.SendLocationParticles(EffectItem.Create(m_Item.Location, m_Item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5029);
                        }
                    }
                    else if (DateTime.UtcNow > m_Item.m_End)
                    {
                        m_Item.Delete();
                        Stop();
                    }
                    else
                    {
                        Map    map    = m_Item.Map;
                        Mobile caster = m_Item.m_Caster;

                        if (map != null && caster != null)
                        {
                            foreach (Mobile m in m_Item.GetMobilesInRange(0))
                            {
                                if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && m != caster && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false))
                                {
                                    m_Queue.Enqueue(m);
                                }
                            }

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

                                caster.DoHarmful(m);

                                AOS.Damage(m, caster, 2, 0, 100, 0, 0, 0);
                                m.PlaySound(0x208);
                            }
                        }
                    }
                }
Esempio n. 6
0
        public override void OnDoubleClick(Mobile m)
        {
            if (m.InRange(GetWorldLocation(), 2))
            {
                if (0.1 > Utility.RandomDouble())
                {
                    m.BAC = Math.Min(60, m.BAC + 10);
                    m.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    BaseBeverage.CheckHeaveTimer(m);

                    m.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1156270, m.NetState); // *You ready the bottle to throw but it's enchanting label persuades you to drink it instead!*

                    Delete();
                }
                else
                {
                    m.SendLocalizedMessage(1010086); // What do you want to use this on?
                    m.BeginTarget(10, false, Targeting.TargetFlags.None, (from, targeted) =>
                    {
                        if (0.25 > Utility.RandomDouble() && m.BAC > 0)
                        {
                            AOS.Damage(m, Utility.RandomMinMax(25, 50), 100, 0, 0, 0, 0);
                            m.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1156271, m.NetState); // *You wind up to throw but in your inebriated state you manage to hit yourself!*
                            m.FixedParticles(0x3728, 20, 10, 5044, EffectLayer.Head);

                            Delete();
                        }
                        else if (targeted is ShadowguardPirate pirate)
                        {
                            m.DoHarmful(pirate);
                            m.MovingParticles(pirate, 0x99B, 10, 0, false, true, 0, 0, 9502, 6014, 0x11D, EffectLayer.Waist, 0);

                            Timer.DelayCall(TimeSpan.FromSeconds(.5), () =>
                            {
                                if (pirate.Alive && !pirate.BlockReflect)
                                {
                                    // this is dumb but can't figure out a better way to do it!
                                    pirate.BlockReflect = true;
                                    AOS.Damage(pirate, m, 300, 0, 0, 0, 0, 0, 0, 100);
                                    pirate.BlockReflect = false;
                                    pirate.FixedParticles(0x3728, 20, 10, 5044, EffectLayer.Head);

                                    pirate.PlaySound(Utility.Random(0x3E, 3));
                                }
                            });

                            Delete();
                        }
                        else
                        {
                            m.SendLocalizedMessage(1156211); // You cannot throw this there!
                        }
                    });
                }
            }
        }
Esempio n. 7
0
            protected override void OnTick()
            {
                m_Ticks++;

                if (m_Spell == null)
                {
                    Stop();
                    return;
                }

                if (m_Ticks >= 20)
                {
                    int damage = 0;

                    foreach (Mobile m in m_ToEffect)
                    {
                        if (m.Deleted || !m.Alive)
                        {
                            continue;
                        }

                        damage = m_Spell.GetNewAosDamage(51, 1, 5, m is PlayerMobile);

                        if (m_ToEffect.Count > 2)
                        {
                            damage = (damage * 2) / m_ToEffect.Count;
                        }

                        m_Caster.DoHarmful(m);
                        SpellHelper.Damage(m_Spell, m, damage, 0, 0, 100, 0, 0);

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

                    Stop();
                }

                int x = m_EffectArea.X + Utility.Random(m_EffectArea.Width);
                int y = m_EffectArea.Y + Utility.Random(m_EffectArea.Height);
                int z = m_Map.GetAverageZ(x, y);

                int fromX = x + Utility.RandomMinMax(-8, 8);
                int fromY = y - 10;
                int fromZ = z + 30;

                Point3D start  = new Point3D(fromX, fromY, fromZ);
                Point3D finish = new Point3D(x, y, z);

                Effects.SendMovingParticles(
                    new Entity(Serial.Zero, start, m_Map),
                    new Entity(Serial.Zero, finish, m_Map),
                    0x36D4, 15, 0, false, false, 1365, 0, 9502, 1, 0, (EffectLayer)255, 0x100);

                Effects.SendLocationEffect(finish, m_Map, 0x3728, 10, 20, 1365, 0);
                Effects.PlaySound(finish, m_Map, 0x64F);
            }
Esempio n. 8
0
                protected override void OnTick()
                {
                    if (m_Item.Deleted)
                    {
                        return;
                    }

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

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

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

                            eable.Free();

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

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

                                caster.DoHarmful(m);

                                int damage = m_Item.m_Damage;

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

                                if (m is BaseCreature)
                                {
                                    ((BaseCreature)m).OnHarmfulSpell(caster);
                                }
                            }
                        }
                    }
                }
Esempio n. 9
0
            protected override void OnTick()
            {
                if (DateTime.Now > final)
                {
                    Stop();
                    return;
                }

                //efeito
                Caster.FixedEffect(0x3779, 5, 40);
                if (DateTime.Now > efeitoSonoro)
                {
                    Caster.PlaySound(0x1DD);
                }

                //lista dos mobiles que vao tomar dano
                List <Mobile> targets = new List <Mobile>();

                //pega os mobiles afetados
                IPooledEnumerable mobiles = Caster.GetMobilesInRange(2);

                foreach (Mobile m in mobiles)
                {
                    if (m == Caster)
                    {
                        continue;
                    }

                    if (SpellHelper.ValidIndirectTarget(Caster, m) &&
                        Caster.CanBeHarmful(m, false) &&
                        Caster.CanSee(m))
                    {
                        targets.Add(m);
                    }
                }
                mobiles.Free();

                if (targets.Count > 0)
                {
                    //para cada mobile, enviar um raio
                    foreach (Mobile mobile in targets)
                    {
                        Caster.DoHarmful(mobile);

                        double damage = magia.GetNewAosDamage(1, 1, 2, null);

                        SpellHelper.Damage(magia, mobile, damage, 0, 0, 0, 0, 100);

                        Caster.MovingParticles(mobile, 0x379F, 5, 0, false, false, 0, 0, 0);
                    }

                    Caster.PlaySound(0x20A);
                }
            }
Esempio n. 10
0
            public void DoDamage_Callback(object state)
            {
                object[] obj = (object[])state;

                Mobile c   = (Mobile)obj[0];
                Mobile d   = (Mobile)obj[1];
                int    dam = (int)obj[2];

                d.DoHarmful(c);
                AOS.Damage(c, d, dam, false, 0, 0, 0, 0, 0, 100, 0, false);
            }
Esempio n. 11
0
        private static void DealDamage(Mobile caster, Mobile target, double power)
        {
            if (SpellHelper.CanRevealCaster(target))
            {
                caster.RevealingAction();
            }

            caster.DoHarmful(target);
            SpellHelper.Damage(Utility.Dice((uint)power, 8, 0), target, caster, null, null, ElementalType.Fire);
            target.PlaySound(0x208);
        }
Esempio n. 12
0
            protected override void OnTick()
            {
                if (m_Owner == null || m_Map == null || m_Map == Map.Internal)
                {
                    return;
                }

                m_LifeSpan -= 1;

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

                foreach (var m in GetTargets())
                {
                    if (BaseHouse.FindHouseAt(m.Location, m.Map, 20) == null)
                    {
                        targets.Add(m);
                    }
                }

                int count = targets.Count;

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

                    m_Owner.DoHarmful(m);

                    if (m_Map.CanFit(m.Location, 12, true, false))
                    {
                        new FireItem(m_LifeSpan).MoveToWorld(m.Location, m_Map);
                    }

                    Effects.PlaySound(m.Location, m_Map, 0x5CF);

                    double sdiBonus = (double)AosAttributes.GetValue(m_Owner, AosAttribute.SpellDamage) / 100;

                    if (m is PlayerMobile && sdiBonus > .15)
                    {
                        sdiBonus = .15;
                    }

                    int damage = m_Damage + (int)(m_Damage * sdiBonus);

                    if (count > 1)
                    {
                        damage /= Math.Min(3, count);
                    }

                    AOS.Damage(m, m_Owner, damage, 0, 100, 0, 0, 0, 0, 0, DamageType.SpellAOE);
                    Table[m] = Core.TickCount + 1000;
                }

                ColUtility.Free(targets);
            }
Esempio n. 13
0
            protected override void OnTarget(Mobile from, object obj)
            {
                if (this.m_Bola.Deleted)
                {
                    return;
                }

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

                    if (!this.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)))
                    {
                        EtherealMount.StopMounting(from);

                        from.DoHarmful(to);

                        this.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.
                }
            }
Esempio n. 14
0
        public override bool OnMoveOver(Mobile m)
        {
            if (ItemID == 0x398C && m_LitBy == null || (SpellHelper.ValidIndirectTarget(m_LitBy, m) && m_LitBy.CanBeHarmful(m, false)))
            {
                if (m_LitBy != null)
                {
                    m_LitBy.DoHarmful(m);
                }

                AOS.Damage(m, m_LitBy, 2, 0, 100, 0, 0, 0);
                m.PlaySound(0x208);

                if (!m_Burning.Contains(m))
                {
                    m_Burning.Add(m);
                }
            }

            return(true);
        }
Esempio n. 15
0
        public override void OnItemLifted(Mobile from, Item item)
        {
            bool         notYetLifted = !m_Lifted.Contains(item);
            BaseCreature witness      = null;

            if (notYetLifted)
            {
                // Adam: Insure IOB wearers are not stealing from their kin
                if (Engines.IOBSystem.IOBSystem.IsIOBAligned(from) && CheckThief(from, out witness))
                {
                    from.SendMessage("You have been discovered stealing from your kin!");
                    if (from.Hidden)
                    {
                        from.RevealingAction();
                    }

                    // attack kin to make them come after you
                    from.DoHarmful(witness);
                }
                else if (Utility.RandomDouble() < 0.30 && CheckGuardian(from, out witness))
                {
                    from.SendMessage("You have been discovered stealing pirate booty!");
                    if (from.Hidden)
                    {
                        from.RevealingAction();
                    }

                    // attack kin to make them come after you
                    from.DoHarmful(witness);
                }
                // adam: we want to reveal the looter about level * 3% of the time (per item looted)
                // for chest levels 1-5, this works out to: 3%, 6%, 9%, 12%, 15%
                else if ((from.Hidden) && (Utility.RandomDouble() < (0.025 * m_Level)))
                {
                    from.SendMessage("You have been revealed!");
                    from.RevealingAction();
                }
            }

            base.OnItemLifted(from, item);
        }
Esempio n. 16
0
				protected override void OnTick()
				{
					if ( m_Item.Deleted )
						return;

					if ( !m_Item.Visible )
					{
						if ( m_InLOS && m_CanFit )
							m_Item.Visible = true;
						else
							m_Item.Delete();

						if ( !m_Item.Deleted )
						{
							m_Item.ProcessDelta();
							Effects.SendLocationParticles( EffectItem.Create( m_Item.Location, m_Item.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 5040 );
						}
					}
					else if ( DateTime.UtcNow > m_Item.m_End )
					{
						m_Item.Delete();
						Stop();
					}
					else
					{
						Map map = m_Item.Map;
						Mobile caster = m_Item.m_Caster;

						if ( map != null && caster != null )
						{
							bool eastToWest = ( m_Item.ItemID == 0x3915 );
							IPooledEnumerable eable = map.GetMobilesInBounds( new Rectangle2D( m_Item.X - (eastToWest ? 0 : 1), m_Item.Y - (eastToWest ? 1 : 0), (eastToWest ? 1 : 2), (eastToWest ? 2 : 1) ) );

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

							eable.Free();

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

								caster.DoHarmful( m );

								m_Item.ApplyPoisonTo( m );
								m.PlaySound( 0x474 );
							}
						}
					}
				}
Esempio n. 17
0
        public void Wither()
        {
            Map    map    = this.Map;
            Mobile Caster = this;

            if (map != null)
            {
                List <Mobile> targets = new List <Mobile>();

                BaseCreature cbc       = Caster as BaseCreature;
                bool         isMonster = (cbc != null && !cbc.Controlled && !cbc.Summoned);

                foreach (Mobile m in Caster.GetMobilesInRange(8))
                {
                    if (Caster != m && Caster.InLOS(m) && (isMonster || SpellHelper.ValidIndirectTarget(Caster, m)) && Caster.CanBeHarmful(m, false))
                    {
                        if (isMonster)
                        {
                            if (m is BaseCreature)
                            {
                                BaseCreature bc = (BaseCreature)m;

                                if (!bc.Controlled && !bc.Summoned && bc.Team == cbc.Team)
                                {
                                    continue;
                                }
                            }
                            else if (!m.Player)
                            {
                                continue;
                            }
                        }

                        targets.Add(m);
                    }
                }

                Effects.PlaySound(Caster.Location, map, 0x1FB);
                Effects.PlaySound(Caster.Location, map, 0x10B);
                Effects.SendLocationParticles(EffectItem.Create(Caster.Location, map, EffectItem.DefaultDuration), 0x37CC, 1, 40, 97, 3, 9917, 0);

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

                    Caster.DoHarmful(m);
                    m.FixedParticles(0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255);

                    int damage = 50;
                    Damage(damage, m);
                }
            }
        }
            protected override void OnTick()
            {
                try
                {
                    if (m_Target != null)
                    {
                        m_Target.BoltEffect(0);
                        m_Caster.DoHarmful(m_Target);
                        SpellHelper.Damage(m_Spell, m_Target, m_Damage, 0, 0, 0, 0, 100);
                        m_bounced.Add(m_Target, m_Target);

                        ArrayList         targets = new ArrayList();
                        IPooledEnumerable eable   = m_Target.Map.GetMobilesInRange(m_Target.Location, 2);

                        foreach (Mobile m in eable)
                        {
                            if (m == null)
                            {
                                continue;
                            }
                            if (m == m_Caster || m_bounced.Contains(m))
                            {
                                continue;
                            }

                            if (SpellHelper.ValidIndirectTarget(m_Caster, m) && m_Caster.CanBeHarmful(m, false))
                            {
                                targets.Add(m);
                            }
                        }

                        eable.Free();

                        if (targets.Count > 0 && m_Damage > 10)
                        {
                            if (targets[0] != null)
                            {
                                Mobile targ = targets[0] as Mobile;
                                //Entity dummy = new Entity(Serial.Zero,(Point3D)m_Loc,m_Caster.Map);
                                //Effects.SendMovingEffect(dummy, targ, 0x3818, 16, 5, false, false);
                                Timer m_Chain = new ChainBounce(m_Caster, m_bounced, targ, m_Damage * .75, m_Spell);
                                m_Chain.Start();
                            }
                        }
                        else
                        {
                            m_bounced.Clear();
                        }
                    }
                }
                catch { m_bounced.Clear(); }
            }
Esempio n. 19
0
            public override bool OnMoveOver(Mobile from)
            {
                if (Mobile != null && Mobile != from && Server.Spells.SpellHelper.ValidIndirectTarget(Mobile, from) && Mobile.CanBeHarmful(from, false))
                {
                    Mobile.DoHarmful(from);

                    AOS.Damage(from, Mobile, Utility.RandomMinMax(50, 85), 0, 100, 0, 0, 0);
                    Effects.PlaySound(Location, Map, 0x1DD);
                    from.PrivateOverheadMessage(Server.Network.MessageType.Regular, 0x20, 1156084, from.NetState); // *The trail of fire scorches you, setting you ablaze!*
                }

                return(true);
            }
Esempio n. 20
0
            public override bool OnMoveOver(Mobile m)
            {
                if (Visible && m_Caster != null && (!Core.AOS || m != m_Caster) &&
                    SpellHelper.ValidIndirectTarget(m_Caster, m) && m_Caster.CanBeHarmful(m, false))
                {
                    m_Caster.DoHarmful(m);

                    ApplyPoisonTo(m);
                    m.PlaySound(0x474);
                }

                return(true);
            }
Esempio n. 21
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 && attacker.Weapon is BaseWeapon weapon))
            {
                return;
            }

            List <Mobile> targets = attacker.GetMobilesInRange(1).Where(m =>
                                                                        m?.Deleted == false && m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m) &&
                                                                        m.Map == attacker.Map && m.Alive && attacker.CanSee(m) && attacker.CanBeHarmful(m) &&
                                                                        attacker.InRange(m, weapon.MaxRange) && attacker.InLOS(m)).ToList();

            if (targets.Count == 0 || !CheckMana(attacker, true))
            {
                return;
            }

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

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

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

                if (Registry.TryGetValue(m, out FrenziedWirlwindTimer timer))
                {
                    timer.Stop();
                    Registry.Remove(m);
                }

                timer = new FrenziedWirlwindTimer(attacker, m, amount);
                timer.Start();
                Registry.Add(m, timer);
            }

            Timer.DelayCall(TimeSpan.FromSeconds(2.0), RepeatEffect, attacker);
        }
Esempio n. 22
0
		public void DoFlamestrike( Mobile attacker, Mobile defender )
		{
			if ( !attacker.CanBeHarmful( defender, false ) )
				return;

			attacker.DoHarmful( defender );

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

			SpellHelper.Damage( TimeSpan.FromSeconds( 1.0 ), defender, attacker, damage, 0, 100, 0, 0, 0 );
		}
Esempio n. 23
0
            protected override void OnTick()
            {
                if (m_FireRing.Deleted)
                {
                    return;
                }

                if (DateTime.Now > m_Duration)
                {
                    Stop();
                }
                else
                {
                    Map map = m_FireRing.Map;

                    if (map != null)
                    {
                        foreach (Mobile m in m_FireRing.GetMobilesInRange(1))
                        {
                            if ((m.Z + 16) > m_FireRing.Z && (m_FireRing.Z + 12) > m.Z)
                            {
                                m_Queue.Enqueue(m);
                            }
                        }

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

                            if (m_FireRing.Visible && m_Caster != null && SpellHelper.ValidIndirectTarget(m_Caster, m) && m_Caster.CanBeHarmful(m, false))
                            {
                                m_Caster.DoHarmful(m);

                                int damage = Utility.Random(1, 2);

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

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

                                AOS.Damage(m, m_Caster, damage, 0, 100, 0, 0, 0);
                                m.PlaySound(0x1DD);
                                m.SendLocalizedMessage(503000);
                            }
                        }
                    }
                }
            }
Esempio n. 24
0
        public override bool DoEffect(Mobile from, Mobile target)
        {
            bool result = false;

            if (!SpellHelper.HasStatEffect(target, m_Stat) && from.CanSee(target) && from.InLOS(target) && target.Alive && from.CanBeHarmful(target))
            {
                from.DoHarmful(target);
                SpellHelper.Turn(from, target);

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

                if (m_Stat != StatType.All)
                {
                    SpellHelper.AddStatCurse(null, target, m_Stat);
                    result = true;
                }
                else
                {
                    Timer t = (Timer)CurseSpell.UnderEffect[target];
                    if (from.Player && target.Player && t == null)
                    {
                        SpellHelper.AddStatCurse(null, target, StatType.Str); SpellHelper.DisableSkillCheck = true;
                        SpellHelper.AddStatCurse(null, target, StatType.Dex);
                        SpellHelper.AddStatCurse(null, target, StatType.Int); SpellHelper.DisableSkillCheck = false;

                        TimeSpan duration = SpellHelper.GetDuration(from, target);
                        CurseSpell.UnderEffect[target] = t = Timer.DelayCall(duration, new TimerStateCallback(CurseSpell.RemoveEffect), target);
                        target.UpdateResistances();

                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }

                if (result)
                {
                    target.Paralyzed = false;

                    target.FixedParticles(m_EffIID, m_EffSpd, m_Dur, m_Eff, m_ELayer);
                    target.PlaySound(m_Snd);
                }
            }

            return(result);
        }
Esempio n. 25
0
                protected override void OnTick()
                {
                    if (m_Item.Deleted)
                    {
                        return;
                    }

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

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

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

                                caster.DoHarmful(m);

                                int damage = Utility.RandomMinMax(m_Min, m_Max);

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

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

                                AOS.Damage(m, caster, damage, 0, 100, 0, 0, 0);
                                m.PlaySound(0x208);
                            }
                        }
                    }
                }
Esempio n. 26
0
                protected override void OnTick()
                {
                    if (m_Item.Deleted)
                    {
                        return;
                    }

                    if (DateTime.UtcNow > m_End)
                    {
                        m_Item.Delete();
                        Stop();
                        return;
                    }

                    Mobile from = m_Item.From;

                    if (m_Item.Map == null || from == null)
                    {
                        return;
                    }

                    List <Mobile>     mobiles = new List <Mobile>();
                    IPooledEnumerable eable   = m_Item.GetMobilesInRange(0);

                    foreach (Mobile mobile in eable)
                    {
                        mobiles.Add(mobile);
                    }
                    eable.Free();

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

                        if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && (!Core.AOS || m != from) && SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false))
                        {
                            if (from != null)
                            {
                                from.DoHarmful(m);
                            }

                            AOS.Damage(m, from, m_Item.GetDamage(), 0, 100, 0, 0, 0);
                            m.PlaySound(0x208);
                        }
                    }

                    ColUtility.Free(mobiles);
                }
Esempio n. 27
0
        public void DoFlamestrike(Mobile attacker, Mobile defender)
        {
            if (!attacker.CanBeHarmful(defender, false))
            {
                return;
            }

            attacker.DoHarmful(defender);

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

            defender.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
            defender.PlaySound(0x208);

            SpellHelper.Damage(TimeSpan.FromSeconds(1.0), defender, attacker, damage, 0, 100, 0, 0, 0);
        }
Esempio n. 28
0
        public virtual void Explode(Mobile from, Point3D loc, Map map)
        {
            if (Deleted || map == null)
            {
                return;
            }

            Consume();

            // Check if any other players are using this potion
            for (int i = 0; i < m_Users.Count; i++)
            {
                ThrowTarget targ = m_Users[i].Target as ThrowTarget;

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

            Timer.DelayCall(TimeSpan.FromSeconds(1), new TimerStateCallback(TarEffect), new object[] { loc, map });
            IPooledEnumerable eable = map.GetMobilesInRange(loc, Radius);

            foreach (Mobile mobile in eable)
            {
                if (mobile != from && from.CanBeHarmful(mobile, false))
                {
                    double chance = (double)(((4 * mobile.Skills[SkillName.MagicResist].Value) + 150) / 700);

                    if (chance < Utility.RandomDouble())
                    {
                        mobile.SendLocalizedMessage(1115815); // You resist the effects of the Fear Essence.
                    }
                    else
                    {
                        Point3D p = mobile.Location;
                        Effects.SendPacket(p, mobile.Map, new ParticleEffect(EffectType.FixedFrom, Serial, Serial.Zero, 0x376A, p, p, 9, 32, false, false, 0, 0, 0, 5039, 1, Serial.Zero, 254, 0));
                        mobile.Damage(0, from);
                        mobile.Paralyze(TimeSpan.FromSeconds(3));
                        from.DoHarmful(mobile);
                    }
                }
            }

            eable.Free();
        }
Esempio n. 29
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!");
                    }
                }
            }
        }
Esempio n. 30
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);
                    }
                }
            }
        }
Esempio n. 31
0
                protected override void OnTick()
                {
                    if (m_Item.Deleted)
                    {
                        return;
                    }
                    else if (DateTime.Now > m_Item.m_End)
                    {
                        m_Item.Delete();
                        Stop();
                    }
                    else
                    {
                        Map    map    = m_Item.Map;
                        Mobile caster = m_Item.m_Caster;

                        if (map != null && caster != null)
                        {
                            foreach (Mobile m in m_Item.GetMobilesInRange(0))
                            {
                                if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && m != caster && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false))
                                {
                                    m_Queue.Enqueue(m);
                                }
                            }

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

                                if (caster.CanSee(m) && caster.InLOS(m) && (caster.IsPlayer || m.IsPlayer || (m is BaseCreature && ((BaseCreature)m).Controlled)))
                                {
                                    caster.DoHarmful(m);

                                    if (!m_Item.Visible)
                                    {
                                        m_Item.Visible = true;
                                    }

                                    AOS.Damage(m, caster, m_Item.Damage, 0, 100, 0, 0, 0);
                                    m.PlaySound(0x5CF);
                                }
                            }
                        }
                    }
                }
Esempio n. 32
0
        protected override void OnTarget(Mobile from, object target)
        {
            if (target is Mobile && target != from)
            {
                Mobile defender = target as Mobile;
                Mobile attacker = from;

                attacker.SendLocalizedMessage(1060165);
                defender.SendLocalizedMessage(1060166);

                defender.PlaySound(0x213);
                defender.FixedParticles(0x377A, 1, 32, 9949, 1153, 0, EffectLayer.Head);

                Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(defender.X, defender.Y, defender.Z + 10), defender.Map), new Entity(Serial.Zero, new Point3D(defender.X, defender.Y, defender.Z + 20), defender.Map), 0x36FE, 1, 0, false, false, 1133, 3, 9501, 1, 0, EffectLayer.Waist, 0x100);

                int damage = 10; // Base

                if (defender.HitsMax > 0)
                {
                    double hitsPercent = ((double)defender.Hits / (double)defender.HitsMax) * 100.0;

                    double manaPercent = 0;

                    if (defender.ManaMax > 0)
                    {
                        manaPercent = ((double)defender.Mana / (double)defender.ManaMax) * 100.0;
                    }

                    damage += Math.Min((int)(Math.Abs(hitsPercent - manaPercent) / 4), 20);
                }

                defender.Damage(damage + Utility.RandomMinMax(4, 8), attacker);
                attacker.DoHarmful(defender);

                StatMod intLoss = new StatMod(StatType.Int, "intloss", defender.Int / 3, TimeSpan.FromSeconds(30));
                defender.AddStatMod(intLoss);

                ((Player)from).NextRaceAbility = TimeSpan.FromMinutes(0.5);
            }

            else
            {
                from.SendMessage("You can not attack that.");
            }
        }
Esempio n. 33
0
        /// <summary>
        /// Allows the adventurer to use a torch as a second weapon at <code>PerkLevel.Fifth</code>
        /// </summary>
        public void TorchAttack( Mobile attacker, Mobile defender )
        {
            if (Level == PerkLevel.Fifth)
            {
                Item torch = attacker.FindItemOnLayer(Layer.TwoHanded);
                if (torch != null && torch is Items.Torch)
                {
                    int hitChance = (attacker.Dex / 6);
                    if (hitChance > Utility.RandomMinMax(0, 100))
                    {
                            int torchDamage = Utility.RandomMinMax(1, 5) + (attacker.Str / 10);

                            attacker.DoHarmful(defender);
                            defender.Damage(torchDamage);
                            attacker.SendMessage("You follow through with your torch, using it to strike your opponent.");
                            defender.SendMessage("{0} strikes you with {1} torch.", attacker, attacker.Female ? "her" : "his");
                            attacker.PlaySound(0x142);
                    }                   
                }
            }
        }
Esempio n. 34
0
			protected override void OnTarget( Mobile from, object target )
			{
				from.RevealingAction();

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

					//Pixie - 11/10/04 - added this so discordance is an aggressive action.
					from.DoHarmful( targ );

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

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

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

								ArrayList mods = new ArrayList();
								double scalar;

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

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

									scalar = effect * 0.01;

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

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

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

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

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

								m_Table[targ] = info;
							}
							else
							{
								from.SendLocalizedMessage( 1049537 );// Your target is already in discord.
							}
						}
						else
						{
							from.SendLocalizedMessage( 1049540 );// You fail to disrupt your target
							m_Instrument.PlayInstrumentBadly( from );
							m_Instrument.ConsumeUse( from );
						}
					}
					else
					{
						m_Instrument.PlayInstrumentBadly( from );
					}
				}
			}
Esempio n. 35
0
			protected override void OnTarget( Mobile from, object obj )
			{
				if ( m_Bola.Deleted )
					return;

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

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

						from.DoHarmful( to );

						m_Bola.Consume();

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

						Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback( FinishThrow ), new object[]{ from, to } );
					}
					else
					{
						from.SendLocalizedMessage( 1049624 ); // You have to wait a few moments before you can use another bola!
					}
				}
				else
				{
					from.SendLocalizedMessage( 1049629 ); // You cannot throw a bola at that.
				}
			}
Esempio n. 36
0
		public virtual void DoAreaAttack( Mobile from, int sound, int hue, int phys, int fire, int cold, int pois, int nrgy )
		{
			Map map = from.Map;

			if ( map == null )
				return;

			ArrayList list = new ArrayList();

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

			if ( list.Count == 0 )
				return;

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

			// TODO: What is the damage calculation?

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

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

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

				from.DoHarmful( m, true );
				m.FixedEffect( 0x3779, 1, 15, hue, 0 );
				AOS.Damage( m, from, (int)(GetBaseDamage( from ) * scalar), phys, fire, cold, pois, nrgy );
			}
		}
			public static void POISON(
				TriggerObject trigObj, IPoint2D target, Mobile from, int level, int range, bool playeronly, bool mobsonly)
			{
				if (target == null)
				{
					return;
				}

				// apply the damage to all mobs within range if range is > 0
				Map map = (target is IEntity) ? ((IEntity)target).Map : Map.Felucca;
				Mobile targetMob = target as Mobile;

				// if it's a death trigger, then don't do damage to trigObj.This (if you do, it results in an infinite loop!)
				Mobile dyingMob = (trigObj.TrigName == TriggerName.onDeath ? trigObj.This as Mobile : null);

				if (range >= 0)
				{
					var rangelist = map.GetMobilesInRange(new Point3D(target, 0), range);
					// don't do damage in a list like this--if mobs are killed it screws up the enumerator!
					// ... copy the list first
					var affected =
						rangelist.OfType<Mobile>()
								 .Where(p => p.Alive && (p is PlayerMobile && !mobsonly) || (p is BaseCreature && !playeronly))
								 .ToList();

					rangelist.Free();

					foreach (Mobile mob in affected.Where(mob => mob != dyingMob))
					{
						if (from != null)
						{
							if (from.CanBeHarmful(mob))
							{
								from.DoHarmful(mob);
								mob.ApplyPoison(from, Poison.GetPoison(level));
							}
						}
						else
						{
							mob.ApplyPoison(mob, Poison.GetPoison(level));
						}
					}
				} // range of -1 means hit only the target
				else if ((targetMob is PlayerMobile && !mobsonly) || (targetMob is BaseCreature && !playeronly))
				{
					if (targetMob.Alive && targetMob != dyingMob)
					{
						if (from != null)
						{
							if (from.CanBeHarmful(targetMob))
							{
								from.DoHarmful(targetMob);
								targetMob.ApplyPoison(from, Poison.GetPoison(level));
							}
						}
						else
						{
							targetMob.ApplyPoison(targetMob, Poison.GetPoison(level));
						}
					}
				}
			}
Esempio n. 38
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 = (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.SendMessage("You feel yourself resisting magic"); // 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.
				Delete();
			}
		}
Esempio n. 39
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;
			}
Esempio n. 40
0
		public virtual void DoHarm(Mobile attacker, Mobile defender)
		{
			if (!attacker.CanBeHarmful(defender, false))
			{
				return;
			}

			attacker.DoHarmful(defender);

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

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

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

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

			attacker.DoHarmful(defender);

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

			defender.BoltEffect(0);

			SpellHelper.Damage(TimeSpan.Zero, defender, attacker, damage, 0, 0, 0, 0, 100);
		}
Esempio n. 42
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, 0x307);

			Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0);
			int alchemyBonus = 0;

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

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

			int toDamage = 0;

			foreach (object o in eable)
			{
				if (o is Mobile &&
					(from == null || (SpellHelper.ValidIndirectTarget(from, (Mobile)o) && from.CanBeHarmful((Mobile)o, false))))
				{
					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)
					{
						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);
				}
			}
		}
		public void Explode( Mobile from, bool direct, Point3D loc, Map map )
		{
			if ( Deleted )
				return;

            if (from != null)
            {
                CustomRegion cR = from.Region as CustomRegion;
                CustomRegion cR2 = Region.Find(loc, map) as CustomRegion;

                if ((cR != null && !cR.Controller.CanUsePotExplosion) || (cR2 != null && !cR2.Controller.CanUsePotExplosion))
                    return;
            }
            else
            {
                CustomRegion cR = Region.Find(loc, map) as CustomRegion;

                if ((cR != null && !cR.Controller.CanUsePotExplosion))
                    return;
            }

		    if (!EventItem || (EventItem && EventItemConsume))
                Consume();
            else
            {
                Mobile m;
                if (m_Users != null && m_Users[0] is Mobile)
                    m = (Mobile)m_Users[0];
                else
                    m = from;

                if (m != null && RootParentEntity != m)
                    m.AddToBackpack(this);

                m_Timer = null;
            }

		    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 && from != null)
			    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 );
		    int count = 1;

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

				if ( o is Mobile )
				{
				    Mobile m = (Mobile)o;
                    GuardedRegion reg = (GuardedRegion)Region.Find(m.Location, m.Map).GetRegion(typeof(GuardedRegion));

                    //Taran: Don't hurt mobiles in guarded
                    if (reg == null || reg.Disabled)
                    {
                        if (from != null && from.CanBeHarmful(m, false))
                        {
                            from.DoHarmful(m);

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

                            damage += alchemyBonus;

                            #region Taran - Damage based on AR
                            if (m is PlayerMobile)
                            {
                                int armorRating = (int) ((PlayerMobile) m).BaseArmorRatingSpells;

                                damage = (int) (damage*1.5) - armorRating;

                                if (damage > 49)
                                    damage = 49;

                                if (damage < 15)
                                    damage = 15;
                            }
                            #endregion

                            /*
				        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 && direct )
				{
                    if (count > 4) //Only explode 5 pots at most including the used one
                        break;

				    BaseExplosionPotion pot = (BaseExplosionPotion)o;
				    Mobile m;

                    if (pot.m_Users != null && pot.m_Users[0] is Mobile)
                        m = (Mobile)pot.m_Users[0];
                    else
                        m = from;

					pot.Explode( m, false, pot.GetWorldLocation(), pot.Map );

                    count++;
				}
			}
		}
Esempio n. 44
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                from.RevealingAction();

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

                    if ( m_Creature.Unprovokable || ( creature != null && creature.Unprovokable ) )
                    {
                        from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures.
                    }
                    else if ( m_Creature.Map != targ.Map || !m_Creature.InRange( targ, 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 != targ )
                    {
                        if ( from == targ )
                        {
                            from.SendAsciiMessage( "Maybe you should just attack it." );
                            return;
                        }

                        if ( from.CanBeHarmful( m_Creature, true ) && from.CanBeHarmful( targ, true ) )
                        {
                            // provoking a guard, or provoking to attack a positive creature is bad
                            if ( m_Creature is BaseGuard || m_Creature is BaseShieldGuard || targ is BaseGuard || targ is BaseShieldGuard )
                            {
                                from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures.
                                Server.Misc.Titles.AlterNotoriety( from, -40 );
                                return;
                            }
                            else if ( Notoriety.Compute( from, targ ) == Notoriety.Innocent )
                            {
                                Misc.Titles.AlterNotoriety( from, -10 );
                            }

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

                                if ( !from.CheckTargetSkill( SkillName.Provocation, targ, 0, 110 ) )//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, targ, true );
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage( 501593 ); // You can't tell someone to attack themselves!
                    }
                }
            }
Esempio n. 45
0
        public virtual void DoAreaAttack( Mobile from, Mobile defender, int sound, int hue, int phys, int fire, int cold, int pois, int nrgy )
        {
            Map map = from.Map;

            if ( map == null )
                return;

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

            int range = Core.ML ? 5 : 10;

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

            if ( list.Count == 0 )
                return;

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

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

                double scalar = Core.ML ? 1.0 : ( 11 - from.GetDistanceToSqrt( m ) ) / 10;
                double damage = GetBaseDamage( from );

                if(scalar <= 0)
                {
                    continue;
                }
                else if( scalar < 1.0 )
                {
                    damage *= ( 11 - from.GetDistanceToSqrt( m ) ) / 10;
                }

                from.DoHarmful( m, true );
                m.FixedEffect( 0x3779, 1, 15, hue, 0 );
                AOS.Damage(m, from, (int)damage, phys, fire, cold, pois, nrgy);
            }
        }
Esempio n. 46
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                from.RevealingAction();

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

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

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

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

                        if ( from.CanBeHarmful( m_Creature, true ) && from.CanBeHarmful( creature, true ) )
                        {
                            if ( !BaseInstrument.CheckMusicianship( from ) )
                            {
                                from.SendAsciiMessage( "You play poorly, and there is no effect." );
                                m_Instrument.PlayInstrumentBadly( from );
                                m_Instrument.ConsumeUse( from );
                            }
                            else
                            {
                                from.DoHarmful( m_Creature );
                                from.DoHarmful( creature );

                                if ( !from.CheckTargetSkill( SkillName.Provocation, creature, 0, 100 ) )
                                {
                                    from.SendAsciiMessage( "Your music fails to incite enough anger." );
                                    m_Instrument.PlayInstrumentBadly( from );
                                    m_Instrument.ConsumeUse( from );
                                }
                                else
                                {
                                    from.SendAsciiMessage( "Your music succeeds, as you start a fight." );
                                    m_Instrument.PlayInstrumentWell( from );
                                    m_Instrument.ConsumeUse( from );
                                    m_Creature.Provoke( from, creature, true );
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendAsciiMessage( "You can't tell someone to attack themselves!" );
                    }
                }
            }
Esempio n. 47
0
        public void Explode(Mobile from, Point3D loc, Map map, bool detonatenearby)
        {
            if (Deleted)
                return;

            if (!m_MoveOnUse)
                loc = target;

            if ((m_DeleteOnUse && !EventItem) || (EventItem && EventItemConsume))
                Consume();
            else
            {
                if (m_DeleteOnUse)
                {
                    Mobile m;
                    if (m_Users != null && m_Users[0] is Mobile)
                        m = (Mobile) m_Users[0];
                    else
                        m = from;

                    if (RootParentEntity != m)
                        m.AddToBackpack(this);
                }

                m_Timer = null;
            }

            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.ThrowableItem == this)
                    Target.Cancel(m);
            }

            if (map == null)
                return;

            if (m_DetonationSound > 0)
                Effects.PlaySound(loc, map, m_DetonationSound);

            if (m_DetonationEffect > 0 && m_DetonationEffectDuration > 0)
            {
                if (m_BlastRadius > 0)
                {
                    ArrayList effects = new ArrayList();

                    int startX = loc.X - m_BlastRadius;
                    int startY = loc.Y - m_BlastRadius;
                    int endX = loc.X + m_BlastRadius + 1;
                    int endY = loc.Y + m_BlastRadius + 1;

                    Point2D start = new Point2D(startX, startY);
                    Point2D end = new Point2D(endX, endY);

                    Rectangle2D rect = new Rectangle2D(start, end);

                    Point2D point;

                    for (int x = rect.Start.X; x < rect.End.X; ++x)
                        for (int y = rect.Start.Y; y < rect.End.Y; ++y)
                        {
                            point = new Point2D(x, y);
                            if (!effects.Contains(point))
                                effects.Add(point);
                        }

                    if (effects.Count < 500)
                    {
                        Point3D location;

                        foreach (Point2D p in effects)
                        {
                            location = new Point3D(p.X, p.Y, loc.Z + 2);
                            Effects.SendLocationEffect(location, map, m_DetonationEffect, m_DetonationEffectDuration, m_DetonationEffectHue - 1, 0);
                        }
                    }
                    else
                    {
                        PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Too big blast radius to create effects");
                        return;
                    }

                    effects.Clear();
                }
                else
                {
                    Effects.SendLocationEffect(loc, map, m_DetonationEffect, m_DetonationEffectDuration, m_DetonationEffectHue - 1, 0);
                }
            }

            if (m_TargetItemID > 0)
            {
                if (m_BlastRadius > 0)
                {
                    Point2D point;
                    ArrayList effects = new ArrayList();

                    int startX = loc.X - m_BlastRadius;
                    int startY = loc.Y - m_BlastRadius;
                    int endX = loc.X + m_BlastRadius + 1;
                    int endY = loc.Y + m_BlastRadius + 1;

                    Point2D start = new Point2D(startX, startY);
                    Point2D end = new Point2D(endX, endY);

                    Rectangle2D rect = new Rectangle2D(start, end);

                    for (int x = rect.Start.X; x < rect.End.X; ++x)
                        for (int y = rect.Start.Y; y < rect.End.Y; ++y)
                        {
                            point = new Point2D(x, y);
                            if (!effects.Contains(point))
                                effects.Add(point);
                        }

                    if (effects.Count < 500)
                    {
                        foreach (Point2D p in effects)
                        {
                            new ThrowableItemTargetItem(m_TargetItemDuration, m_TargetItemID)
                                {
                                    Name = m_TargetItemName,
                                    Hue = m_TargetItemHue,
                                    MinDamage = m_TargetItemMinDamage,
                                    MaxDamage = m_TargetItemMaxDamage,
                                    Location = new Point3D(p.X, p.Y, loc.Z + 2),
                                    Map = Map
                                };
                        }
                        if (m_MoveOnUse)
                            Location = new Point3D(X, Y, loc.Z + 2);
                    }
                    else
                    {
                        PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Too big blast radius to create target items");
                        return;
                    }

                    effects.Clear();
                }
                else
                {
                    new ThrowableItemTargetItem(m_TargetItemDuration, m_TargetItemID)
                    {
                        Name = m_TargetItemName,
                        Hue = m_TargetItemHue,
                        MinDamage = m_TargetItemMinDamage,
                        MaxDamage = m_TargetItemMaxDamage,
                        Location = loc,
                        Map = Map
                    };
                }

                
            }

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

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

            eable.Free();

            int min = m_MinDamage;
            int max = m_MaxDamage;

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

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

                    if (m_MaxDamage > 0)
                    {
                        GuardedRegion reg = (GuardedRegion)Region.Find(m.Location, m.Map).GetRegion(typeof(GuardedRegion));

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

                                int damage = Utility.RandomMinMax(min, max);
                                AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);
                            }
                        }

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

                                int damage = Utility.RandomMinMax(min, max);
                                AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);
                            }
                        }
                    }
                }

                else if (o is ThrowableItem && detonatenearby)
                {
                    ThrowableItem throwable = (ThrowableItem)o;
                    Mobile m;

                    if (throwable.m_Users != null && throwable.m_Users[0] is Mobile)
                        m = (Mobile)throwable.m_Users[0];
                    else
                        m = from;

                    target = throwable.GetWorldLocation();
                    throwable.Explode(m, throwable.GetWorldLocation(), throwable.Map, false);
                }
            }
        }
Esempio n. 48
0
		public virtual void DoAreaAttack(
			Mobile from, Mobile defender, int sound, int hue, int phys, int fire, int cold, int pois, int nrgy)
		{
			Map map = from.Map;

			if (map == null)
			{
				return;
			}

			var list = new List<Mobile>();

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

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

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

			// TODO: What is the damage calculation?

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

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

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

				from.DoHarmful(m, true);
				m.FixedEffect(0x3779, 1, 15, hue, 0);
				AOS.Damage(m, from, (int)(GetBaseDamage(from) * scalar), phys, fire, cold, pois, nrgy);
			}
		}
Esempio n. 49
0
        public virtual void DoAreaAttack( Mobile from, Mobile defender, int sound, int hue, int phys, int fire, int cold, int pois, int nrgy )
        {
            Map map = from.Map;

            if( map == null )
                return;

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

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

            if( list.Count == 0 )
                return;

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

            // TODO: What is the damage calculation?

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

                from.DoHarmful(m, true);
                m.FixedEffect(0x3779, 1, 15, hue, 0);
                AOS.Damage(m, from, (int)((GetBaseDamage(from) + 5)), phys, fire, cold, pois, nrgy);
            }
        }
Esempio n. 50
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 (creature.UnprovokableTarget)
					{
						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 ) ) )
					else if ( m_Creature.Map != creature.Map || !m_Creature.InRange( creature, m_Creature.RangePerception ) )
					{
						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.UtcNow + TimeSpan.FromSeconds( 7.0 );

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

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

						if ( from.CanBeHarmful( m_Creature, true ) && from.CanBeHarmful( creature, true ) )
						{
							if ( !BaseInstrument.CheckMusicianship( from ) )
							{
								from.NextSkillTime = DateTime.UtcNow + TimeSpan.FromSeconds( 5.05);
								from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
								m_Instrument.PlayInstrumentBadly( from );
								m_Instrument.ConsumeUse( from );
							}
							else
							{
								from.DoHarmful( m_Creature, true );
								from.DoHarmful( creature, true );

								if ( !from.CheckTargetSkill( SkillName.Provocation, creature, diff-25.0, diff+25.0 ) )
								{
									from.NextSkillTime = DateTime.UtcNow + TimeSpan.FromSeconds( 5.05 );
									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 );
								}
							}
						}
					}
					else
					{
						from.SendLocalizedMessage( 501593 ); // You can't tell someone to attack themselves!
					}
				}
				//allow for targetting a player
				else if( targeted is PlayerMobile )
				{
					PlayerMobile player = (PlayerMobile)targeted;

					if ( m_Creature.Unprovokable )
					{
						from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures.
					}
					else if ( m_Creature.Map != player.Map || 
						!m_Creature.InRange( player, 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.
						from.Target = new InternalFirstTarget( from, m_Instrument );
					}
					else //valid pair
					{
						from.NextSkillTime = DateTime.UtcNow + TimeSpan.FromSeconds( 10.0 );      //Appropriate skill delay for player provoke
						
						double diff = ((m_Instrument.GetDifficultyFor( m_Creature ) + m_Instrument.GetDifficultyFor( player )) * 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( player, 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( player );

								if ( !from.CheckTargetSkill( SkillName.Provocation, player, 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, player, true );
								}
							}
						}
					}
				}//end of else (target is player)
				
				else
				{
					from.SendLocalizedMessage( 501589 ); // You can't incite that!
				}
			}
		public void Explode(Mobile from, bool direct, Point3D loc, Map map)
		{
			if (Deleted)
			{
				return;
			}

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

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

			Consume();

			if (map == null)
			{
				return;
			}

			Effects.PlaySound(loc, map, 0x307);
			Effects.SendLocationEffect(loc, map, 0x36BD, 9, 10, 0, 0);

			int alchemyBonus = 0;

			if (direct)
			{
				alchemyBonus = (int)(from.Skills.Alchemy.Value * ExplosionPotionController._AlchemyBonusPercentageOfSkill * 0.01);
			}
			if (alchemyBonus > ExplosionPotionController._AlchemyBonusMax)
			{
				alchemyBonus = ExplosionPotionController._AlchemyBonusMax;
			}

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

			int toDamage = 0;

			foreach (IEntity o in eable)
			{
				if (o is Mobile &&
					(from == null || (SpellHelper.ValidIndirectTarget(from, (Mobile)o) && from.CanBeHarmful((Mobile)o, false))))
				{
					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)
				{
					var m = (Mobile)o;

					if (from != null)
					{
						from.DoHarmful(m);

						double damage = Scale(from, Damage);

						damage += alchemyBonus;

						if (damage > 30)
						{
							damage = 15;
						}

						if (toDamage > 2)
						{
							damage /= toDamage - 1;
						}

						if (m is BaseCreature && !((BaseCreature)m).TakesNormalDamage)
						{
							damage *= 1.4;
						}

						var iDamage = (int)damage;
						if ((XmlScript.HasTrigger(from, TriggerName.onGivenHit) &&
							 UberScriptTriggers.Trigger(from, m, TriggerName.onGivenHit, this, null, null, iDamage)) ||
							(XmlScript.HasTrigger(m, TriggerName.onTakenHit) &&
							 UberScriptTriggers.Trigger(m, from, TriggerName.onTakenHit, this, null, null, iDamage)))
						{
							return;
						}
						m.Damage(iDamage, from);
					}
				}
				else if (o is BaseExplosionPotion)
				{
					var pot = (BaseExplosionPotion)o;

					pot.Explode(from, false, pot.GetWorldLocation(), pot.Map);
				}
			}
		}
Esempio n. 52
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 );
			}
		}
Esempio n. 53
0
		public virtual void DoMagicArrow(Mobile attacker, Mobile defender)
		{
			if (!attacker.CanBeHarmful(defender, false))
			{
				return;
			}

			attacker.DoHarmful(defender);

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

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

			SpellHelper.Damage(TimeSpan.FromSeconds(1.0), defender, attacker, damage, 0, 100, 0, 0, 0);
		}
			public static void DODAMAGE(
				TriggerObject trigObj,
				IPoint2D target,
				Mobile from,
				int amount,
				int range,
				bool playeronly,
				bool mobsonly,
				int zRange)
			{
				if (target == null)
				{
					return;
				}

				// apply the damage to all mobs within range if range is > 0
				Map map = (target is IEntity) ? ((IEntity)target).Map : Map.Felucca;
				Mobile targetMob = target as Mobile;

				// if it's a death trigger, then don't do damage to trigObj.This (if you do, it results in an infinite loop!)
				Mobile dyingMob = (trigObj.TrigName == TriggerName.onDeath ? trigObj.This as Mobile : null);

				if (range >= 0)
				{
					Point3D target3D = (target is IPoint3D) ? new Point3D((IPoint3D)target) : new Point3D(target, 0);

					var rangelist = map.GetMobilesInRange(target3D, range);
					// don't do damage in a list like this--if mobs are killed it screws up the enumerator!
					// ... copy the list first
					var affected = new List<Mobile>();
					bool inZRange;

					foreach (Mobile p in rangelist)
					{
						if (zRange == -1)
						{
							inZRange = true;
						}
						else
						{
							inZRange = Math.Abs(target3D.Z - p.Z) <= zRange;
						}

						if (!inZRange)
						{
							continue;
						}

						if (p.Alive && (p is PlayerMobile && !mobsonly) || (p is BaseCreature && !playeronly))
						{
							affected.Add(p);
						}
					}

					rangelist.Free();

					foreach (Mobile mob in affected.Where(mob => mob != dyingMob))
					{
						if (from != null)
						{
							if (from.CanBeHarmful(mob))
							{
								from.DoHarmful(mob);
								mob.Damage(amount, from);
							}
						}
						else
						{
							mob.Damage(amount, mob);
						}
					}
				} // range of -1 means hit only the target
				else if ((targetMob is PlayerMobile && !mobsonly) || (targetMob is BaseCreature && !playeronly))
				{
					if (targetMob.Alive && targetMob != dyingMob)
					{
						if (from != null)
						{
							if (from.CanBeHarmful(targetMob))
							{
								from.DoHarmful(targetMob);
								targetMob.Damage(amount, from);
							}
						}
						else
						{
							targetMob.Damage(amount, targetMob);
						}
					}
				}
			}
Esempio n. 55
0
		public virtual void DoFireball(Mobile attacker, Mobile defender)
		{
			if (!attacker.CanBeHarmful(defender, false))
			{
				return;
			}

			attacker.DoHarmful(defender);

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

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

			SpellHelper.Damage(TimeSpan.FromSeconds(1.0), defender, attacker, damage, 0, 100, 0, 0, 0);
		}
Esempio n. 56
0
		public static void Damage(Spell spell, TimeSpan delay, Mobile target, Mobile from, double damage)
		{
			var iDamage = (int)damage;

			if (delay == TimeSpan.Zero)
			{
				// return if return override has been encountered
				// NOTE this would skip an XmlOnHit attachment's action
				if ((XmlScript.HasTrigger(from, TriggerName.onGivenHit) &&
					 UberScriptTriggers.Trigger(from, target, TriggerName.onGivenHit, null, null, spell, iDamage)) ||
					(XmlScript.HasTrigger(target, TriggerName.onTakenHit) &&
					 UberScriptTriggers.Trigger(target, from, TriggerName.onTakenHit, null, null, spell, iDamage)))
				{
					return;
				}

				if (from != null)
				{
					from.DoHarmful(target);
					if (from is BaseCreature)
					{
						((BaseCreature)from).AlterSpellDamageTo(target, ref iDamage);
					}
				}

				if (target is BaseCreature)
				{
					((BaseCreature)target).AlterSpellDamageFrom(from, ref iDamage);
				}

				target.Damage(iDamage, from);

				if (from is BaseCreature && target != null && delay == TimeSpan.Zero)
				{
					((BaseCreature)from).OnGaveSpellDamage(target);
				}

				if (target is BaseCreature && from != null && delay == TimeSpan.Zero)
				{
					var c = (BaseCreature)target;

					c.OnHarmfulSpell(from);
					c.OnDamagedBySpell(from);
				}
			}
			else
			{
				if (target.Player)
				{
					from.DoHarmful(target);
				}
				new SpellDamageTimer(spell, target, from, iDamage, delay).Start();
			}
		}
Esempio n. 57
0
		public virtual void DoDispel(Mobile attacker, Mobile defender)
		{
			bool dispellable = false;

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

			if (!dispellable)
			{
				return;
			}

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

			attacker.DoHarmful(defender);

			MagerySpell sp = new DispelSpell(attacker, null);

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

				defender.Delete();
			}
		}
Esempio n. 58
0
		public static void CheckReflect(int circle, ref Mobile caster, ref Mobile target)
		{
			bool reflect = false;

			if (target.MagicDamageAbsorb > 0)
			{
				++circle;

				target.MagicDamageAbsorb -= circle;

				reflect = (target.MagicDamageAbsorb >= 0);

				if (target.MagicDamageAbsorb <= 0)
				{
					target.MagicDamageAbsorb = 0;
					DefensiveSpell.Nullify(target);
				}
			}

			if (target is BaseCreature)
			{
				((BaseCreature)target).CheckReflect(caster, ref reflect);
			}

			if (reflect)
			{
				target.FixedEffect(0x37B9, 10, 5);

				//if ( target.Spell != null && target.Spell.IsCasting )
				//	((Spell)target.Spell).Disturb( DisturbType.Hurt, false, false );

                caster.DoHarmful(target);
				Mobile temp = caster;
				caster = target;
				target = temp;
			}
		}
Esempio n. 59
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				from.RevealingAction();

				if ( !(targeted is Mobile) )
				{
					from.SendLocalizedMessage( 1049528 ); // You cannot calm that!
				}
				else
				{
					m_SetSkillTime = false;
					from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 );

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

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

							Map map = from.Map;

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

								bool calmed = false;

								IPooledEnumerable eable = from.GetMobilesInRange( range );
								foreach ( Mobile m in eable)
								{
                                    // execute the new Peace Action, and allow the NPC to speak out!
                                    if (m is BaseCreature)
                                        ((BaseCreature)m).OnPeace();

									if ( (m is BaseCreature && ((BaseCreature)m).Uncalmable) || m == from || !from.CanBeHarmful( m, false ) )
										continue;

									calmed = true;

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

									if ( m is BaseCreature && !((BaseCreature)m).BardPacified )
										((BaseCreature)m).Pacify( from, DateTime.Now + TimeSpan.FromSeconds( 1.0 ) );
								}
								eable.Free();

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

						// wea: made this an aggressive action
						from.DoHarmful( targ );

                        // execute the new Peace Action, and allow the NPC to speak out!
                        if (targ is BaseCreature)
                            ((BaseCreature)targ).OnPeace();
                        
						if ( !from.CanBeHarmful( targ, false ) )
						{
							from.SendLocalizedMessage( 1049528 );
							m_SetSkillTime = true;
						}
						else if ( targ is BaseCreature && ((BaseCreature)targ).Uncalmable )
						{
							from.SendLocalizedMessage( 1049526 ); // You have no chance of calming that creature.
							m_SetSkillTime = true;
						}
						else if ( targ is BaseCreature && ((BaseCreature)targ).BardPacified )
						{
							from.SendLocalizedMessage( 1049527 ); // That creature is already being calmed.
							m_SetSkillTime = true;
						}
						else if ( !BaseInstrument.CheckMusicianship( from ) )
						{
							from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
							m_Instrument.PlayInstrumentBadly( from );
							m_Instrument.ConsumeUse( from );
						}
						else
						{
							double diff = m_Instrument.GetDifficultyFor( targ ) - 10.0;
							double music = from.Skills[SkillName.Musicianship].Value;

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

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

								if ( targ is BaseCreature )
								{
									BaseCreature bc = (BaseCreature)targ;
									from.SendLocalizedMessage(1049532); // You play hypnotic music, calming your target.

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

									double seconds = 100 - (diff / 1.5);

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

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

									targ.SendLocalizedMessage( 500616 ); // You hear lovely music, and forget to continue battling!
									targ.Combatant = null;
									targ.Warmode = false;
								}
							}
						}
					}
				}
			}
Esempio n. 60
0
            protected override void OnTarget(Mobile from, object obj)
            {
                if (this.m_Bola.Deleted)
                    return;

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

                    if (!this.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);

                        if (Core.AOS)
                        {
                            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));

                        this.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.
                }
            }