Esempio n. 1
0
        public Item Mutate(Mobile from, int luckChance, Item item)
        {
            if (item != null)
            {
                /*if ( item is BaseWeapon && 1 > Utility.Random( 100 ) )
                 * {
                 *      item.Delete();
                 *      item = new FireHorn();
                 *      return item;
                 * }*/

                if ((item is BaseWeapon || item is BaseArmor || item is BaseClothing || item is BaseHat) && m_MaxIntensity > 0)
                {
                    if (item is MagicWand)
                    {
                        SpellCastEffect.MutateLoot(m_MaxIntensity, (MagicWand)item);
                    }
                    else if (item is BaseClothing)
                    {
                        if (50 > Utility.Random(100) || m_MinIntensity > 0)
                        {
                            SpellCastEffect.MutateLoot(m_MaxIntensity, (BaseClothing)item);
                        }
                    }
                    else if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        int count = 0;
                        while (++count < 10 && !weapon.IsMagic)
                        {
                            if (80 > Utility.Random(100))
                            {
                                weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus();
                            }

                            if (60 > Utility.Random(100))
                            {
                                weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus();
                            }

                            if (40 > Utility.Random(100))
                            {
                                weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus();
                            }

                            if (10 > Utility.Random(100))
                            {
                                weapon.Slayer = SlayerName.Silver;
                            }

                            if (5 > Utility.Random(100))
                            {
                                SpellCastEffect.MutateLoot(m_MaxIntensity, weapon);
                            }
                        }

                        //if ( from != null && weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random( 100 ) )
                        //	weapon.Slayer = SlayerGroup.GetLootSlayerType( from.GetType() );
                    }
                    else if (item is BaseArmor)
                    {
                        int       count = 0;
                        BaseArmor armor = (BaseArmor)item;
                        while (++count < 10 && !armor.IsMagic)
                        {
                            if (80 > Utility.Random(100))
                            {
                                armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus();
                            }

                            if (40 > Utility.Random(100))
                            {
                                armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus();
                            }
                        }
                    }
                }

                /*else if ( item is BaseInstrument )
                 * {
                 *      SlayerName slayer = SlayerName.None;
                 *
                 *      if ( Core.AOS )
                 *              slayer = BaseRunicTool.GetRandomSlayer();
                 *      else
                 *              slayer = SlayerGroup.GetLootSlayerType( from.GetType() );
                 *
                 *      if ( slayer == SlayerName.None )
                 *      {
                 *              item.Delete();
                 *              return null;
                 *      }
                 *
                 *      BaseInstrument instr = (BaseInstrument)item;
                 *
                 *      instr.Quality = InstrumentQuality.Regular;
                 *      instr.Slayer = slayer;
                 * }*/

                if (item.Stackable)
                {
                    item.Amount = m_Quantity.Roll();
                }
            }

            return(item);
        }
