feat: Adds Monster Abilities (#1179)
* Adds ability to create monster abilities * Adds Fire/Cold/Chaos Breath * Adds Grasping Claw * Adds Summon Skeletons & Summon Undead w/ Polymorph
This commit is contained in:
parent
8a2c0ead3d
commit
43e7fe29c2
91 changed files with 1262 additions and 977 deletions
|
|
@ -1062,6 +1062,9 @@ public static class Utility
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool RandomBool() => RandomSources.Source.NextBool();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static TimeSpan RandomMinMax(TimeSpan min, TimeSpan max) => new(RandomMinMax(min.Ticks, max.Ticks));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static double RandomMinMax(double min, double max)
|
||||
{
|
||||
|
|
@ -1540,4 +1543,67 @@ public static class Utility
|
|||
|
||||
return combined;
|
||||
}
|
||||
|
||||
public static Point3D GetValidLocation(Map map, Point3D center, int range, int retries = 10)
|
||||
{
|
||||
if (map == null)
|
||||
{
|
||||
return center;
|
||||
}
|
||||
|
||||
var loc = new Point3D(center.Z, center.Y, center.Z);
|
||||
|
||||
for (var i = 0; i < retries; i++)
|
||||
{
|
||||
loc.X = center.X + (Random(range * 2 + 1) - range);
|
||||
loc.Y = center.Y + (Random(range * 2 + 1) - range);
|
||||
loc.Z = center.Z;
|
||||
|
||||
if (map.CanSpawnMobile(loc))
|
||||
{
|
||||
return loc;
|
||||
}
|
||||
|
||||
loc.Z = map.GetAverageZ(loc.X, loc.Y);
|
||||
|
||||
if (map.CanSpawnMobile(loc))
|
||||
{
|
||||
return loc;
|
||||
}
|
||||
}
|
||||
|
||||
return center;
|
||||
}
|
||||
|
||||
public static Point3D GetValidLocationInLOS(Map map, Mobile from, int range, int retries = 10)
|
||||
{
|
||||
if (map == null)
|
||||
{
|
||||
return from.Location;
|
||||
}
|
||||
|
||||
var center = from.Location;
|
||||
var loc = center;
|
||||
|
||||
for (var i = 0; i < retries; i++)
|
||||
{
|
||||
loc.X = center.X + (Random(range * 2 + 1) - range);
|
||||
loc.Y = center.Y + (Random(range * 2 + 1) - range);
|
||||
loc.Z = center.Z;
|
||||
|
||||
if (map.CanSpawnMobile(loc) && map.LineOfSight(from, loc))
|
||||
{
|
||||
return loc;
|
||||
}
|
||||
|
||||
loc.Z = map.GetAverageZ(loc.X, loc.Y);
|
||||
|
||||
if (map.CanSpawnMobile(loc) && map.LineOfSight(from, loc))
|
||||
{
|
||||
return loc;
|
||||
}
|
||||
}
|
||||
|
||||
return center;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue