Roll() public method

public Roll ( ) : int
return int
Ejemplo 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 BaseJewel || item is BaseHat )
				{
					int bonusProps = GetBonusProperties();

					if ( bonusProps < m_MaxProps && LootPack.CheckLuck( luckChance ) )
						++bonusProps;

					int props = 1 + bonusProps;

					// Make sure we're not spawning items with 6 properties.
					if ( props > m_MaxProps )
						props = m_MaxProps;

					if ( item is BaseWeapon )
						BaseRunicTool.ApplyAttributesTo( (BaseWeapon) item, false, luckChance, props, m_MinIntensity, m_MaxIntensity );
					else if ( item is BaseArmor )
						BaseRunicTool.ApplyAttributesTo( (BaseArmor) item, false, luckChance, props, m_MinIntensity, m_MaxIntensity );
					else if ( item is BaseJewel )
						BaseRunicTool.ApplyAttributesTo( (BaseJewel) item, false, luckChance, props, m_MinIntensity, m_MaxIntensity );
					else if ( item is BaseHat )
						BaseRunicTool.ApplyAttributesTo( (BaseHat) item, false, luckChance, props, m_MinIntensity, m_MaxIntensity );
				}
				else if ( item is BaseInstrument )
				{
					SlayerName slayer = SlayerName.None;

					slayer = BaseRunicTool.GetRandomSlayer();

					if ( slayer == SlayerName.None )
					{
						item.Delete();
						return null;
					}

					BaseInstrument instr = (BaseInstrument) item;

					instr.Slayer = slayer;
				}

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

			return item;
		}
Ejemplo n.º 2
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)
                {
                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        if (0.80 > Utility.RandomDouble() + (luckChance / 10000))
                        {
                            weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomBonus(luckChance);
                        }

                        if (0.60 > Utility.RandomDouble() + (luckChance / 10000))
                        {
                            weapon.DamageLevel = (WeaponDamageLevel)GetRandomBonus(luckChance);
                        }

                        if (0.40 > Utility.RandomDouble() + (luckChance / 10000))
                        {
                            weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomBonus(luckChance);
                        }
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        if (0.80 > Utility.RandomDouble() + (luckChance / 10000))
                        {
                            armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomBonus(luckChance);
                        }

                        if (0.40 > Utility.RandomDouble() + (luckChance / 10000))
                        {
                            armor.DurabilityLevel = (ArmorDurabilityLevel)GetRandomBonus(luckChance);
                        }
                    }
                }

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

            return(item);
        }
Ejemplo n.º 3
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.Stackable)
                {
                    item.Amount = m_Quantity.Roll();
                }
            }

            return(item);
        }
Ejemplo n.º 4
0
        public Item Construct()
        {
            if (m_Items == null) // m_Items == null ?.. Wtf ?
            {
                Console.WriteLine("Wtf");
                return(null);
            }

            try
            {
                int f = Utility.RandomMinMax(1, m_Items.Length) - 1;

                Item i = m_Items[f].Construct();


                if (i != null)
                {
                    if (i is BaseWeapon || i is BaseArmor || i is BaseJewel || i is BaseClothing)
                    {
                        int Quality = Utility.RandomList((int)WeaponQuality.Low, (int)WeaponQuality.Regular, (int)WeaponQuality.Exceptional);
                    }

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

                return(i);
            }
            catch (Exception e)
            {
                ExceptionLogging.WriteLine(e);
            }

            return(null);
        }
Ejemplo n.º 5
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 BaseJewel || item is BaseHat)
                {
                    if (Core.AOS)
                    {
                        int bonusProps = GetBonusProperties();
                        int min        = m_MinIntensity;
                        int max        = m_MaxIntensity;

                        if (bonusProps < m_MaxProps && LootPack.CheckLuck(luckChance))
                        {
                            ++bonusProps;
                        }

                        int props = 1 + bonusProps;

                        // Make sure we're not spawning items with 6 properties.
                        if (props > m_MaxProps)
                        {
                            props = m_MaxProps;
                        }

                        // Try to generate a new random item
                        if (from is BaseCreature)
                        {
                            if (RandomItemGenerator.GenerateRandomItem(item, ((BaseCreature)from).LastKiller, (BaseCreature)from))
                            {
                                return(item);
                            }
                        }
                        else if (RandomItemGenerator.GenerateRandomItem(item, null, null))
                        {
                            return(item);
                        }

                        // Otherwise use the older style random generation
                        if (item is BaseWeapon)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseArmor)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseJewel)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseHat)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseHat)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                    }
                    else                     // not aos
                    {
                        if (item is BaseWeapon)
                        {
                            BaseWeapon weapon = (BaseWeapon)item;

                            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 (5 > Utility.Random(100))
                            {
                                weapon.Slayer = SlayerName.Silver;
                            }

                            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)
                        {
                            BaseArmor armor = (BaseArmor)item;

                            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);
        }
Ejemplo n.º 6
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 BaseJewel || item is BaseHat || item is BaseEarrings)
                {
                    if (Core.AOS)
                    {
                        int bonusProps = GetBonusProperties();
                        int min        = m_MinIntensity;
                        int max        = m_MaxIntensity;

                        if (bonusProps < m_MaxProps && LootPack.CheckLuck(luckChance))
                        {
                            ++bonusProps;
                        }

                        int props = 1 + bonusProps;

                        // Make sure we're not spawning items with too many properties.
                        if (props > m_MaxProps)
                        {
                            props = m_MaxProps;
                        }

                        if (item is BaseWeapon)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseArmor)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseJewel)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseHat)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseHat)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseEarrings)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseEarrings)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }

                        if (bonusProps >= 5 || item is BaseEarrings)  //Item is epic and should be cursed 95% chance
                        {
                            if (Utility.RandomDouble() > .05)
                            {
                                item.LootType = LootType.Cursed;
                            }
                        }
                    }
                    else                     // not aos
                    {
                        if (item is BaseWeapon)
                        {
                            BaseWeapon weapon = (BaseWeapon)item;

                            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 (5 > Utility.Random(100))
                            {
                                weapon.Slayer = SlayerName.Silver;
                            }

                            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)
                        {
                            BaseArmor armor = (BaseArmor)item;

                            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;
                    if (instr.Slayer == SlayerName.None)
                    {
                        instr.Slayer = slayer;
                    }
                    else
                    {
                        instr.Slayer2 = slayer;
                    }
                    if (instr.Slayer2 != SlayerName.None)
                    {
                        if (Utility.RandomDouble() > .05)
                        {
                            item.LootType = LootType.Cursed;
                        }
                    }
                }

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

            return(item);
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
        public Item Mutate(Mobile from, int luckChance, Item item)
        {
            if (item != null && !(item is BaseWand))
            {
                if (item is BaseWeapon && 1 > Utility.Random(100))
                {
                    item.Delete();
                    item = new FireHorn();
                    return(item);
                }

                if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat)
                {
                    /*
                     * if ( Core.AOS )
                     * {
                     *      int bonusProps = GetBonusProperties();
                     *      int min = m_MinIntensity;
                     *      int max = m_MaxIntensity;
                     *
                     *      if ( bonusProps < m_MaxProps && LootPack.CheckLuck( luckChance ) )
                     ++bonusProps;
                     *
                     *      int props = 1 + bonusProps;
                     *
                     *      // Make sure we're not spawning items with 6 properties.
                     *      if ( props > m_MaxProps )
                     *              props = m_MaxProps;
                     *
                     *      if ( item is BaseWeapon )
                     *              BaseRunicTool.ApplyAttributesTo( (BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity );
                     *      else if ( item is BaseArmor )
                     *              BaseRunicTool.ApplyAttributesTo( (BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity );
                     *      else if ( item is BaseJewel )
                     *              BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity );
                     *      else if ( item is BaseHat )
                     *              BaseRunicTool.ApplyAttributesTo( (BaseHat)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity );
                     * }
                     * else // not aos
                     * { */
                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        if (55 > Utility.Random(100))
                        {
                            weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus();
                        }

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

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

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

                        if (1 > Utility.Random(1000) || (weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random(100)))
                        {
                            if (from != null)
                            {
                                weapon.Slayer = SlayerGroup.GetLootSlayerType(from.GetType());
                            }
                            else
                            {
                                weapon.Slayer = BaseRunicTool.GetRandomSlayer();
                            }
                        }
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        if (55 > Utility.Random(100))
                        {
                            armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus();
                        }

                        if (25 > Utility.Random(100))
                        {
                            armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus();
                        }
                    }
                    //}
                }
                else if (item is BaseInstrument)
                {
                    SlayerName slayer = SlayerName.None;

                    if (/*Core.AOS ||*/ from == null)
                    {
                        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);
        }
Ejemplo n.º 9
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 BaseJewel || item is BaseHat)
                {
                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        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 (5 > Utility.Random(100))
                        {
                            weapon.Slayer = SlayerName.Silver;
                        }

                        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)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        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;

                    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);
        }
Ejemplo n.º 10
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 BaseJewel)
                {
                    if (Core.AOS)
                    {
                        int bonusProps = GetBonusProperties();

                        if (bonusProps < m_MaxProps && LootPack.CheckLuck(luckChance))
                        {
                            ++bonusProps;
                        }

                        int props = 1 + bonusProps;

                        if (item is BaseWeapon)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseArmor)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseJewel)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                    }
                    else                     // not aos
                    {
                        if (item is BaseWeapon)
                        {
                            BaseWeapon weapon = (BaseWeapon)item;

                            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 (5 > Utility.Random(100))
                            {
                                weapon.Slayer = SlayerName.Silver;
                            }

                            if (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)
                        {
                            BaseArmor armor = (BaseArmor)item;

                            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);
        }
Ejemplo n.º 11
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 BaseJewel || item is BaseHat)
                {
                    // Try to generate a new random item based on the creature killed
                    if (RandomItemGenerator.Enabled && from is BaseCreature)
                    {
                        if (RandomItemGenerator.GenerateRandomItem(item, ((BaseCreature)from).LastKiller, (BaseCreature)from))
                        {
                            return(item);
                        }
                    }

                    int bonusProps = GetBonusProperties();
                    int min        = m_MinIntensity;
                    int max        = m_MaxIntensity;

                    if (bonusProps < m_MaxProps && LootPack.CheckLuck(luckChance))
                    {
                        ++bonusProps;
                    }

                    int props = 1 + bonusProps;

                    // Make sure we're not spawning items with 6 properties.
                    if (props > m_MaxProps)
                    {
                        props = m_MaxProps;
                    }

                    // Use the older style random generation
                    if (item is BaseWeapon)
                    {
                        BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                    }
                    else if (item is BaseArmor)
                    {
                        BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                    }
                    else if (item is BaseJewel)
                    {
                        BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                    }
                    else if (item is BaseHat)
                    {
                        BaseRunicTool.ApplyAttributesTo((BaseHat)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                    }
                }
                else if (item is BaseInstrument)
                {
                    SlayerName slayer = SlayerName.None;

                    slayer = BaseRunicTool.GetRandomSlayer();

                    if (slayer == SlayerName.None)
                    {
                        item.Delete();
                        return(null);
                    }

                    BaseInstrument instr = (BaseInstrument)item;

                    instr.Quality = ItemQuality.Normal;
                    instr.Slayer  = slayer;
                }

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

            return(item);
        }
Ejemplo n.º 12
0
        public Item Mutate(Mobile from, int luckChance, Item item)
        {
            if (item != null)
            {
                if (item is BaseWeapon || item is BaseArmor || item is BaseJewel)
                {
                    if (Core.AOS)
                    {
                        int bonusProps = GetBonusProperties();
                        int min        = m_MinIntensity;
                        int max        = m_MaxIntensity;

                        if (bonusProps < m_MaxProps && LootPack.CheckLuck(luckChance))
                        {
                            ++bonusProps;
                        }

                        int props = 1 + bonusProps;

                        if (item is BaseWeapon)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseArmor)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseJewel)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                    }
                    else                     // not aos
                    {
                        if (item is BaseWeapon)
                        {
                            BaseWeapon weapon = (BaseWeapon)item;

                            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 (20 > Utility.Random(100))
                            {
                                weapon.Slayer = SlayerName.Silver;
                            }

                            if (weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && 35 > Utility.Random(100))
                            {
                                switch (Utility.Random(25))
                                {
                                case 0:
                                {
                                    weapon.Slayer = SlayerName.Silver;
                                    break;
                                }

                                case 1:
                                {
                                    weapon.Slayer = SlayerName.OrcSlaying;
                                    break;
                                }

                                case 2:
                                {
                                    weapon.Slayer = SlayerName.TrollSlaughter;
                                    break;
                                }

                                case 3:
                                {
                                    weapon.Slayer = SlayerName.OgreTrashing;
                                    break;
                                }

                                case 4:
                                {
                                    weapon.Slayer = SlayerName.Repond;
                                    break;
                                }

                                case 5:
                                {
                                    weapon.Slayer = SlayerName.DragonSlaying;
                                    break;
                                }

                                case 6:
                                {
                                    weapon.Slayer = SlayerName.Terathan;
                                    break;
                                }

                                case 7:
                                {
                                    weapon.Slayer = SlayerName.LizardmanSlaughter;
                                    break;
                                }

                                case 8:
                                {
                                    weapon.Slayer = SlayerName.ReptilianDeath;
                                    break;
                                }

                                case 9:
                                {
                                    weapon.Slayer = SlayerName.DaemonDismissal;
                                    break;
                                }

                                case 10:
                                {
                                    weapon.Slayer = SlayerName.GargoylesFoe;
                                    break;
                                }

                                case 11:
                                {
                                    weapon.Slayer = SlayerName.BalronDamnation;
                                    break;
                                }

                                case 12:
                                {
                                    weapon.Slayer = SlayerName.Exorcism;
                                    break;
                                }

                                case 13:
                                {
                                    weapon.Slayer = SlayerName.Ophidian;
                                    break;
                                }

                                case 14:
                                {
                                    weapon.Slayer = SlayerName.SpidersDeath;
                                    break;
                                }

                                case 15:
                                {
                                    weapon.Slayer = SlayerName.ScorpionsBane;
                                    break;
                                }

                                case 16:
                                {
                                    weapon.Slayer = SlayerName.ArachnidDoom;
                                    break;
                                }

                                case 17:
                                {
                                    weapon.Slayer = SlayerName.FlameDousing;
                                    break;
                                }

                                case 18:
                                {
                                    weapon.Slayer = SlayerName.WaterDissipation;
                                    break;
                                }

                                case 19:
                                {
                                    weapon.Slayer = SlayerName.Vacuum;
                                    break;
                                }

                                case 20:
                                {
                                    weapon.Slayer = SlayerName.ElementalHealth;
                                    break;
                                }

                                case 21:
                                {
                                    weapon.Slayer = SlayerName.EarthShatter;
                                    break;
                                }

                                case 22:
                                {
                                    weapon.Slayer = SlayerName.BloodDrinking;
                                    break;
                                }

                                case 23:
                                {
                                    weapon.Slayer = SlayerName.SummerWind;
                                    break;
                                }

                                case 24:
                                {
                                    weapon.Slayer = SlayerName.ElementalBan;
                                    break;
                                }

                                case 25:
                                {
                                    weapon.Slayer = SlayerName.Fey;
                                    break;
                                }
                                }
                            }
                        }
                        else if (item is BaseArmor)
                        {
                            BaseArmor armor = (BaseArmor)item;

                            if (80 > Utility.Random(100))
                            {
                                armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus();
                            }

                            if (40 > Utility.Random(100))
                            {
                                armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus();
                            }
                        }
                        else if (item is BaseJewel)
                        {
                            BaseJewel jewel = (BaseJewel)item;

                            if (80 > Utility.Random(100))
                            {
                                jewel.Effect = (MagicEffect)Utility.Random(0, 11);
                                jewel.Uses   = Utility.Random(1, 10);
                            }
                        }
                    }
                }
                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);
        }
Ejemplo n.º 13
0
 public void GenerateGold(Mobile creature, Container c)
 {
     c.TryDropItem(creature, new Gold(m_Gold.Roll()), false, false);
 }