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

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

			hashtbl[target] = timer;

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

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

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

			from.DoHarmful( target );

			return;
		}
コード例 #2
0
ファイル: Poison.cs プロジェクト: MythikGN/Mythik
            protected override void OnTick()
            {
                Interval      = m_baseInterval + TimeSpan.FromSeconds(Utility.Random(4));
                m_skillLevel -= 50;
                if (m_Index++ == m_Poison.m_Count || m_skillLevel < 50)
                {
                    m_Mobile.SendLocalizedMessage(502136); // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }


                if (m_skillLevel < 800 && m_PLevel == 3)
                {
                    m_PLevel = 2;
                    m_dmg   -= 2;
                }
                if (m_skillLevel < 400 && m_PLevel == 2)
                {
                    m_PLevel = 1;
                    m_dmg   -= 2;
                }
                if (m_skillLevel < 200 && m_PLevel == 1)
                {
                    m_PLevel = 0;
                    m_dmg   -= 2;
                }



                m_LastDamage = m_dmg;


                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }


                AOS.Damage(m_Mobile, m_From, m_dmg, 0, 0, 0, 100, 0);

                if (0.60 <= Utility.RandomDouble()) // OSI: randomly revealed between first and third damage tick, guessing 60% chance
                {
                    m_Mobile.RevealingAction();
                }

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.LocalOverheadMessage(MessageType.Regular, 0x21, true, "You feel " + m_messages[m_PLevel]);
                    m_Mobile.NonlocalOverheadMessage(MessageType.Regular, 0x21, true, "looks " + m_messages[m_PLevel]);
                }
                m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
            }
コード例 #3
0
            protected override void OnTick()
            {
                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage;

                if (m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

//				AOS.Damage( m_Mobile, m_From, damage, 0, 0, 0, 100, 0 );
                m_Mobile.Damage(damage, m_From);

                if (0.60 <= Utility.RandomDouble())   // OSI: randomly revealed between first and third damage tick, guessing 60% chance
                {
                    m_Mobile.RevealingAction();
                }

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
コード例 #4
0
ファイル: RustEffect.cs プロジェクト: justdanofficial/khaeros
        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( source != to )
                source.DoHarmful( to );
            int chance = Utility.RandomMinMax( 1, 8 );
            string sundname = "";

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

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

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

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

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

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

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

                to.Emote( "*got {0} {1} damaged by {2}*", to.Female == true ? "her" : "his", sundname, source.Name );
            }
        }
コード例 #5
0
ファイル: Poison.cs プロジェクト: zerodowned/Origins
            protected override void OnTick()
            {
                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendAsciiMessage("The poison seems to have worn off.");                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomMinMax(1, 3) != 1)
                {
                    damage = m_LastDamage;
                }
                else
                {
                    //damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);
                    damage = 2 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);

                    /*if ( damage < m_Poison.m_Minimum )
                     *      damage = m_Poison.m_Minimum;
                     * else if ( damage > m_Poison.m_Maximum )
                     *      damage = m_Poison.m_Maximum;*/

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                IHonorTarget honorTarget = m_Mobile as IHonorTarget;

                if (honorTarget != null && honorTarget.ReceivedHonorContext != null)
                {
                    honorTarget.ReceivedHonorContext.OnTargetPoisoned();
                }

                AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0);

                //if ( (m_Index % m_Poison.m_MessageInterval) == 0 )
                //	m_Mobile.OnPoisoned( m_From, m_Poison, m_Poison );
            }
コード例 #6
0
        public static void IcyWindAttack(Mobile from, Mobile target)
        {
            Effects.PlaySound(from.Location, from.Map, 0x1FB);
            Effects.PlaySound(from.Location, from.Map, 0x10B);
            Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x37CC, 1, 40, 97, 3, 9917, 0);

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

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

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

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

            from.DoHarmful(target);
        }
コード例 #7
0
        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            bool curse = false;
            if ( intensity < 0 )
            {
                if ( source != to )
                    source.DoHarmful( to );

                curse = true;
                intensity*=-1;
            }

            int offset = (int)( intensity * Divisor );
            TimeSpan duration = TimeSpan.FromSeconds( (int)( ( Math.Abs( intensity ) * 15) * Divisor ) );
            if ( !Spells.SpellHelper.AddStatOffset( to, StatType.Dex, ( curse ? -1 : 1 ) * ( BasePotion.Scale( to, Math.Abs( offset ) ) ), duration ) )
                to.SendLocalizedMessage( 502173 ); // You are already under a similar effect.
        }
コード例 #8
0
ファイル: Pugilist.cs プロジェクト: greeduomacro/hubroot
        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!");
                    }
                }
            }
        }
コード例 #9
0
        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( source != to && intensity < 0 )
                source.DoHarmful( to );

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

                else
                    return;
            }

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

                if ( source != to ) // if it was thrown or something
                    source.DoHarmful( to );
            }
        }
コード例 #11
0
ファイル: LightningArrow.cs プロジェクト: Ravenwolfe/xrunuo
        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 );
                    }
                }
            }
        }
コード例 #12
0
        public static void LifeforceDrainAttack(Mobile from, Mobile target)
        {
            int toDrain = 6 + (int)((120 - target.Skills[SkillName.MagicResist].Value) / 10);

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

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

            target.Damage(toDrain, from);

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

            from.Heal(toDrain);

            from.DoHarmful(target);

            return;
        }
コード例 #13
0
        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( intensity < 0 || to.Paralyzed )
                return;

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

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

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

            IMount mt = target.Mount;

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

            if (target is PlayerMobile)
            {
                target.BeginAction(typeof(BaseMount));

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

                target.EndAction(typeof(BaseMount));
            }

            from.DoHarmful(target);
        }
コード例 #15
0
        public static void DismountAttack( Mobile from, Mobile target )
        {
            target.Damage( 1, from );

            IMount mt = target.Mount;

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

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

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

                target.EndAction( typeof( BaseMount ) );
            }

            from.DoHarmful( target );
        }
コード例 #16
0
        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( source != to && intensity < 0 )
                source.DoHarmful( to );

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

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

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

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

                if ( seconds < 1 )
                    seconds = 1;

                duration = TimeSpan.FromSeconds( seconds );
                to.CantWalk = true;
                Timer.DelayCall( duration, new TimerStateCallback( ReleaseMobile ), to );
                to.SendMessage( "Your feet have been glued to the ground!" );
            }
        }
コード例 #18
0
ファイル: Bola.cs プロジェクト: Godkong/RunUO
			protected override void OnTarget( Mobile from, object obj )
			{
				if ( m_Bola.Deleted )
					return;

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

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

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

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

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

						from.DoHarmful( to );

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

						m_Bola.Consume();

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

						Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback( FinishThrow ), new object[]{ from, to } );
					}
					else
					{
						from.SendLocalizedMessage( 1049624 ); // You have to wait a few moments before you can use another bola!
					}
				}
				else
				{
					from.SendLocalizedMessage( 1049629 ); // You cannot throw a bola at that.
				}
			}
コード例 #19
0
		public static void ThrowBomb( Mobile m, Mobile bomber )
		{
			m.DoHarmful( m );

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

			new BomberTimer( m, bomber ).Start();
		}
コード例 #20
0
        public static void IcyWindAttack( Mobile from, Mobile target )
        {
            Effects.PlaySound( from.Location, from.Map, 0x1FB );
            Effects.PlaySound( from.Location, from.Map, 0x10B );
            Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x37CC, 1, 40, 97, 3, 9917, 0 );

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

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

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

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

            from.DoHarmful( target );
        }
コード例 #21
0
            protected override void OnTick()
            {
                if (m_Mobile is NubiaPlayer)
                {
                    if (((NubiaPlayer)m_Mobile).hasDon(DonEnum.CorpDiamant))
                    {
                        m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                      "* Votre corps est imunisé contre le poison *");

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                         String.Format("* {0} ne semble pas affecté par le poison *", m_Mobile.Name));

                        Stop();
                        return;
                    }
                }

                if ((Core.AOS && m_Poison.Level < 4 && TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) ||
                    (m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)) ||
                    AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                      "* You feel yourself resisting the effects of the poison *");

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                         String.Format("* {0} seems resistant to the poison *", m_Mobile.Name));

                        Stop();
                        return;
                    }
                }

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                IHonorTarget honorTarget = m_Mobile as IHonorTarget;

                if (honorTarget != null && honorTarget.ReceivedHonorContext != null)
                {
                    honorTarget.ReceivedHonorContext.OnTargetPoisoned();
                }

                AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0);

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
コード例 #22
0
ファイル: FireHorn.cs プロジェクト: Godkong/Origins
        public void Use( Mobile from, IPoint3D loc )
        {
            if ( !CheckUse( from ) )
                return;

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

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

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

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

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

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

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

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

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

                    targets.Add( m );

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

            eable.Free();

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

                int minDamage, maxDamage;

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

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

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

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

                    if ( playerVsPlayer )
                        total /= 3;

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

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

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

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

                    double toDeal = damage;

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

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

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

            double breakChance = Core.AOS ? 0.01 : 0.16;
            if ( Utility.RandomDouble() < breakChance )
            {
                from.SendLocalizedMessage( 1049619 ); // The fire horn crumbles in your hands.
                this.Delete();
            }
        }
