Inheritance: BaseMeleeWeapon
 public void Sharpening(Mobile from, object o)
 {
     if (o is Item)
     {
         if (!((Item)o).IsChildOf(from.Backpack))
         {
             from.SendMessage(32, "This must be in your backpack to sharpen");
         }
         else if (o is BaseSword && ((BaseSword)o).IsChildOf(from.Backpack))
         {
             BaseSword weap = o as BaseSword;
             int       i_DI = weap.Attributes.WeaponDamage;
             if (weap.Quality == WeaponQuality.Exceptional)
             {
                 i_DI += 15;
             }
             if (i_DI >= 60)
             {
                 from.SendMessage(32, "This weapon cannot be sharpened any further");
                 return;
             }
             else if (from.Skills[SkillName.Blacksmith].Value < 60.0)
             {
                 from.SendMessage(32, "You need at least 60.0 blacksmith to sharpen weapons with this stone");
             }
             else if (!Deleted)
             {
                 int bonus = Utility.Random((int)(from.Skills[SkillName.Blacksmith].Value / 20));
                 if (bonus > 0)
                 {
                     if (60 < i_DI + bonus)
                     {
                         bonus = 60 - i_DI;
                     }
                     weap.Attributes.WeaponDamage += bonus;
                     from.SendMessage(88, "You sharpened the weapon with {0} damange increase", bonus);
                 }
                 else
                 {
                     from.SendMessage(32, "You fail to sharpen the weapon");
                 }
                 if (Uses <= 1)
                 {
                     from.SendMessage(32, "You used up the sharpening stone");
                     Delete();
                 }
                 else
                 {
                     --Uses;
                     from.SendMessage(32, "You have {0} uses left", Uses);
                 }
             }
         }
         else if (o is BaseKnife && ((BaseKnife)o).IsChildOf(from.Backpack))
         {
             BaseKnife weap = o as BaseKnife;
             int       i_DI = weap.Attributes.WeaponDamage;
             if (weap.Quality == WeaponQuality.Exceptional)
             {
                 i_DI += 15;
             }
             if (i_DI >= 60)
             {
                 from.SendMessage(32, "This weapon cannot be sharpened any further");
                 return;
             }
             else if (from.Skills[SkillName.Blacksmith].Value < 60.0)
             {
                 from.SendMessage(32, "You need at least 60.0 blacksmith to sharpen weapons with this stone");
             }
             else if (!Deleted)
             {
                 int bonus = Utility.Random((int)(from.Skills[SkillName.Blacksmith].Value / 20));
                 if (bonus > 0)
                 {
                     if (60 < i_DI + bonus)
                     {
                         bonus = 60 - i_DI;
                     }
                     weap.Attributes.WeaponDamage += bonus;
                     from.SendMessage(88, "You sharpened the weapon with {0} damange increase", bonus);
                 }
                 else
                 {
                     from.SendMessage(32, "You fail to sharpen the weapon");
                 }
                 if (Uses <= 1)
                 {
                     from.SendMessage(32, "You used up the sharpening stone");
                     Delete();
                 }
                 else
                 {
                     --Uses;
                     from.SendMessage(32, "You have {0} uses left", Uses);
                 }
             }
         }
         else if (o is BaseAxe && ((BaseAxe)o).IsChildOf(from.Backpack))
         {
             BaseAxe weap = o as BaseAxe;
             int     i_DI = weap.Attributes.WeaponDamage;
             if (weap.Quality == WeaponQuality.Exceptional)
             {
                 i_DI += 15;
             }
             if (i_DI >= 60)
             {
                 from.SendMessage(32, "This weapon cannot be sharpened any further");
                 return;
             }
             else if (from.Skills[SkillName.Blacksmith].Value < 60.0)
             {
                 from.SendMessage(32, "You need at least 60.0 blacksmith to sharpen weapons with this stone");
             }
             else if (!Deleted)
             {
                 int bonus = Utility.Random((int)(from.Skills[SkillName.Blacksmith].Value / 20));
                 if (bonus > 0)
                 {
                     if (60 < i_DI + bonus)
                     {
                         bonus = 60 - i_DI;
                     }
                     weap.Attributes.WeaponDamage += bonus;
                     from.SendMessage(88, "You sharpened the weapon with {0} damange increase", bonus);
                 }
                 else
                 {
                     from.SendMessage(32, "You fail to sharpen the weapon");
                 }
                 if (Uses <= 1)
                 {
                     from.SendMessage(32, "You used up the sharpening stone");
                     Delete();
                 }
                 else
                 {
                     --Uses;
                     from.SendMessage(32, "You have {0} uses left", Uses);
                 }
             }
         }
         else
         {
             from.SendMessage(32, "You can only enhance edged weapons");
         }
     }
     else
     {
         from.SendMessage(32, "You can only enhance edged weapons");
     }
 }
