Example #1
0
            protected override void OnTick()
            {
                IDurability d = m_Item as IDurability;

                if (m_Item.Deleted || d == null || !d.CanLoseDurability)
                {
                    m_Timers.Remove(m_Item);
                    Stop();
                    return;
                }

                if (m_Item.IsEphemeral())
                {
                    Mobile parent = m_Item.Parent as Mobile;

                    if (parent != null && parent.Combatant != null)
                    {
                        m_BreakCounter = (m_BreakCounter + 1) % (int)BreakInterval.TotalSeconds;

                        if (m_BreakCounter == 0)
                        {
                            d.MaxHitPoints--;

                            if (d.MaxHitPoints == 0)
                            {
                                m_Item.Delete();
                            }
                            if (d.HitPoints > d.MaxHitPoints)
                            {
                                d.HitPoints = d.MaxHitPoints;
                            }
                        }
                    }
                }
            }
Example #2
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            foreach (Type[] t in _Table)
            {
                if (dropped is IDurability && t[0] == dropped.GetType())
                {
                    IDurability dur = dropped as IDurability;

                    if (dur != null && dur.MaxHitPoints == 255 && dur.HitPoints == 255)
                    {
                        var item = Loot.Construct(t[1]);

                        if (item != null)
                        {
                            from.AddToBackpack(item);
                            dropped.Delete();
                            return(true);
                        }
                    }
                    else
                    {
                        SayTo(from, 1157368); // I can only work with artifacts that are in pristine condition.
                        return(false);
                    }
                }
            }

            SayTo(from, 1157365); // I'm sorry, I cannot accept this item.
            return(false);
        }
        public virtual void Damage(Mobile m)
        {
            if (!m.Alive)
            {
                StopTimer(m);
            }

            if (m_Corrosive)
            {
                for (int i = 0; i < m.Items.Count; i++)
                {
                    IDurability item = m.Items[i] as IDurability;

                    if (item != null && Utility.RandomDouble() < 0.25)
                    {
                        if (item.HitPoints > 10)
                        {
                            item.HitPoints -= 10;
                        }
                        else
                        {
                            item.HitPoints -= 1;
                        }
                    }
                }
            }
            else
            {
                AOS.Damage(m, 40, 0, 0, 0, 100, 0);
            }
        }
Example #4
0
        public void Damage(Mobile m)
        {
            if (m_Corrosive)
            {
                List <Item> items   = m.Items;
                bool        damaged = false;

                for (int i = 0; i < items.Count; ++i)
                {
                    IDurability wearable = items[i] as IDurability;

                    if (wearable != null && wearable.HitPoints >= 10 && Utility.RandomDouble() < 0.25)
                    {
                        wearable.HitPoints -= (wearable.HitPoints == 10) ? Utility.Random(1, 5) : 10;
                        damaged             = true;
                    }
                }

                if (damaged)
                {
                    m.LocalOverheadMessage(MessageType.Regular, 0x21, 1072070); // The infernal ooze scorches you, setting you and your equipment ablaze!
                    return;
                }
            }

            AOS.Damage(m, 40, 0, 0, 0, 100, 0);
        }
Example #5
0
        private static double GetDurabilityPenalty(IDurability item)
        {
            if (!item.CanLoseDurability)
            {
                return(0.0);
            }

            return(0.02 * (Math.Max(0, 50 - item.HitPoints)));
        }
        public static void RemoveDurability(Item item, int amount)
        {
            if (item is IDurability)
            {
                IDurability durableItem = (IDurability)item;

                durableItem.MaxHitPoints = ((100 + amount) * durableItem.MaxHitPoints) / 100;
                durableItem.HitPoints    = durableItem.MaxHitPoints;
            }
        }
