Revert "Updates Packets & Randomizer (#43)" (#61)

This reverts commit 179cb50557.
This commit is contained in:
Kamron Batman 2019-11-11 08:46:11 -08:00 • committed by GitHub
parent 179cb50557
commit c2ecc76457
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
588 changed files with 16260 additions and 10926 deletions

View file

@ -1,5 +1,5 @@
// Ideas
// When you run on animals they panic
// When you run on animals the panic
// When if ( distance < 8 && Utility.RandomDouble() * Math.Sqrt( (8 - distance) / 6 ) >= incoming.Skills.AnimalTaming.Value )
// More your close, the more it can panic
/*

View file

@ -12,6 +12,7 @@ using Server.Regions;
using Server.Spells;
using Server.Spells.Spellweaving;
using Server.Targets;
using MoveImpl = Server.Movement.MovementImpl;
namespace Server.Mobiles
{
@ -110,7 +111,18 @@ namespace Server.Mobiles
m_Timer = new AITimer(this);
if (!(m.PlayerRangeSensitive || World.Loading || m.Map == null || m.Map == Map.Internal || !m.Map.GetSector(m).Active))
bool activate;
if (!m.PlayerRangeSensitive)
activate = true;
else if (World.Loading)
activate = false;
else if (m.Map == null || m.Map == Map.Internal || !m.Map.GetSector(m).Active)
activate = false;
else
activate = true;
if (activate)
m_Timer.Start();
Action = ActionType.Wander;
@ -1677,17 +1689,20 @@ namespace Server.Mobiles
bool isPassive = delay == m_Mobile.PassiveSpeed;
bool isControlled = m_Mobile.Controlled || m_Mobile.Summoned;
delay = delay switch
{
0.2 => 0.3,
0.25 => 0.45,
0.3 => 0.6,
0.4 => 0.9,
0.5 => 1.05,
0.6 => 1.2,
0.8 => 1.5,
_ => delay
};
if (delay == 0.2)
delay = 0.3;
else if (delay == 0.25)
delay = 0.45;
else if (delay == 0.3)
delay = 0.6;
else if (delay == 0.4)
delay = 0.9;
else if (delay == 0.5)
delay = 1.05;
else if (delay == 0.6)
delay = 1.2;
else if (delay == 0.8)
delay = 1.5;
if (isPassive)
delay += 0.2;
@ -1767,13 +1782,13 @@ namespace Server.Mobiles
m_Mobile.Pushing = false;
MovementImpl.IgnoreMovableImpassables = m_Mobile.CanMoveOverObstacles && !m_Mobile.CanDestroyObstacles;
MoveImpl.IgnoreMovableImpassables = m_Mobile.CanMoveOverObstacles && !m_Mobile.CanDestroyObstacles;
if ((m_Mobile.Direction & Direction.Mask) != (d & Direction.Mask))
{
bool v = m_Mobile.Move(d);
MovementImpl.IgnoreMovableImpassables = false;
MoveImpl.IgnoreMovableImpassables = false;
return v ? MoveResult.Success : MoveResult.Blocked;
}
@ -1795,7 +1810,7 @@ namespace Server.Mobiles
if (map != null)
{
int x = m_Mobile.X, y = m_Mobile.Y;
Movement.Offset(d, ref x, ref y);
Movement.Movement.Offset(d, ref x, ref y);
int destroyables = 0;
@ -1884,20 +1899,20 @@ namespace Server.Mobiles
if (m_Mobile.Move(m_Mobile.Direction))
{
MovementImpl.IgnoreMovableImpassables = false;
MoveImpl.IgnoreMovableImpassables = false;
return MoveResult.SuccessAutoTurn;
}
}
MovementImpl.IgnoreMovableImpassables = false;
MoveImpl.IgnoreMovableImpassables = false;
return wasPushing ? MoveResult.BadState : MoveResult.Blocked;
}
MovementImpl.IgnoreMovableImpassables = false;
MoveImpl.IgnoreMovableImpassables = false;
return MoveResult.Success;
}
MovementImpl.IgnoreMovableImpassables = false;
MoveImpl.IgnoreMovableImpassables = false;
return MoveResult.Success;
}
@ -2007,9 +2022,9 @@ namespace Server.Mobiles
return true;
}
if (ReferenceEquals(m_Path?.Goal, m))
if (m_Path?.Goal == m)
{
if (m_Path?.Follow(run, 1) == true)
if (m_Path.Follow(run, 1))
{
m_Path = null;
return true;
@ -2017,7 +2032,8 @@ namespace Server.Mobiles
}
else if (!DoMove(m_Mobile.GetDirectionTo(m), true))
{
m_Path = new PathFollower(m_Mobile, m) {Mover = DoMoveImpl};
m_Path = new PathFollower(m_Mobile, m);
m_Path.Mover = DoMoveImpl;
if (m_Path.Follow(run, 1))
{
@ -2059,23 +2075,30 @@ namespace Server.Mobiles
if (iCurrDist < iWantDistMin || iCurrDist > iWantDistMax)
{
bool needCloser = iCurrDist > iWantDistMax;
bool needFurther = !needCloser;
if (needCloser && m_Path != null && ReferenceEquals(m_Path.Goal, m))
if (needCloser && m_Path != null && m_Path.Goal == m)
{
if (m_Path.Follow(bRun, 1))
m_Path = null;
}
else
{
Direction dirTo = iCurrDist > iWantDistMax ? m_Mobile.GetDirectionTo(m) : m.GetDirectionTo(m_Mobile);
Direction dirTo;
if (iCurrDist > iWantDistMax)
dirTo = m_Mobile.GetDirectionTo(m);
else
dirTo = m.GetDirectionTo(m_Mobile);
// Add the run flag
if (bRun)
dirTo |= Direction.Running;
dirTo = dirTo | Direction.Running;
if (!DoMove(dirTo, true) && needCloser)
{
m_Path = new PathFollower(m_Mobile, m) {Mover = DoMoveImpl};
m_Path = new PathFollower(m_Mobile, m);
m_Path.Mover = DoMoveImpl;
if (m_Path.Follow(bRun, 1))
m_Path = null;
@ -2681,9 +2704,13 @@ namespace Server.Mobiles
}
if (m_Owner.m_Mobile.BardPacified)
{
m_Owner.DoBardPacified();
}
else if (m_Owner.m_Mobile.BardProvoked)
{
m_Owner.DoBardProvoked();
}
else
{
if (!m_Owner.m_Mobile.Controlled)

View file

@ -1,4 +1,3 @@
using System.Linq;
using Server.Spells;
using Server.Spells.First;
using Server.Spells.Fourth;
@ -117,16 +116,19 @@ namespace Server.Mobiles
if (!m_Mobile.CanSee(m) || !(m is BaseCreature) || ((BaseCreature)m).Team != m_Mobile.Team)
continue;
if (funcs.Any(t => t(m)))
{
double val = -m_Mobile.GetDistanceToSqrt(m);
if (found == null || val > prio)
for (int i = 0; i < funcs.Length; ++i)
if (funcs[i](m))
{
prio = val;
found = m;
double val = -m_Mobile.GetDistanceToSqrt(m);
if (found == null || val > prio)
{
prio = val;
found = m;
}
break;
}
}
}
return found;

View file

@ -339,17 +339,18 @@ namespace Server.Mobiles
if (m_Mobile.Skills.Magery.Value >= 80.0 && Utility.RandomBool())
return new ManaVampireSpell(m_Mobile);
public virtual Spell GetRandomManaDrainSpell() =>
m_Mobile.Skills.Magery.Value >= 80.0 && Utility.RandomBool()
? (Spell)new ManaVampireSpell(m_Mobile)
: new ManaDrainSpell(m_Mobile);
return new ManaDrainSpell(m_Mobile);
}
public virtual Spell DoDispel(Mobile toDispel)
{
if (!SmartAI)
return ScaleBySkill(DispelChance, SkillName.Magery) > Utility.RandomDouble()
? new DispelSpell(m_Mobile)
: ChooseSpell(toDispel);
{
if (ScaleBySkill(DispelChance, SkillName.Magery) > Utility.RandomDouble())
return new DispelSpell(m_Mobile);
return ChooseSpell(toDispel);
}
Spell spell = CheckCastHealingSpell();