コード例 #23
0
ファイル: Poison.cs プロジェクト: keninishna/ServUO-master
            protected override void OnTick()
            {
                #region Mondain's Legacy
                if ((Core.AOS && m_Poison.RealLevel < 4 &&
                     TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) ||
                    (m_Poison.RealLevel < 3 && OrangePetals.UnderEffect(m_Mobile)) ||
                    AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.LocalOverheadMessage(
                            MessageType.Emote, 0x3F, true, "* You feel yourself resisting the effects of the poison *");

                        m_Mobile.NonlocalOverheadMessage(
                            MessageType.Emote, 0x3F, true, String.Format("* {0} seems resistant to the poison *", m_Mobile.Name));

                        Stop();
                        return;
                    }
                }
                #endregion

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                     // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                IHonorTarget honorTarget = m_Mobile as IHonorTarget;
                if (honorTarget != null && honorTarget.ReceivedHonorContext != null)
                {
                    honorTarget.ReceivedHonorContext.OnTargetPoisoned();
                }

                #region Mondain's Legacy
                if (Core.ML)
                {
                    if (m_From != null && m_Mobile != m_From && !m_From.InRange(m_Mobile.Location, 1) && m_Poison.m_Level >= 10 &&
                        m_Poison.m_Level <= 13)                         // darkglow
                    {
                        m_From.SendLocalizedMessage(1072850);           // Darkglow poison increases your damage!

                        Stop();

                        new DarkglowTimer(m_Mobile, m_From, m_Poison, m_Index).Start();
                    }

                    if (m_From != null && m_Mobile != m_From && m_From.InRange(m_Mobile.Location, 1) && m_Poison.m_Level >= 14 &&
                        m_Poison.m_Level <= 18)                         // parasitic
                    {
                        Stop();

                        new ParasiticTimer(m_Mobile, m_From, m_Poison, m_Index).Start();
                    }
                }
                #endregion

                AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0);

                if (0.60 <= Utility.RandomDouble())
                // OSI: randomly revealed between first and third damage tick, guessing 60% chance
                {
                    m_Mobile.RevealingAction();
                }

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
コード例 #24
0
ファイル: Poison.cs プロジェクト: zerodowned/UO-Forever
            protected override void OnTick()
            {
                if ((m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                      "* You feel yourself resisting the effects of the poison *");

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                         String.Format("* {0} seems resistant to the poison *", m_Mobile.Name));

                        Stop();
                        return;
                    }
                }

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                if (Interval == m_Poison.m_Delay)
                {
                    Interval = m_Poison.m_Interval;
                }
                else                 //if ( Delay == m_Poison.m_Interval )
                {
                    Interval = m_Poison.m_Delay;
                }

                int damage;

                if (m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                if (XmlScript.HasTrigger(m_Mobile, TriggerName.onPoisonTick) && UberScriptTriggers.Trigger(m_Mobile, m_From, TriggerName.onPoisonTick, null, null, null, damage))
                {
                    return;
                }

                m_Mobile.Damage(damage, m_From);

                //if ( Utility.RandomBool() ) // OSI: randomly revealed between first and third damage tick, guessing 60% chance
                //		m_Mobile.RevealingAction();

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
コード例 #25
0
        public void Explode( Mobile from, Point3D loc, Map map )
        {
            if ( Deleted )
                return;

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

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

            if ( map == null )
                return;

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

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

            eable.Free();

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

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

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

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

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

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

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

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

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

            Delete();
        }
コード例 #26
0
ファイル: Bola.cs プロジェクト: FreeReign/Rebirth-Repack
            protected override void OnTarget( Mobile from, object obj )
            {
                if ( m_Bola.Deleted )
                    return;

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

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

                        m_Bola.Consume();

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

                        Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback( FinishThrow ), new object[]{ from, to } );
                    }
                    else
                    {
                        from.SendLocalizedMessage( 1049624 ); // You have to wait a few moments before you can use another bola!
                    }
                }
                else
                {
                    from.SendLocalizedMessage( 1049629 ); // You cannot throw a bola at that.
                }
            }
コード例 #27
0
ファイル: Bola.cs プロジェクト: cynricthehun/UOLegends
            protected override void OnTarget( Mobile from, object obj )
            {
                if ( m_Bola.Deleted )
                    return;

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

                    if ( !m_Bola.IsChildOf( from.Backpack ) )
                    {
                        from.SendAsciiMessage( "The bola must be in your pack to use it." );
                    }
                    else if ( !Core.AOS && (from.FindItemOnLayer( Layer.OneHanded ) != null || from.FindItemOnLayer( Layer.TwoHanded ) != null) )
                    {
                        from.SendAsciiMessage( "Your hands must be free to use this." );
                    }
                    else if ( from.Mounted )
                    {
                        from.SendAsciiMessage( "You cannot use this while riding a mount." );
                    }
                    else if ( !to.Mounted )
                    {
                        from.SendAsciiMessage( "You have no reason to throw a bola at that." );
                    }
                    else if ( !from.CanBeHarmful( to ) )
                    {
                    }
                    else if ( from.BeginAction( typeof( Bola ) ) )
                    {
                        EtherealMount.StopMounting( from );

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

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

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

                        from.DoHarmful( to );

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

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

                        m_Bola.Consume();

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

                        Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback( FinishThrow ), new object[]{ from, to } );
                    }
                    else
                    {
                        from.SendAsciiMessage( "You have to wait a few moments before you can use another bola!" );
                    }
                }
                else
                {
                    from.SendAsciiMessage( "You cannot throw a bola at that." );
                }
            }
コード例 #28
0
ファイル: BaseDoorTrap.cs プロジェクト: greeduomacro/hubroot
		public virtual void ExecuteTrap( Mobile from )
		{
			from.DoHarmful( Owner, true );
			from.RevealingAction();
			from.SendMessage( "You've set off a trap!" );
		}
コード例 #29
0
ファイル: Poison.cs プロジェクト: zerodowned/genovaproject-1
            protected override void OnTick()
            {
                if ((Core.AOS && m_Poison.Level < 4 && TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) ||
                    (m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)) ||
                    AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                      "* You feel yourself resisting the effects of the poison *");

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                         String.Format("* {0} seems resistant to the poison *", m_Mobile.Name));

                        Stop();
                        return;
                    }
                }

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                IHonorTarget honorTarget = m_Mobile as IHonorTarget;

                if (honorTarget != null && honorTarget.ReceivedHonorContext != null)
                {
                    honorTarget.ReceivedHonorContext.OnTargetPoisoned();
                }

                // Genova: suporte ao UO:ML.
                #region Mondain's Legacy
                if (m_Mobile != m_From && m_From.InRange(m_Mobile.Location, 1) && Utility.InsensitiveCompare(m_Poison.Name, "Parasitic") == 0)
                {
                    m_From.Heal((int)(damage * 0.4));                          // TODO check
                }
                #endregion

                AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0);

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
コード例 #30
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.SendLocationParticles( EffectItem.Create( loc, map, EffectItem.DefaultDuration ), 0x36B0, 1, 14, 63, 7, 9915, 0 );
			Effects.PlaySound( loc, map, 0x229 );

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

			int toDamage = 0;

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

			eable.Free();

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

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

					if ( from == null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) )
					{
						if ( from != null )
							from.DoHarmful( m );
							
						int level = 0;
						if( this.PotionEffect == PotionEffect.ExplosionLesser )
						{
							level = 1;
						}
						else if ( this.PotionEffect == PotionEffect.Explosion )
						{
							level = 2;
						}
						else if ( this.PotionEffect == PotionEffect.ExplosionGreater )
						{
							level = 3;
						}
							
						m.ApplyPoison( from, Poison.GetPoison(level) );
					}
				}
				else if ( o is BasePoisonExplosionPotion )
				{
					BasePoisonExplosionPotion pot = (BasePoisonExplosionPotion)o;

					pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
				}
			}
		}
コード例 #31
0
        public override bool DoEffect(Mobile from, Mobile target)
        {
            if ( from.CanSee( target ) && from.CanBeHarmful( target ) && from.InLOS( target ) && target.Alive )
            {
                from.DoHarmful( target );
                SpellHelper.Turn( from, target );

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

                target.Paralyzed = false;

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

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

                return true;
            }

            return false;
        }
