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

@ -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);
}

View file

@ -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.");
}
}
}