ScaleDurability() public méthode

public ScaleDurability ( ) : void
Résultat void
Exemple #1
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 BaseArmor /*&& (DefBlacksmithy.CraftSystem.CraftItems.SearchForSubclass( targeted.GetType() ) != null)*/)
                {
                    BaseArmor ar = (BaseArmor)targeted;

                    if (ar.IsChildOf(from.Backpack) && m_Powder.IsChildOf(from.Backpack))
                    {
                        int origMaxHP = ar.MaxHitPoints;
                        int origCurHP = ar.HitPoints;

                        ar.UnscaleDurability();

                        if (ar.MaxHitPoints < ar.InitMaxHits)
                        {
                            int bonus = ar.InitMaxHits - ar.MaxHitPoints;

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

                            ar.MaxHitPoints += bonus;
                            ar.HitPoints    += bonus;

                            ar.ScaleDurability();

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

                                --m_Powder.UsesRemaining;

                                if (m_Powder.UsesRemaining <= 0)
                                {
                                    from.SendLocalizedMessage(1049086);                                       // You have used up your powder of temperament.
                                    m_Powder.Delete();
                                }
                            }
                            else
                            {
                                ar.MaxHitPoints = origMaxHP;
                                ar.HitPoints    = origCurHP;
                                from.SendLocalizedMessage(1049085);                                   // The item cannot be improved any further.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1049085);                               // The item cannot be improved any further.
                            ar.ScaleDurability();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042001);                           // That must be in your pack for you to use it.
                    }
                }
                else if (targeted is BaseWeapon /*&& (DefBlacksmithy.CraftSystem.CraftItems.SearchForSubclass( targeted.GetType() ) != null)*/)
                {
                    BaseWeapon wep = (BaseWeapon)targeted;

                    if (wep.IsChildOf(from.Backpack) && m_Powder.IsChildOf(from.Backpack))
                    {
                        int origMaxHP = wep.MaxHitPoints;
                        int origCurHP = wep.HitPoints;

                        wep.UnscaleDurability();

                        if (wep.MaxHitPoints < wep.InitMaxHits)
                        {
                            int bonus = wep.InitMaxHits - wep.MaxHitPoints;

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

                            wep.MaxHitPoints += bonus;
                            wep.HitPoints    += bonus;

                            wep.ScaleDurability();

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

                                --m_Powder.UsesRemaining;

                                if (m_Powder.UsesRemaining <= 0)
                                {
                                    from.SendLocalizedMessage(1049086);                                       // You have used up your powder of temperament.
                                    m_Powder.Delete();
                                }
                            }
                            else
                            {
                                wep.MaxHitPoints = origMaxHP;
                                wep.HitPoints    = origCurHP;
                                from.SendLocalizedMessage(1049085);                                   // The item cannot be improved any further.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1049085);                               // The item cannot be improved any further.
                            wep.ScaleDurability();
                        }
                    }
                    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.
                }
            }