Example #7
0
        public static int[] ReadDurability(this IDurability obj, List <ClilocItemRec> properties)
        {
            if (!ClilocHelper.Contains(properties, 1060639))
            {
                return new[] { 0, 0 }
            }
            ;

            var Params = ClilocHelper.GetParams(properties, 1060639);
            var dura   = new int[] { Params[0], Params[1] };

            return(dura);
        }
        public static void ApplyDurability(Item item, int amount)
        {
            if (item is IDurability)
            {
                IDurability durableItem = (IDurability)item;

                durableItem.MaxHitPoints = ((100 + amount) * durableItem.MaxHitPoints) / 100;

                if (durableItem.MaxHitPoints > 255)
                {
                    durableItem.MaxHitPoints = 255;
                }

                durableItem.HitPoints = durableItem.MaxHitPoints;                 // Item is repaired upon enhancing
            }
        }
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (ViceVsVirtueSystem.IsVvV(from))
            {
                if (!(dropped is IOwnerRestricted) || ((IOwnerRestricted)dropped).Owner == from)
                {
                    if (dropped is IVvVItem && from.Race == Race.Gargoyle)
                    {
                        foreach (var t in _Table)
                        {
                            if (dropped.GetType() == t[0])
                            {
                                IDurability dur = dropped as IDurability;

                                if (dur != null && dur.MaxHitPoints == 255 && dur.HitPoints == 255)
                                {
                                    var item = Loot.Construct(t[1]);

                                    if (item != null)
                                    {
                                        VvVRewards.OnRewardItemCreated(from, item);

                                        if (item is GargishCrimsonCincture)
                                        {
                                            ((GargishCrimsonCincture)item).Attributes.BonusDex = 10;
                                        }

                                        from.AddToBackpack(item);
                                        dropped.Delete();

                                        return(true);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            SayTo(from, 1157365); // I'm sorry, I cannot accept this item.
            return(false);
        }
Example #10
0
        public virtual void Damage(Mobile m)
        {
            if (m == null || m.Deleted || !m.Alive || m.Map == null || m.Map == Map.Internal) /* cant have that happen again */
            {
                StopTimer(m);
            }
            else
            {
                if (ValidMobile(m))
                {
                    if (m_Corrosive && (m.Items.Count > 0))
                    {
                        for (int i = 0; i < m.Items.Count; i++)
                        {
                            Item m_Item; IDurability item = ValidDurabilityEquipment(m, (m_Item = m.Items[i] as Item));

                            if (item != null && (IsUsingDurability(item)) && (Utility.RandomDouble() < 0.25))
                            {
                                int hp; bool z = ((hp = item.HitPoints) < 1); int mhp = item.MaxHitPoints;

                                if (!(DamageSelector(ref z, ref hp, ref mhp)) && z)
                                {
                                    m.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061121); // Your equipment is severely damaged.

                                    if ((item.MaxHitPoints = mhp) < 1)
                                    {
                                        m_Item.Delete();
                                    }
                                }

                                item.HitPoints = hp;
                            }
                        }
                    }
                    else
                    {
                        AOS.Damage(m, 40, 0, 0, 0, 100, 0);
                    }
                }
                else
                {
                    StopTimer(m);
                }
            }
        }
Example #11
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                int DestroyChance = 1;              // Utility.Random( 9 );  // success chance.  no fails to apply.

                if (targeted is IDurability && targeted is Item)
                {
                    IDurability wearable = (IDurability)targeted;
                    Item        item     = (Item)targeted;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 3))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }

                    else
                    {
                        if (DestroyChance > 0)                      // Success
                        {
                            if (wearable.HitPoints < wearable.MaxHitPoints)
                            {
                                wearable.HitPoints = wearable.MaxHitPoints; from.SendMessage("The Rune's Magic fully repaired the item.");
                                from.PlaySound(0x1F5);
                                m_RepairItem.Delete();
                            }
                            else                     // Fail
                            {
                                from.SendMessage("You have failed to enhance the item, and the rune crumbles!");
                                from.PlaySound(42);
                                //item.Delete();
                                m_RepairItem.Delete();
                            }
                        }
                    }
                }
                else
                {
                    from.SendMessage("You cannot enhance that.");
                }
            }
        public virtual void Damage(Mobile m)
        {
            if (!m.Alive)
            {
                StopTimer(m);
            }

            if (m_Corrosive)
            {
                for (int i = 0; i < m.Items.Count; i++)
                {
                    IDurability item = m.Items[i] as IDurability;

                    if (item != null && Utility.RandomDouble() < 0.25)
                    {
                        if (item.HitPoints > 10)
                        {
                            item.HitPoints -= 10;
                        }
                        else
                        {
                            item.HitPoints -= 1;
                        }
                    }
                }
            }
            else
            {
                int dmg = m_Damage;

                if (m is PlayerMobile)
                {
                    PlayerMobile pm = m as PlayerMobile;
                    dmg = (int)BalmOfProtection.HandleDamage(pm, dmg);
                    AOS.Damage(m, dmg, 0, 0, 0, 100, 0);
                }
                else
                {
                    AOS.Damage(m, dmg, 0, 0, 0, 100, 0);
                }
            }
        }
Example #13
0
 public static bool ReadCannotRepairedState(this IDurability ic, List <ClilocItemRec> properties)
 {
     return(ClilocHelper.Contains(properties, 1151782));
 }
Example #14
0
 private bool IsUsingDurability(IDurability item)
 {
     return((item.HitPoints + item.MaxHitPoints) > 0);
 }
Example #15
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Powder.Deleted || m_Powder.UsesRemaining <= 0)
                {
                    from.SendLocalizedMessage(1049086); // You have used up your powder of temperament.
                    return;
                }

                if (targeted is Item)
                {
                    Item item    = (Item)targeted;
                    bool noGo    = false;
                    int  antique = 0;

                    if (!Server.Engines.Craft.Repair.AllowsRepair(item, null) || (item is BaseJewel && !CanPOFJewelry))
                    {
                        from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                        return;
                    }

                    #region SA
                    if (item is BaseWeapon)
                    {
                        if (((BaseWeapon)item).Attributes.Brittle > 0 || ((BaseWeapon)item).NegativeAttributes.Brittle > 0)
                        {
                            noGo = true;
                        }
                        antique = ((BaseWeapon)item).NegativeAttributes.Antique;
                    }
                    else if (item is BaseArmor)
                    {
                        if (((BaseArmor)item).Attributes.Brittle > 0 || ((BaseArmor)item).NegativeAttributes.Brittle > 0)
                        {
                            noGo = true;
                        }
                        antique = ((BaseArmor)item).NegativeAttributes.Antique;
                    }
                    else if (item is BaseClothing)
                    {
                        if (((BaseClothing)item).Attributes.Brittle > 0 || ((BaseClothing)item).NegativeAttributes.Brittle > 0)
                        {
                            noGo = true;
                        }
                        antique = ((BaseClothing)item).NegativeAttributes.Antique;
                    }
                    else if (item is BaseJewel)
                    {
                        if (((BaseJewel)item).Attributes.Brittle > 0 || ((BaseJewel)item).NegativeAttributes.Brittle > 0)
                        {
                            noGo = true;
                        }
                        antique = ((BaseJewel)item).NegativeAttributes.Antique;
                    }
                    else if (item is BaseTalisman && ((BaseTalisman)item).Attributes.Brittle > 0)
                    {
                        noGo = true;
                    }
                    if (noGo)
                    {
                        from.SendLocalizedMessage(1149799); //That cannot be used on brittle items.
                        return;
                    }
                    #endregion

                    if (targeted is IDurability)
                    {
                        IDurability wearable = (IDurability)targeted;

                        if (!wearable.CanFortify)
                        {
                            from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                            return;
                        }

                        if ((item.IsChildOf(from.Backpack) || (Core.ML && item.Parent == from)) && m_Powder.IsChildOf(from.Backpack))
                        {
                            int origMaxHP = wearable.MaxHitPoints;
                            int origCurHP = wearable.HitPoints;

                            if (origMaxHP > 0)
                            {
                                //int initMaxHP = Core.AOS ? 255 : wearable.InitMaxHits;
                                int initMaxHP = antique <= 0 ? 255 : antique == 1 ? 200 : 150;

                                wearable.UnscaleDurability();

                                if (wearable.MaxHitPoints < initMaxHP)
                                {
                                    if (antique > 0)
                                    {
                                        if (item is BaseWeapon)
                                        {
                                            ((BaseWeapon)item).NegativeAttributes.Antique++;
                                        }
                                        if (item is BaseArmor)
                                        {
                                            ((BaseArmor)item).NegativeAttributes.Antique++;
                                        }
                                        if (item is BaseJewel)
                                        {
                                            ((BaseJewel)item).NegativeAttributes.Antique++;
                                        }
                                        if (item is BaseClothing)
                                        {
                                            ((BaseClothing)item).NegativeAttributes.Antique++;
                                        }
                                    }

                                    int bonus = initMaxHP - wearable.MaxHitPoints;

                                    if (bonus > 10)
                                    {
                                        bonus = 10;
                                    }

                                    wearable.MaxHitPoints += bonus;
                                    wearable.HitPoints    += bonus;

                                    wearable.ScaleDurability();

                                    if (wearable.MaxHitPoints > 255)
                                    {
                                        wearable.MaxHitPoints = 255;
                                    }
                                    if (wearable.HitPoints > 255)
                                    {
                                        wearable.HitPoints = 255;
                                    }

                                    if (wearable.MaxHitPoints > origMaxHP)
                                    {
                                        from.SendLocalizedMessage(1049084); // You successfully use the powder on the item.
                                        from.PlaySound(0x247);

                                        --m_Powder.UsesRemaining;

                                        if (m_Powder.UsesRemaining <= 0)
                                        {
                                            from.SendLocalizedMessage(1049086); // You have used up your powder of fortifying.
                                            m_Powder.Delete();
                                        }
                                    }
                                    else
                                    {
                                        wearable.MaxHitPoints = origMaxHP;
                                        wearable.HitPoints    = origCurHP;
                                        from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
                                    wearable.ScaleDurability();
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                }
            }
Example #16
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped.GetSocket <HonestyItemSocket>() != null)
            {
                return(base.OnDragDrop(from, dropped));
            }

            if (ViceVsVirtueSystem.IsVvV(from))
            {
                if (!(dropped is IOwnerRestricted) || ((IOwnerRestricted)dropped).Owner == from)
                {
                    if (dropped is IVvVItem && from.Race == Race.Gargoyle)
                    {
                        foreach (Type[] t in _Table)
                        {
                            if (dropped.GetType() == t[0])
                            {
                                IDurability dur = dropped as IDurability;

                                if (dur != null && dur.MaxHitPoints == 255 && dur.HitPoints == 255)
                                {
                                    Item item = Loot.Construct(t[1]);

                                    if (item != null)
                                    {
                                        VvVRewards.OnRewardItemCreated(from, item);

                                        if (item is GargishCrimsonCincture)
                                        {
                                            ((GargishCrimsonCincture)item).Attributes.BonusDex = 10;
                                        }

                                        if (item is GargishMaceAndShieldGlasses)
                                        {
                                            ((GargishMaceAndShieldGlasses)item).Attributes.WeaponDamage = 10;
                                        }

                                        if (item is GargishFoldedSteelGlasses)
                                        {
                                            ((GargishFoldedSteelGlasses)item).Attributes.DefendChance = 25;
                                        }

                                        if (item is GargishWizardsCrystalGlasses)
                                        {
                                            ((GargishWizardsCrystalGlasses)item).PhysicalBonus = 5;
                                            ((GargishWizardsCrystalGlasses)item).FireBonus     = 5;
                                            ((GargishWizardsCrystalGlasses)item).ColdBonus     = 5;
                                            ((GargishWizardsCrystalGlasses)item).PoisonBonus   = 5;
                                            ((GargishWizardsCrystalGlasses)item).EnergyBonus   = 5;
                                        }

                                        from.AddToBackpack(item);
                                        dropped.Delete();

                                        return(true);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            SayTo(from, 1157365); // I'm sorry, I cannot accept this item.
            return(false);
        }
Example #17
0
 public static bool ReadCursedState(this IDurability ic, List <ClilocItemRec> properties)
 {
     return(ClilocHelper.Contains(properties, 1049643));
 }
Example #18
0
/*
 *              public override void AlterSpellDamageFrom( Mobile from, ref int damage )
 *              {
 *                      damage = 0;
 *              }
 */
/*
 *              public override void AlterAbilityDamageFrom( Mobile from, ref int damage )
 *              {
 *                      AlterMeleeDamageFrom( from, ref damage );
 *              }
 */
        public override void OnGotMeleeAttack(Mobile attacker)
        {
            this.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
            PlaySound(0x2F4);

            int discordanceEffect = 0;

            if (attacker is PlayerMobile && SkillHandlers.Discordance.GetEffect(this, ref discordanceEffect))
            {
                attacker.SendAsciiMessage("The creature's magnetic field is weak.");
            }
            else if (attacker != null)
            {
                attacker.SendAsciiMessage("The creature's magnetic field repels your attack.");

                if (attacker.AccessLevel == AccessLevel.Player && attacker.InRange(this.Location, 2) && 0.15 > Utility.RandomDouble())
                {
                    List <Item> items = new List <Item>();

                    for (int i = 0; i < attacker.Items.Count; i++)
                    {
                        Item item = attacker.Items[i];

                        if (item.Movable && item.LootType != LootType.Blessed && item.LootType != LootType.Newbied && item.BlessedFor == null)
                        {
                            CraftResource resource = CraftResource.None;

                            if (item is BaseWeapon)
                            {
                                resource = ((BaseWeapon)item).Resource;
                            }
                            else if (item is BaseArmor)
                            {
                                resource = ((BaseArmor)item).Resource;
                            }
                            else if (item is BaseJewel)
                            {
                                resource = CraftResource.Iron;
                            }
                            else if (item is BaseClothing)
                            {
                                resource = ((BaseClothing)item).Resource;
                            }
                            else
                            {
                                continue;
                            }

                            if (CraftResources.GetType(resource) == CraftResourceType.Metal)
                            {
                                items.Add(item);
                            }
                        }
                    }

                    if (items.Count > 0)
                    {
                        Item todrop = items[Utility.Random(items.Count)];

                        if (todrop is IDurability)
                        {
                            IDurability dura = (IDurability)todrop;
                            if (dura.MaxHitPoints > 0)                               //It is not invulnerable
                            {
                                int maxpts = dura.MaxHitPoints / 10;
                                int points = Math.Min(maxpts, dura.HitPoints);

                                dura.HitPoints -= points;
                                if (dura.HitPoints == 0)
                                {
                                    dura.MaxHitPoints -= maxpts - points;
                                }

                                if (dura.MaxHitPoints <= 0)
                                {
                                    attacker.SendMessage("The creature's magnetic field destroyed your {0}.", todrop.GetDisplayName(attacker.NetState, false));
                                    todrop.Delete();
                                }
                                else
                                {
                                    attacker.SendMessage("The creature's magnetic field attracted your {0}, and damaged it in the process.", todrop.GetDisplayName(attacker.NetState, false));
                                    todrop.MoveToWorld(Location, Map);
                                }
                            }
                        }
                        else
                        {
                            attacker.SendMessage("The creature's magnetic field attracted your {0}.", todrop.GetDisplayName(attacker.NetState, false));
                            todrop.MoveToWorld(Location, Map);
                        }

                        this.FixedParticles(0, 10, 0, 0x2530, EffectLayer.Waist);
                    }
                }
            }

            base.OnGotMeleeAttack(attacker);
        }
Example #19
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Powder.Deleted || m_Powder.UsesRemaining <= 0)
                {
                    from.SendLocalizedMessage(1049086);                       // You have used up your powder of temperament.
                    return;
                }

                if (targeted is IDurability && targeted is Item)
                {
                    IDurability wearable = (IDurability)targeted;
                    Item        item     = (Item)targeted;

                    if (!wearable.CanFortify)
                    {
                        from.SendLocalizedMessage(1049083);                           // You cannot use the powder on that item.
                        return;
                    }

                    if ((item.IsChildOf(from.Backpack) || (Core.ML && item.Parent == from)) && m_Powder.IsChildOf(from.Backpack))
                    {
                        int origMaxHP = wearable.MaxHitPoints;
                        int origCurHP = wearable.HitPoints;

                        if (origMaxHP > 0)
                        {
                            int initMaxHP = Core.AOS ? 255 : wearable.InitMaxHits;

                            wearable.UnscaleDurability();

                            if (wearable.MaxHitPoints < initMaxHP)
                            {
                                int bonus = initMaxHP - wearable.MaxHitPoints;

                                if (bonus > 10)
                                {
                                    bonus = 10;
                                }

                                wearable.MaxHitPoints += bonus;
                                wearable.HitPoints    += bonus;

                                wearable.ScaleDurability();

                                if (wearable.MaxHitPoints > 255)
                                {
                                    wearable.MaxHitPoints = 255;
                                }
                                if (wearable.HitPoints > 255)
                                {
                                    wearable.HitPoints = 255;
                                }

                                if (wearable.MaxHitPoints > origMaxHP)
                                {
                                    from.SendLocalizedMessage(1049084);                                       // You successfully use the powder on the item.
                                    from.PlaySound(0x247);

                                    --m_Powder.UsesRemaining;

                                    if (m_Powder.UsesRemaining <= 0)
                                    {
                                        from.SendLocalizedMessage(1049086);                                           // You have used up your powder of fortifying.
                                        m_Powder.Delete();
                                    }
                                }
                                else
                                {
                                    wearable.MaxHitPoints = origMaxHP;
                                    wearable.HitPoints    = origCurHP;
                                    from.SendLocalizedMessage(1049085);                                       // The item cannot be improved any further.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1049085);                                   // The item cannot be improved any further.
                                wearable.ScaleDurability();
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1049083);                               // You cannot use the powder on that item.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042001);                           // That must be in your pack for you to use it.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049083);                       // You cannot use the powder on that item.
                }
            }
Example #20
0
 public static bool ReadAntiqueState(this IDurability ic, List <ClilocItemRec> properties)
 {
     return(ClilocHelper.Contains(properties, 1152714));
 }
		private bool IsUsingDurability( IDurability item )
		{
			return ( (item.HitPoints + item.MaxHitPoints ) > 0 );
		}
Example #22
0
        private void Target_Callback(Mobile from, object targeted)
        {
            if (targeted is Item && !((Item)targeted).IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042593);                   // That is not in your backpack.
            }
            else if (!(targeted is IFactionArtifact))
            {
                from.SendLocalizedMessage(1049083);                   // You cannot use the powder on that item.
            }
            else if (!(targeted is IDurability))
            {
                from.SendLocalizedMessage(1049083);                   // You cannot use the powder on that item.
            }
            else
            {
                IDurability item = targeted as IDurability;

                if (item.HitPoints == item.MaxHitPoints)
                {
                    from.SendLocalizedMessage(1094761);                       // This item is already in perfect condition.
                }
                else
                {
                    if (item.MaxHitPoints > 225)
                    {
                        item.MaxHitPoints = item.HitPoints = 225;
                    }
                    else if (item.MaxHitPoints > 200)
                    {
                        item.MaxHitPoints = item.HitPoints = 200;
                    }
                    else if (item.MaxHitPoints > 175)
                    {
                        item.MaxHitPoints = item.HitPoints = 175;
                    }
                    else if (item.MaxHitPoints > 150)
                    {
                        item.MaxHitPoints = item.HitPoints = 150;
                    }
                    else if (item.MaxHitPoints > 125)
                    {
                        item.MaxHitPoints = item.HitPoints = 125;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1049085);                           // The item cannot be improved any further.
                        return;
                    }

                    from.SendLocalizedMessage(1049084);                       // You successfully use the powder on the item.
                    from.PlaySound(0x247);

                    m_UsesRemaining--;

                    if (m_UsesRemaining == 0)
                    {
                        from.SendLocalizedMessage(1094760);                           // You have used up your Powder of Perseverance.
                        Delete();
                    }
                }
            }
        }
Example #23
0
        private static double GetDurabilityPenalty( IDurability item )
        {
            if ( !item.CanLoseDurability )
                return 0.0;

            return 0.02 * ( Math.Max( 0, 50 - item.HitPoints ) );
        }
Example #24
0
 public static bool ReadBrittleState(this IDurability ic, List <ClilocItemRec> properties)
 {
     return(ClilocHelper.Contains(properties, 1116209));
 }
Example #25
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                int DestroyChance = Utility.Random(8);                 // success chance.

                if (targeted is IDurability && targeted is Item)
                {
                    IDurability wearable = (IDurability)targeted;
                    Item        item     = (Item)targeted;

                    if (!from.InRange(((Item)targeted).GetWorldLocation(), 3))
                    {
                        from.SendLocalizedMessage(500446);                           // That is too far away.
                    }

                    else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile))
                    {
                        from.SendMessage("You cannot enhance that in it's current location.");
                    }
                    else if (wearable.MaxHitPoints >= 255)
                    {
                        from.SendMessage("You cannot Enhance this item further.");
                    }
                    else if (!wearable.CanFortify)
                    {
                        from.SendMessage("Replicas Cannot be enhanced with this object.");                           // You cannot use the powder on that item.
                        return;
                    }

                    else
                    {
                        if (DestroyChance > 0)
                        {
                            wearable.MaxHitPoints = wearable.MaxHitPoints + 10;
                            from.SendMessage("The Rune increased the durability.");
                            from.PlaySound(0x1F5);
                            m_DurabilityBonusRune.Delete();
                            if (wearable.MaxHitPoints > 255)
                            {
                                wearable.MaxHitPoints = 255;
                            }
                            wearable.HitPoints = wearable.HitPoints += 10;
                            if (wearable.HitPoints > wearable.MaxHitPoints)
                            {
                                wearable.HitPoints = wearable.MaxHitPoints;
                            }
                        }
                        else                         // Fail
                        {
                            from.SendMessage("You have failed to enhance the item, and it is damage beyond repair!");
                            from.PlaySound(42);
                            item.Delete();
                            m_DurabilityBonusRune.Delete();
                        }
                    }
                }

                else
                {
                    from.SendMessage("You cannot enhance that.");
                }
            }
Example #26
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (this.m_Powder.Deleted || this.m_Powder.UsesRemaining <= 0)
                {
                    from.SendLocalizedMessage(1049086); // You have used up your powder of temperament.
                    return;
                }

                if (targeted is IDurability && targeted is Item)
                {
                    IDurability wearable = (IDurability)targeted;
                    Item        item     = (Item)targeted;

                    if (!wearable.CanFortify)
                    {
                        from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                        return;
                    }

                    #region SF Imbuing
                    if (item is BaseArmor)
                    {
                        BaseArmor Ti = (BaseArmor)item as BaseArmor;
                        if (Ti.Attributes.Brittle > 0)
                        {
                            from.SendLocalizedMessage(1149799);   // That cannot be used on brittle items.
                            return;
                        }
                    }
                    else if (item is BaseJewel)
                    {
                        BaseJewel Ti = (BaseJewel)item as BaseJewel;
                        if (Ti.Attributes.Brittle > 0)
                        {
                            from.SendLocalizedMessage(1149799);   // That cannot be used on brittle items.
                            return;
                        }
                    }
                    else if (item is BaseHat)
                    {
                        BaseHat Ti = (BaseHat)item as BaseHat;
                        if (Ti.Attributes.Brittle > 0)
                        {
                            from.SendLocalizedMessage(1149799);   // That cannot be used on brittle items.
                            return;
                        }
                    }
                    else if (item is BaseWeapon)
                    {
                        BaseWeapon Ti = (BaseWeapon)item as BaseWeapon;
                        if (Ti.Attributes.Brittle > 0)
                        {
                            from.SendLocalizedMessage(1149799);   // That cannot be used on brittle items.
                            return;
                        }
                    }
                    #endregion


                    if ((item.IsChildOf(from.Backpack) || (Core.ML && item.Parent == from)) && this.m_Powder.IsChildOf(from.Backpack))
                    {
                        int origMaxHP = wearable.MaxHitPoints;
                        int origCurHP = wearable.HitPoints;

                        if (origMaxHP > 0)
                        {
                            int initMaxHP = Core.AOS ? 255 : wearable.InitMaxHits;

                            wearable.UnscaleDurability();

                            if (wearable.MaxHitPoints < initMaxHP)
                            {
                                int bonus = initMaxHP - wearable.MaxHitPoints;

                                if (bonus > 10)
                                {
                                    bonus = 10;
                                }

                                wearable.MaxHitPoints += bonus;
                                wearable.HitPoints    += bonus;

                                wearable.ScaleDurability();

                                if (wearable.MaxHitPoints > 255)
                                {
                                    wearable.MaxHitPoints = 255;
                                }
                                if (wearable.HitPoints > 255)
                                {
                                    wearable.HitPoints = 255;
                                }

                                if (wearable.MaxHitPoints > origMaxHP)
                                {
                                    from.SendLocalizedMessage(1049084); // You successfully use the powder on the item.
                                    from.PlaySound(0x247);

                                    --this.m_Powder.UsesRemaining;

                                    if (this.m_Powder.UsesRemaining <= 0)
                                    {
                                        from.SendLocalizedMessage(1049086); // You have used up your powder of fortifying.
                                        this.m_Powder.Delete();
                                    }
                                }
                                else
                                {
                                    wearable.MaxHitPoints = origMaxHP;
                                    wearable.HitPoints    = origCurHP;
                                    from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
                                wearable.ScaleDurability();
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                }
            }