コード例 #32
0
        public void ResolveCannonHit(Mobile from, Point3D targetLocation)
        {
            ArrayList validTargets = new ArrayList();

            Map map = Map;

            BaseBoat boatFrom   = BaseBoat.FindBoatAt(from.Location, map);
            BaseBoat targetBoat = BaseBoat.FindBoatAt(targetLocation, map);

            bool hitObject     = false;
            bool hitBoat       = false;
            bool showExplosion = true;

            IPooledEnumerable nearbyMobiles = map.GetMobilesInRange(targetLocation, BaseBoat.CannonExplosionRange);

            foreach (Mobile mobile in nearbyMobiles)
            {
                if (!validTargets.Contains(mobile))
                {
                    validTargets.Add(mobile);
                }
            }

            nearbyMobiles.Free();

            List <Mobile> m_MobilesOnSourceBoat = new List <Mobile>();
            List <Mobile> m_Targets             = new List <Mobile>();

            double baseCannonDamage = (double)(Utility.RandomMinMax(BaseBoat.CannonDamageMin, BaseBoat.CannonDamageMax));

            if (m_Boat == null)
            {
                m_MobilesOnSourceBoat.Add(from);
            }

            else
            {
                baseCannonDamage = m_Boat.CannonDamageScalar * baseCannonDamage;

                m_MobilesOnSourceBoat = m_Boat.GetMobilesOnBoat(false, false);
            }

            bool targetLocationIsBoat = false;

            if (targetBoat != null)
            {
                targetLocationIsBoat = true;
                m_Targets            = targetBoat.GetMobilesOnBoat(false, false);

                validTargets.Add(targetBoat);
            }

            else
            {
                m_Targets = new List <Mobile>();
            }

            double damageDealt;

            for (int a = 0; a < validTargets.Count; ++a)
            {
                damageDealt = baseCannonDamage;

                object target = validTargets[a];

                int d      = 0;
                int damage = 0;

                bool largeCreatureHit = false;

                PlayerMobile pm_Target;
                BaseCreature bc_Target;

                //Large Boss-Size Creature Hit: Don't Deal Damage to Boat Underneath it
                if (target is Mobile)
                {
                    bc_Target = target as BaseCreature;

                    if (bc_Target != null)
                    {
                        if (bc_Target.IsChamp() || bc_Target.IsBoss() || bc_Target.IsLoHBoss() || bc_Target.IsEventBoss())
                        {
                            largeCreatureHit = true;
                        }
                    }
                }

                if (target is Mobile)
                {
                    Mobile mobile = target as Mobile;

                    pm_Target = mobile as PlayerMobile;
                    bc_Target = mobile as BaseCreature;

                    if (!mobile.Alive)
                    {
                        continue;
                    }

                    //Mobile is somehow on boat that cannon is shooting from
                    BaseBoat mobileBoat = BaseBoat.FindBoatAt(mobile.Location, mobile.Map);

                    if (m_Boat != null && mobileBoat != null)
                    {
                        if (m_Boat == mobileBoat)
                        {
                            continue;
                        }
                    }

                    hitObject = true;

                    bool dealDamage = true;
                    bool directHit  = false;

                    if (mobile.InRange(targetLocation, 0))
                    {
                        directHit = true;
                    }

                    bool isOnWater = BaseBoat.IsWaterTile(mobile.Location, mobile.Map);

                    if (from != null || (SpellHelper.ValidIndirectTarget(from, mobile) && from.CanBeHarmful(mobile, false)))
                    {
                        //Player
                        if (pm_Target != null)
                        {
                            damageDealt *= BaseBoat.CannonPlayerDamageMultiplier;
                        }

                        //Creature
                        if (bc_Target != null)
                        {
                            if (bc_Target.IsOceanCreature)
                            {
                                damageDealt *= BaseBoat.CannonOceanCreatureDamageMultiplier;
                            }

                            else
                            {
                                damageDealt *= BaseBoat.CannonMobileDamageMultiplier;
                            }
                        }

                        if (!directHit)
                        {
                            damageDealt *= BaseBoat.CannonIndirectHitDamageMultiplier;
                        }

                        if (dealDamage)
                        {
                            from.DoHarmful(mobile);

                            int finalDamage = (int)Math.Round(damageDealt);

                            BaseCreature bc_Creature = mobile as BaseCreature;

                            if (bc_Creature != null)
                            {
                                bool willKill = false;

                                if (bc_Creature.Hits - finalDamage <= 0)
                                {
                                    willKill = true;
                                }

                                bc_Creature.OnGotCannonHit(finalDamage, from, willKill);
                            }

                            new Blood().MoveToWorld(mobile.Location, mobile.Map);
                            AOS.Damage(mobile, from, finalDamage, 100, 0, 0, 0, 0);
                        }
                    }
                }

                else if (target is DerelictCargo)
                {
                    DerelictCargo crate = target as DerelictCargo;
                    crate.TakeDamage(from, (int)damageDealt);
                }

                else if (target is BaseBoat && !largeCreatureHit)
                {
                    BaseBoat boatTarget = target as BaseBoat;

                    if (from != null && m_Boat != null && boatTarget != null)
                    {
                        //Somehow Hitting Own Boat
                        if (m_Boat == boatTarget)
                        {
                            continue;
                        }

                        CannonDoHarmful(from, m_MobilesOnSourceBoat, m_Targets);

                        hitObject = true;
                        hitBoat   = true;

                        bool dealDamage = true;

                        if (dealDamage)
                        {
                            DamageType damageType = boatTarget.GetDamageTypeByTargetingMode(m_Boat.TargetingMode);

                            int finalDamage = (int)(Math.Round(damageDealt));

                            boatTarget.ReceiveDamage(from, m_Boat, finalDamage, damageType);
                        }
                    }
                }
            }

            if (hitObject)
            {
                IEntity explosionLocationEntity = new Entity(Serial.Zero, new Point3D(targetLocation.X, targetLocation.Y, targetLocation.Z - 1), map);

                int explosionHue   = 0;
                int explosionSound = 0x307;

                if (m_Boat.MobileFactionType == MobileFactionType.Undead)
                {
                    explosionHue   = 2630;
                    explosionSound = 0x56E;
                }

                if (showExplosion)
                {
                    Effects.SendLocationParticles(explosionLocationEntity, Utility.RandomList(14013, 14015, 14027, 14012), 30, 7, explosionHue, 0, 5044, 0);
                    Effects.PlaySound(explosionLocationEntity.Location, map, explosionSound);
                }
            }

            else
            {
                Splash(targetLocation, map);
            }
        }
コード例 #33
0
        public void Explode( Mobile from, bool direct, Point3D loc, Map map )
        {
            if ( Deleted )
                return;

            Consume();

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

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

            if ( map == null )
                return;

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

            int alchemyBonus = 0;

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

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

            int toDamage = 0;

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

            eable.Free();

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

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

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

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

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

                        damage += alchemyBonus;

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

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

                    pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
                }
            }
        }
コード例 #34
0
 public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
 {
     if ( to != source )
         source.DoHarmful( to );
 }
コード例 #35
0
ファイル: Poison.cs プロジェクト: Pumpk1ns/outlands
            protected override void OnTick()
            {
                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                double damage;

                damage = 1 + ((double)m_Mobile.HitsMax * m_Poison.m_Scalar);

                double minimum = m_Poison.m_Minimum;
                double maximum = m_Poison.m_Maximum;

                PlayerMobile pm_From = m_From as PlayerMobile;
                BaseCreature bc_From = m_From as BaseCreature;

                PlayerMobile pm_Target = m_Mobile as PlayerMobile;
                BaseCreature bc_Target = m_Mobile as BaseCreature;

                if (bc_Target != null)
                {
                    bc_Target.m_TakenDamageFromPoison = true;
                }

                if (pm_From != null && bc_Target != null)
                {
                    double poisonDamageScalar = 1.0;

                    DungeonArmor.PlayerDungeonArmorProfile poisonerDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(pm_From, null);

                    if (poisonerDungeonArmor.MatchingSet && !poisonerDungeonArmor.InPlayerCombat)
                    {
                        poisonDamageScalar = poisonerDungeonArmor.DungeonArmorDetail.PoisonDamageInflictedScalar;
                    }

                    minimum = (double)minimum * 1.5 * poisonDamageScalar;
                    maximum = (double)maximum * 1.5 * poisonDamageScalar;
                }

                if (bc_From != null && pm_Target != null)
                {
                    double poisonDamageScalar = 1.0;

                    DungeonArmor.PlayerDungeonArmorProfile defenderDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(pm_Target, null);

                    if (defenderDungeonArmor.MatchingSet && !defenderDungeonArmor.InPlayerCombat)
                    {
                        poisonDamageScalar = defenderDungeonArmor.DungeonArmorDetail.PoisonDamageReceivedScalar;
                    }

                    if (bc_From.Controlled && bc_From.ControlMaster is PlayerMobile)
                    {
                        minimum = (double)minimum * bc_From.PvPAbilityDamageScalar;
                        maximum = (double)maximum * bc_From.PvPAbilityDamageScalar;
                    }

                    minimum *= defenderDungeonArmor.DungeonArmorDetail.PoisonDamageReceivedScalar;
                    maximum *= defenderDungeonArmor.DungeonArmorDetail.PoisonDamageReceivedScalar;
                }

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

                else if (damage > maximum)
                {
                    damage = maximum;
                }

                int finalDamage = (int)(Math.Round(damage));

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

                m_LastDamage = finalDamage;

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                int finalAdjustedDamage = AOS.Damage(m_Mobile, m_From, finalDamage, 0, 0, 0, 100, 0);
                int displayedDamage     = DamageTracker.AdjustDisplayedDamage(m_From, m_Mobile, finalAdjustedDamage);

                if (pm_From != null)
                {
                    DamageTracker.RecordDamage(pm_From, pm_From, m_Mobile, DamageTracker.DamageType.PoisonDamage, displayedDamage);
                }

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
コード例 #36
0
ファイル: Poison.cs プロジェクト: SynPDX/RCUO_Alpha2
            protected override void OnTick()
            {
                bool usingPetals = OrangePetals.UnderEffect(m_Mobile);

                if (Core.SA && usingPetals && m_Poison.RealLevel >= 3 && 0.25 > Utility.RandomDouble())
                {
                    OrangePetals.RemoveContext(m_Mobile);
                    usingPetals = false;

                    m_Mobile.LocalOverheadMessage(MessageType.Regular, 0x3F, 1053093); // * The strength of the poison overcomes your resistance! *
                }

                if ((Core.AOS && m_Poison.RealLevel < 4 && TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) ||
                    (m_Poison.RealLevel <= 3 && usingPetals) ||
                    AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, 1053092);                   // * You feel yourself resisting the effects of the poison *

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, 1114442, m_Mobile.Name); // * ~1_NAME~ seems resistant to the poison *

                        Stop();
                        return;
                    }
                }

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136); // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    if (m_Mobile is PlayerMobile)
                    {
                        BuffInfo.RemoveBuff((PlayerMobile)m_Mobile, BuffIcon.Poison);
                    }

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                IHonorTarget honorTarget = m_Mobile as IHonorTarget;

                if (honorTarget != null && honorTarget.ReceivedHonorContext != null)
                {
                    honorTarget.ReceivedHonorContext.OnTargetPoisoned();
                }

                #region Mondain's Legacy
                if (Core.ML)
                {
                    if (m_From != null && m_Mobile != m_From && !m_From.InRange(m_Mobile.Location, 1) && m_Poison.m_Level >= 10 && m_Poison.m_Level <= 13) // darkglow
                    {
                        m_From.SendLocalizedMessage(1072850);                                                                                              // Darkglow poison increases your damage!
                        damage = (int)Math.Floor(damage * 1.1);
                    }

                    if (m_From != null && m_Mobile != m_From && m_From.InRange(m_Mobile.Location, 1) && m_Poison.m_Level >= 14 && m_Poison.m_Level <= 18) // parasitic
                    {
                        int toHeal = Math.Min(m_From.HitsMax - m_From.Hits, damage);

                        if (toHeal > 0)
                        {
                            m_From.SendLocalizedMessage(1060203, toHeal.ToString()); // You have had ~1_HEALED_AMOUNT~ hit points of damage healed.
                            m_From.Heal(toHeal, m_Mobile, false);
                        }
                    }
                }
                #endregion

                AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0);

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
コード例 #37
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;
            }
