internal Item Construct() { try { Item item; if (Type == typeof(Gold)) { item = new Gold(Amount); } else if (Type == typeof(ImagineNickel)) { item = new ImagineNickel(Amount); } else if (Type == typeof(BaseWeapon)) { BaseWeapon w = Loot.RandomWeapon(); w.DamageLevel = WeaponDamageLevel.Vanq; int accuracyRoll = Utility.Random(99); if (accuracyRoll < 31) // 30% to get Accurate { w.AccuracyLevel = WeaponAccuracyLevel.Accurate; } else if (accuracyRoll < 56) // 25% to get Surpassingly { w.AccuracyLevel = WeaponAccuracyLevel.Surpassingly; } else if (accuracyRoll < 76) // 20% to get Eminently { w.AccuracyLevel = WeaponAccuracyLevel.Eminently; } else if (accuracyRoll < 91) // 15% to get Exceedingly { w.AccuracyLevel = WeaponAccuracyLevel.Exceedingly; } else if (accuracyRoll < 100) // 10% to get Supremely { w.AccuracyLevel = WeaponAccuracyLevel.Supremely; } item = w; } else if (Type == typeof(BaseArmor)) { BaseArmor armor = Loot.RandomArmorOrShield(); armor.ProtectionLevel = ArmorProtectionLevel.Invulnerability; armor.Durability = (ArmorDurabilityLevel)Utility.Random(6); item = armor; } else if (Type == typeof(BaseClothing)) { item = Loot.RandomClothing(); item.LootType = LootType.Blessed; item.Hue = Utility.RandomList(Sphere.RareHues); } else if (Type == typeof(BaseJewel)) { item = Loot.RandomJewelry(); item.LootType = LootType.Blessed; item.Hue = Utility.RandomList(Sphere.RareHues); } else if (Type == typeof(Mustang)) { Mustang m = new Mustang(); MustangCollection.Randomize().ApplyTo(m); item = new ShrinkItem(m); } else { item = Activator.CreateInstance(Type) as Item; } return(item); } catch { } return(null); }
internal Item Construct() { try { Item item; if (Type == typeof(Gold)) item = new Gold(Amount); else if (Type == typeof(ImagineNickel)) item = new ImagineNickel(Amount); else if (Type == typeof(BaseWeapon)) { BaseWeapon w = Loot.RandomWeapon(); w.DamageLevel = WeaponDamageLevel.Vanq; int accuracyRoll = Utility.Random(99); if (accuracyRoll < 31) // 30% to get Accurate w.AccuracyLevel = WeaponAccuracyLevel.Accurate; else if (accuracyRoll < 56) // 25% to get Surpassingly w.AccuracyLevel = WeaponAccuracyLevel.Surpassingly; else if (accuracyRoll < 76) // 20% to get Eminently w.AccuracyLevel = WeaponAccuracyLevel.Eminently; else if (accuracyRoll < 91) // 15% to get Exceedingly w.AccuracyLevel = WeaponAccuracyLevel.Exceedingly; else if (accuracyRoll < 100) // 10% to get Supremely w.AccuracyLevel = WeaponAccuracyLevel.Supremely; item = w; } else if (Type == typeof(BaseArmor)) { BaseArmor armor = Loot.RandomArmorOrShield(); armor.ProtectionLevel = ArmorProtectionLevel.Invulnerability; armor.Durability = (ArmorDurabilityLevel)Utility.Random(6); item = armor; } else if (Type == typeof(BaseClothing)) { item = Loot.RandomClothing(); item.LootType = LootType.Blessed; item.Hue = Utility.RandomList(Sphere.RareHues); } else if (Type == typeof(BaseJewel)) { item = Loot.RandomJewelry(); item.LootType = LootType.Blessed; item.Hue = Utility.RandomList(Sphere.RareHues); } else if (Type == typeof(Mustang)) { Mustang m = new Mustang(); MustangCollection.Randomize().ApplyTo(m); item = new ShrinkItem(m); } else item = Activator.CreateInstance(Type) as Item; return item; } catch { } return null; }