Exemplo n.º 1
1
		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( this.GetWorldLocation(), 2 ) || !from.InLOS( this ) )
			{
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
			}
			else if ( Visible && ( ItemID == 4656 || ItemID == 4702 ) && DateTime.Now >= m_NextUse )
			{
				Point3D p = this.GetWorldLocation();

				if ( 1 > Utility.Random( Math.Max( Math.Abs( from.X - p.X ), Math.Abs( from.Y - p.Y ) ) ) )
				{
					Effects.PlaySound( from.Location, from.Map, from.GetHurtSound() );
					from.PublicOverheadMessage( MessageType.Regular, from.SpeechHue, true, "Ouch!" );
					Spells.SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, Utility.Dice( 2, 10, 5 ) );
				}

				Effects.PlaySound( this.GetWorldLocation(), this.Map, 0x387 );

				Timer.DelayCall( TimeSpan.FromSeconds( 0.25 ), new TimerCallback( Down1 ) );
				Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), new TimerCallback( Down2 ) );

				Timer.DelayCall( TimeSpan.FromSeconds( 5.00 ), new TimerCallback( BackUp ) );

				m_NextUse = DateTime.Now + TimeSpan.FromSeconds( 10.0 );
			}
		}
Exemplo n.º 2
0
        // When this object -- the bottle -- is double-clicked...
        public override void OnDoubleClick(Mobile m)
        {
            if (m.Followers >= m.FollowersMax) // If the player's followers is greater than or equal to his max followers...
            {
                m.SendMessage("You need at least one free follower slot to open the bottle.");
            }
            else if (((m.InRange(this, 1) && m.CanSee(this)) || this.IsChildOf(m.Backpack)) && (!GetGooInBottle())) // If the bottle is in-range and the goo is not in its bottle...
            {
                m.SendMessage("The goo is out of its bottle!");
                m.SendLocalizedMessage(1010018); // What do you want to use this item on?

                m.Target = new BottleOfGooTarget(this, gooPet); // Creates a target from this mobile with the goo mobile thrown to the new class as a reference.
            }
            else if (((m.InRange(this, 1) && m.CanSee(this)) || this.IsChildOf(m.Backpack)) && (GetGooInBottle())) // If the bottle is in-range and the goo IS in its bottle, this function creates a new goo mobile.
            {
                gooPet = new Goo(this);

                ((GenericWarrior)gooPet).Controlled = true;
                ((GenericWarrior)gooPet).ControlMaster = m;

                gooPet.MoveToWorld(m.Location, m.Map);
                gooPet.PlaySound(0x1CC);
                gooPet.Emote("*leaps out of " + m.Name + "'s bottle!*");

                SetGooInBottle(false);
            }
            else
            {
                m.SendLocalizedMessage(500446); //That is too far away.
            }
        }
 protected override void OnTarget( Mobile from, object targeted )
 {
    if ( targeted is BaseWeapon )
    {
       BaseWeapon Weapon = targeted as BaseWeapon;
       if ( !from.InRange( m_LTub.GetWorldLocation(), 1 ) || !from.InRange( ((Item)targeted).GetWorldLocation(), 1 ) )
       {
          from.SendLocalizedMessage( 500446 ); // That is too far away.
       }
       else if (( ((Item)targeted).Parent != null ) && ( ((Item)targeted).Parent is Mobile ) )
       {
          from.SendMessage( "You cannot dye that in it's current location." );
       }
       else if ( Weapon.Type == WeaponType.Polearm || Weapon.Type == WeaponType.Piercing
       || Weapon.Type == WeaponType.Staff || Weapon.Type == WeaponType.Staff || Weapon.Type == WeaponType.Slashing
       || Weapon.Type == WeaponType.Bashing || Weapon.Type == WeaponType.Axe || Weapon.Type == WeaponType.Ranged )
       {
          Weapon.Hue = m_LTub.Hue;
          from.PlaySound( 0x23E );
       }
    }
    else if ( targeted is BaseLeather )
    {
       from.SendLocalizedMessage( 1042083 ); // You can not dye that.
    }
 }
Exemplo n.º 4
0
		public virtual void OnDoubleClick( Mobile from, bool createWeedsAndDelete )
		{
			if( !from.CanSee( this ) )
			{
				from.SendMessage( "You cannot see that." );
			}
			else if( !(this is HarvestableTree) && !from.InRange( this, 1 ) )
			{
				from.SendLocalizedMessage( CommonLocs.YouTooFar );
			}
			else if( this is HarvestableTree && !from.InRange( this, 2 ) )
			{
				from.SendLocalizedMessage( CommonLocs.YouTooFar );
			}
			else if( (Sower != null && from != m_Sower) && !(this is HarvestableTree) )
			{
				from.SendMessage( "You cannot harvest any of this crop." );
			}
			else if( from.Mounted )
			{
				from.SendMessage( "You cannot do this while riding a mount." );
			}
			else
			{
				int calcYield = CalculateYield( from );
				Item crop = null;

				try { crop = CreateCrop( calcYield ); }
				catch( Exception e ) { Server.Utilities.ExceptionManager.LogException( "BaseGrownCrop.cs", e ); }

				if( crop == null )
				{
					from.SendMessage( "You are unable to harvest any of this crop!" );
				}
				else
				{
					from.AddToBackpack( crop );

					from.Direction = from.GetDirectionTo( this );
					from.Animate( AnimationFrame, 5, 1, true, false, 0 );
					from.PlaySound( 0x133 );
					from.SendMessage( "You successfully harvest the crop!" );
				}

				if( createWeedsAndDelete )
				{
					new Weeds().MoveToWorld( this.Location, this.Map );
					this.Delete();
				}
				else
				{
					OnHarvest( from );
				}
			}
		}
Exemplo n.º 5
0
 public override void OnDoubleClick(Mobile from)
 {
     if (from.InRange(this.GetWorldLocation(), 1))
     {
         from.SendMessage("You try to examine the strange wall but the vines get in your way.");
     }
     else if (!from.InRange(this.GetWorldLocation(), 1))
     {
         from.SendMessage("I can't reach that.");
     }
     base.OnDoubleClick(from);
 }
        public override void OnDoubleClick(Mobile from)
        {
            if (from != base.Owner || !base.IncludedEntities.Contains(from))
                from.SendMessage("You are not permitted to board this carpet.");

            if (!from.InRange(this.Location, 1))
                from.SendMessage("You must be closer if you wish to board this.");

            if ((from == base.Owner || base.IncludedEntities.Contains(from))
                && from.InRange(this.Location, 1))
            {
                from.MoveToWorld(this.Location, this.Map);
            }
        }
Exemplo n.º 7
0
        public void WoundingShot(Mobile attacker, Mobile defender)
        {
            if (Level >= PerkLevel.Fifth)
            {
                int distance = 0;

                for (int x = 0; x <= 12; x++)
                {
                    if (attacker.InRange(defender, x))
                    {
                        distance = x;
                    }
                }

                int woundChance = (int)((attacker.Skills.Anatomy.Value / 8) - (distance / 2));

                if (woundChance >= Utility.RandomMinMax(0, 100))
                {
                    BleedAttack.BeginBleed(defender, attacker);

                    attacker.SendMessage("You wound your opponent, causing them to bleed!");
                    defender.SendMessage("You've been wounded!");
                }
            }
        }
Exemplo n.º 8
0
        public virtual bool Dye( Mobile from, DyeTub sender )
        {
            if ( Deleted )
                return false;

            BaseHouse house = BaseHouse.FindHouseAt( this );

            if ( house != null && house.IsCoOwner( from ) )
            {
                if ( from.InRange( GetWorldLocation(), 1 ) )
                {
                    Hue = sender.DyedHue;
                    return true;
                }
                else
                {
                    from.SendLocalizedMessage( 500295 ); // You are too far away to do that.
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
        public override void OnDoubleClick( Mobile from )
        {
            Direction dir;
            if ( from.Location != this.Location )
                dir = from.GetDirectionTo( this );
            else if ( this.East )
                dir = Direction.West;
            else
                dir = Direction.North;

            from.Direction = dir;

            bool canThrow = true;

            if ( !from.InRange( this, 4 ) || !from.InLOS( this ) )
                canThrow = false;
            else if ( this.East )
                canThrow = ( dir == Direction.Left || dir == Direction.West || dir == Direction.Up );
            else
                canThrow = ( dir == Direction.Up || dir == Direction.North || dir == Direction.Right );

            if ( canThrow )
                Throw( from );
            else
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
        }
Exemplo n.º 10
0
		public bool ValidatePlacement( Mobile from, Point3D loc )
		{
			if ( from.AccessLevel >= AccessLevel.GameMaster )
				return true;

			if ( !from.InRange( this.GetWorldLocation(), 1 ) )
			{
				from.SendLocalizedMessage( 500446 ); // That is too far away.
				return false;
			}

			Map map = from.Map;

			if ( map == null )
				return false;

			BaseHouse house = BaseHouse.FindHouseAt( loc, map, 20 );

			if ( house != null && !house.IsFriend( from ) )
			{
				from.SendLocalizedMessage(500269); // You cannot build that there.
				return false;
			}

			if ( !map.CanFit( loc, 20 ) )
			{
				from.SendLocalizedMessage( 500269 ); // You cannot build that there.
				return false;
			}

			return true;
		}
Exemplo n.º 11
0
 protected override void OnTarget( Mobile from, object targeted )
 {
     if ( !m_Plant.Deleted && from.InRange( m_Plant.GetWorldLocation(), 3 ) && targeted is Item )
     {
         m_Plant.Pour( from, (Item)targeted );
     }
 }
		protected override void OnTargetFinish( Mobile from )
		{
			if ( !m_Plant.Deleted && m_Plant.PlantStatus < PlantStatus.DecorativePlant && m_Plant.PlantStatus != PlantStatus.BowlOfDirt && from.InRange( m_Plant.GetWorldLocation(), 3 ) && m_Plant.IsUsableBy( from ) )
			{
				from.SendGump( new ReproductionGump( m_Plant ) );
			}
		}
Exemplo n.º 13
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( GetWorldLocation(), 2 ) )
			from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
			else if ( from is PlayerMobile )
			from.SendGump( new FoodPantryGump( (PlayerMobile)from, this ) );
		}
Exemplo n.º 14
0
		private bool CheckUse( Mobile from )
		{
			if ( !this.IsAccessibleTo( from ) )
				return false;

			if ( from.Map != this.Map || !from.InRange( GetWorldLocation(), 2 ) )
			{
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
				return false;
			}

			if ( !from.CanBeginAction( typeof( FireHorn ) ) )
			{
				from.SendLocalizedMessage( 1049615 ); // You must take a moment to catch your breath.
				return false;
			}

			int sulfAsh = Core.AOS ? 4 : 15;
			if ( from.Backpack == null || from.Backpack.GetAmount( typeof( SulfurousAsh ) ) < sulfAsh )
			{
				from.SendLocalizedMessage( 1049617 ); // You do not have enough sulfurous ash.
				return false;
			}

			return true;
		}
Exemplo n.º 15
0
        protected override void OnTarget( Mobile from, object target )
        {
            if( target is HitchingPost )
            {
                HitchingPost post = (HitchingPost)target;

                if( !from.InRange(post.GetWorldLocation(), 1) )
                    from.SendLocalizedMessage(500295);

                else
                {
                    from.LocalOverheadMessage(MessageType.Regular, from.EmoteHue, false, "*ties the rope to the hitching post ring*");
                    from.SendMessage("Target the pet you wish to hitch.");

                    from.Target = new PostToPetTarget();
                }
            }
            else if( target is BaseCreature )
                from.SendMessage("You must tie the rope to a hitching post before being able to hitch your pet.");

            else if( target is PlayerMobile )
                from.SendMessage("The person looks at you in disgust.");

            else if( target == from )
                from.SendMessage("That would be a stupid idea.");
        }
Exemplo n.º 16
0
		protected override void OnTargetOutOfRange( Mobile from, object targeted )
		{
			if ( targeted is UnholyBone && from.InRange( ((UnholyBone)targeted), 12 ) )
				((UnholyBone)targeted).Carve( from, m_Item );
			else
				base.OnTargetOutOfRange (from, targeted);
		}
Exemplo n.º 17
0
		public override bool HandlesOnSpeech( Mobile m )
		{
			if( m.InRange( this.Location, 2 ) && m.Alive && !m.Hidden && m_Board != null )
				return true;
			
			return base.HandlesOnSpeech( m );
		}
Exemplo n.º 18
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( !from.InRange( Location, 2 ) )
            {
                // I can't reach that.
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 );
            }
            else if ( from is PlayerMobile && ( (PlayerMobile) from ).SacredQuest )
            {
                // You cannot think of any reason to want to do this.
                from.SendLocalizedMessage( 1080538 );
            }
            else if ( from.Backpack != null )
            {
                from.DropHolding();

                Item key = from.Backpack.FindItemByType( KeyType );

                if ( key != null )
                {
                    // You are already carrying a copy of this key fragment.
                    from.SendLocalizedMessage( 1111653 );
                }
                else
                {
                    from.PlaceInBackpack( (Item) Activator.CreateInstance( KeyType ) );

                    // You reach for the key and receive a glowing copy that you place in your bag.
                    from.SendLocalizedMessage( 1111652 );
                }
            }
        }
Exemplo n.º 19
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( this.GetWorldLocation(), 2 ) )
				return;

			Roll( from );
		}
Exemplo n.º 20
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
		{
			if(from.InRange(c.Location, 3) && from.Backpack != null)
			{
				foreach(WispOrb orb in WispOrb.Orbs)
				{
					if(orb.Owner == from)
					{
						LabelTo(from, 1153357); // Thou can guide but one of us.
						return;
					}
				}
				
				Alignment alignment = Alignment.Neutral;
				
				if(from.Karma > 0 && m_Alignment == Alignment.Good)
					alignment = Alignment.Good;
				else if (from.Karma < 0 && m_Alignment == Alignment.Evil)
					alignment = Alignment.Evil;
					
				if(alignment != Alignment.Neutral)
				{
                    WispOrb orb = new WispOrb(from, alignment);
					from.Backpack.DropItem(orb);

                    Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(SendMessage_Callback), new object[] { orb, from } );
				}
				else
					LabelTo(from, 1153350); // Thy spirit be not compatible with our goals!
			}
		}
Exemplo n.º 21
0
 protected override void OnTargetFinish( Mobile from )
 {
     if ( !m_Plant.Deleted && m_Plant.PlantStatus < PlantStatus.DecorativePlant && from.InRange( m_Plant.GetWorldLocation(), 3 ) && m_Plant.IsUsableBy( from ) && !from.HasGump( typeof(MainPlantGump) ) )
     {
         from.SendGump( new MainPlantGump( m_Plant ) );
     }
 }
Exemplo n.º 22
0
        public override void Open( Mobile from, bool checkSelfLoot )
        {
            if ( !from.InRange( this.GetWorldLocation(), 2 ) )
                return;

            PlayerMobile player = from as PlayerMobile;

            if ( player != null )
            {
                QuestSystem qs = player.Quest;

                if ( qs is WitchApprenticeQuest )
                {
                    FindApprenticeObjective obj = qs.FindObjective( typeof( FindApprenticeObjective ) ) as FindApprenticeObjective;

                    if ( obj != null && !obj.Completed )
                    {
                        if ( obj.Corpse == this )
                        {
                            obj.Complete();
                            Delete();
                        }
                        else
                        {
                            SendLocalizedMessageTo( from, 1055047 ); // You examine the corpse, but it doesn't fit the description of the particular apprentice the Hag tasked you with finding.
                        }

                        return;
                    }
                }
            }

            SendLocalizedMessageTo( from, 1055048 ); // You examine the corpse, but find nothing of interest.
        }
Exemplo n.º 23
0
        protected void OnTarget( Mobile from, object targeted )
        {
            if ( from.Backpack == null || !IsChildOf( from.Backpack ) )
            {
                from.SendLocalizedMessage( 1080063 ); // This must be in your backpack to use it.
                return;
            }

            if ( targeted is MagicVines )
            {
                MagicVines vines = targeted as MagicVines;

                if ( from.InRange( vines, 1 ) )
                {
                    vines.OnAcidSac( from );
                    Consume();
                }
                else
                {
                    from.SendLocalizedMessage( 1076766 ); // That is too far away.
                }
            }
            else
            {
                from.SendLocalizedMessage( 1046439 ); // That is not a valid target.
            }
        }
Exemplo n.º 24
0
		public override bool HandlesOnSpeech( Mobile from )
		{
			if ( from.InRange( this.Location, 4 ) )
				return true;

			return base.HandlesOnSpeech( from );
		}
Exemplo n.º 25
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( this.GetWorldLocation(), 2 ) )
				return;

			this.PublicOverheadMessage( MessageType.Regular, 0, false, string.Format( "*{0} rolls {1}, {2}*", from.Name, Utility.Random( 1, 6 ), Utility.Random( 1, 6 ) ) );
		}
Exemplo n.º 26
0
		public override void OnComponentUsed( AddonComponent c, Mobile from )
		{
			if ( from.InRange( c.Location, 2 ) )
			{
				if ( m_Fruits > 0 )
				{
					Item fruit = Fruit;

					if ( fruit == null )
						return;

					if ( !from.PlaceInBackpack( fruit ) )
					{
						fruit.Delete();
						from.SendLocalizedMessage( 501015 ); // There is no room in your backpack for the fruit.
					}
					else
					{
						if ( --m_Fruits == 0 )
							Timer.DelayCall( TimeSpan.FromMinutes( 30 ), new TimerCallback( Respawn ) );

						from.SendLocalizedMessage( 501016 ); // You pick some fruit and put it in your backpack.
					}
				}
				else
					from.SendLocalizedMessage( 501017 ); // There is no more fruit on this tree
			}
			else
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
		}
Exemplo n.º 27
0
		private void DestroyFurniture( Mobile from, Item item )
		{
			if ( !from.InRange( item.GetWorldLocation(), 3 ) )
			{
				from.SendLocalizedMessage( 500446 ); // That is too far away.
				return;
			}
			else if ( !item.IsChildOf( from.Backpack ) && !item.Movable )
			{
				from.SendLocalizedMessage( 500462 ); // You can't destroy that while it is here.
				return;
			}

			from.SendLocalizedMessage( 500461 ); // You destroy the item.
			Effects.PlaySound( item.GetWorldLocation(), item.Map, 0x3B3 );

			if ( item is Container )
			{
				if ( item is TrapableContainer )
					(item as TrapableContainer).ExecuteTrap( from );

				((Container)item).Destroy();
			}
			else
			{
				item.Delete();
			}
		}
Exemplo n.º 28
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( this.Parent != null || !this.VerifyMove( from ) )
                return;

            if ( !from.InRange( this, 2 ) )
            {
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "I can't reach that." ); // I can't reach that.
                return;
            }

            if ( this.ItemID == 0xA57 ) // rolled
            {
                Direction dir = PlayerMobile.GetDirection4( from.Location, this.Location );

                if ( dir == Direction.North || dir == Direction.South )
                    this.ItemID = 0xA55;
                else
                    this.ItemID = 0xA56;
            }
            else // unrolled
            {
                this.ItemID = 0xA57;

                if ( !from.HasGump( typeof( LogoutGump ) ) )
                {
                    CampfireEntry entry = Campfire.GetEntry( from );

                    if ( entry != null && entry.Safe )
                        from.SendGump( new LogoutGump( entry, this ) );
                }
            }
        }
Exemplo n.º 29
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( from.InRange( GetWorldLocation(), 1 ) )
				UseGate( from );
			else
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
		}
Exemplo n.º 30
0
		public override void OnDoubleClickSecureTrade( Mobile from )
		{
			if ( !from.InRange( GetWorldLocation(), 2 ) )
			{
				from.SendLocalizedMessage( 500446 ); // That is too far away.
			}
			else if ( m_Entries.Count == 0 )
			{
				from.SendLocalizedMessage( 1062381 ); // The book is empty.
			}
			else
			{
				from.SendGump( new BOBGump( (PlayerMobile)from, this ) );

				SecureTradeContainer cont = GetSecureTradeCont();

				if ( cont != null )
				{
					SecureTrade trade = cont.Trade;

					if ( trade != null && trade.From.Mobile == from )
						trade.To.Mobile.SendGump( new BOBGump( (PlayerMobile)(trade.To.Mobile), this ) );
					else if ( trade != null && trade.To.Mobile == from )
						trade.From.Mobile.SendGump( new BOBGump( (PlayerMobile)(trade.From.Mobile), this ) );
				}
			}
		}
Exemplo n.º 31
0
            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);
                }
            }
Exemplo n.º 32
0
            protected override void OnTick()
            {
                if (CheckResistPoison())
                {
                    // Curing this way cause we don't want to trigger the PoisonCured event,
                    // so that the resistance timer is not refreshed.
                    m_Mobile.Poison = null;
                    BuffInfo.RemoveBuff(m_Mobile, BuffIcon.Poison);

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

                #region Darkglow
                Mobile poisoner = DarkglowPotion.GetPoisoner(m_Mobile);

                if (poisoner != null)
                {
                    int distance = (int)m_Mobile.GetDistanceToSqrt(poisoner.Location);

                    if (distance > 1)
                    {
                        if (distance > 20)
                        {
                            distance = 20;
                        }

                        damage += AOS.Scale(damage, distance * 5);
                        poisoner.SendLocalizedMessage(1072850);                           // Darkglow poison increases your damage!
                    }
                }
                #endregion

                IHonorTarget honorTarget = m_Mobile as IHonorTarget;

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

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

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

                #region Parasitic
                poisoner = ParasiticPotion.GetPoisoner(m_Mobile);

                if (poisoner != null && m_Mobile.InRange(poisoner.Location, 1))
                {
                    int toHeal = Math.Min(damage, poisoner.HitsMax - poisoner.Hits);

                    if (toHeal > 0)
                    {
                        poisoner.SendLocalizedMessage(1060203, toHeal.ToString());                           // You have had ~1_HEALED_AMOUNT~ hit points of damage healed.
                        poisoner.Hits += toHeal;
                    }
                }
                #endregion
            }
Exemplo n.º 33
0
        public static bool CheckDoubleClick(
            this Item item,
            Mobile from,
            bool handle        = true,
            bool allowDead     = false,
            int range          = -1,
            bool packOnly      = false,
            bool inTrade       = false,
            bool inDisplay     = true,
            AccessLevel access = AccessLevel.Player)
        {
            if (item == null || item.Deleted || from == null || from.Deleted)
            {
                return(false);
            }

            if (from.AccessLevel < access)
            {
                if (handle)
                {
                    from.SendMessage("You do not have sufficient access to use this item.");
                }

                return(false);
            }

            if (!from.CanSee(item))
            {
                if (handle)
                {
                    from.SendMessage("This item can't be seen.");
                    item.OnDoubleClickCantSee(from);
                }

                return(false);
            }

            if (!item.IsAccessibleTo(from))
            {
                if (handle)
                {
                    item.OnDoubleClickNotAccessible(from);
                }

                return(false);
            }

            if (item.InSecureTrade && !inTrade)
            {
                if (handle)
                {
                    item.OnDoubleClickSecureTrade(from);
                }

                return(false);
            }

            if (((item.Parent == null && !item.Movable && !item.IsLockedDown && !item.IsSecure && !item.InSecureTrade) ||
                 IsShopItem(item)) && !inDisplay)
            {
                if (handle)
                {
                    from.SendMessage("This item can not be accessed because it is part of a display.");
                }

                return(false);
            }

            if (!from.Alive && !allowDead)
            {
                if (handle)
                {
                    item.OnDoubleClickDead(from);
                }

                return(false);
            }

            if (range >= 0 && !from.InRange(item.GetWorldLocation(), range) && !packOnly)
            {
                if (handle)
                {
                    if (range > 0)
                    {
                        from.SendMessage("You must be within {0:#,0} paces to use this item.", range);
                    }
                    else
                    {
                        from.SendMessage("You must be standing on this item to use it.");
                    }

                    item.OnDoubleClickOutOfRange(from);
                }

                return(false);
            }

            if (packOnly && item.RootParent != from)
            {
                if (handle)
                {
                    // This item must be in your backpack.
                    from.SendLocalizedMessage(1054107);
                }

                return(false);
            }

            return(true);
        }