示例#1
0
        public void Enhance(Mobile from)
        {
            EnhancedBandage existing = null;

            foreach (Item item in Items)
            {
                if (item is EnhancedBandage)
                {
                    existing = item as EnhancedBandage;
                    break;
                }
            }

            for (int i = this.Items.Count - 1; i >= 0 && this.m_Charges > 0; --i)
            {
                if (this.Items[i] is EnhancedBandage)
                {
                    continue;
                }

                Bandage bandage = this.Items[i] as Bandage;

                if (bandage != null)
                {
                    Item enhanced;

                    m_NextUse = DateTime.UtcNow + TimeSpan.FromDays(1);

                    if (bandage.Amount > this.m_Charges)
                    {
                        bandage.Amount -= this.m_Charges;
                        enhanced        = new EnhancedBandage(this.m_Charges);
                        this.m_Charges  = 0;
                    }
                    else
                    {
                        enhanced        = new EnhancedBandage(bandage.Amount);
                        this.m_Charges -= bandage.Amount;
                        bandage.Delete();
                    }

                    if (from == null || !this.TryDropItem(from, enhanced, false))
                    {
                        if (existing != null)
                        {
                            existing.StackWith(from, enhanced);
                        }
                        else
                        {
                            this.DropItem(enhanced);
                        }
                    }
                }
            }

            this.InvalidateProperties();
        }
示例#2
0
        public void Enhance(Mobile from)
        {
            EnhancedBandage existing = null;

            foreach (Item item in Items)
            {
                if (item is EnhancedBandage)
                {
                    existing = item as EnhancedBandage;
                    break;
                }
            }

            for (int i = Items.Count - 1; i >= 0 && m_Charges > 0; --i)
            {
                if (Items[i] is EnhancedBandage)
                {
                    continue;
                }

                Bandage bandage = Items[i] as Bandage;

                if (bandage != null)
                {
                    Item enhanced;

                    if (bandage.Amount > m_Charges)
                    {
                        bandage.Amount -= m_Charges;
                        enhanced        = new EnhancedBandage(m_Charges);
                        m_Charges       = 0;
                    }
                    else
                    {
                        enhanced   = new EnhancedBandage(bandage.Amount);
                        m_Charges -= bandage.Amount;
                        bandage.Delete();
                    }

                    // try stacking first
                    if (from == null || !TryDropItem(from, enhanced, false))
                    {
                        if (existing != null)
                        {
                            existing.StackWith(from, enhanced);
                        }
                        else
                        {
                            DropItem(enhanced);
                        }
                    }
                }
            }

            InvalidateProperties();
        }
示例#3
0
        public void Enhance(Mobile from)
        {
            for (int i = this.Items.Count - 1; i >= 0 && this.m_Charges > 0; --i)
            {
                if (this.Items[i] is EnhancedBandage)
                {
                    continue;
                }

                Bandage bandage = this.Items[i] as Bandage;

                if (bandage != null)
                {
                    Item enhanced;

                    if (bandage.Amount > this.m_Charges)
                    {
                        bandage.Amount -= this.m_Charges;
                        enhanced        = new EnhancedBandage(this.m_Charges);
                        this.m_Charges  = 0;
                    }
                    else
                    {
                        enhanced        = new EnhancedBandage(bandage.Amount);
                        this.m_Charges -= bandage.Amount;
                        bandage.Delete();
                    }

                    if (from == null || !this.TryDropItem(from, enhanced, false)) // try stacking first
                    {
                        this.DropItem(enhanced);
                    }
                }
            }

            this.InvalidateProperties();
        }
        public void Enhance(Mobile from)
        {
            for (int i = this.Items.Count - 1; i >= 0 && this.m_Charges > 0; --i)
            {
                if (this.Items[i] is EnhancedBandage)
                    continue;

                Bandage bandage = this.Items[i] as Bandage;

                if (bandage != null)
                {
                    Item enhanced;

                    if (bandage.Amount > this.m_Charges)
                    {
                        bandage.Amount -= this.m_Charges;
                        enhanced = new EnhancedBandage(this.m_Charges);
                        this.m_Charges = 0;
                    }
                    else
                    {
                        enhanced = new EnhancedBandage(bandage.Amount);
                        this.m_Charges -= bandage.Amount;
                        bandage.Delete();
                    }

                    if (from == null || !this.TryDropItem(from, enhanced, false)) // try stacking first
                        this.DropItem(enhanced);
                }
            }

            this.InvalidateProperties();
        }
 public InternalTarget( EnhancedBandage EnhancedBandage )
     : base(1, false, TargetFlags.Beneficial)
 {
     m_EnhancedBandage = EnhancedBandage;
 }
示例#6
0
        public void Enhance(Mobile from)
        {
			EnhancedBandage existing = null;

			foreach(Item item in Items)
			{
				if(item is EnhancedBandage)
				{
					existing = item as EnhancedBandage;
					break;
				}
			}

            for (int i = this.Items.Count - 1; i >= 0 && this.m_Charges > 0; --i)
            {
                if (this.Items[i] is EnhancedBandage)
                    continue;

                Bandage bandage = this.Items[i] as Bandage;

                if (bandage != null)
                {
                    Item enhanced;

                    if (bandage.Amount > this.m_Charges)
                    {
                        bandage.Amount -= this.m_Charges;
                        enhanced = new EnhancedBandage(this.m_Charges);
                        this.m_Charges = 0;
                    }
                    else
                    {
                        enhanced = new EnhancedBandage(bandage.Amount);
                        this.m_Charges -= bandage.Amount;
                        bandage.Delete();
                    }

					// try stacking first
					if (from == null || !this.TryDropItem(from, enhanced, false))
					{
						if (existing != null)
							existing.StackWith(from, enhanced);
						else
							this.DropItem(enhanced);
					}
                }
            }

            this.InvalidateProperties();
        }