Esempio n. 2
0
        public Item Mutate(Item item)
        {
            if (item == null)
            {
                return(null);
            }

            int stop = 0;

            if (item is MagicWand)
            {
                MagicWand wand = (MagicWand)item;

                while (wand.SpellEffect == SpellEffect.None && stop < 500)
                {
                    stop++;
                    double dr = Utility.RandomDouble() * 100.0;

                    if (dr < 8.0)
                    {
                        if (dr < 0.2 && m_MaxIntensity >= 80)
                        {
                            wand.SpellEffect = SpellEffect.ManaDrain;
                        }
                        else if (dr < 0.8 && m_MaxIntensity >= 80)
                        {
                            wand.SpellEffect = SpellEffect.Lightning;
                        }
                        else if (dr < 1.3 && m_MaxIntensity >= 60)
                        {
                            wand.SpellEffect = SpellEffect.Fireball;
                        }
                        else if (dr < 1.8 && m_MaxIntensity >= 60)
                        {
                            wand.SpellEffect = SpellEffect.GHeal;
                        }
                        else if (dr < 2.8 && m_MaxIntensity >= 40)
                        {
                            wand.SpellEffect = SpellEffect.Harm;
                        }
                        else if (dr < 3.8 && m_MaxIntensity >= 40)
                        {
                            wand.SpellEffect = SpellEffect.MagicArrow;
                        }
                        else if (dr < 4.8 && m_MaxIntensity >= 20)
                        {
                            wand.SpellEffect = SpellEffect.Feeblemind;
                        }
                        else if (dr < 5.8 && m_MaxIntensity >= 20)
                        {
                            wand.SpellEffect = SpellEffect.Clumsy;
                        }
                        else if (dr < 6.8 && m_MaxIntensity >= 20)
                        {
                            wand.SpellEffect = SpellEffect.MiniHeal;
                        }
                        else                         //if ( dr < 8.0 )
                        {
                            wand.SpellEffect = SpellEffect.ItemID;
                        }
                    }
                }

                if (wand.SpellEffect != SpellEffect.None)
                {
                    wand.SpellCharges = SpellCastEffect.GetChargesFor(wand.SpellEffect);
                }
                else
                {
                    wand.Delete();
                }
            }
            else if (item is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)item;

                while (weapon.AccuracyLevel == WeaponAccuracyLevel.Regular &&
                       weapon.DamageLevel == WeaponDamageLevel.Regular &&
                       weapon.DurabilityLevel == DurabilityLevel.Regular &&
                       weapon.Slayer == SlayerName.None &&
                       weapon.SpellEffect == SpellEffect.None && stop < 500)
                {
                    stop++;

                    if (45 > Utility.Random(100))
                    {
                        weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomBonus();
                    }
                    if (40 > Utility.Random(100))
                    {
                        weapon.DamageLevel = (WeaponDamageLevel)GetRandomBonus();
                    }
                    if (35 > Utility.Random(100))
                    {
                        weapon.DurabilityLevel = (DurabilityLevel)GetRandomBonus();
                    }
                    if (5 > Utility.Random(100))
                    {
                        weapon.Slayer = SlayerName.Silver;
                    }

                    double dr = Utility.RandomDouble() * 100.0;
                    if (dr < 7.8)
                    {
                        if (dr < 0.2 && m_MaxIntensity >= 80)
                        {
                            weapon.SpellEffect = SpellEffect.Lightning;
                        }
                        else if (dr < 0.8 && m_MaxIntensity >= 80)
                        {
                            weapon.SpellEffect = SpellEffect.ManaDrain;
                        }
                        else if (dr < 1.3 && m_MaxIntensity >= 60)
                        {
                            weapon.SpellEffect = SpellEffect.Curse;
                        }
                        else if (dr < 1.8 && m_MaxIntensity >= 60)
                        {
                            weapon.SpellEffect = SpellEffect.Fireball;
                        }
                        else if (dr < 2.8 && m_MaxIntensity >= 40)
                        {
                            weapon.SpellEffect = SpellEffect.Paralyze;
                        }
                        else if (dr < 3.8 && m_MaxIntensity >= 40)
                        {
                            weapon.SpellEffect = SpellEffect.Harm;
                        }
                        else if (dr < 4.8 && m_MaxIntensity >= 20)
                        {
                            weapon.SpellEffect = SpellEffect.Weaken;
                        }
                        else if (dr < 5.8 && m_MaxIntensity >= 20)
                        {
                            weapon.SpellEffect = SpellEffect.MagicArrow;
                        }
                        else if (dr < 6.8)
                        {
                            weapon.SpellEffect = SpellEffect.Feeblemind;
                        }
                        else                         //if ( dr < 7.8 )
                        {
                            weapon.SpellEffect = SpellEffect.Clumsy;
                        }
                    }
                }

                if (weapon.SpellEffect != SpellEffect.None)
                {
                    weapon.SpellCharges = SpellCastEffect.GetChargesFor(weapon.SpellEffect);
                }
            }
            else if (item is BaseArmor)
            {
                BaseArmor armor = (BaseArmor)item;

                while (armor.ProtectionLevel == ArmorProtectionLevel.Regular && armor.Durability == DurabilityLevel.Regular && stop < 500)
                {
                    stop++;

                    if (75 > Utility.Random(100))
                    {
                        armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomBonus();
                    }

                    if (35 > Utility.Random(100))
                    {
                        armor.Durability = (DurabilityLevel)GetRandomBonus();
                    }
                }
            }
            else if (item is BaseInstrument)
            {
                ((BaseInstrument)item).Quality = InstrumentQuality.Regular;
            }
            else if (item is BaseRing)
            {
                BaseRing ring = (BaseRing)item;

                if (GetRandomBonus() >= 5)
                {
                    if (Utility.RandomBool())
                    {
                        ring.SpellEffect = SpellEffect.Invis;
                    }
                    else
                    {
                        ring.SpellEffect = SpellEffect.Teleportation;
                    }
                    ring.SpellCharges = SpellCastEffect.GetChargesFor(ring.SpellEffect);
                }
                else
                {
                    ring.Delete();
                }
            }
            else if (item is BaseClothing)
            {
                BaseClothing clothes = (BaseClothing)item;

                while (clothes.SpellEffect == SpellEffect.None && stop < 1)
                {
                    stop++;
                    double dr = Utility.RandomDouble() * 100.0;
                    if (dr < 10.0)
                    {
                        if (dr < 0.2 && m_MaxIntensity >= 80)
                        {
                            clothes.SpellEffect = SpellEffect.Curse;
                        }
                        else if (dr < 0.8 && m_MaxIntensity >= 80)
                        {
                            clothes.SpellEffect = SpellEffect.Bless;
                        }
                        else if (dr < 1.3 && m_MaxIntensity >= 60)
                        {
                            clothes.SpellEffect = SpellEffect.Weaken;
                        }
                        else if (dr < 1.8 && m_MaxIntensity >= 60)
                        {
                            clothes.SpellEffect = SpellEffect.Clumsy;
                        }
                        else if (dr < 2.8 && m_MaxIntensity >= 60)
                        {
                            clothes.SpellEffect = SpellEffect.Feeblemind;
                        }
                        else if (dr < 3.8 && m_MaxIntensity >= 50)
                        {
                            clothes.SpellEffect = SpellEffect.Reflect;
                        }
                        else if (dr < 4.8 && m_MaxIntensity >= 50)
                        {
                            clothes.SpellEffect = SpellEffect.Invis;
                        }
                        else if (dr < 5.8 && m_MaxIntensity >= 20)
                        {
                            clothes.SpellEffect = SpellEffect.Strength;
                        }
                        else if (dr < 6.8 && m_MaxIntensity >= 20)
                        {
                            clothes.SpellEffect = SpellEffect.Cunning;
                        }
                        else if (dr < 7.8 && m_MaxIntensity >= 20)
                        {
                            clothes.SpellEffect = SpellEffect.Agility;
                        }
                        else if (dr < 8.9)
                        {
                            clothes.SpellEffect = SpellEffect.Protection;
                        }
                        else
                        {
                            clothes.SpellEffect = SpellEffect.NightSight;
                        }
                    }
                }

                if (clothes.SpellEffect != SpellEffect.None)
                {
                    clothes.SpellCharges = SpellCastEffect.GetChargesFor(clothes.SpellEffect);
                }
            }

            if (item.Stackable)
            {
                item.Amount = m_Quantity.Generate();
            }

            return(item);
        }