fix: Fixes random bias & Adds back champion arties for UOML (#1235)

* Fixes RNG bias, we should never do `Utility.RandomDouble() <=`
* Adds back champion artifacts behind UOML flag.
This commit is contained in:
Kamron Batman 2022-11-09 16:33:27 -08:00 • committed by GitHub
parent 810061db8c
commit 8e01db8555
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
60 changed files with 289 additions and 335 deletions

View file

@ -502,8 +502,10 @@ namespace Server.Engines.CannedEvil
{
RegisterDamageTo(Champion);
//if (m_Champion is BaseChampion)
// AwardArtifact(((BaseChampion)m_Champion).GetArtifact());
if (Core.ML)
{
AwardArtifact((Champion as BaseChampion)?.GetArtifact());
}
DamageEntries.Clear();
@ -560,31 +562,22 @@ namespace Server.Engines.CannedEvil
{
if (Map == Map.Felucca)
{
if (Utility.RandomDouble() < 0.001)
// 1 in 1000 you get either a scroll of transcendence or a powerscroll
var random = Utility.Random(2000);
if (random == 0)
{
double random = Utility.Random (49);
if (random <= 24)
{
ScrollofTranscendence SoTF = CreateRandomFelSoT();
GiveScrollOfTranscendenceFelTo (pm, SoTF);
}
else
{
PowerScroll PS = CreateRandomFelPS();
GivePowerScrollFelTo (pm, PS);
}
GiveScrollOfTranscendenceFelTo(pm, CreateRandomFelSoT());
}
else if (random == 1)
{
GivePowerScrollFelTo(pm, CreateRandomFelPS());
}
}
if (Map == Map.Ilshenar || Map == Map.Tokuno)
if ((Map == Map.Ilshenar || Map == Map.Tokuno) && Utility.Random(10000) < 15)
{
if (Utility.RandomDouble() < 0.0015)
{
pm.SendLocalizedMessage(1094936); // You have received a Scroll of Transcendence!
ScrollofTranscendence SoTT = CreateRandomTramSoT();
pm.AddToBackpack(SoTT);
}
pm.SendLocalizedMessage(1094936); // You have received a Scroll of Transcendence!
pm.AddToBackpack(CreateRandomTramSoT());
}
}

View file

@ -115,7 +115,7 @@ namespace Server.Engines.Harvest
if (obj?.Completed == false)
{
if (Utility.RandomDouble() < 0.5)
if (Utility.RandomBool())
{
// You pull a shellfish out of the water, and find a rainbow pearl inside of it.
player.SendLocalizedMessage(1055086, "", 0x59);

View file

@ -61,7 +61,7 @@ namespace Server.Engines.MLQuests.Items
{
AddBaseLoot(Loot.MLArmorTypes, Loot.JewelryTypes, m_TalismanType);
if (Utility.RandomDouble() < 0.50)
if (Utility.RandomBool())
{
AddRecipe(DefTailoring.CraftSystem);
}
@ -94,7 +94,7 @@ namespace Server.Engines.MLQuests.Items
{
AddBaseLoot(Loot.MLWeaponTypes, Loot.JewelryTypes, m_TalismanType);
if (Utility.RandomDouble() < 0.50)
if (Utility.RandomBool())
{
AddRecipe(DefBlacksmithy.CraftSystem);
}
@ -127,7 +127,7 @@ namespace Server.Engines.MLQuests.Items
{
AddBaseLoot(Loot.MLArmorTypes, Loot.MLWeaponTypes, Loot.MLRangedWeaponTypes, Loot.JewelryTypes, m_TalismanType);
if (Utility.RandomDouble() < 0.50)
if (Utility.RandomBool())
{
switch (Utility.Random(6))
{
@ -173,7 +173,7 @@ namespace Server.Engines.MLQuests.Items
{
AddBaseLoot(Loot.MLRangedWeaponTypes, Loot.JewelryTypes, m_TalismanType);
if (Utility.RandomDouble() < 0.50)
if (Utility.RandomBool())
{
AddRecipe(DefBowFletching.CraftSystem);
}
@ -208,7 +208,7 @@ namespace Server.Engines.MLQuests.Items
{
AddBaseLoot(Loot.MLArmorTypes, Loot.MLWeaponTypes, Loot.MLRangedWeaponTypes, Loot.JewelryTypes, m_TalismanType);
if (Utility.RandomDouble() < 0.50)
if (Utility.RandomBool())
{
AddRecipe(DefCarpentry.CraftSystem);
}