예제 #1
0
파일: LootPack.cs 프로젝트: nogu3ira/xrunuo
		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;
		}
예제 #2
0
        public void Generate(Mobile from, Container cont, bool spawning)
        {
            if (cont == null)
            {
                return;
            }

            int luckChance = 0;

            if (!spawning)
            {
                luckChance = LootPack.GetLuckChanceForKiller(from);
            }

            for (int i = 0; i < m_Entries.Length; ++i)
            {
                LootPackEntry entry = m_Entries[i];

                bool shouldAdd = entry.Chance > Utility.Random(10000);

                if (!shouldAdd)
                {
                    if (LootPack.CheckLuck(luckChance))
                    {
                        shouldAdd = entry.Chance > Utility.Random(10000);
                    }
                }

                if (!shouldAdd)
                {
                    continue;
                }

                Item item = entry.Construct(from, luckChance, spawning);

                if (item != null)
                {
                    if (!item.Stackable || !cont.TryDropItem(from, item, false))
                    {
                        cont.DropItem(item);
                    }
                }
            }
        }
예제 #3
0
파일: LootPack.cs 프로젝트: nydehi/divinity
        public void Generate(Mobile from, Container cont, bool spawning, int luckChance)
        {
            if (cont == null)
            {
                return;
            }

            bool checkLuck = Core.AOS;

            for (int i = 0; i < m_Entries.Length; ++i)
            {
                LootPackEntry entry = m_Entries[i];

                bool shouldAdd = (entry.Chance > Utility.Random(10000));

                if (!shouldAdd && checkLuck)
                {
                    checkLuck = false;

                    if (LootPack.CheckLuck(luckChance))
                    {
                        shouldAdd = (entry.Chance > Utility.Random(10000));
                    }
                }

                if (!shouldAdd)
                {
                    continue;
                }

                Item item = entry.Construct(from, luckChance, spawning);

                if (item != null)
                {
                    if (!item.Stackable || (from == null || !cont.TryDropItem(from, item, false)))
                    {
                        cont.DropItem(item);
                    }
                }
            }
        }
예제 #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)
                {
                    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);
        }
예제 #5
0
        public void Generate(Mobile from, Container cont, bool spawning, int luckChance)
        {
            if (cont == null)
            {
                return;
            }

            bool checkLuck = Core.AOS;

            for (int i = 0; i < m_Entries.Length; ++i)
            {
                LootPackEntry entry = m_Entries[i];

                bool shouldAdd = (entry.Chance > Utility.Random(10000));

                if (!shouldAdd && checkLuck)
                {
                    checkLuck = false;

                    if (LootPack.CheckLuck(luckChance))
                    {
                        shouldAdd = (entry.Chance > Utility.Random(10000));
                    }
                }

                if (!shouldAdd)
                {
                    continue;
                }

                Item item = entry.Construct(from, luckChance, spawning);

                // Plume begin check Identification
                if (item is BaseWeapon || item is BaseArmor || item is BaseClothing || item is BaseJewel)
                {
                    bool IsID = true;

                    int    bonusProps = entry.GetBonusProperties();
                    double min        = (double)entry.MinIntensity;
                    double max        = (double)entry.MaxIntensity;

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

                    int props = 1 + bonusProps;

                    double dblID = (((min / max) + (min / 5.0) + (max / 10.0)) * (props + props / 10.0)) / 100.0;

                    if (props >= 5 && Utility.Random(0, 100) > 1)
                    {
                        IsID = false;
                    }
                    else if (dblID > Utility.RandomDouble())
                    {
                        IsID = false;
                    }

                    if (!IsID)
                    {
                        if (item is BaseWeapon)
                        {
                            ((BaseWeapon)item).Identified = false;
                        }
                        else if (item is BaseArmor)
                        {
                            ((BaseArmor)item).Identified = false;
                        }
                        else if (item is BaseClothing)
                        {
                            ((BaseClothing)item).Identified = false;
                        }
                        else if (item is BaseJewel)
                        {
                            ((BaseJewel)item).Identified = false;
                        }
                    }
                }
                // End
                if (item != null)
                {
                    if (!item.Stackable || !cont.TryDropItem(from, item, false))
                    {
                        cont.DropItem(item);
                    }
                }
            }
        }
예제 #6
0
        public virtual void AddLootGold(LootPack pack)
        {
            if (Summoned)
                return;

            Container backpack = Backpack;

            if (backpack == null)
            {
                backpack = new Backpack();

                backpack.Movable = false;

                AddItem(backpack);
            }
            //find top most container
            while (backpack.FindItemByType(typeof(Backpack)) != null)
                backpack = (Container)backpack.FindItemByType(typeof(Backpack));

            pack.Generate(this, backpack, m_Spawning, m_KillersLuck);
        }
예제 #7
0
        public virtual void AddLootPouch(LootPack pack)
        {
            if (Summoned)
                return;

            Container backpack = Backpack;

            if (backpack == null)
            {
                backpack = new Backpack();

                backpack.Movable = false;

                AddItem(backpack);
            }
            //find top most container
            while (backpack.FindItemByType(typeof(Backpack)) != null)
                backpack = (Container)backpack.FindItemByType(typeof(Backpack));

            Container LootBag = new Bag();
            backpack.DropItem(LootBag);

            pack.Generate(this, LootBag, m_Spawning, m_KillersLuck);

            if (LootBag.Items.Count <= 0)
                LootBag.Delete();
        }
예제 #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 (Core.AOS)
                    {
                        int bonusProps = GetBonusProperties();

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

                        int 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 if (item is BaseHat hat)
                        {
                            BaseRunicTool.ApplyAttributesTo(hat, false, luckChance, props, MinIntensity, MaxIntensity);
                        }
                    }
                    else                     // not aos
                    {
                        if (item is BaseWeapon weapon)
                        {
                            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 = (DurabilityLevel)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 armor)
                        {
                            if (80 > Utility.Random(100))
                            {
                                armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus();
                            }

                            if (40 > Utility.Random(100))
                            {
                                armor.Durability = (DurabilityLevel)GetRandomOldBonus();
                            }
                        }
                    }
                }
                else if (item is BaseInstrument instrument)
                {
                    SlayerName slayer;
                    if (Core.AOS)
                    {
                        slayer = BaseRunicTool.GetRandomSlayer();
                    }
                    else
                    {
                        slayer = SlayerGroup.GetLootSlayerType(from.GetType());
                    }

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

                    BaseInstrument instr = instrument;

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

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

            return(item);
        }
예제 #9
0
        /*       public virtual void AddLootBackpack(LootPack pack)
        {
            AddLootBackpack(pack, 1);
        }*/
        public virtual void AddLootBackpack(LootPack pack, int amount)
        {
            return;

            /*if (Summoned)
                return;

            Container backpack;
            Container LootBag;

            for (int i = 0; i < amount; ++i)
            {
                backpack = Backpack;
                LootBag = new Backpack();

                if (backpack == null)
                {
                    backpack = new Backpack();

                    backpack.Movable = false;

                    AddItem(backpack);
                }

                while (backpack.FindItemByType(typeof(Backpack)) != null)
                    backpack = (Container)backpack.FindItemByType(typeof(Backpack));

                backpack.DropItem(LootBag);
                pack.Generate(this, LootBag, m_Spawning, m_KillersLuck);

                if (LootBag.Items.Count <= 0)
                    LootBag.Delete();
            }

            LootBag = (Container)Backpack.FindItemByType(typeof(Backpack));
            Item[] gold = LootBag.FindItemsByType(typeof(Gold));
            int balance = 0;

            for (int i = 0; i < gold.Length; ++i)
            {
                balance += gold[i].Amount;
                gold[i].Delete();
            }

            LootBag = (Container)Backpack.FindItemByType(typeof(Backpack));
            while (LootBag.FindItemByType(typeof(Backpack)) != null)
                LootBag = (Container)LootBag.FindItemByType(typeof(Backpack));

            Container purse = new Bag();
            purse.DropItem(new Gold(balance));
            LootBag.DropItem(purse);

            if (Backpack.FindItemsByType(typeof(Bag)) != null)
            {
                Item[] bags = Backpack.FindItemsByType(typeof(Bag));
                for (int i = 0; i < bags.Length; ++i)
                {
                    Container bagss = bags[i] as Container;
                    if (bagss.Items.Count <= 0)
                        bagss.Delete();
                }
            }*/
        }
예제 #10
0
 public virtual void AddLoot( LootPack pack, int amount )
 {
     for ( int i = 0; i < amount; ++i )
         AddLoot( pack );
 }
        public virtual void AddLoot( LootPack pack, int amount )
        {
            if ( Summoned )
                return;

            Container backpack = Backpack;

            if ( backpack == null )
            {
                backpack = new Backpack();

                backpack.Movable = false;

                AddItem( backpack );
            }

            for ( int i = 0; i < amount; ++i )
                AddLoot( pack, backpack );
        }
        public virtual void AddPackedLoot( LootPack pack, Type type, int amount )
        {
            if ( type.IsSubclassOf( typeof( Container ) ) )
            {
                try
                {
                    Container backpack = Backpack;

                    if ( backpack == null )
                    {
                        backpack = new Backpack();
                        backpack.Movable = false;
                        AddItem( backpack );
                    }

                    Container cnt = (Container)Activator.CreateInstance( type );
                    if ( cnt != null )
                        for ( int i = 0; i < amount; ++i )
                            AddLoot( pack, cnt );

                    backpack.DropItem( cnt );
                }
                catch
                {
                }
            }
        }
 public virtual void AddLoot( LootPack pack )
 {
     pack.Generate( null, this, false, 0 );
 }
 public virtual void AddPackedLoot( LootPack pack, Type type )
 {
     AddPackedLoot( pack, type, 1 );
 }
        public virtual void AddLoot( LootPack pack, Container cont )
        {
            if ( Summoned )
                return;

            pack.Generate( this, cont, m_Spawning, m_KillersLuck );
        }
 public virtual void AddLoot( LootPack pack )
 {
     AddLoot( pack, 1 );
 }
예제 #17
0
		public virtual void AddLoot( Mobile from, LootPack pack, int amount )
		{
			for ( int i = 0; i < amount; ++i )
				AddLoot( from, pack );
		}
예제 #18
0
파일: LootPack.cs 프로젝트: KairiL/runuo
        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);
        }
예제 #19
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);
        }
예제 #20
0
		public virtual void AddLoot( Mobile from, LootPack pack )
		{
			pack.Generate( null, this, false);
		}
예제 #21
0
        public virtual void AddLoot( LootPack pack )
        {
            if ( Summoned )
                return;

            Container backpack = Backpack;

            if ( backpack == null )
            {
                backpack = new Backpack();

                backpack.Movable = false;

                AddItem( backpack );
            }

            pack.Generate( this, backpack, m_Spawning, m_KillersLuck );
        }
예제 #22
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);
        }
예제 #23
0
파일: LootPack.cs 프로젝트: bsenyuva/ServUO
        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);
        }
예제 #24
0
        public virtual void AddLootBackpack(LootPack pack)
        {
            if (pack == null)
                return;

            if (Summoned)
                return;

            Container backpack = Backpack;
            if (backpack == null)
            {
                backpack = new Backpack();

                backpack.Movable = false;

                AddItem(backpack);
            }

            //find top most container
            while (backpack.FindItemByType(typeof(Backpack)) != null)
                backpack = (Container)backpack.FindItemByType(typeof(Backpack));

            Container LootBag = new Backpack();
            backpack.DropItem(LootBag);

            //base loot
            pack.Generate(this, LootBag, m_Spawning, m_KillersLuck);

            if (LootBag.Items.Count <= 0 && pack != LootPack.Undead)
            {
                LootBag.Delete();
                return;
            }

            //extras
            if (pack == LootPack.Poor)
            {
                switch (Utility.RandomMinMax(1, 2))
                {
                    case 0: AddLootBackpack(LootPack.Poor); break;
                    case 1: AddLootGold(LootPack.PoorPile); break;
                    case 2: AddLootPouch(LootPack.PoorPouch); break;
                }
            }
            else if (pack == LootPack.Meager)
            {
                switch (Utility.RandomMinMax(1,2))
                {
                    case 0: AddLootBackpack(LootPack.Meager); break;
                    case 1: AddLootGold(LootPack.MeagerPile); break;
                    case 2: AddLootPouch(LootPack.MeagerPouch); break;
                }
            }
            else if (pack == LootPack.Average)
            {
                switch (Utility.RandomMinMax(1, 2))
                {
                    case 0: AddLootBackpack(LootPack.Average); break;
                    case 1: AddLootGold(LootPack.AveragePile); break;
                    case 2: AddLootPouch(LootPack.AveragePouch); break;
                }
            }
            else if (pack == LootPack.Rich)
            {
                switch (Utility.RandomMinMax(1, 2))
                {
                    case 0: AddLootBackpack(LootPack.Rich); break;
                    case 1: AddLootGold(LootPack.RichPile); break;
                    case 2: AddLootPouch(LootPack.RichPouch); break;
                }
            }
            else if (pack == LootPack.FilthyRich)
            {
                switch (Utility.RandomMinMax(1,2))
                {
                    case 0: AddLootBackpack(LootPack.FilthyRich); break;
                    case 1: AddLootGold(LootPack.FilthyRichPile); break;
                    case 2: AddLootPouch(LootPack.FilthyRichPouch); break;
                }
            }
            else if (pack == LootPack.UltraRich)
            {
                switch (Utility.RandomMinMax(1, 2))
                {
                    case 0: AddLootBackpack(LootPack.UltraRich); break;
                    case 1: AddLootGold(LootPack.UltraRichPile); break;
                    case 2: AddLootPouch(LootPack.UltraRichPouch); break;
                }
            }
            else if (pack == LootPack.SuperBoss)
            {
                switch (Utility.RandomMinMax(1, 2))
                {
                    case 0: AddLootBackpack(LootPack.SuperBoss); break;
                    case 1: AddLootGold(LootPack.SuperBossPile); break;
                    case 2: AddLootPouch(LootPack.SuperBossPouch); break;
                }
            }
            else if (pack == LootPack.Special)
            {
                switch (Utility.RandomMinMax(1, 2))
                {
                    case 0: AddLootBackpack(LootPack.Special); break;
                    case 1: AddLootGold(LootPack.SpecialPile); break;
                    case 2: AddLootPouch(LootPack.SpecialPouch); break;
                }
            }
            else if (pack == LootPack.Undead)
            {
                LootBag.DropItem(Loot.RandomScroll(0, 64, SpellbookType.Regular));

                if (Utility.Random(3) == 3)
                    LootBag.DropItem(Loot.RandomPotion());

                switch (Utility.Random(2))
                {
                    case 0: AddLootGold(LootPack.RichPile); break;
                    case 1: AddLootPouch(LootPack.RichPouch); break;
                }
            }
        }