Esempio n. 2
0
        public void Sharpening(Mobile from, object o)
        {
            if (o is Item)
            {
                if (!((Item)o).IsChildOf(from.Backpack))
                {
                    from.SendMessage(32, "This must be in your backpack to sharpen");
                }
                else if (o is BaseSword && ((BaseSword)o).IsChildOf(from.Backpack))
                {
                    BaseSword weap = o as BaseSword;
                    int       i_DI = weap.Attributes.WeaponDamage;
                    //if (weap.Quality == WeaponQuality.Exceptional)
                    i_DI += 15;
                    if (i_DI >= 70)
                    {
                        from.SendMessage(32, "This weapon cannot be sharpened any further");
                        return;
                    }
                    else if (from.Skills[SkillName.Blacksmith].Value < 100.0)
                    {
                        from.SendMessage(32, "You need at least 100.0 blacksmith and 80.0 chivalry to sharpen weapons with this stone");
                    }
                    else if (from.Skills[SkillName.Chivalry].Value < 80.0)
                    {
                        from.SendMessage(32, "You need at least 100.0 blacksmith and 80 chivalry to sharpen weapons with this stone");
                    }
                    else if (!Deleted)
                    {
                        int bonus = Utility.Random((int)(from.Skills[SkillName.Blacksmith].Value / 10));
                        if (bonus > 0)
                        {
                            if (70 < i_DI + bonus)
                            {
                                bonus = 70 - i_DI;
                            }
                            weap.Attributes.WeaponDamage += bonus;
                            weap.Consecrated              = true;
                            weap.LootType = LootType.Blessed;
                            from.SendMessage(88, "You sharpened the weapon with {0} damange increase", bonus);
                            this.Amount = this.Amount - 1;
                        }
                        else
                        {
                            from.SendMessage(32, "You fail to sharpen the weapon");
                        }
                        if (this.Amount == 0)
                        {
                            from.SendMessage(32, "You used up a sharpening stone");


                            Delete();
                        }
                        else
                        {
                            //--Uses;
                            from.SendMessage(32, "You were scared you'd cut your finger.");
                        }
                    }
                }
                else if (o is BaseKnife && ((BaseKnife)o).IsChildOf(from.Backpack))
                {
                    BaseKnife weap = o as BaseKnife;
                    int       i_DI = weap.Attributes.WeaponDamage;
                    if (weap.Quality == WeaponQuality.Exceptional)
                    {
                        i_DI += 15;
                    }
                    if (i_DI >= 70)
                    {
                        from.SendMessage(32, "This weapon cannot be sharpened any further");
                        return;
                    }
                    else if (from.Skills[SkillName.Blacksmith].Value < 100.0)
                    {
                        from.SendMessage(32, "You need at least 100.0 blacksmith and 80.0 chivalry to sharpen weapons with this stone");
                    }
                    else if (from.Skills[SkillName.Chivalry].Value < 80.0)
                    {
                        from.SendMessage(32, "You need at least 100.0 blacksmith and 80 chivalry to sharpen weapons with this stone");
                    }
                    else if (!Deleted)
                    {
                        int bonus = Utility.Random((int)(from.Skills[SkillName.Blacksmith].Value / 10));
                        if (bonus > 0)
                        {
                            if (70 < i_DI + bonus)
                            {
                                bonus = 70 - i_DI;
                            }
                            weap.Attributes.WeaponDamage += bonus;
                            weap.Consecrated              = true;
                            weap.LootType = LootType.Blessed;
                            from.SendMessage(88, "You sharpened the weapon with {0} damange increase", bonus);
                        }
                        else
                        {
                            from.SendMessage(32, "You fail to sharpen the weapon");
                        }
                        if (Uses <= 1)
                        {
                            from.SendMessage(32, "You used up the sharpening stone");
                            Delete();
                        }
                        else
                        {
                            --Uses;
                            from.SendMessage(32, "You have {0} uses left", Uses);
                        }
                    }
                }
                else if (o is BaseAxe && ((BaseAxe)o).IsChildOf(from.Backpack))
                {
                    BaseAxe weap = o as BaseAxe;
                    int     i_DI = weap.Attributes.WeaponDamage;
                    if (weap.Quality == WeaponQuality.Exceptional)
                    {
                        i_DI += 15;
                    }
                    if (i_DI >= 70)
                    {
                        from.SendMessage(32, "This weapon cannot be sharpened any further");
                        return;
                    }
                    else if (from.Skills[SkillName.Blacksmith].Value < 100.0)
                    {
                        from.SendMessage(32, "You need at least 100.0 blacksmith and 80.0 chivalry to sharpen weapons with this stone");
                    }
                    else if (from.Skills[SkillName.Chivalry].Value < 80.0)
                    {
                        from.SendMessage(32, "You need at least 100.0 blacksmith and 80 chivalry to sharpen weapons with this stone");
                    }
                    else if (!Deleted)
                    {
                        int bonus = Utility.Random((int)(from.Skills[SkillName.Blacksmith].Value / 10));
                        if (bonus > 0)
                        {
                            if (70 < i_DI + bonus)
                            {
                                bonus = 70 - i_DI;
                            }
                            weap.Attributes.WeaponDamage += bonus;
                            weap.Consecrated              = true;
                            weap.LootType = LootType.Blessed;
                            from.SendMessage(88, "You sharpened the weapon with {0} damange increase", bonus);
                        }
                        else
                        {
                            from.SendMessage(32, "You fail to sharpen the weapon");
                        }
                        if (Uses <= 1)
                        {
                            from.SendMessage(32, "You used up the sharpening stone");
                            Delete();
                        }
                        else
                        {
                            --Uses;
                            from.SendMessage(32, "You have {0} uses left", Uses);
                        }
                    }
                }
                else
                {
                    from.SendMessage(32, "You can only enhance edged weapons");
                }
            }
            else
            {
                from.SendMessage(32, "You can only enhance edged weapons");
            }
        }