コード例 #38
0
        public override bool DoEffect(Mobile from, Mobile target)
        {
            if (target.Frozen || target.Paralyzed)
            {
                return false; // The target is already frozen.
            }
            else if ( target.Alive && from.CanBeHarmful( target ) && from.CanSee( target ) && from.InLOS( target ) )
            {
                from.DoHarmful( target );
                SpellHelper.Turn( from, target );
                SpellHelper.CheckReflect( 5, from, ref target );

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

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

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

            return false;
        }
コード例 #39
0
        public static void LifeforceDrainAttack( Mobile from, Mobile target )
        {
            int toDrain = 6 + (int) ( ( 120 - target.Skills[SkillName.MagicResist].Value ) / 10 );

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

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

            target.Damage( toDrain, from );

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

            from.Heal( toDrain );

            from.DoHarmful( target );

            return;
        }
コード例 #40
0
ファイル: FrenziedWhirlwind.cs プロジェクト: nathanvy/runuo
		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 );
			}
		}
コード例 #41
0
		public void OnHit(Mobile from, ISiegeWeapon weapon, IEntity target, Point3D targetloc)
		{
			if (weapon == null || from == null) return;

			// play explosion sound at target

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

			ArrayList damagelist = new ArrayList();

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

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

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

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

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

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

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

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

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

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

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

					mobdamage.Add(m);
				}
			}

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

					from.DoHarmful( m, true );
				}
			}

			// consume the ammunition
			Consume(1);
			weapon.Projectile = this;
		}
コード例 #42
0
      private void Explode( Mobile from, Point3D loc, Map map )
      {
         if ( map == null )
            return;

         Effects.PlaySound( loc, map, 0x207 );
         Effects.SendLocationEffect( loc, map, 0x36BD, 20 );
         IPooledEnumerable eable = map.GetObjectsInRange( loc, 2 );
         ArrayList toExplode = new ArrayList();

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

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

            if ( o is Mobile )
            {
               Mobile m = (Mobile)o;
               if ( m.InRange( loc, 0 ) )
                  d = 1;
               else if ( m.InRange( loc, 1 ) )
                  d = 2;
               else if ( m.InRange( loc, 2 ) )
                  d = 3;
               if ( from == null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) )
               {
                  if ( from != null )
                     from.DoHarmful( m );

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

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

               pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
            }
         }
      }
