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:
parent
810061db8c
commit
8e01db8555
60 changed files with 289 additions and 335 deletions
|
|
@ -656,7 +656,7 @@ namespace Server.Items
|
|||
{
|
||||
fish.Hue = FishHues.RandomElement();
|
||||
}
|
||||
else if (Utility.RandomDouble() < 0.5)
|
||||
else if (Utility.RandomBool())
|
||||
{
|
||||
fish.Hue = Utility.RandomMinMax(0x100, 0x3E5);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace Server.Items
|
|||
public partial class Futon : Item
|
||||
{
|
||||
[Constructible]
|
||||
public Futon() : base(Utility.RandomDouble() > 0.5 ? 0x295C : 0x295E)
|
||||
public Futon() : base(Utility.RandomBool() ? 0x295C : 0x295E)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ public partial class TreasureMapChest : LockableContainer
|
|||
|
||||
public override void OnItemLifted(Mobile from, Item item)
|
||||
{
|
||||
var notYetLifted = _lifted?.Contains(item) != true;
|
||||
var notYetLifted = _lifted?.Contains(item) != true;
|
||||
from.RevealingAction();
|
||||
|
||||
if (notYetLifted)
|
||||
|
|
@ -369,7 +369,7 @@ public partial class TreasureMapChest : LockableContainer
|
|||
_lifted ??= new HashSet<Item>();
|
||||
_lifted.Add(item);
|
||||
|
||||
if (Utility.RandomDouble() <= 0.1) // 10% chance to spawn a new monster
|
||||
if (Utility.RandomDouble() < 0.1) // 10% chance to spawn a new monster
|
||||
{
|
||||
TreasureMap.Spawn(_level, GetWorldLocation(), Map, from, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ namespace Server.Items
|
|||
.Random(3)
|
||||
); // "That doesn't seem like the smartest thing to do." / "That was an encounter you don't wish to repeat." / "Ha! You missed!"
|
||||
}
|
||||
else if (Core.SE && Utility.RandomDouble() > .20 && (from.Direction & Direction.Running) != 0 &&
|
||||
else if (Core.SE && Utility.RandomDouble() < 0.80 && (from.Direction & Direction.Running) != 0 &&
|
||||
Core.TickCount - from.LastMoveTime < from.ComputeMovementSpeed(from.Direction))
|
||||
{
|
||||
// Didn't your parents ever tell you not to run with scissors in your hand?!
|
||||
|
|
|
|||
|
|
@ -1059,7 +1059,7 @@ namespace Server.Items
|
|||
|
||||
public static TalismanAttribute GetRandomSummoner()
|
||||
{
|
||||
if (Utility.RandomDouble() >= 0.025)
|
||||
if (Utility.RandomDouble() < 0.975)
|
||||
{
|
||||
return new TalismanAttribute();
|
||||
}
|
||||
|
|
@ -1141,7 +1141,7 @@ namespace Server.Items
|
|||
? (TalismanSlayerName)Utility.RandomMinMax(1, 9)
|
||||
: TalismanSlayerName.None;
|
||||
|
||||
public static int GetRandomCharges() => Utility.RandomDouble() < 0.5 ? Utility.RandomMinMax(10, 50) : 0;
|
||||
public static int GetRandomCharges() => Utility.RandomBool() ? Utility.RandomMinMax(10, 50) : 0;
|
||||
|
||||
[Flags]
|
||||
private enum SaveFlag
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class Dismount : WeaponAbility
|
|||
return;
|
||||
}
|
||||
|
||||
if (Core.ML && attacker is LesserHiryu && Utility.RandomDouble() <= 0.8)
|
||||
if (Core.ML && attacker is LesserHiryu && Utility.RandomDouble() < 0.8)
|
||||
{
|
||||
return; // Lesser Hiryu have an 80% chance of missing this attack
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace Server.Items
|
|||
{
|
||||
--PoisonCharges;
|
||||
|
||||
if (Utility.RandomDouble() >= 0.5) // 50% chance to poison
|
||||
if (Utility.RandomBool()) // 50% chance to poison
|
||||
{
|
||||
defender.ApplyPoison(attacker, Poison);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,72 +47,85 @@ namespace Server.Items
|
|||
{
|
||||
from.SendMessage("You must be holding that weapon to use it.");
|
||||
}
|
||||
else if (targeted is Mobile m)
|
||||
else if (targeted is Mobile m && m != from && from.HarmfulCheck(m))
|
||||
{
|
||||
if (m != from && from.HarmfulCheck(m))
|
||||
var to = from.GetDirectionTo(m);
|
||||
|
||||
from.Direction = to;
|
||||
|
||||
from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);
|
||||
|
||||
if (Utility.RandomDouble() >= Math.Sqrt(m.Dex / 100.0) * 0.8)
|
||||
{
|
||||
var to = from.GetDirectionTo(m);
|
||||
from.MovingEffect(m, 0x1BFE, 7, 1, false, false, 0x481, 0);
|
||||
|
||||
from.Direction = to;
|
||||
AOS.Damage(m, from, Utility.Random(5, from.Str / 10), 100, 0, 0, 0, 0);
|
||||
|
||||
from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);
|
||||
m_Dagger.MoveToWorld(m.Location, m.Map);
|
||||
}
|
||||
else
|
||||
{
|
||||
int x = 0, y = 0;
|
||||
|
||||
if (Utility.RandomDouble() >= Math.Sqrt(m.Dex / 100.0) * 0.8)
|
||||
switch (to & Direction.Mask)
|
||||
{
|
||||
from.MovingEffect(m, 0x1BFE, 7, 1, false, false, 0x481, 0);
|
||||
|
||||
AOS.Damage(m, from, Utility.Random(5, from.Str / 10), 100, 0, 0, 0, 0);
|
||||
|
||||
m_Dagger.MoveToWorld(m.Location, m.Map);
|
||||
case Direction.North:
|
||||
{
|
||||
--y;
|
||||
break;
|
||||
}
|
||||
case Direction.South:
|
||||
{
|
||||
++y;
|
||||
break;
|
||||
}
|
||||
case Direction.West:
|
||||
{
|
||||
--x;
|
||||
break;
|
||||
}
|
||||
case Direction.East:
|
||||
{
|
||||
++x;
|
||||
break;
|
||||
}
|
||||
case Direction.Up:
|
||||
{
|
||||
--x;
|
||||
--y;
|
||||
break;
|
||||
}
|
||||
case Direction.Down:
|
||||
{
|
||||
++x;
|
||||
++y;
|
||||
break;
|
||||
}
|
||||
case Direction.Left:
|
||||
{
|
||||
--x;
|
||||
++y;
|
||||
break;
|
||||
}
|
||||
case Direction.Right:
|
||||
{
|
||||
++x;
|
||||
--y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int x = 0, y = 0;
|
||||
|
||||
switch (to & Direction.Mask)
|
||||
{
|
||||
case Direction.North:
|
||||
--y;
|
||||
break;
|
||||
case Direction.South:
|
||||
++y;
|
||||
break;
|
||||
case Direction.West:
|
||||
--x;
|
||||
break;
|
||||
case Direction.East:
|
||||
++x;
|
||||
break;
|
||||
case Direction.Up:
|
||||
--x;
|
||||
--y;
|
||||
break;
|
||||
case Direction.Down:
|
||||
++x;
|
||||
++y;
|
||||
break;
|
||||
case Direction.Left:
|
||||
--x;
|
||||
++y;
|
||||
break;
|
||||
case Direction.Right:
|
||||
++x;
|
||||
--y;
|
||||
break;
|
||||
}
|
||||
x += Utility.Random(-1, 3);
|
||||
y += Utility.Random(-1, 3);
|
||||
|
||||
x += Utility.Random(-1, 3);
|
||||
y += Utility.Random(-1, 3);
|
||||
x += m.X;
|
||||
y += m.Y;
|
||||
|
||||
x += m.X;
|
||||
y += m.Y;
|
||||
m_Dagger.MoveToWorld(new Point3D(x, y, m.Z), m.Map);
|
||||
|
||||
m_Dagger.MoveToWorld(new Point3D(x, y, m.Z), m.Map);
|
||||
from.MovingEffect(m_Dagger, 0x1BFE, 7, 1, false, false, 0x481, 0);
|
||||
|
||||
from.MovingEffect(m_Dagger, 0x1BFE, 7, 1, false, false, 0x481, 0);
|
||||
|
||||
from.SendMessage("You miss.");
|
||||
}
|
||||
from.SendMessage("You miss.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ namespace Server.Items
|
|||
public override void OnHit(Mobile attacker, Mobile defender, double damageBonus = 1)
|
||||
{
|
||||
if (attacker.Player && !defender.Player && (defender.Body.IsAnimal || defender.Body.IsMonster) &&
|
||||
Utility.RandomDouble() <= 0.4)
|
||||
Utility.RandomDouble() < 0.4)
|
||||
{
|
||||
defender.AddToBackpack(Ammo);
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnMiss(Mobile attacker, Mobile defender)
|
||||
{
|
||||
if (attacker.Player && Utility.RandomDouble() <= 0.4)
|
||||
if (attacker.Player && Utility.RandomDouble() < 0.4)
|
||||
{
|
||||
if (Core.SE)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace Server.Items
|
|||
{
|
||||
--PoisonCharges;
|
||||
|
||||
if (Utility.RandomDouble() >= 0.5) // 50% chance to poison
|
||||
if (Utility.RandomBool()) // 50% chance to poison
|
||||
{
|
||||
defender.ApplyPoison(attacker, Poison);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace Server.Items
|
|||
{
|
||||
--PoisonCharges;
|
||||
|
||||
if (Utility.RandomDouble() >= 0.5) // 50% chance to poison
|
||||
if (Utility.RandomBool()) // 50% chance to poison
|
||||
{
|
||||
defender.ApplyPoison(attacker, Poison);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue