RandomMinMaxScaled() public static méthode

public static RandomMinMaxScaled ( int min, int max ) : int
min int
max int
Résultat int
Exemple #1
0
        public bool GiveReward(Mobile to)
        {
            Bag bag = new Bag();

            bag.DropItem(new Gold(Utility.RandomMinMax(500, 1000)));

            if (Utility.RandomBool())
            {
                BaseWeapon weapon = Loot.RandomWeapon();

                if (Core.AOS)
                {
                    BaseRunicTool.ApplyAttributesTo(weapon, 2, 20, 30);
                }
                else
                {
                    weapon.DamageLevel     = (WeaponDamageLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                    weapon.AccuracyLevel   = (WeaponAccuracyLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                    weapon.DurabilityLevel = (WeaponDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                }

                bag.DropItem(weapon);
            }
            else
            {
                Item item;

                if (Core.AOS)
                {
                    item = Loot.RandomArmorOrShieldOrJewelry();

                    if (item is BaseArmor)
                    {
                        BaseRunicTool.ApplyAttributesTo((BaseArmor)item, 2, 20, 30);
                    }
                    else if (item is BaseJewel)
                    {
                        BaseRunicTool.ApplyAttributesTo((BaseJewel)item, 2, 20, 30);
                    }
                }
                else
                {
                    BaseArmor armor = Loot.RandomArmorOrShield();
                    item = armor;

                    armor.ProtectionLevel = (ArmorProtectionLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                    armor.Durability      = (ArmorDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                }

                bag.DropItem(item);
            }

            bag.DropItem(new Obsidian());

            if (to.PlaceInBackpack(bag))
            {
                return(true);
            }
            else
            {
                bag.Delete();
                return(false);
            }
        }