コード例 #43
0
            protected override void OnTick()
            {
                //if ( (Core.AOS && m_Poison.Level < 4 && TransformationSpellHelper.UnderTransformation( m_Mobile, typeof( VampiricEmbraceSpell ) )) || (m_Poison.Level < 3 && OrangePetals.UnderEffect( m_Mobile )) || AnimalForm.UnderTransformation( m_Mobile, typeof( Licorne ) ) )

                /*        if ((Core.AOS && m_Poison.Level < 4) || (m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)))
                 *                      {
                 *                              if ( m_Mobile.CurePoison( m_Mobile ) )
                 *                              {
                 *                                      m_Mobile.LocalOverheadMessage( MessageType.Emote, 0x3F, true,
                 *                                              "* You feel yourself resisting the effects of the poison *" );
                 *
                 *                                      m_Mobile.NonlocalOverheadMessage( MessageType.Emote, 0x3F, true,
                 *                                              String.Format( "* {0} seems resistant to the poison *", m_Mobile.Name ) );
                 *
                 *                                      Stop();
                 *                                      return;
                 *                              }
                 *                      }*/

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = Utility.Random(m_Poison.m_Minimum, m_Poison.m_Maximum);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                Damage.instance.AppliquerDegatsMagiques(m_Mobile, damage);

                if (0.60 <= Utility.RandomDouble())                   // OSI: randomly revealed between first and third damage tick, guessing 60% chance
                {
                    m_Mobile.RevealingAction();
                }

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
コード例 #44
0
	public void Explode( Mobile from, Point3D loc, Map map )
		{

			if ( map == null )
				return;

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


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

			int toDamage = 0;

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

			eable.Free();
			int d = 0; // Damage scalar
			int damage = 0;
			for ( int i = 0; i < toExplode.Count; ++i )
			{
				object o;
				o = toExplode[i];
				
				if ( o is Mobile )
				{
					Mobile m = (Mobile)o;
					if ( m.InRange( loc, 0 ) )
						d = 1;
					else if ( m.InRange( loc, 1 ) )
						d = 2;
					else if ( m.InRange( loc, 2 ) )
						d = 3;
					if ( from != null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) )
					{
						if ( from != null )
							from.DoHarmful( m );
						damage = Utility.RandomMinMax( (MinDamage / d), (MaxDamage / d) );
						if( d == 1 )
							AOS.Damage( m, from, damage, 50, 50, 0, 0, 0 ); // Same tile 50% physical 50% fire
						else
							AOS.Damage( m, from, damage, 0, 100, 0, 0, 0 ); // 2 tile radius 100% fire damage
					}
				}
				else if ( o is BaseExplosionPotion )
				{
					BaseExplosionPotion pot = (BaseExplosionPotion)o;
					pot.Explode( from, true, pot.GetWorldLocation(), pot.Map );
				}
				else if ( o is ICannonDamage )
				{
					//((ICannonDamage)o).Hits -=  Utility.RandomMinMax(MinDamage/3,MaxDamage/3);
					((ICannonDamage)o).Damage(from,Utility.RandomMinMax(MinDamage/3,MaxDamage/3));
				}
			}
		}
コード例 #45
0
            protected override void OnTick()
            {
                if ((Core.AOS && m_Poison.Level < 4 && TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) ||
                    (m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)) ||
                    AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.SendAsciiMessage("You feel yourself resisting the effects of the poison");

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x22, true,
                                                         String.Format("* {0} seems resistant to the poison *", m_Mobile.Name));

                        Stop();
                        return;
                    }
                }



                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                IHonorTarget honorTarget = m_Mobile as IHonorTarget;

                if (honorTarget != null && honorTarget.ReceivedHonorContext != null)
                {
                    honorTarget.ReceivedHonorContext.OnTargetPoisoned();
                }

                AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0);

                //if (0.60 <= Utility.RandomDouble()) // OSI: randomly revealed between first and third damage tick, guessing 60% chance
                //    m_Mobile.RevealingAction();

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
コード例 #46
0
ファイル: Poison.cs プロジェクト: phpjunkie420/RunUO
            protected override void OnTick()
            {
                if ((Core.AOS && m_Poison.Level < 4 && TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) ||
                    (m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)) ||
                    AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true, "* You feel yourself resisting the effects of the poison *");

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true, String.Format("* {0} seems resistant to the poison *", m_Mobile.Name));

                        Stop();
                        return;
                    }
                }

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendAsciiMessage("The poison seems to have worn off.");                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomMinMax(1, 3) != 1)
                {
                    damage = m_LastDamage;
                }
                else
                {
                    //damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);
                    damage = 2 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);

                    /*if ( damage < m_Poison.m_Minimum )
                     *      damage = m_Poison.m_Minimum;
                     * else if ( damage > m_Poison.m_Maximum )
                     *      damage = m_Poison.m_Maximum;*/

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                IHonorTarget honorTarget = m_Mobile as IHonorTarget;

                if (honorTarget != null && honorTarget.ReceivedHonorContext != null)
                {
                    honorTarget.ReceivedHonorContext.OnTargetPoisoned();
                }

                AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0);

                //if ( (m_Index % m_Poison.m_MessageInterval) == 0 )
                //	m_Mobile.OnPoisoned( m_From, m_Poison, m_Poison );
            }