#W# Rework: Complete rework of ThiefPedestals.
This commit is contained in:
parent
a440cb72d1
commit
bc3c5143b9
4 changed files with 443 additions and 221 deletions
|
|
@ -3,60 +3,130 @@ using ModernUO.Serialization;
|
|||
|
||||
namespace Server.Items;
|
||||
|
||||
// ==============================================================
|
||||
// LEVEL 4: 99% Trapped / 99% Locked (1% Lottery Ticket!)
|
||||
// ==============================================================
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class RandomLootBag : Bag
|
||||
{
|
||||
private static void GetRandomAOSStats(out int attributeCount, out int min, out int max)
|
||||
private static int GetWeightedTier()
|
||||
{
|
||||
var rnd = Utility.Random(15);
|
||||
var roll = Utility.Random(100);
|
||||
|
||||
if (rnd < 1)
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax(2, 5);
|
||||
min = 20;
|
||||
max = 70;
|
||||
}
|
||||
else if (rnd < 3)
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax(2, 4);
|
||||
min = 20;
|
||||
max = 50;
|
||||
}
|
||||
else if (rnd < 6)
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax(2, 3);
|
||||
min = 20;
|
||||
max = 40;
|
||||
}
|
||||
else if (rnd < 10)
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax(1, 2);
|
||||
min = 10;
|
||||
max = 30;
|
||||
}
|
||||
else
|
||||
if (roll < 25) return 0; // 25% chance (Rolls 0-24)
|
||||
else if (roll < 55) return 1; // 30% chance (Rolls 25-54)
|
||||
else if (roll < 75) return 2; // 20% chance (Rolls 55-74)
|
||||
else if (roll < 90) return 3; // 15% chance (Rolls 75-89)
|
||||
else if (roll < 96) return 4; // 6% chance (Rolls 90-95)
|
||||
else if (roll < 99) return 5; // 3% chance (Rolls 96-98)
|
||||
else return 6; // 1% chance (Rolls 99)
|
||||
}
|
||||
|
||||
private static void GetRandomLevel(out int attributeCount, out int min, out int max)
|
||||
{
|
||||
var pwr = GetWeightedTier();
|
||||
|
||||
if (pwr == 1)
|
||||
{
|
||||
attributeCount = 1;
|
||||
min = 10;
|
||||
max = 20;
|
||||
}
|
||||
else if (pwr == 2)
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax(1, 2);
|
||||
min = 20;
|
||||
max = 40;
|
||||
}
|
||||
else if (pwr == 3)
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax(2, 3);
|
||||
min = 30;
|
||||
max = 60;
|
||||
}
|
||||
else if (pwr == 4)
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax(2, 4);
|
||||
min = 40;
|
||||
max = 80;
|
||||
}
|
||||
else if (pwr == 5)
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax(3, 5);
|
||||
min = 60;
|
||||
max = 80;
|
||||
}
|
||||
else if (pwr == 6)
|
||||
{
|
||||
attributeCount = Utility.RandomMinMax(4, 5);
|
||||
min = 60;
|
||||
max = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
attributeCount = 1;
|
||||
min = 5;
|
||||
max = 10;
|
||||
}
|
||||
}
|
||||
|
||||
private static void GetRandomResists(out int phy, out int fire, out int cold, out int poison, out int energy)
|
||||
{
|
||||
var phyR = Utility.Random(1, 15);
|
||||
phy = phyR;
|
||||
var fireR = Utility.Random(1, 15);
|
||||
fire = fireR;
|
||||
var coldR = Utility.Random(1, 15);
|
||||
cold = coldR;
|
||||
var poisonR = Utility.Random(1, 15);
|
||||
poison = poisonR;
|
||||
var energyR = Utility.Random(1, 15);
|
||||
energy = energyR;
|
||||
var pwr = GetWeightedTier();
|
||||
|
||||
if (pwr == 1)
|
||||
{
|
||||
phy = Utility.RandomMinMax(1, 3);
|
||||
fire = Utility.RandomMinMax(1, 3);
|
||||
cold = Utility.RandomMinMax(1, 3);
|
||||
poison = Utility.RandomMinMax(1, 3);
|
||||
energy = Utility.RandomMinMax(1, 3);
|
||||
}
|
||||
else if (pwr == 2)
|
||||
{
|
||||
phy = Utility.RandomMinMax(2, 5);
|
||||
fire = Utility.RandomMinMax(2, 5);
|
||||
cold = Utility.RandomMinMax(2, 5);
|
||||
poison = Utility.RandomMinMax(2, 5);
|
||||
energy = Utility.RandomMinMax(2, 5);
|
||||
}
|
||||
else if (pwr == 3)
|
||||
{
|
||||
phy = Utility.RandomMinMax(4, 7);
|
||||
fire = Utility.RandomMinMax(4, 7);
|
||||
cold = Utility.RandomMinMax(4, 7);
|
||||
poison = Utility.RandomMinMax(4, 7);
|
||||
energy = Utility.RandomMinMax(4, 7);
|
||||
}
|
||||
else if (pwr == 4)
|
||||
{
|
||||
phy = Utility.RandomMinMax(6, 10);
|
||||
fire = Utility.RandomMinMax(6, 10);
|
||||
cold = Utility.RandomMinMax(6, 10);
|
||||
poison = Utility.RandomMinMax(6, 10);
|
||||
energy = Utility.RandomMinMax(6, 10);
|
||||
}
|
||||
else if (pwr == 5)
|
||||
{
|
||||
phy = Utility.RandomMinMax(9, 12);
|
||||
fire = Utility.RandomMinMax(9, 12);
|
||||
cold = Utility.RandomMinMax(9, 12);
|
||||
poison = Utility.RandomMinMax(9, 12);
|
||||
energy = Utility.RandomMinMax(9, 12);
|
||||
}
|
||||
else if (pwr == 6)
|
||||
{
|
||||
phy = Utility.RandomMinMax(12, 15);
|
||||
fire = Utility.RandomMinMax(12, 15);
|
||||
cold = Utility.RandomMinMax(12, 15);
|
||||
poison = Utility.RandomMinMax(12, 15);
|
||||
energy = Utility.RandomMinMax(12, 15);
|
||||
}
|
||||
else
|
||||
{
|
||||
phy = 0;
|
||||
fire = 0;
|
||||
cold = 0;
|
||||
poison = 0;
|
||||
energy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
|
|
@ -65,7 +135,7 @@ public partial class RandomLootBag : Bag
|
|||
for (var i = Utility.Random(10) + 1; i > 0; i--)
|
||||
{
|
||||
var weapon = Loot.RandomWeapon();
|
||||
GetRandomAOSStats(out var attributeCount, out var min, out var max);
|
||||
GetRandomLevel(out var attributeCount, out var min, out var max);
|
||||
BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);
|
||||
DropItem(weapon);
|
||||
}
|
||||
|
|
@ -73,7 +143,7 @@ public partial class RandomLootBag : Bag
|
|||
for ( var i = Utility.Random(10) + 1; i > 0; i--)
|
||||
{
|
||||
var armor = Loot.RandomArmorOrShield();
|
||||
GetRandomAOSStats(out var attributeCount, out var min, out var max);
|
||||
GetRandomLevel(out var attributeCount, out var min, out var max);
|
||||
BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
|
||||
GetRandomResists(out var phy, out var fire, out var cold, out var poison, out var energy);
|
||||
armor.PhysicalBonus = phy;
|
||||
|
|
@ -87,7 +157,7 @@ public partial class RandomLootBag : Bag
|
|||
for (var i = Utility.Random(10) + 1; i > 0; i--)
|
||||
{
|
||||
var jewelry = Loot.RandomJewelry();
|
||||
GetRandomAOSStats(out var attributeCount, out var min, out var max);
|
||||
GetRandomLevel(out var attributeCount, out var min, out var max);
|
||||
BaseRunicTool.ApplyAttributesTo(jewelry, attributeCount, min, max);
|
||||
DropItem(jewelry);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue