public Item Mutate(Mobile from, int luckChance, Item item)
        {
            if (item == null)
            {
                return(null);
            }

            if (item is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)item;

                //Taran: Below we remove the items we don't want mobs to drop
                while (weapon is BaseKnife || weapon is Pickaxe || weapon is Hatchet || weapon is BaseStaff)
                {
                    weapon.Delete();
                    weapon = BaseWeapon.CreateRandomWeapon();
                }

                if (m_WeaponModifiers != null)
                {
                    m_WeaponModifiers.Mutate(weapon);
                }

                //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());

                weapon.Identified = true;
            }
            else if (item is BaseArmor)
            {
                BaseArmor armor = (BaseArmor)item;

                if (m_ArmorModifiers != null)
                {
                    m_ArmorModifiers.Mutate(armor);
                }

                armor.Identified = true;
            }
            else if (item is BaseInstrument)
            {
                SlayerName slayer = SlayerGroup.GetLootSlayerType(from.GetType());

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

                BaseInstrument instr = (BaseInstrument)item;

                instr.Quality = InstrumentQuality.Regular;
                instr.Slayer  = slayer;
            }

            return(item);
        }
        public override Tuple <Item[], int> GenerateLootItem(Mobile creature)
        {
            Type           type       = m_InstrumentTypes[Utility.Random(m_InstrumentTypes.Length)];
            BaseInstrument instrument = Activator.CreateInstance(type) as BaseInstrument;

            if (instrument == null)
            {
                throw new Exception(String.Format("Type {0} is not BaseInstrument or could not be instantiated.", type));
            }

            int value = 50;

            if (m_SlayerChance > Utility.RandomDouble())
            {
                if (creature != null)
                {
                    instrument.Slayer = SlayerGroup.GetLootSlayerType(creature.GetType());
                }
                else
                {
                    instrument.Slayer = BaseRunicTool.GetRandomSlayer();
                }

                value += 100;
            }

            if (0.08 > Utility.RandomDouble())               // chance that this is low quality
            {
                instrument.Quality = InstrumentQuality.Low;
                value -= 50;
            }

            return(new Tuple <Item[], int>(new Item[] { instrument }, value));
        }
Example #3
0
        public Item Mutate(Mobile from, 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 (item is BaseWeapon)
                    {
                        var weapon = (BaseWeapon)item;

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

                        if (45 > Utility.Random(100))
                        {
                            int damageLevel = GetRandomOldBonus();

                            if (PseudoSeerStone.Instance != null && PseudoSeerStone.Instance._HighestDamageLevelSpawn < damageLevel)
                            {
                                if (damageLevel == 5 && PseudoSeerStone.ReplaceVanqWithSkillScrolls)
                                {
                                    return(PuzzleChest.CreateRandomSkillScroll());
                                }
                                int platAmount = PseudoSeerStone.PlatinumPerMissedDamageLevel *
                                                 (damageLevel - PseudoSeerStone.Instance._HighestDamageLevelSpawn);
                                if (platAmount > 0)
                                {
                                    return(new Platinum(platAmount));
                                }
                                damageLevel = PseudoSeerStone.Instance._HighestDamageLevelSpawn;
                            }
                            weapon.DamageLevel = (WeaponDamageLevel)damageLevel;
                        }

                        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)))
                        {
                            weapon.Slayer = from != null?SlayerGroup.GetLootSlayerType(from.GetType()) : BaseRunicTool.GetRandomSlayer();
                        }

                        if (weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 &&
                            weapon.Slayer == SlayerName.None)
                        {
                            weapon.Identified = true;
                        }
                    }
                    else if (item is BaseArmor)
                    {
                        var armor = (BaseArmor)item;

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

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

                        if (armor.ProtectionLevel == 0 && armor.Durability == 0)
                        {
                            armor.Identified = true;
                        }
                    }
                }
                else if (item is BaseInstrument)
                {
                    SlayerName slayer = from == null || from.EraAOS
                                                                                        ? BaseRunicTool.GetRandomSlayer()
                                                                                        : SlayerGroup.GetLootSlayerType(from.GetType());

                    var instr = (BaseInstrument)item;

                    instr.Quality = InstrumentQuality.Regular;
                    instr.Slayer  = slayer;
                }
                else if (item is Spellbook)                 //Randomize spellbook
                {
                    var book = item as Spellbook;

                    if (MaxIntensity == 100 && MinIntensity / 1000.0 > Utility.RandomDouble())
                    {
                        book.LootType = LootType.Blessed;
                    }

                    if (MaxIntensity == 100 && MinIntensity >= 50 && (MinIntensity / 3000.0 > Utility.RandomDouble()))
                    {
                        book.Dyable = true;
                    }

                    int rnd    = Utility.RandomMinMax(MinIntensity, MaxIntensity);
                    var circle = (int)((rnd / 12.5) + 1.0);

                    if (circle >= 8 && 0.33 > Utility.RandomDouble())
                    {
                        book.Content = ulong.MaxValue;
                    }
                    else
                    {
                        circle = Math.Min(circle, 8);

                        //do we fill this circle?
                        for (int i = 0; i < circle; i++)
                        {
                            if (Utility.RandomBool())
                            {
                                book.Content |= (ulong)Utility.Random(0x100) << (i * 8);
                            }
                        }
                    }
                }

                if (item.Stackable)
                {
                    // Note: do not check hits max here if you want to multiply against gold
                    // the max hits have not been set when this function is called
                    // The inital loot is added to the BaseCreature before the attributes are set
                    // for the specific mob type
                    if (item is Gold)
                    {
                        item.Amount = (int)Math.Ceiling(Quantity.Roll() * DynamicSettingsController.GoldMulti);
                    }
                    else
                    {
                        item.Amount = Quantity.Roll();
                    }
                }
            }

            return(item);
        }
Example #4
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);
        }
Example #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 || 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);
        }
Example #6
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);
        }
        public override Tuple <Item[], int> GenerateLootItem(Mobile creature)
        {
            Type       type   = m_WeaponTypes[Utility.Random(m_WeaponTypes.Length)];
            BaseWeapon weapon = Activator.CreateInstance(type) as BaseWeapon;

            if (weapon == null)
            {
                throw new Exception(String.Format("Type {0} is not BaseWeapon or could not be instantiated.", type));
            }

            int value = 100;

            if (0.40 > Utility.RandomDouble())
            {
                int bonus = GetBonus();
                weapon.AccuracyLevel = (WeaponAccuracyLevel)bonus;
                value += 20 * bonus;
            }

            if (0.30 > Utility.RandomDouble())
            {
                int bonus = GetBonus();
                if (PseudoSeerStone.Instance != null && PseudoSeerStone.Instance._HighestDamageLevelSpawn < bonus)
                {
                    bonus = PseudoSeerStone.Instance._HighestDamageLevelSpawn;
                }
                weapon.DamageLevel = (WeaponDamageLevel)bonus;
                value += 20 * bonus;
            }

            if (0.25 > Utility.RandomDouble())
            {
                int bonus = GetBonus();
                weapon.DurabilityLevel = (WeaponDurabilityLevel)bonus;
                value += 20 * bonus;
            }

            if (GetBonus() > 2)
            {
                if (0.10 > Utility.RandomDouble())
                {
                    weapon.Slayer = SlayerName.Silver;
                    value        += 100;
                }

                if (0.01 > Utility.RandomDouble() || (weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 0.15 > Utility.RandomDouble()))
                {
                    if (creature != null)
                    {
                        weapon.Slayer = SlayerGroup.GetLootSlayerType(creature.GetType());
                    }
                    else
                    {
                        weapon.Slayer = BaseRunicTool.GetRandomSlayer();
                    }

                    value += 100;
                }
            }

            if (weapon.Hue == 0 && 0.01 > Utility.RandomDouble())
            {
                int bonus = GetBonus();

                if (bonus > 2 && 0.045 > Utility.RandomDouble())
                {
                    weapon.Hue = Math.Max(0, GetLowRareHue());
                    value     += 600;
                }
                else if (bonus > 3 && 0.005 > Utility.RandomDouble())
                {
                    weapon.Hue = Math.Max(0, GetHighRareHue());
                    value     += 1200;
                }
                else if (weapon.Resource != CraftResource.RegularWood && bonus == 5 && 0.001 > Utility.RandomDouble())
                {
                    weapon.Hue = Math.Max(0, GetVeryRareHue());
                    value     += 1550;
                }
            }

            return(new Tuple <Item[], int>(new Item[] { weapon }, value));
        }
Example #8
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);
        }
Example #9
0
        public Item Mutate(Mobile from, int luckChance, Item item)
        {
            if (item != null)
            {
                if (item is BaseWeapon && Utility.Random(100) < 1)
                {
                    item.Delete();
                    item = new FireHorn();
                    return(item);
                }

                if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat)
                {
                    if (Core.AOS)
                    {
                        var bonusProps = GetBonusProperties();
                        var min        = MinIntensity;
                        var max        = MaxIntensity;

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

                        var props = 1 + bonusProps;

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

                        if (item is BaseWeapon weapon)
                        {
                            BaseRunicTool.ApplyAttributesTo(weapon, false, luckChance, props, MinIntensity, MaxIntensity);
                        }
                        else if (item is BaseArmor armor)
                        {
                            BaseRunicTool.ApplyAttributesTo(armor, false, luckChance, props, MinIntensity, MaxIntensity);
                        }
                        else if (item is BaseJewel jewel)
                        {
                            BaseRunicTool.ApplyAttributesTo(jewel, false, luckChance, props, MinIntensity, MaxIntensity);
                        }
                        else
                        {
                            BaseRunicTool.ApplyAttributesTo(
                                (BaseHat)item,
                                false,
                                luckChance,
                                props,
                                MinIntensity,
                                MaxIntensity
                                );
                        }
                    }
                    else // not aos
                    {
                        if (item is BaseWeapon weapon)
                        {
                            if (Utility.Random(100) < 80)
                            {
                                weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus();
                            }

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

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

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

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

                            if (Utility.Random(100) < 40)
                            {
                                armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus();
                            }
                        }
                    }
                }
                else if (item is BaseInstrument instr)
                {
                    SlayerName slayer;

                    if (Core.AOS)
                    {
                        slayer = BaseRunicTool.GetRandomSlayer();
                    }
                    else
                    {
                        slayer = SlayerGroup.GetLootSlayerType(from.GetType());
                    }

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

                    instr.Quality = InstrumentQuality.Regular;
                    instr.Slayer  = slayer;
                }

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

            return(item);
        }
Example #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);
        }
Example #11
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);
        }
Example #12
0
        public Item Mutate(Mobile m, int luckChance, Item item, int index, int itemIndex)
        {
            if (item != null)
            {
                //Console.WriteLine("Mutate: Existance Check Passed");
                if (item is BaseWeapon && 1 > Utility.Random(100))
                {
                    //Console.WriteLine("Mutate: Created Fire Horn");
                    item.Delete();
                    item = new FireHorn();
                    return(item);
                }

                if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat)
                {
                    int m_MinIntensity = m_Entries[index].AttributeAmount;
                    int m_MaxIntensity = (int)m_Entries[index].AttributeChance + (int)m_Entries[index].AttributeAmount;
                    //Console.WriteLine("Mutate: Intensity ({0},{1})", m_MinIntensity, m_MaxIntensity);

                    if (Core.AOS)
                    {
                        //Console.WriteLine("Mutate: -(AOS)-");
                        int bonusProps = Custom.ItemProps.BonusCount(item); //GetBonusProperties();
                        //int min = m_MinIntensity;
                        //int max = m_MaxIntensity;
                        int m_MaxProps = m_Entries[index].AttributeAmount;
                        //Console.WriteLine("Mutate: Current Props {0} :: Max Props {1}", bonusProps, m_MaxProps);

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


                        int props = 1 + bonusProps;

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

                        //Console.WriteLine("Mutate: Prop Check Passed");

                        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(m_MinIntensity, m_MaxIntensity);
                            }

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

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

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

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

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

                            if (40 > Utility.Random(100))
                            {
                                armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus(m_MinIntensity, m_MaxIntensity);
                            }
                        }
                    }
                }
                else if (item is BaseInstrument)
                {
                    SlayerName slayer = SlayerName.None;

                    if (Core.AOS)
                    {
                        slayer = BaseRunicTool.GetRandomSlayer();
                    }
                    else
                    {
                        slayer = SlayerGroup.GetLootSlayerType(m.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_Entries[index].DropAmount; //m_Quantity.Roll();
                }
            }

            return(item);
        }