Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -4,7 +4,7 @@
|
|||
// More your close, the more it can panic
|
||||
/*
|
||||
* AnimalHunterAI, AnimalHidingAI, AnimalDomesticAI...
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Server.Mobiles
|
||||
|
|
@ -26,7 +26,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
else if ( m_Mobile.IsHurt() || m_Mobile.Combatant != null )
|
||||
{
|
||||
m_Mobile.DebugSay( "I am hurt or being attacked, I flee" );
|
||||
m_Mobile.DebugSay( "I am hurt or being attacked, I flee" );
|
||||
Action = ActionType.Flee;
|
||||
}
|
||||
else
|
||||
|
|
@ -66,7 +66,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile combatant = m_Mobile.Combatant;
|
||||
|
||||
if (combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map)
|
||||
if (combatant?.Deleted != false || combatant.Map != m_Mobile.Map)
|
||||
{
|
||||
m_Mobile.DebugSay("My combatant is gone..");
|
||||
|
||||
|
|
@ -147,4 +147,4 @@ namespace Server.Mobiles
|
|||
return base.DoActionFlee();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool DoActionCombat()
|
||||
{
|
||||
if (m_Mobile.Combatant == null || m_Mobile.Combatant.Deleted || !m_Mobile.Combatant.Alive ||
|
||||
if (m_Mobile.Combatant?.Deleted != false || !m_Mobile.Combatant.Alive ||
|
||||
m_Mobile.Combatant.IsDeadBondedPet)
|
||||
{
|
||||
m_Mobile.DebugSay("My combatant is deleted");
|
||||
|
|
@ -117,4 +117,4 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ namespace Server.Mobiles
|
|||
Skill skill = ourSkills[i];
|
||||
Skill theirSkill = theirSkills[i];
|
||||
|
||||
if (skill != null && theirSkill != null && skill.Base >= 60.0 &&
|
||||
if (skill != null && skill?.Base >= 60.0 &&
|
||||
m_Mobile.CheckTeach(skill.SkillName, e.Mobile))
|
||||
{
|
||||
double toTeach = skill.Base / 3.0;
|
||||
|
|
@ -813,7 +813,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
m_Mobile.DebugSay("I will go to the next waypoint");
|
||||
m_Mobile.CurrentWayPoint = point.NextPoint;
|
||||
if (point.NextPoint != null && point.NextPoint.Deleted)
|
||||
if (point.NextPoint?.Deleted == true)
|
||||
m_Mobile.CurrentWayPoint = point.NextPoint = point.NextPoint.NextPoint;
|
||||
}
|
||||
}
|
||||
|
|
@ -833,7 +833,7 @@ namespace Server.Mobiles
|
|||
WalkRandomInHome(2, 2, 1);
|
||||
}
|
||||
|
||||
if (m_Mobile.Combatant != null && !m_Mobile.Combatant.Deleted && m_Mobile.Combatant.Alive &&
|
||||
if (m_Mobile.Combatant?.Deleted == false && m_Mobile.Combatant.Alive &&
|
||||
!m_Mobile.Combatant.IsDeadBondedPet) m_Mobile.Direction = m_Mobile.GetDirectionTo(m_Mobile.Combatant);
|
||||
|
||||
return true;
|
||||
|
|
@ -849,7 +849,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile c = m_Mobile.Combatant;
|
||||
|
||||
if (c == null || c.Deleted || c.Map != m_Mobile.Map || !c.Alive || c.IsDeadBondedPet)
|
||||
if (c?.Deleted != false || c.Map != m_Mobile.Map || !c.Alive || c.IsDeadBondedPet)
|
||||
Action = ActionType.Wander;
|
||||
else
|
||||
m_Mobile.Direction = m_Mobile.GetDirectionTo(c);
|
||||
|
|
@ -882,7 +882,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile from = m_Mobile.FocusMob;
|
||||
|
||||
if (from == null || from.Deleted || from.Map != m_Mobile.Map)
|
||||
if (from?.Deleted != false || from.Map != m_Mobile.Map)
|
||||
{
|
||||
m_Mobile.DebugSay("I have lost him");
|
||||
Action = ActionType.Guard;
|
||||
|
|
@ -964,7 +964,7 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual void OnCurrentOrderChanged()
|
||||
{
|
||||
if (m_Mobile.Deleted || m_Mobile.ControlMaster == null || m_Mobile.ControlMaster.Deleted)
|
||||
if (m_Mobile.Deleted || m_Mobile.ControlMaster?.Deleted != false)
|
||||
return;
|
||||
|
||||
switch (m_Mobile.ControlOrder)
|
||||
|
|
@ -1077,7 +1077,7 @@ namespace Server.Mobiles
|
|||
|
||||
WalkRandomInHome(3, 2, 1);
|
||||
|
||||
if (m_Mobile.Combatant != null && !m_Mobile.Combatant.Deleted && m_Mobile.Combatant.Alive &&
|
||||
if (m_Mobile.Combatant?.Deleted == false && m_Mobile.Combatant.Alive &&
|
||||
!m_Mobile.Combatant.IsDeadBondedPet)
|
||||
{
|
||||
m_Mobile.Warmode = true;
|
||||
|
|
@ -1093,35 +1093,35 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual bool DoOrderCome()
|
||||
{
|
||||
if (m_Mobile.ControlMaster != null && !m_Mobile.ControlMaster.Deleted)
|
||||
if (m_Mobile.ControlMaster?.Deleted != false)
|
||||
return true;
|
||||
|
||||
int iCurrDist = (int)m_Mobile.GetDistanceToSqrt(m_Mobile.ControlMaster);
|
||||
|
||||
if (iCurrDist > m_Mobile.RangePerception)
|
||||
{
|
||||
int iCurrDist = (int)m_Mobile.GetDistanceToSqrt(m_Mobile.ControlMaster);
|
||||
m_Mobile.DebugSay("I have lost my master. I stay here");
|
||||
m_Mobile.ControlTarget = null;
|
||||
m_Mobile.ControlOrder = OrderType.None;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.DebugSay("My master told me come");
|
||||
|
||||
if (iCurrDist > m_Mobile.RangePerception)
|
||||
// Not exactly OSI style, but better than nothing.
|
||||
bool bRun = iCurrDist > 5;
|
||||
|
||||
if (WalkMobileRange(m_Mobile.ControlMaster, 1, bRun, 0, 1))
|
||||
{
|
||||
m_Mobile.DebugSay("I have lost my master. I stay here");
|
||||
m_Mobile.ControlTarget = null;
|
||||
m_Mobile.ControlOrder = OrderType.None;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.DebugSay("My master told me come");
|
||||
|
||||
// Not exactly OSI style, but better than nothing.
|
||||
bool bRun = iCurrDist > 5;
|
||||
|
||||
if (WalkMobileRange(m_Mobile.ControlMaster, 1, bRun, 0, 1))
|
||||
if (m_Mobile.Combatant?.Deleted == false && m_Mobile.Combatant.Alive &&
|
||||
!m_Mobile.Combatant.IsDeadBondedPet)
|
||||
{
|
||||
if (m_Mobile.Combatant != null && !m_Mobile.Combatant.Deleted && m_Mobile.Combatant.Alive &&
|
||||
!m_Mobile.Combatant.IsDeadBondedPet)
|
||||
{
|
||||
m_Mobile.Warmode = true;
|
||||
m_Mobile.Direction = m_Mobile.GetDirectionTo(m_Mobile.Combatant);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.Warmode = false;
|
||||
}
|
||||
m_Mobile.Warmode = true;
|
||||
m_Mobile.Direction = m_Mobile.GetDirectionTo(m_Mobile.Combatant);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.Warmode = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1140,7 +1140,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (pack != null)
|
||||
{
|
||||
List<Item> list = pack.Items;
|
||||
List<Item> list = pack?.Items;
|
||||
|
||||
for (int i = list.Count - 1; i >= 0; --i)
|
||||
if (i < list.Count)
|
||||
|
|
@ -1196,7 +1196,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
m_Mobile.DebugSay("Praise the shepherd!");
|
||||
}
|
||||
else if (m_Mobile.ControlTarget != null && !m_Mobile.ControlTarget.Deleted && m_Mobile.ControlTarget != m_Mobile)
|
||||
else if (m_Mobile.ControlTarget?.Deleted == false && m_Mobile.ControlTarget != m_Mobile)
|
||||
{
|
||||
int iCurrDist = (int)m_Mobile.GetDistanceToSqrt(m_Mobile.ControlTarget);
|
||||
|
||||
|
|
@ -1204,7 +1204,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
m_Mobile.DebugSay("I have lost the one to follow. I stay here");
|
||||
|
||||
if (m_Mobile.Combatant != null && !m_Mobile.Combatant.Deleted && m_Mobile.Combatant.Alive &&
|
||||
if (m_Mobile.Combatant?.Deleted == false && m_Mobile.Combatant.Alive &&
|
||||
!m_Mobile.Combatant.IsDeadBondedPet)
|
||||
{
|
||||
m_Mobile.Warmode = true;
|
||||
|
|
@ -1224,7 +1224,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (WalkMobileRange(m_Mobile.ControlTarget, 1, bRun, 0, 1))
|
||||
{
|
||||
if (m_Mobile.Combatant != null && !m_Mobile.Combatant.Deleted && m_Mobile.Combatant.Alive &&
|
||||
if (m_Mobile.Combatant?.Deleted == false && m_Mobile.Combatant.Alive &&
|
||||
!m_Mobile.Combatant.IsDeadBondedPet)
|
||||
{
|
||||
m_Mobile.Warmode = true;
|
||||
|
|
@ -1254,7 +1254,7 @@ namespace Server.Mobiles
|
|||
Mobile from = m_Mobile.ControlMaster;
|
||||
Mobile to = m_Mobile.ControlTarget;
|
||||
|
||||
if (from == null || to == null || from == to || from.Deleted || to.Deleted || !to.Player)
|
||||
if (from?.Deleted != false || to?.Deleted != false || from == to || !to.Player)
|
||||
{
|
||||
m_Mobile.PublicOverheadMessage(MessageType.Regular, 0x3B2, 502039); // *looks confused*
|
||||
}
|
||||
|
|
@ -1326,7 +1326,7 @@ namespace Server.Mobiles
|
|||
Mobile from = m_Mobile.ControlMaster;
|
||||
Mobile to = m_Mobile.ControlTarget;
|
||||
|
||||
if (from == null || to == null || from == to || from.Deleted || to.Deleted || !to.Player)
|
||||
if (from?.Deleted != false || to?.Deleted != false || from == to || !to.Player)
|
||||
{
|
||||
m_Mobile.PublicOverheadMessage(MessageType.Regular, 0x3B2, 502039); // *looks confused*
|
||||
}
|
||||
|
|
@ -1360,7 +1360,7 @@ namespace Server.Mobiles
|
|||
|
||||
Mobile controlMaster = m_Mobile.ControlMaster;
|
||||
|
||||
if (controlMaster == null || controlMaster.Deleted)
|
||||
if (controlMaster?.Deleted != false)
|
||||
return true;
|
||||
|
||||
Mobile combatant = m_Mobile.Combatant;
|
||||
|
|
@ -1374,7 +1374,7 @@ namespace Server.Mobiles
|
|||
AggressorInfo info = aggressors[i];
|
||||
Mobile attacker = info.Attacker;
|
||||
|
||||
if (attacker != null && !attacker.Deleted &&
|
||||
if (attacker?.Deleted == false &&
|
||||
attacker.GetDistanceToSqrt(m_Mobile) <= m_Mobile.RangePerception)
|
||||
if (combatant == null || attacker.GetDistanceToSqrt(controlMaster) <
|
||||
combatant.GetDistanceToSqrt(controlMaster))
|
||||
|
|
@ -1385,7 +1385,7 @@ namespace Server.Mobiles
|
|||
m_Mobile.DebugSay("Crap, my master has been attacked! I will attack one of those bastards!");
|
||||
}
|
||||
|
||||
if (combatant != null && combatant != m_Mobile && combatant != m_Mobile.ControlMaster && !combatant.Deleted &&
|
||||
if (combatant?.Deleted == false && combatant != m_Mobile && combatant != m_Mobile.ControlMaster &&
|
||||
combatant.Alive && !combatant.IsDeadBondedPet && m_Mobile.CanSee(combatant) &&
|
||||
m_Mobile.CanBeHarmful(combatant, false) && combatant.Map == m_Mobile.Map)
|
||||
{
|
||||
|
|
@ -1420,9 +1420,8 @@ namespace Server.Mobiles
|
|||
if (m_Mobile.IsDeadPet)
|
||||
return true;
|
||||
|
||||
if (m_Mobile.ControlTarget == null || m_Mobile.ControlTarget.Deleted ||
|
||||
m_Mobile.ControlTarget.Map != m_Mobile.Map || !m_Mobile.ControlTarget.Alive ||
|
||||
m_Mobile.ControlTarget.IsDeadBondedPet)
|
||||
if (m_Mobile.ControlTarget?.Deleted != false || m_Mobile.ControlTarget.Map != m_Mobile.Map ||
|
||||
!m_Mobile.ControlTarget.Alive || m_Mobile.ControlTarget.IsDeadBondedPet)
|
||||
{
|
||||
m_Mobile.DebugSay(
|
||||
"I think he might be dead. He's not anywhere around here at least. That's cool. I'm glad he's dead.");
|
||||
|
|
@ -1527,7 +1526,7 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual bool DoOrderStop()
|
||||
{
|
||||
if (m_Mobile.ControlMaster == null || m_Mobile.ControlMaster.Deleted)
|
||||
if (m_Mobile.ControlMaster?.Deleted != false)
|
||||
return true;
|
||||
|
||||
m_Mobile.DebugSay("My master told me to stop.");
|
||||
|
|
@ -1553,7 +1552,7 @@ namespace Server.Mobiles
|
|||
Mobile from = m_Mobile.ControlMaster;
|
||||
Mobile to = m_Mobile.ControlTarget;
|
||||
|
||||
if (from != to && from != null && !from.Deleted && to != null && !to.Deleted && to.Player)
|
||||
if (from?.Deleted == false && to?.Deleted == false && from != to && to.Player)
|
||||
{
|
||||
m_Mobile.DebugSay("Begin transfer with {0}", to.Name);
|
||||
|
||||
|
|
@ -1639,10 +1638,9 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual bool DoBardProvoked()
|
||||
{
|
||||
if (DateTime.UtcNow >= m_Mobile.BardEndTime && (m_Mobile.BardMaster == null || m_Mobile.BardMaster.Deleted ||
|
||||
m_Mobile.BardMaster.Map != m_Mobile.Map ||
|
||||
m_Mobile.GetDistanceToSqrt(m_Mobile.BardMaster) >
|
||||
m_Mobile.RangePerception))
|
||||
if (DateTime.UtcNow >= m_Mobile.BardEndTime && (m_Mobile.BardMaster?.Deleted != false ||
|
||||
m_Mobile.BardMaster.Map != m_Mobile.Map || m_Mobile.GetDistanceToSqrt(m_Mobile.BardMaster) >
|
||||
m_Mobile.RangePerception))
|
||||
{
|
||||
m_Mobile.DebugSay("I have lost my provoker");
|
||||
m_Mobile.BardProvoked = false;
|
||||
|
|
@ -1654,7 +1652,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
else
|
||||
{
|
||||
if (m_Mobile.BardTarget == null || m_Mobile.BardTarget.Deleted || m_Mobile.BardTarget.Map != m_Mobile.Map ||
|
||||
if (m_Mobile.BardTarget?.Deleted != false || m_Mobile.BardTarget.Map != m_Mobile.Map ||
|
||||
m_Mobile.GetDistanceToSqrt(m_Mobile.BardTarget) > m_Mobile.RangePerception)
|
||||
{
|
||||
m_Mobile.DebugSay("I have lost my provoke target");
|
||||
|
|
@ -2056,7 +2054,7 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual bool MoveTo(Mobile m, bool run, int range)
|
||||
{
|
||||
if (m_Mobile.Deleted || m_Mobile.DisallowAllMoves || m == null || m.Deleted)
|
||||
if (m_Mobile.Deleted || m_Mobile.DisallowAllMoves || m?.Deleted != false)
|
||||
return false;
|
||||
|
||||
if (m_Mobile.InRange(m, range))
|
||||
|
|
@ -2065,7 +2063,7 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
|
||||
if (m_Path != null && m_Path.Goal == m)
|
||||
if (m_Path?.Goal == m)
|
||||
{
|
||||
if (m_Path.Follow(run, 1))
|
||||
{
|
||||
|
|
@ -2184,7 +2182,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (m_Mobile.BardProvoked)
|
||||
{
|
||||
if (m_Mobile.BardTarget == null || m_Mobile.BardTarget.Deleted)
|
||||
if (m_Mobile.BardTarget?.Deleted != false)
|
||||
{
|
||||
m_Mobile.FocusMob = null;
|
||||
return false;
|
||||
|
|
@ -2196,7 +2194,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (m_Mobile.Controlled)
|
||||
{
|
||||
if (m_Mobile.ControlTarget == null || m_Mobile.ControlTarget.Deleted || m_Mobile.ControlTarget.Hidden ||
|
||||
if (m_Mobile.ControlTarget?.Deleted != false || m_Mobile.ControlTarget.Hidden ||
|
||||
!m_Mobile.ControlTarget.Alive || m_Mobile.ControlTarget.IsDeadBondedPet ||
|
||||
!m_Mobile.InRange(m_Mobile.ControlTarget, m_Mobile.RangePerception * 2))
|
||||
{
|
||||
|
|
@ -2386,6 +2384,7 @@ namespace Server.Mobiles
|
|||
return;
|
||||
|
||||
IPooledEnumerable<Mobile> eable = m_Mobile.GetMobilesInRange(m_Mobile.RangePerception);
|
||||
|
||||
foreach (Mobile trg in eable)
|
||||
if (trg != m_Mobile && trg.Player && trg.Alive && trg.Hidden && trg.AccessLevel == AccessLevel.Player &&
|
||||
m_Mobile.InLOS(trg))
|
||||
|
|
@ -2599,7 +2598,7 @@ namespace Server.Mobiles
|
|||
if (!base.AllowSecureTrade(from, to, newOwner, accepted))
|
||||
return false;
|
||||
|
||||
if (Deleted || m_Creature == null || m_Creature.Deleted || m_Creature.ControlMaster != from ||
|
||||
if (Deleted || m_Creature?.Deleted != false || m_Creature.ControlMaster != from ||
|
||||
!from.CheckAlive() || !to.CheckAlive())
|
||||
return false;
|
||||
|
||||
|
|
@ -2661,7 +2660,7 @@ namespace Server.Mobiles
|
|||
|
||||
Delete();
|
||||
|
||||
if (m_Creature == null || m_Creature.Deleted || m_Creature.ControlMaster != from || !from.CheckAlive() ||
|
||||
if (m_Creature?.Deleted != false || m_Creature.ControlMaster != from || !from.CheckAlive() ||
|
||||
!to.CheckAlive())
|
||||
return;
|
||||
|
||||
|
|
@ -2795,4 +2794,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool DoActionCombat()
|
||||
{
|
||||
if (m_Mobile.Combatant == null || m_Mobile.Combatant.Deleted)
|
||||
if (m_Mobile.Combatant?.Deleted != false)
|
||||
{
|
||||
m_Mobile.DebugSay("My combatant is deleted");
|
||||
Action = ActionType.Guard;
|
||||
|
|
@ -79,4 +79,4 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,23 +48,23 @@ namespace Server.Mobiles
|
|||
if (m_Mobile.Debug)
|
||||
m_Mobile.DebugSay("{0} needs a cure", toHelp.Name);
|
||||
|
||||
if (!new CureSpell(m_Mobile, null).Cast())
|
||||
new CureSpell(m_Mobile, null).Cast();
|
||||
if (!new CureSpell(m_Mobile).Cast())
|
||||
new CureSpell(m_Mobile).Cast();
|
||||
}
|
||||
else if (NeedGHeal(toHelp))
|
||||
{
|
||||
if (m_Mobile.Debug)
|
||||
m_Mobile.DebugSay("{0} needs a greater heal", toHelp.Name);
|
||||
|
||||
if (!new GreaterHealSpell(m_Mobile, null).Cast())
|
||||
new HealSpell(m_Mobile, null).Cast();
|
||||
if (!new GreaterHealSpell(m_Mobile).Cast())
|
||||
new HealSpell(m_Mobile).Cast();
|
||||
}
|
||||
else if (NeedLHeal(toHelp))
|
||||
{
|
||||
if (m_Mobile.Debug)
|
||||
m_Mobile.DebugSay("{0} needs a lesser heal", toHelp.Name);
|
||||
|
||||
new HealSpell(m_Mobile, null).Cast();
|
||||
new HealSpell(m_Mobile).Cast();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -151,4 +151,4 @@ namespace Server.Mobiles
|
|||
|
||||
private delegate bool NeedDelegate(Mobile m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
// If I'm poisoned, always attempt to cure.
|
||||
if (m_Mobile.Poisoned)
|
||||
return new CureSpell(m_Mobile, null);
|
||||
return new CureSpell(m_Mobile);
|
||||
|
||||
// Summoned creatures never heal themselves.
|
||||
if (m_Mobile.Summoned)
|
||||
|
|
@ -150,11 +150,11 @@ namespace Server.Mobiles
|
|||
m_Mobile.UseSkill(SkillName.SpiritSpeak);
|
||||
}
|
||||
else
|
||||
spell = new GreaterHealSpell(m_Mobile, null);
|
||||
spell = new GreaterHealSpell(m_Mobile);
|
||||
}
|
||||
else if (m_Mobile.Hits < m_Mobile.HitsMax - 10)
|
||||
{
|
||||
spell = new HealSpell(m_Mobile, null);
|
||||
spell = new HealSpell(m_Mobile);
|
||||
}
|
||||
|
||||
double delay;
|
||||
|
|
@ -213,7 +213,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
m_Mobile.Target?.Cancel(m_Mobile, TargetCancelType.Canceled);
|
||||
|
||||
new TeleportSpell(m_Mobile, null).Cast();
|
||||
new TeleportSpell(m_Mobile).Cast();
|
||||
|
||||
m_Mobile.DebugSay("I am stuck, I'm going to try teleporting away");
|
||||
}
|
||||
|
|
@ -265,19 +265,19 @@ namespace Server.Mobiles
|
|||
{
|
||||
case 0:
|
||||
m_Mobile.DebugSay("Pain Spike");
|
||||
return new PainSpikeSpell(m_Mobile, null);
|
||||
return new PainSpikeSpell(m_Mobile);
|
||||
case 1:
|
||||
m_Mobile.DebugSay("Poison Strike");
|
||||
return new PoisonStrikeSpell(m_Mobile, null);
|
||||
return new PoisonStrikeSpell(m_Mobile);
|
||||
case 2:
|
||||
m_Mobile.DebugSay("Strangle");
|
||||
return new StrangleSpell(m_Mobile, null);
|
||||
return new StrangleSpell(m_Mobile);
|
||||
case 3:
|
||||
m_Mobile.DebugSay("Wither");
|
||||
return new WitherSpell(m_Mobile, null);
|
||||
return new WitherSpell(m_Mobile);
|
||||
default:
|
||||
m_Mobile.DebugSay("Vengeful Spirit");
|
||||
return new VengefulSpiritSpell(m_Mobile, null);
|
||||
return new VengefulSpiritSpell(m_Mobile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -293,18 +293,18 @@ namespace Server.Mobiles
|
|||
switch (Utility.Random(maxCircle * 2))
|
||||
{
|
||||
case 0:
|
||||
case 1: return new MagicArrowSpell(m_Mobile, null);
|
||||
case 1: return new MagicArrowSpell(m_Mobile);
|
||||
case 2:
|
||||
case 3: return new HarmSpell(m_Mobile, null);
|
||||
case 3: return new HarmSpell(m_Mobile);
|
||||
case 4:
|
||||
case 5: return new FireballSpell(m_Mobile, null);
|
||||
case 5: return new FireballSpell(m_Mobile);
|
||||
case 6:
|
||||
case 7: return new LightningSpell(m_Mobile, null);
|
||||
case 7: return new LightningSpell(m_Mobile);
|
||||
case 8:
|
||||
case 9: return new MindBlastSpell(m_Mobile, null);
|
||||
case 10: return new EnergyBoltSpell(m_Mobile, null);
|
||||
case 11: return new ExplosionSpell(m_Mobile, null);
|
||||
default: return new FlameStrikeSpell(m_Mobile, null);
|
||||
case 9: return new MindBlastSpell(m_Mobile);
|
||||
case 10: return new EnergyBoltSpell(m_Mobile);
|
||||
case 11: return new ExplosionSpell(m_Mobile);
|
||||
default: return new FlameStrikeSpell(m_Mobile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -319,38 +319,38 @@ namespace Server.Mobiles
|
|||
{
|
||||
case 0:
|
||||
m_Mobile.DebugSay("Blood Oath");
|
||||
return new BloodOathSpell(m_Mobile, null);
|
||||
return new BloodOathSpell(m_Mobile);
|
||||
case 1:
|
||||
m_Mobile.DebugSay("Corpse Skin");
|
||||
return new CorpseSkinSpell(m_Mobile, null);
|
||||
return new CorpseSkinSpell(m_Mobile);
|
||||
case 2:
|
||||
m_Mobile.DebugSay("Evil Omen");
|
||||
return new EvilOmenSpell(m_Mobile, null);
|
||||
return new EvilOmenSpell(m_Mobile);
|
||||
default:
|
||||
m_Mobile.DebugSay("Mind Rot");
|
||||
return new MindRotSpell(m_Mobile, null);
|
||||
return new MindRotSpell(m_Mobile);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual Spell GetRandomCurseSpellMage()
|
||||
{
|
||||
if (m_Mobile.Skills.Magery.Value >= 40.0 && Utility.Random(4) == 0)
|
||||
return new CurseSpell(m_Mobile, null);
|
||||
return new CurseSpell(m_Mobile);
|
||||
|
||||
switch (Utility.Random(3))
|
||||
{
|
||||
case 0: return new WeakenSpell(m_Mobile, null);
|
||||
case 1: return new ClumsySpell(m_Mobile, null);
|
||||
default: return new FeeblemindSpell(m_Mobile, null);
|
||||
case 0: return new WeakenSpell(m_Mobile);
|
||||
case 1: return new ClumsySpell(m_Mobile);
|
||||
default: return new FeeblemindSpell(m_Mobile);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual Spell GetRandomManaDrainSpell()
|
||||
{
|
||||
if (m_Mobile.Skills.Magery.Value >= 80.0 && Utility.RandomBool())
|
||||
return new ManaVampireSpell(m_Mobile, null);
|
||||
return new ManaVampireSpell(m_Mobile);
|
||||
|
||||
return new ManaDrainSpell(m_Mobile, null);
|
||||
return new ManaDrainSpell(m_Mobile);
|
||||
}
|
||||
|
||||
public virtual Spell DoDispel(Mobile toDispel)
|
||||
|
|
@ -358,7 +358,7 @@ namespace Server.Mobiles
|
|||
if (!SmartAI)
|
||||
{
|
||||
if (ScaleBySkill(DispelChance, SkillName.Magery) > Utility.RandomDouble())
|
||||
return new DispelSpell(m_Mobile, null);
|
||||
return new DispelSpell(m_Mobile);
|
||||
|
||||
return ChooseSpell(toDispel);
|
||||
}
|
||||
|
|
@ -368,11 +368,11 @@ namespace Server.Mobiles
|
|||
if (spell == null)
|
||||
{
|
||||
if (!m_Mobile.DisallowAllMoves && Utility.Random((int)m_Mobile.GetDistanceToSqrt(toDispel)) == 0)
|
||||
spell = new TeleportSpell(m_Mobile, null);
|
||||
spell = new TeleportSpell(m_Mobile);
|
||||
else if (Utility.Random(3) == 0 && !m_Mobile.InRange(toDispel, 3) && !toDispel.Paralyzed && !toDispel.Frozen)
|
||||
spell = new ParalyzeSpell(m_Mobile, null);
|
||||
spell = new ParalyzeSpell(m_Mobile);
|
||||
else
|
||||
spell = new DispelSpell(m_Mobile, null);
|
||||
spell = new DispelSpell(m_Mobile);
|
||||
}
|
||||
|
||||
return spell;
|
||||
|
|
@ -380,7 +380,7 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual Spell ChooseSpell(Mobile c)
|
||||
{
|
||||
Spell spell = null;
|
||||
Spell spell;
|
||||
|
||||
if (!SmartAI)
|
||||
{
|
||||
|
|
@ -396,7 +396,7 @@ namespace Server.Mobiles
|
|||
(c.Player ? 18 : 30);
|
||||
|
||||
if (psDamage > c.Hits)
|
||||
return new PainSpikeSpell(m_Mobile, null);
|
||||
return new PainSpikeSpell(m_Mobile);
|
||||
}
|
||||
|
||||
switch (Utility.Random(16))
|
||||
|
|
@ -409,14 +409,14 @@ namespace Server.Mobiles
|
|||
|
||||
m_Mobile.DebugSay("Attempting to poison");
|
||||
|
||||
spell = new PoisonSpell(m_Mobile, null);
|
||||
spell = new PoisonSpell(m_Mobile);
|
||||
break;
|
||||
}
|
||||
case 2: // Bless ourselves
|
||||
{
|
||||
m_Mobile.DebugSay("Blessing myself");
|
||||
|
||||
spell = new BlessSpell(m_Mobile, null);
|
||||
spell = new BlessSpell(m_Mobile);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
|
|
@ -434,7 +434,7 @@ namespace Server.Mobiles
|
|||
|
||||
m_Mobile.DebugSay("Attempting to paralyze");
|
||||
|
||||
spell = new ParalyzeSpell(m_Mobile, null);
|
||||
spell = new ParalyzeSpell(m_Mobile);
|
||||
break;
|
||||
}
|
||||
case 6: // Drain mana
|
||||
|
|
@ -451,7 +451,7 @@ namespace Server.Mobiles
|
|||
|
||||
m_Mobile.DebugSay("Attempting to invis myself");
|
||||
|
||||
spell = new InvisibilitySpell(m_Mobile, null);
|
||||
spell = new InvisibilitySpell(m_Mobile);
|
||||
break;
|
||||
}
|
||||
default: // Damage them
|
||||
|
|
@ -478,7 +478,7 @@ namespace Server.Mobiles
|
|||
if (c.Poisoned)
|
||||
goto case 1;
|
||||
|
||||
spell = new PoisonSpell(m_Mobile, null);
|
||||
spell = new PoisonSpell(m_Mobile);
|
||||
break;
|
||||
}
|
||||
case 1: // Deal some damage
|
||||
|
|
@ -499,7 +499,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
else if (!c.Poisoned)
|
||||
{
|
||||
spell = new ParalyzeSpell(m_Mobile, null);
|
||||
spell = new ParalyzeSpell(m_Mobile);
|
||||
}
|
||||
}
|
||||
else if (m_Mobile.Mana > 60)
|
||||
|
|
@ -507,12 +507,12 @@ namespace Server.Mobiles
|
|||
if (Utility.RandomBool() && !c.Paralyzed && !c.Frozen && !c.Poisoned)
|
||||
{
|
||||
m_Combo = 0;
|
||||
spell = new ParalyzeSpell(m_Mobile, null);
|
||||
spell = new ParalyzeSpell(m_Mobile);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Combo = 1;
|
||||
spell = new ExplosionSpell(m_Mobile, null);
|
||||
spell = new ExplosionSpell(m_Mobile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -529,20 +529,20 @@ namespace Server.Mobiles
|
|||
|
||||
if (m_Combo == 0)
|
||||
{
|
||||
spell = new ExplosionSpell(m_Mobile, null);
|
||||
spell = new ExplosionSpell(m_Mobile);
|
||||
++m_Combo; // Move to next spell
|
||||
}
|
||||
else if (m_Combo == 1)
|
||||
{
|
||||
spell = new WeakenSpell(m_Mobile, null);
|
||||
spell = new WeakenSpell(m_Mobile);
|
||||
++m_Combo; // Move to next spell
|
||||
}
|
||||
else if (m_Combo == 2)
|
||||
{
|
||||
if (!c.Poisoned)
|
||||
spell = new PoisonSpell(m_Mobile, null);
|
||||
spell = new PoisonSpell(m_Mobile);
|
||||
else if (IsNecromancer)
|
||||
spell = new StrangleSpell(m_Mobile, null);
|
||||
spell = new StrangleSpell(m_Mobile);
|
||||
|
||||
++m_Combo; // Move to next spell
|
||||
}
|
||||
|
|
@ -554,9 +554,9 @@ namespace Server.Mobiles
|
|||
case 0:
|
||||
{
|
||||
if (c.Int < c.Dex)
|
||||
spell = new FeeblemindSpell(m_Mobile, null);
|
||||
spell = new FeeblemindSpell(m_Mobile);
|
||||
else
|
||||
spell = new ClumsySpell(m_Mobile, null);
|
||||
spell = new ClumsySpell(m_Mobile);
|
||||
|
||||
++m_Combo; // Move to next spell
|
||||
|
||||
|
|
@ -564,19 +564,19 @@ namespace Server.Mobiles
|
|||
}
|
||||
case 1:
|
||||
{
|
||||
spell = new EnergyBoltSpell(m_Mobile, null);
|
||||
spell = new EnergyBoltSpell(m_Mobile);
|
||||
m_Combo = -1; // Reset combo state
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
spell = new FlameStrikeSpell(m_Mobile, null);
|
||||
spell = new FlameStrikeSpell(m_Mobile);
|
||||
m_Combo = -1; // Reset combo state
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
spell = new PainSpikeSpell(m_Mobile, null);
|
||||
spell = new PainSpikeSpell(m_Mobile);
|
||||
m_Combo = -1; // Reset combo state
|
||||
break;
|
||||
}
|
||||
|
|
@ -584,7 +584,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
else if (m_Combo == 4 && spell == null)
|
||||
{
|
||||
spell = new MindBlastSpell(m_Mobile, null);
|
||||
spell = new MindBlastSpell(m_Mobile);
|
||||
m_Combo = -1;
|
||||
}
|
||||
|
||||
|
|
@ -607,7 +607,7 @@ namespace Server.Mobiles
|
|||
Mobile c = m_Mobile.Combatant;
|
||||
m_Mobile.Warmode = true;
|
||||
|
||||
if (c == null || c.Deleted || !c.Alive || c.IsDeadBondedPet || !m_Mobile.CanSee(c) ||
|
||||
if (c?.Deleted != false || !c.Alive || c.IsDeadBondedPet || !m_Mobile.CanSee(c) ||
|
||||
!m_Mobile.CanBeHarmful(c, false) || c.Map != m_Mobile.Map)
|
||||
{
|
||||
// Our combatant is deleted, dead, hidden, or we cannot hurt them
|
||||
|
|
@ -710,7 +710,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
m_Mobile.DebugSay("I am going to cure myself");
|
||||
|
||||
spell = new CureSpell(m_Mobile, null);
|
||||
spell = new CureSpell(m_Mobile);
|
||||
}
|
||||
else if (toDispel != null) // Something dispellable is attacking us
|
||||
{
|
||||
|
|
@ -725,7 +725,7 @@ namespace Server.Mobiles
|
|||
else if (SmartAI && (c.Spell is HealSpell || c.Spell is GreaterHealSpell) && !c.Poisoned
|
||||
) // They have a heal spell out
|
||||
{
|
||||
spell = new PoisonSpell(m_Mobile, null);
|
||||
spell = new PoisonSpell(m_Mobile);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -764,7 +764,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool DoActionGuard()
|
||||
{
|
||||
if (m_LastTarget != null && m_LastTarget.Hidden)
|
||||
if (m_LastTarget?.Hidden == true)
|
||||
{
|
||||
Map map = m_Mobile.Map;
|
||||
|
||||
|
|
@ -777,7 +777,7 @@ namespace Server.Mobiles
|
|||
m_Mobile.DebugSay("I am going to reveal my last target");
|
||||
|
||||
m_RevealTarget = new LandTarget(m_LastTargetLoc, map);
|
||||
Spell spell = new RevealSpell(m_Mobile, null);
|
||||
Spell spell = new RevealSpell(m_Mobile);
|
||||
|
||||
if (spell.Cast())
|
||||
m_LastTarget = null; // only do it once
|
||||
|
|
@ -827,7 +827,7 @@ namespace Server.Mobiles
|
|||
m_Mobile.FocusMob = null;
|
||||
|
||||
if (m_Mobile.Poisoned && Utility.Random(0, 5) == 0)
|
||||
new CureSpell(m_Mobile, null).Cast();
|
||||
new CureSpell(m_Mobile).Cast();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -855,7 +855,7 @@ namespace Server.Mobiles
|
|||
|
||||
Mobile comb = m_Mobile.Combatant;
|
||||
|
||||
if (comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet &&
|
||||
if (comb?.Deleted == false && comb.Alive && !comb.IsDeadBondedPet &&
|
||||
m_Mobile.InRange(comb, Core.ML ? 10 : 12) && CanDispel(comb))
|
||||
{
|
||||
active = comb;
|
||||
|
|
@ -917,7 +917,7 @@ namespace Server.Mobiles
|
|||
|
||||
Mobile comb = m_Mobile.Combatant;
|
||||
|
||||
if (comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel(comb))
|
||||
if (comb?.Deleted == false && comb.Alive && !comb.IsDeadBondedPet && CanDispel(comb))
|
||||
{
|
||||
active = inactive = comb;
|
||||
actPrio = inactPrio = m_Mobile.GetDistanceToSqrt(comb);
|
||||
|
|
@ -1100,4 +1100,4 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile combatant = m_Mobile.Combatant;
|
||||
|
||||
if (combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map || !combatant.Alive ||
|
||||
if (combatant?.Deleted != false || combatant.Map != m_Mobile.Map || !combatant.Alive ||
|
||||
combatant.IsDeadBondedPet)
|
||||
{
|
||||
m_Mobile.DebugSay("My combatant is gone, so my guard is up");
|
||||
|
|
@ -174,4 +174,4 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* PredatorAI, its an animal that can attack
|
||||
* Dont flee but dont attack if not hurt or attacked
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Server.Mobiles
|
||||
|
|
@ -36,7 +36,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile combatant = m_Mobile.Combatant;
|
||||
|
||||
if (combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map)
|
||||
if (combatant?.Deleted != false || combatant.Map != m_Mobile.Map)
|
||||
{
|
||||
m_Mobile.DebugSay("My combatant is gone, so my guard is up");
|
||||
Action = ActionType.Wander;
|
||||
|
|
@ -89,4 +89,4 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile combatant = m_Mobile.Combatant;
|
||||
|
||||
if (combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map)
|
||||
if (combatant?.Deleted != false || combatant.Map != m_Mobile.Map)
|
||||
{
|
||||
m_Mobile.DebugSay("My combatant is gone, so my guard is up");
|
||||
|
||||
|
|
@ -50,24 +50,15 @@ namespace Server.Mobiles
|
|||
if (WalkMobileRange(combatant, 1, true, m_Mobile.RangeFight, m_Mobile.RangeFight))
|
||||
{
|
||||
m_Mobile.Direction = m_Mobile.GetDirectionTo(combatant);
|
||||
if (m_toDisarm == null)
|
||||
m_toDisarm = combatant.FindItemOnLayer(Layer.OneHanded);
|
||||
|
||||
if (m_toDisarm == null)
|
||||
m_toDisarm = combatant.FindItemOnLayer(Layer.TwoHanded);
|
||||
|
||||
if (m_toDisarm != null && m_toDisarm.IsChildOf(m_Mobile.Backpack))
|
||||
{
|
||||
m_toDisarm = combatant.FindItemOnLayer(Layer.OneHanded);
|
||||
if (m_toDisarm == null)
|
||||
m_toDisarm = combatant.FindItemOnLayer(Layer.TwoHanded);
|
||||
}
|
||||
if (m_toDisarm?.IsChildOf(m_Mobile.Backpack) != false)
|
||||
m_toDisarm = combatant.FindItemOnLayer(Layer.OneHanded) ?? combatant.FindItemOnLayer(Layer.TwoHanded);
|
||||
|
||||
if (!Core.AOS && !m_Mobile.DisarmReady && m_Mobile.Skills.Wrestling.Value >= 80.0 &&
|
||||
m_Mobile.Skills.ArmsLore.Value >= 80.0 && m_toDisarm != null)
|
||||
EventSink.InvokeDisarmRequest(new DisarmRequestEventArgs(m_Mobile));
|
||||
|
||||
if (m_toDisarm != null && m_toDisarm.IsChildOf(combatant.Backpack) &&
|
||||
if (m_toDisarm?.IsChildOf(combatant.Backpack) == true &&
|
||||
Core.TickCount - m_Mobile.NextSkillTime >= 0 && m_toDisarm.LootType != LootType.Blessed &&
|
||||
m_toDisarm.LootType != LootType.Newbied)
|
||||
{
|
||||
|
|
@ -126,31 +117,28 @@ namespace Server.Mobiles
|
|||
m_Mobile.DebugSay("I should be closer to {0}", combatant.Name);
|
||||
}
|
||||
|
||||
if (m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100 && m_Mobile.CanFlee)
|
||||
if (m_Mobile.Hits >= m_Mobile.HitsMax * 20 / 100 || !m_Mobile.CanFlee)
|
||||
return true;
|
||||
// We are low on health, should we flee?
|
||||
|
||||
bool flee;
|
||||
|
||||
if (m_Mobile.Hits < combatant.Hits)
|
||||
{
|
||||
// We are low on health, should we flee?
|
||||
// We are more hurt than them
|
||||
int diff = combatant.Hits - m_Mobile.Hits;
|
||||
|
||||
bool flee = false;
|
||||
flee = Utility.Random(0, 100) > 10 + diff; // (10 + diff)% chance to flee
|
||||
}
|
||||
else
|
||||
{
|
||||
flee = Utility.Random(0, 100) > 10; // 10% chance to flee
|
||||
}
|
||||
|
||||
if (m_Mobile.Hits < combatant.Hits)
|
||||
{
|
||||
// We are more hurt than them
|
||||
|
||||
int diff = combatant.Hits - m_Mobile.Hits;
|
||||
|
||||
flee = Utility.Random(0, 100) > 10 + diff; // (10 + diff)% chance to flee
|
||||
}
|
||||
else
|
||||
{
|
||||
flee = Utility.Random(0, 100) > 10; // 10% chance to flee
|
||||
}
|
||||
|
||||
if (flee)
|
||||
{
|
||||
m_Mobile.DebugSay("I am going to flee from {0}", combatant.Name);
|
||||
|
||||
Action = ActionType.Flee;
|
||||
}
|
||||
if (flee)
|
||||
{
|
||||
m_Mobile.DebugSay("I am going to flee from {0}", combatant.Name);
|
||||
Action = ActionType.Flee;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -189,4 +177,4 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
|
||||
if (customer == null || customer.Deleted || customer.Map != m_Mobile.Map)
|
||||
if (customer?.Deleted != false || customer.Map != m_Mobile.Map)
|
||||
{
|
||||
m_Mobile.DebugSay("My customer have disapeared");
|
||||
m_Mobile.FocusMob = null;
|
||||
|
|
@ -147,4 +147,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,19 +111,16 @@ namespace Server.Mobiles
|
|||
if (m_Rider == null)
|
||||
return;
|
||||
|
||||
Mobile attacker = from;
|
||||
if (attacker == null)
|
||||
attacker = m_Rider.FindMostRecentDamager(true);
|
||||
Mobile attacker = from ?? m_Rider.FindMostRecentDamager(true);
|
||||
|
||||
if (!(attacker == this || attacker == m_Rider || willKill || DateTime.UtcNow < NextMountAbility))
|
||||
if (DoMountAbility(amount, from))
|
||||
if (!(attacker == this || attacker == m_Rider || willKill || DateTime.UtcNow < NextMountAbility)
|
||||
&& DoMountAbility(amount, from))
|
||||
NextMountAbility = DateTime.UtcNow + MountAbilityDelay;
|
||||
}
|
||||
|
||||
public override bool OnBeforeDeath()
|
||||
{
|
||||
Rider = null;
|
||||
|
||||
return base.OnBeforeDeath();
|
||||
}
|
||||
|
||||
|
|
@ -351,4 +348,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,12 +7,8 @@ namespace Server.Mobiles
|
|||
public class Beetle : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public Beetle() : this("a giant beetle")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Beetle(string name) : base(name, 0x317, 0x3EBC, AIType.AI_Melee, FightMode.Closest, 10, 1, 0.25, 0.5)
|
||||
public Beetle(string name = "a giant beetle") :
|
||||
base(name, 0x317, 0x3EBC, AIType.AI_Melee, FightMode.Closest, 10, 1, 0.25, 0.5)
|
||||
{
|
||||
SetStr(300);
|
||||
SetDex(100);
|
||||
|
|
@ -172,4 +168,4 @@ namespace Server.Mobiles
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class DesertOstard : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public DesertOstard() : this("a desert ostard")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public DesertOstard(string name) : base(name, 0xD2, 0x3EA3, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public DesertOstard(string name = "a desert ostard") :
|
||||
base(name, 0xD2, 0x3EA3, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0x270;
|
||||
|
||||
|
|
@ -62,4 +58,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ namespace Server.Mobiles
|
|||
if (m_Rider != null)
|
||||
m_Rider.Followers -= FollowerSlots;
|
||||
|
||||
if (m_Rider != null && m_Rider.Followers < 0)
|
||||
if (m_Rider?.Followers < 0)
|
||||
m_Rider.Followers = 0;
|
||||
}
|
||||
|
||||
|
|
@ -161,8 +161,9 @@ namespace Server.Mobiles
|
|||
return false;
|
||||
}
|
||||
|
||||
if (IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null)) return false;
|
||||
if (!BaseMount.CheckMountAllowed(from)) return false;
|
||||
if (IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this) || !BaseMount.CheckMountAllowed(from))
|
||||
return false;
|
||||
|
||||
if (from.Mounted)
|
||||
{
|
||||
from.SendLocalizedMessage(1005583); // Please dismount first.
|
||||
|
|
@ -187,9 +188,7 @@ namespace Server.Mobiles
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!DesignContext.Check(from)) return false;
|
||||
|
||||
return true;
|
||||
return DesignContext.Check(from);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
|
|
@ -202,10 +201,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
base.OnSingleClick(from);
|
||||
|
||||
if (m_IsDonationItem)
|
||||
LabelTo(from, "Donation Ethereal");
|
||||
else
|
||||
LabelTo(from, "Veteran Reward");
|
||||
LabelTo(from, m_IsDonationItem ? "Donation Ethereal" : "Veteran Reward");
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
@ -840,4 +836,4 @@ namespace Server.Mobiles
|
|||
if (version <= 1 && Hue != 0) Hue = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,8 @@ namespace Server.Mobiles
|
|||
public class FireSteed : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public FireSteed() : this("a fire steed")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public FireSteed(string name) : base(name, 0xBE, 0x3E9E, AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public FireSteed(string name = "a fire steed") :
|
||||
base(name, 0xBE, 0x3E9E, AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0xA8;
|
||||
|
||||
|
|
@ -85,4 +81,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class ForestOstard : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public ForestOstard() : this("a forest ostard")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public ForestOstard(string name) : base(name, 0xDB, 0x3EA5, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public ForestOstard(string name = "a forest ostard") :
|
||||
base(name, 0xDB, 0x3EA5, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
Hue = Utility.RandomSlimeHue() | 0x8000;
|
||||
|
||||
|
|
@ -63,4 +59,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class FrenziedOstard : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public FrenziedOstard() : this("a frenzied ostard")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public FrenziedOstard(string name) : base(name, 0xDA, 0x3EA4, AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public FrenziedOstard(string name = "a frenzied ostard") :
|
||||
base(name, 0xDA, 0x3EA4, AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
Hue = Race.Human.RandomHairHue() | 0x8000;
|
||||
|
||||
|
|
@ -66,4 +62,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class HellSteed : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public HellSteed() : this("a hellsteed")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public HellSteed(string name) : base(name, 793, 0x3EBB, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public HellSteed(string name = "a hellsteed") :
|
||||
base(name, 793, 0x3EBB, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
SetStats(this);
|
||||
}
|
||||
|
|
@ -61,4 +57,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Items;
|
||||
|
|
|
|||
|
|
@ -13,12 +13,8 @@ namespace Server.Mobiles
|
|||
};
|
||||
|
||||
[Constructible]
|
||||
public Horse() : this("a horse")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Horse(string name) : base(name, 0xE2, 0x3EA0, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public Horse(string name = "a horse") :
|
||||
base(name, 0xE2, 0x3EA0, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
int random = Utility.Random(4);
|
||||
|
||||
|
|
@ -75,4 +71,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,12 +7,8 @@ namespace Server.Mobiles
|
|||
public class Kirin : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public Kirin() : this("a ki-rin")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Kirin(string name) : base(name, 132, 0x3EAD, AIType.AI_Mage, FightMode.Evil, 10, 1, 0.2, 0.4)
|
||||
public Kirin(string name = "a ki-rin") :
|
||||
base(name, 132, 0x3EAD, AIType.AI_Mage, FightMode.Evil, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0x3C5;
|
||||
|
||||
|
|
@ -129,4 +125,4 @@ namespace Server.Mobiles
|
|||
AI = AIType.AI_Mage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Items;
|
||||
|
|
|
|||
|
|
@ -5,12 +5,8 @@ namespace Server.Mobiles
|
|||
public class Nightmare : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public Nightmare() : this("a nightmare")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Nightmare(string name) : base(name, 0x74, 0x3EA7, AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public Nightmare(string name = "a nightmare") :
|
||||
base(name, 0x74, 0x3EA7, AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = Core.AOS ? 0xA8 : 0x16A;
|
||||
|
||||
|
|
@ -120,4 +116,4 @@ namespace Server.Mobiles
|
|||
BaseSoundID = 0x16A;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class RidableLlama : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public RidableLlama() : this("a ridable llama")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public RidableLlama(string name) : base(name, 0xDC, 0x3EA6, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public RidableLlama(string name = "a ridable llama") :
|
||||
base(name, 0xDC, 0x3EA6, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0x3F3;
|
||||
|
||||
|
|
@ -65,4 +61,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class Ridgeback : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public Ridgeback() : this("a ridgeback")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Ridgeback(string name) : base(name, 187, 0x3EBA, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public Ridgeback(string name = "a ridgeback") :
|
||||
base(name, 187, 0x3EBA, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0x3F3;
|
||||
|
||||
|
|
@ -76,4 +72,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class SavageRidgeback : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public SavageRidgeback() : this("a savage ridgeback")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SavageRidgeback(string name) : base(name, 188, 0x3EB8, AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public SavageRidgeback(string name = "a savage ridgeback") :
|
||||
base(name, 188, 0x3EB8, AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0x3F3;
|
||||
|
||||
|
|
@ -76,4 +72,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,8 @@ namespace Server.Mobiles
|
|||
public class ScaledSwampDragon : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public ScaledSwampDragon() : this("a swamp dragon")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public ScaledSwampDragon(string name) : base(name, 0x31F, 0x3EBE, AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2,
|
||||
0.4)
|
||||
public ScaledSwampDragon(string name = "a swamp dragon") :
|
||||
base(name, 0x31F, 0x3EBE, AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
SetStr(201, 300);
|
||||
SetDex(66, 85);
|
||||
|
|
@ -74,4 +69,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class SeaHorse : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public SeaHorse() : this("a sea horse")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SeaHorse(string name) : base(name, 0x90, 0x3EB3, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public SeaHorse(string name = "a sea horse") :
|
||||
base(name, 0x90, 0x3EB3, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
InitStats(Utility.Random(50, 30), Utility.Random(50, 30), 10);
|
||||
Skills.MagicResist.Base = 25.0 + Utility.RandomDouble() * 5.0;
|
||||
|
|
@ -36,4 +32,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class SilverSteed : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public SilverSteed() : this("a silver steed")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SilverSteed(string name) : base(name, 0x75, 0x3EA8, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public SilverSteed(string name = "a silver steed") :
|
||||
base(name, 0x75, 0x3EA8, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
InitStats(Utility.Random(50, 30), Utility.Random(50, 30), 10);
|
||||
Skills.MagicResist.Base = 25.0 + Utility.RandomDouble() * 5.0;
|
||||
|
|
@ -40,4 +36,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class SkeletalMount : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public SkeletalMount() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SkeletalMount(string name) : base(name, 793, 0x3EBB, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public SkeletalMount(string name = null) :
|
||||
base(name, 793, 0x3EBB, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
SetStr(91, 100);
|
||||
SetDex(46, 55);
|
||||
|
|
@ -69,4 +65,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,12 +11,8 @@ namespace Server.Mobiles
|
|||
private bool m_HasBarding;
|
||||
|
||||
[Constructible]
|
||||
public SwampDragon() : this("a swamp dragon")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SwampDragon(string name) : base(name, 0x31A, 0x3EBD, AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public SwampDragon(string name = "a swamp dragon") :
|
||||
base(name, 0x31A, 0x3EBD, AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0x16A;
|
||||
|
||||
|
|
@ -220,4 +216,4 @@ namespace Server.Mobiles
|
|||
BaseSoundID = 0x16A;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,12 +7,8 @@ namespace Server.Mobiles
|
|||
public class Unicorn : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public Unicorn() : this("a unicorn")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Unicorn(string name) : base(name, 0x7A, 0x3EB4, AIType.AI_Mage, FightMode.Evil, 10, 1, 0.2, 0.4)
|
||||
public Unicorn(string name = "a unicorn") :
|
||||
base(name, 0x7A, 0x3EB4, AIType.AI_Mage, FightMode.Evil, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0x4BC;
|
||||
|
||||
|
|
@ -134,4 +130,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Server.ContextMenus;
|
||||
using Server.Engines.ConPVP;
|
||||
|
|
@ -293,7 +294,7 @@ namespace Server.Mobiles
|
|||
|
||||
return base.Name;
|
||||
}
|
||||
set { base.Name = value == DefaultName ? null : value; }
|
||||
set => base.Name = value == DefaultName ? null : value;
|
||||
}
|
||||
|
||||
public virtual InhumanSpeech SpeechType => null;
|
||||
|
|
@ -463,19 +464,17 @@ namespace Server.Mobiles
|
|||
{
|
||||
get
|
||||
{
|
||||
if (HitsMaxSeed > 0)
|
||||
{
|
||||
int value = HitsMaxSeed + GetStatOffset(StatType.Str);
|
||||
if (HitsMaxSeed <= 0)
|
||||
return Str;
|
||||
|
||||
if (value < 1)
|
||||
value = 1;
|
||||
else if (value > 65000)
|
||||
value = 65000;
|
||||
int value = HitsMaxSeed + GetStatOffset(StatType.Str);
|
||||
|
||||
return value;
|
||||
}
|
||||
if (value < 1)
|
||||
value = 1;
|
||||
else if (value > 65000)
|
||||
value = 65000;
|
||||
|
||||
return Str;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -487,19 +486,18 @@ namespace Server.Mobiles
|
|||
{
|
||||
get
|
||||
{
|
||||
if (StamMaxSeed > 0)
|
||||
{
|
||||
int value = StamMaxSeed + GetStatOffset(StatType.Dex);
|
||||
if (StamMaxSeed <= 0)
|
||||
return Dex;
|
||||
|
||||
if (value < 1)
|
||||
value = 1;
|
||||
else if (value > 65000)
|
||||
value = 65000;
|
||||
int value = StamMaxSeed + GetStatOffset(StatType.Dex);
|
||||
|
||||
return value;
|
||||
}
|
||||
if (value < 1)
|
||||
value = 1;
|
||||
else if (value > 65000)
|
||||
value = 65000;
|
||||
|
||||
return value;
|
||||
|
||||
return Dex;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -511,19 +509,18 @@ namespace Server.Mobiles
|
|||
{
|
||||
get
|
||||
{
|
||||
if (ManaMaxSeed > 0)
|
||||
{
|
||||
int value = ManaMaxSeed + GetStatOffset(StatType.Int);
|
||||
if (ManaMaxSeed <= 0)
|
||||
return Int;
|
||||
|
||||
if (value < 1)
|
||||
value = 1;
|
||||
else if (value > 65000)
|
||||
value = 65000;
|
||||
int value = ManaMaxSeed + GetStatOffset(StatType.Int);
|
||||
|
||||
return value;
|
||||
}
|
||||
if (value < 1)
|
||||
value = 1;
|
||||
else if (value > 65000)
|
||||
value = 65000;
|
||||
|
||||
return value;
|
||||
|
||||
return Int;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -537,7 +534,6 @@ namespace Server.Mobiles
|
|||
public virtual bool CanDestroyObstacles => false;
|
||||
|
||||
/*
|
||||
|
||||
Seems this actually was removed on OSI somewhere between the original bug report and now.
|
||||
We will call it ML, until we can get better information. I suspect it was on the OSI TC when
|
||||
originally it taken out of RunUO, and not implemented on OSIs production shards until more
|
||||
|
|
@ -580,7 +576,6 @@ namespace Server.Mobiles
|
|||
set
|
||||
{
|
||||
m_Team = value;
|
||||
|
||||
OnTeamChange();
|
||||
}
|
||||
}
|
||||
|
|
@ -609,19 +604,12 @@ namespace Server.Mobiles
|
|||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public double CurrentSpeed
|
||||
{
|
||||
get
|
||||
{
|
||||
if (TargetLocation != null)
|
||||
return 0.3;
|
||||
|
||||
return m_CurrentSpeed;
|
||||
}
|
||||
get => TargetLocation != null ? 0.3 : m_CurrentSpeed;
|
||||
set
|
||||
{
|
||||
if (m_CurrentSpeed != value)
|
||||
{
|
||||
m_CurrentSpeed = value;
|
||||
|
||||
AIObject?.OnCurrentSpeedChanged();
|
||||
}
|
||||
}
|
||||
|
|
@ -840,7 +828,7 @@ namespace Server.Mobiles
|
|||
Ethic ourEthic = EthicAllegiance;
|
||||
Player pl = Ethics.Player.Find(m, true);
|
||||
|
||||
if (pl != null && pl.IsShielded && (ourEthic == null || ourEthic == pl.Ethic))
|
||||
if (pl?.IsShielded == true && (ourEthic == null || ourEthic == pl.Ethic))
|
||||
return false;
|
||||
|
||||
if (m is PlayerMobile mobile && mobile.HonorActive)
|
||||
|
|
@ -906,7 +894,7 @@ namespace Server.Mobiles
|
|||
(int)((useBaseSkill ? m.Skills.AnimalTaming.Base : m.Skills.AnimalTaming.Value) * 10);
|
||||
int lore =
|
||||
(int)((useBaseSkill ? m.Skills.AnimalLore.Base : m.Skills.AnimalLore.Value) * 10);
|
||||
int bonus = 0, chance = 700;
|
||||
int bonus, chance = 700;
|
||||
|
||||
if (Core.ML)
|
||||
{
|
||||
|
|
@ -1008,15 +996,8 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool CheckPoisonImmunity(Mobile from, Poison poison)
|
||||
{
|
||||
if (base.CheckPoisonImmunity(from, poison))
|
||||
return true;
|
||||
|
||||
Poison p = PoisonImmune;
|
||||
|
||||
if (m_Paragon)
|
||||
p = PoisonImpl.IncreaseLevel(p);
|
||||
|
||||
return p != null && p.Level >= poison.Level;
|
||||
return base.CheckPoisonImmunity(from, poison) ||
|
||||
(m_Paragon ? PoisonImpl.IncreaseLevel(PoisonImmune) : PoisonImmune)?.Level >= poison.Level;
|
||||
}
|
||||
|
||||
public void Unpacify()
|
||||
|
|
@ -1045,7 +1026,7 @@ namespace Server.Mobiles
|
|||
//NPCs can use bandages too!
|
||||
if (!Core.AOS)
|
||||
disruptThreshold = 0;
|
||||
else if (from != null && from.Player)
|
||||
else if (from?.Player == true)
|
||||
disruptThreshold = 18;
|
||||
else
|
||||
disruptThreshold = 25;
|
||||
|
|
@ -1353,9 +1334,9 @@ namespace Server.Mobiles
|
|||
writer.Write(m_Paragon);
|
||||
|
||||
// Version 13
|
||||
writer.Write(Friends != null && Friends.Count > 0);
|
||||
writer.Write(Friends?.Count > 0);
|
||||
|
||||
if (Friends != null && Friends.Count > 0)
|
||||
if (Friends?.Count > 0)
|
||||
writer.Write(Friends, true);
|
||||
|
||||
// Version 14
|
||||
|
|
@ -1735,13 +1716,13 @@ namespace Server.Mobiles
|
|||
else if (m_SummonMaster != null)
|
||||
{
|
||||
m_SummonMaster.Followers -= ControlSlots;
|
||||
if (m_SummonMaster is PlayerMobile mobile) mobile.AllFollowers.Remove(this);
|
||||
(m_SummonMaster as PlayerMobile)?.AllFollowers.Remove(this);
|
||||
}
|
||||
|
||||
if (m_ControlMaster != null && m_ControlMaster.Followers < 0)
|
||||
if (m_ControlMaster?.Followers < 0)
|
||||
m_ControlMaster.Followers = 0;
|
||||
|
||||
if (m_SummonMaster != null && m_SummonMaster.Followers < 0)
|
||||
if (m_SummonMaster?.Followers < 0)
|
||||
m_SummonMaster.Followers = 0;
|
||||
}
|
||||
|
||||
|
|
@ -1750,12 +1731,14 @@ namespace Server.Mobiles
|
|||
if (m_ControlMaster != null)
|
||||
{
|
||||
m_ControlMaster.Followers += ControlSlots;
|
||||
if (m_ControlMaster is PlayerMobile mobile) mobile.AllFollowers.Add(this);
|
||||
if (m_ControlMaster is PlayerMobile mobile)
|
||||
mobile.AllFollowers.Add(this);
|
||||
}
|
||||
else if (m_SummonMaster != null)
|
||||
{
|
||||
m_SummonMaster.Followers += ControlSlots;
|
||||
if (m_SummonMaster is PlayerMobile mobile) mobile.AllFollowers.Add(this);
|
||||
if (m_SummonMaster is PlayerMobile mobile)
|
||||
mobile.AllFollowers.Add(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1797,7 +1780,6 @@ namespace Server.Mobiles
|
|||
if (AIObject != null)
|
||||
{
|
||||
AIObject.m_Timer?.Stop();
|
||||
|
||||
AIObject = null;
|
||||
}
|
||||
|
||||
|
|
@ -1839,20 +1821,20 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual double GetFightModeRanking(Mobile m, FightMode acqType, bool bPlayerOnly)
|
||||
{
|
||||
if (bPlayerOnly && m.Player || !bPlayerOnly)
|
||||
switch (acqType)
|
||||
{
|
||||
case FightMode.Strongest:
|
||||
return m.Skills.Tactics.Value + m.Str; //returns strongest mobile
|
||||
if (bPlayerOnly && !m.Player)
|
||||
return double.MinValue;
|
||||
|
||||
case FightMode.Weakest:
|
||||
return -m.Hits; // returns weakest mobile
|
||||
switch (acqType)
|
||||
{
|
||||
case FightMode.Strongest:
|
||||
return m.Skills.Tactics.Value + m.Str; //returns strongest mobile
|
||||
|
||||
default:
|
||||
return -GetDistanceToSqrt(m); // returns closest mobile
|
||||
}
|
||||
case FightMode.Weakest:
|
||||
return -m.Hits; // returns weakest mobile
|
||||
|
||||
return double.MinValue;
|
||||
default:
|
||||
return -GetDistanceToSqrt(m); // returns closest mobile
|
||||
}
|
||||
}
|
||||
|
||||
// Turn, - for left, + for right
|
||||
|
|
@ -1897,9 +1879,8 @@ namespace Server.Mobiles
|
|||
{
|
||||
base.AggressiveAction(aggressor, criminal);
|
||||
|
||||
if (ControlMaster != null)
|
||||
if (NotorietyHandlers.CheckAggressor(ControlMaster.Aggressors, aggressor))
|
||||
aggressor.Aggressors.Add(AggressorInfo.Create(this, aggressor, true));
|
||||
if (ControlMaster != null && NotorietyHandlers.CheckAggressor(ControlMaster.Aggressors, aggressor))
|
||||
aggressor.Aggressors.Add(AggressorInfo.Create(this, aggressor, true));
|
||||
|
||||
OrderType ct = m_ControlOrder;
|
||||
|
||||
|
|
@ -1925,7 +1906,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Player pl = Ethics.Player.Find(aggressor, true);
|
||||
|
||||
if (pl != null && pl.IsShielded)
|
||||
if (pl?.IsShielded == true)
|
||||
pl.FinishShield();
|
||||
}
|
||||
|
||||
|
|
@ -1952,8 +1933,8 @@ namespace Server.Mobiles
|
|||
#region Dueling
|
||||
|
||||
if (Region.IsPartOf<SafeZone>() && m is PlayerMobile pm &&
|
||||
(pm.DuelContext == null || pm.DuelPlayer == null || !pm.DuelContext.Started || pm.DuelContext.Finished ||
|
||||
pm.DuelPlayer.Eliminated))
|
||||
(pm.DuelContext?.Started != true || pm.DuelContext.Finished ||
|
||||
pm.DuelPlayer?.Eliminated != false))
|
||||
return true;
|
||||
|
||||
#endregion
|
||||
|
|
@ -1987,7 +1968,7 @@ namespace Server.Mobiles
|
|||
Skill skill = ourSkills[i];
|
||||
Skill theirSkill = theirSkills[i];
|
||||
|
||||
if (skill != null && theirSkill != null && skill.Base >= 60.0 && CheckTeach(skill.SkillName, from))
|
||||
if (skill?.Base >= 60.0 && CheckTeach(skill.SkillName, from))
|
||||
{
|
||||
int toTeach = skill.BaseFixedPoint / 3;
|
||||
|
||||
|
|
@ -2002,19 +1983,15 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool HandlesOnSpeech(Mobile from)
|
||||
{
|
||||
InhumanSpeech speechType = SpeechType;
|
||||
|
||||
if (speechType != null && (speechType.Flags & IHSFlags.OnSpeech) != 0 && from.InRange(this, 3))
|
||||
return true;
|
||||
|
||||
return AIObject != null && AIObject.HandlesOnSpeech(from) && from.InRange(this, RangePerception);
|
||||
return (SpeechType?.Flags & IHSFlags.OnSpeech) != 0 && from.InRange(this, 3) ||
|
||||
AIObject?.HandlesOnSpeech(from) == true && from.InRange(this, RangePerception);
|
||||
}
|
||||
|
||||
public override void OnSpeech(SpeechEventArgs e)
|
||||
{
|
||||
InhumanSpeech speechType = SpeechType;
|
||||
|
||||
if (speechType != null && speechType.OnSpeech(this, e.Mobile, e.Speech))
|
||||
if (speechType?.OnSpeech(this, e.Mobile, e.Speech) == true)
|
||||
e.Handled = true;
|
||||
else if (!e.Handled && AIObject != null && e.Mobile.InRange(this, RangePerception))
|
||||
AIObject.OnSpeech(e);
|
||||
|
|
@ -2022,16 +1999,9 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool IsHarmfulCriminal(Mobile target)
|
||||
{
|
||||
if (Controlled && target == m_ControlMaster || Summoned && target == m_SummonMaster)
|
||||
return false;
|
||||
|
||||
if (target is BaseCreature creature && creature.InitialInnocent && !creature.Controlled)
|
||||
return false;
|
||||
|
||||
if (target is PlayerMobile mobile && mobile.PermaFlags.Count > 0)
|
||||
return false;
|
||||
|
||||
return base.IsHarmfulCriminal(target);
|
||||
return (!Controlled || target != m_ControlMaster) && (!Summoned || target != m_SummonMaster) &&
|
||||
(!(target is BaseCreature creature) || !creature.InitialInnocent || creature.Controlled) &&
|
||||
(!(target is PlayerMobile mobile) || mobile.PermaFlags.Count <= 0) && base.IsHarmfulCriminal(target);
|
||||
}
|
||||
|
||||
public override void CriminalAction(bool message)
|
||||
|
|
@ -2161,14 +2131,15 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual void CheckedAnimate(int action, int frameCount, int repeatCount, bool forward, bool repeat, int delay)
|
||||
{
|
||||
if (!Mounted) base.Animate(action, frameCount, repeatCount, forward, repeat, delay);
|
||||
if (!Mounted)
|
||||
base.Animate(action, frameCount, repeatCount, forward, repeat, delay);
|
||||
}
|
||||
|
||||
private void CheckAIActive()
|
||||
{
|
||||
Map map = Map;
|
||||
|
||||
if (PlayerRangeSensitive && AIObject != null && map != null && map.GetSector(Location).Active)
|
||||
if (PlayerRangeSensitive && AIObject != null && map?.GetSector(Location).Active == true)
|
||||
AIObject.Activate();
|
||||
}
|
||||
|
||||
|
|
@ -2176,9 +2147,10 @@ namespace Server.Mobiles
|
|||
{
|
||||
base.OnCombatantChange();
|
||||
|
||||
Warmode = Combatant != null && !Combatant.Deleted && Combatant.Alive;
|
||||
Warmode = Combatant?.Deleted == false && Combatant.Alive;
|
||||
|
||||
if (CanFly && Warmode) Flying = false;
|
||||
if (CanFly && Warmode)
|
||||
Flying = false;
|
||||
}
|
||||
|
||||
protected override void OnMapChange(Map oldMap)
|
||||
|
|
@ -2204,15 +2176,13 @@ namespace Server.Mobiles
|
|||
{
|
||||
if (AcquireOnApproach && !Controlled && !Summoned && FightMode != FightMode.Aggressor)
|
||||
{
|
||||
if (InRange(m.Location, AcquireOnApproachRange) && !InRange(oldLocation, AcquireOnApproachRange))
|
||||
if (CanBeHarmful(m) && IsEnemy(m))
|
||||
{
|
||||
Combatant = FocusMob = m;
|
||||
|
||||
AIObject?.MoveTo(m, true, 1);
|
||||
|
||||
DoHarmful(m);
|
||||
}
|
||||
if (InRange(m.Location, AcquireOnApproachRange) && !InRange(oldLocation, AcquireOnApproachRange) &&
|
||||
CanBeHarmful(m) && IsEnemy(m))
|
||||
{
|
||||
Combatant = FocusMob = m;
|
||||
AIObject?.MoveTo(m, true, 1);
|
||||
DoHarmful(m);
|
||||
}
|
||||
}
|
||||
else if (ReacquireOnMovement)
|
||||
{
|
||||
|
|
@ -2225,14 +2195,14 @@ namespace Server.Mobiles
|
|||
|
||||
/* Begin notice sound */
|
||||
if ((!m.Hidden || m.AccessLevel == AccessLevel.Player) && m.Player && FightMode != FightMode.Aggressor &&
|
||||
FightMode != FightMode.None && Combatant == null && !Controlled && !Summoned)
|
||||
if (InRange(m.Location, 18) && !InRange(oldLocation, 18))
|
||||
{
|
||||
if (Body.IsMonster)
|
||||
Animate(11, 5, 1, true, false, 1);
|
||||
FightMode != FightMode.None && Combatant == null && !Controlled && !Summoned &&
|
||||
InRange(m.Location, 18) && !InRange(oldLocation, 18))
|
||||
{
|
||||
if (Body.IsMonster)
|
||||
Animate(11, 5, 1, true, false, 1);
|
||||
|
||||
PlaySound(GetAngerSound());
|
||||
}
|
||||
PlaySound(GetAngerSound());
|
||||
}
|
||||
/* End notice sound */
|
||||
|
||||
if (MLQuestSystem.Enabled && CanShout && m is PlayerMobile mobile)
|
||||
|
|
@ -2441,9 +2411,7 @@ namespace Server.Mobiles
|
|||
Effects.SendLocationEffect(Location, Map, 0x3728, 13, 1, 0x461, 4);
|
||||
|
||||
InhumanSpeech speechType = SpeechType;
|
||||
|
||||
speechType?.OnDeath(this);
|
||||
|
||||
ReceivedHonorContext?.OnTargetKilled();
|
||||
|
||||
return base.OnBeforeDeath();
|
||||
|
|
@ -2498,37 +2466,36 @@ namespace Server.Mobiles
|
|||
|
||||
List<DamageEntry> respList = de.Responsible;
|
||||
|
||||
if (respList != null)
|
||||
for (int j = 0; j < respList.Count; ++j)
|
||||
for (int j = 0; j < respList?.Count; ++j)
|
||||
{
|
||||
DamageEntry subEntry = respList[j];
|
||||
Mobile master = subEntry.Damager;
|
||||
|
||||
if (master?.Deleted != false || !master.Player)
|
||||
continue;
|
||||
|
||||
bool needNewSubEntry = true;
|
||||
|
||||
for (int k = 0; needNewSubEntry && k < rights.Count; ++k)
|
||||
{
|
||||
DamageEntry subEntry = respList[j];
|
||||
Mobile master = subEntry.Damager;
|
||||
DamageStore ds = rights[k];
|
||||
|
||||
if (master == null || master.Deleted || !master.Player)
|
||||
continue;
|
||||
|
||||
bool needNewSubEntry = true;
|
||||
|
||||
for (int k = 0; needNewSubEntry && k < rights.Count; ++k)
|
||||
if (ds.m_Mobile == master)
|
||||
{
|
||||
DamageStore ds = rights[k];
|
||||
|
||||
if (ds.m_Mobile == master)
|
||||
{
|
||||
ds.m_Damage += subEntry.DamageGiven;
|
||||
needNewSubEntry = false;
|
||||
}
|
||||
ds.m_Damage += subEntry.DamageGiven;
|
||||
needNewSubEntry = false;
|
||||
}
|
||||
|
||||
if (needNewSubEntry)
|
||||
rights.Add(new DamageStore(master, subEntry.DamageGiven));
|
||||
|
||||
damage -= subEntry.DamageGiven;
|
||||
}
|
||||
|
||||
if (needNewSubEntry)
|
||||
rights.Add(new DamageStore(master, subEntry.DamageGiven));
|
||||
|
||||
damage -= subEntry.DamageGiven;
|
||||
}
|
||||
|
||||
Mobile m = de.Damager;
|
||||
|
||||
if (m == null || m.Deleted || !m.Player)
|
||||
if (m?.Deleted != false || !m.Player)
|
||||
continue;
|
||||
|
||||
if (damage <= 0)
|
||||
|
|
@ -2654,7 +2621,7 @@ namespace Server.Mobiles
|
|||
|
||||
Mobile owner = ControlMaster;
|
||||
|
||||
if (owner == null || owner.Deleted || owner.Map != Map || !owner.InRange(this, 12) || !CanSee(owner) ||
|
||||
if (owner?.Deleted != false || owner.Map != Map || !owner.InRange(this, 12) || !CanSee(owner) ||
|
||||
!InLOS(owner))
|
||||
{
|
||||
if (OwnerAbandonTime == DateTime.MinValue)
|
||||
|
|
@ -2785,14 +2752,11 @@ namespace Server.Mobiles
|
|||
public override void OnDelete()
|
||||
{
|
||||
Mobile m = m_ControlMaster;
|
||||
|
||||
SetControlMaster(null);
|
||||
|
||||
SummonMaster = null;
|
||||
|
||||
ReceivedHonorContext?.Cancel();
|
||||
|
||||
base.OnDelete();
|
||||
|
||||
m?.InvalidateProperties();
|
||||
}
|
||||
|
||||
|
|
@ -2961,15 +2925,12 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile target = Combatant;
|
||||
|
||||
if (target != null && target.Alive && !target.IsDeadBondedPet && CanBeHarmful(target) && target.Map == Map &&
|
||||
if (target?.Alive == true && !target.IsDeadBondedPet && CanBeHarmful(target) && target.Map == Map &&
|
||||
!IsDeadBondedPet && target.InRange(this, BreathRange) && InLOS(target) && !BardPacified)
|
||||
{
|
||||
if (Core.TickCount - m_NextBreathTime < 30000 && Utility.RandomBool()) BreathStart(target);
|
||||
|
||||
m_NextBreathTime = tc + (int)TimeSpan
|
||||
.FromSeconds(BreathMinDelay +
|
||||
Utility.RandomDouble() * (BreathMaxDelay - BreathMinDelay))
|
||||
.TotalMilliseconds;
|
||||
m_NextBreathTime = tc + (int)TimeSpan.FromSeconds(BreathMinDelay + Utility.RandomDouble() * (BreathMaxDelay - BreathMinDelay)).TotalMilliseconds;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3022,24 +2983,15 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual bool Rummage()
|
||||
{
|
||||
Corpse toRummage = null;
|
||||
|
||||
IPooledEnumerable<Corpse> eable = GetItemsInRange<Corpse>(2);
|
||||
foreach (Corpse item in eable)
|
||||
if (item.Items.Count > 0)
|
||||
{
|
||||
toRummage = item;
|
||||
break;
|
||||
}
|
||||
Corpse toRummage = eable.FirstOrDefault(item => item.Items.Count > 0);
|
||||
|
||||
eable.Free();
|
||||
|
||||
if (toRummage == null)
|
||||
return false;
|
||||
|
||||
Container pack = Backpack;
|
||||
|
||||
if (pack == null)
|
||||
if (Backpack == null)
|
||||
return false;
|
||||
|
||||
List<Item> items = toRummage.Items;
|
||||
|
|
@ -3048,7 +3000,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Item item = items[Utility.Random(items.Count)];
|
||||
|
||||
Lift(item, item.Amount, out bool rejected, out LRReason reason);
|
||||
Lift(item, item.Amount, out bool rejected, out LRReason _);
|
||||
|
||||
if (!rejected && Drop(this, new Point3D(-1, -1, 0)))
|
||||
{
|
||||
|
|
@ -3193,7 +3145,7 @@ namespace Server.Mobiles
|
|||
|
||||
Mobile owner = ControlMaster;
|
||||
|
||||
if (owner == null || owner.Deleted || owner.Map != Map || !owner.InRange(this, 12) || !CanSee(owner) ||
|
||||
if (owner?.Deleted != false || owner.Map != Map || !owner.InRange(this, 12) || !CanSee(owner) ||
|
||||
!InLOS(owner))
|
||||
{
|
||||
if (OwnerAbandonTime == DateTime.MinValue)
|
||||
|
|
@ -3412,12 +3364,12 @@ namespace Server.Mobiles
|
|||
|
||||
MLQuestContext context = MLQuestSystem.GetContext(pm);
|
||||
|
||||
if (context != null && context.IsFull)
|
||||
if (context?.IsFull == true)
|
||||
return;
|
||||
|
||||
MLQuest quest = MLQuestSystem.RandomStarterQuest(this, pm, context);
|
||||
|
||||
if (quest == null || !quest.Activated || context != null && context.IsDoingQuest(quest))
|
||||
if (quest?.Activated != true || context?.IsDoingQuest(quest) == true)
|
||||
return;
|
||||
|
||||
Shout(pm);
|
||||
|
|
@ -3869,7 +3821,7 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual bool IsPetFriend(Mobile m)
|
||||
{
|
||||
return Friends != null && Friends.Contains(m);
|
||||
return Friends.Contains(m);
|
||||
}
|
||||
|
||||
public virtual void AddPetFriend(Mobile m)
|
||||
|
|
@ -3887,15 +3839,8 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual bool IsFriend(Mobile m)
|
||||
{
|
||||
OppositionGroup g = OppositionGroup;
|
||||
|
||||
if (g != null && g.IsEnemy(this, m))
|
||||
return false;
|
||||
|
||||
if (!(m is BaseCreature c))
|
||||
return false;
|
||||
|
||||
return m_Team == c.m_Team && (m_bSummoned || m_Controlled) == (c.m_bSummoned || c.m_Controlled);
|
||||
return OppositionGroup?.IsEnemy(this, m) != true && m is BaseCreature c && m_Team == c.m_Team
|
||||
&& (m_bSummoned || m_Controlled) == (c.m_bSummoned || c.m_Controlled);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -4666,12 +4611,7 @@ namespace Server.Mobiles
|
|||
PackItem(Loot.RandomScroll(min, min + 7, SpellbookType.Regular));
|
||||
}
|
||||
|
||||
public void PackMagicItems(int minLevel, int maxLevel)
|
||||
{
|
||||
PackMagicItems(minLevel, maxLevel, 0.30, 0.15);
|
||||
}
|
||||
|
||||
public void PackMagicItems(int minLevel, int maxLevel, double armorChance, double weaponChance)
|
||||
public void PackMagicItems(int minLevel, int maxLevel, double armorChance = 0.30, double weaponChance = 0.15)
|
||||
{
|
||||
if (!PackArmor(minLevel, maxLevel, armorChance))
|
||||
PackWeapon(minLevel, maxLevel, weaponChance);
|
||||
|
|
@ -4874,12 +4814,7 @@ namespace Server.Mobiles
|
|||
return val;
|
||||
}
|
||||
|
||||
public bool PackSlayer()
|
||||
{
|
||||
return PackSlayer(0.05);
|
||||
}
|
||||
|
||||
public bool PackSlayer(double chance)
|
||||
public bool PackSlayer(double chance = 0.05)
|
||||
{
|
||||
if (chance <= Utility.RandomDouble())
|
||||
return false;
|
||||
|
|
@ -4908,12 +4843,7 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool PackWeapon(int minLevel, int maxLevel)
|
||||
{
|
||||
return PackWeapon(minLevel, maxLevel, 1.0);
|
||||
}
|
||||
|
||||
public bool PackWeapon(int minLevel, int maxLevel, double chance)
|
||||
public bool PackWeapon(int minLevel, int maxLevel, double chance = 1.0)
|
||||
{
|
||||
if (chance <= Utility.RandomDouble())
|
||||
return false;
|
||||
|
|
@ -4984,17 +4914,12 @@ namespace Server.Mobiles
|
|||
PackItem(Loot.RandomStatue());
|
||||
}
|
||||
|
||||
public void PackGem()
|
||||
{
|
||||
PackGem(1);
|
||||
}
|
||||
|
||||
public void PackGem(int min, int max)
|
||||
{
|
||||
PackGem(Utility.RandomMinMax(min, max));
|
||||
}
|
||||
|
||||
public void PackGem(int amount)
|
||||
public void PackGem(int amount = 1)
|
||||
{
|
||||
if (amount <= 0)
|
||||
return;
|
||||
|
|
@ -5207,23 +5132,11 @@ namespace Server.Mobiles
|
|||
if (!Alive || IsDeadBondedPet)
|
||||
return;
|
||||
|
||||
List<Mobile> list = new List<Mobile>();
|
||||
IPooledEnumerable<Mobile> eable = GetMobilesInRange(AuraRange);
|
||||
|
||||
foreach (Mobile m in GetMobilesInRange(AuraRange))
|
||||
{
|
||||
if (m == this || !CanBeHarmful(m, false) || Core.AOS && !InLOS(m))
|
||||
continue;
|
||||
|
||||
if (m is BaseCreature bc)
|
||||
{
|
||||
if (bc.Controlled || bc.Summoned || bc.Team != Team)
|
||||
list.Add(bc);
|
||||
}
|
||||
else if (m.Player)
|
||||
{
|
||||
list.Add(m);
|
||||
}
|
||||
}
|
||||
IEnumerable<Mobile> list = eable.Where(m =>
|
||||
m != this && CanBeHarmful(m, false) && (Core.AOS || InLOS(m)) &&
|
||||
(m is BaseCreature bc && (bc.Controlled || bc.Summoned || bc.Team != Team) || m.Player));
|
||||
|
||||
foreach (Mobile m in list)
|
||||
{
|
||||
|
|
@ -5231,6 +5144,8 @@ namespace Server.Mobiles
|
|||
AuraEnergyDamage, AuraChaosDamage);
|
||||
AuraEffect(m);
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
}
|
||||
|
||||
public virtual void AuraEffect(Mobile m)
|
||||
|
|
@ -5284,7 +5199,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile owner = c.ControlMaster;
|
||||
|
||||
if (!c.IsStabled && (owner == null || owner.Deleted || owner.Map != c.Map ||
|
||||
if (!c.IsStabled && (owner?.Deleted != false || owner.Map != c.Map ||
|
||||
!owner.InRange(c, 12) || !c.CanSee(owner) || !c.InLOS(owner)))
|
||||
{
|
||||
if (c.OwnerAbandonTime == DateTime.MinValue)
|
||||
|
|
|
|||
|
|
@ -25,37 +25,38 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual void RangeCheck()
|
||||
{
|
||||
if (!Deleted && ControlMaster != null && !ControlMaster.Deleted)
|
||||
if (Deleted || ControlMaster?.Deleted != false)
|
||||
return;
|
||||
|
||||
int range = RangeHome - 2;
|
||||
|
||||
if (InRange(ControlMaster.Location, RangeHome))
|
||||
return;
|
||||
|
||||
Mobile master = ControlMaster;
|
||||
|
||||
Point3D m_Loc = Point3D.Zero;
|
||||
|
||||
if (Map != master.Map)
|
||||
return;
|
||||
|
||||
int x = X > master.X ? master.X + range : master.X - range;
|
||||
int y = Y > master.Y ? master.Y + range : master.Y - range;
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int range = RangeHome - 2;
|
||||
m_Loc.X = x + Utility.RandomMinMax(-1, 1);
|
||||
m_Loc.Y = y + Utility.RandomMinMax(-1, 1);
|
||||
|
||||
if (!InRange(ControlMaster.Location, RangeHome))
|
||||
{
|
||||
Mobile master = ControlMaster;
|
||||
m_Loc.Z = Map.GetAverageZ(m_Loc.X, m_Loc.Y);
|
||||
|
||||
Point3D m_Loc = Point3D.Zero;
|
||||
if (Map.CanSpawnMobile(m_Loc)) break;
|
||||
|
||||
if (Map == master.Map)
|
||||
{
|
||||
int x = X > master.X ? master.X + range : master.X - range;
|
||||
int y = Y > master.Y ? master.Y + range : master.Y - range;
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
m_Loc.X = x + Utility.RandomMinMax(-1, 1);
|
||||
m_Loc.Y = y + Utility.RandomMinMax(-1, 1);
|
||||
|
||||
m_Loc.Z = Map.GetAverageZ(m_Loc.X, m_Loc.Y);
|
||||
|
||||
if (Map.CanSpawnMobile(m_Loc)) break;
|
||||
|
||||
m_Loc = master.Location;
|
||||
}
|
||||
|
||||
if (!Deleted) SetLocation(m_Loc, true);
|
||||
}
|
||||
}
|
||||
m_Loc = master.Location;
|
||||
}
|
||||
|
||||
if (!Deleted)
|
||||
SetLocation(m_Loc, true);
|
||||
}
|
||||
|
||||
public override void OnThink()
|
||||
|
|
@ -63,7 +64,7 @@ namespace Server.Mobiles
|
|||
Mobile master = ControlMaster;
|
||||
|
||||
if (Deleted) return;
|
||||
if (master == null || master.Deleted)
|
||||
if (master?.Deleted != false)
|
||||
{
|
||||
DropPackContents();
|
||||
EndRelease(null);
|
||||
|
|
@ -75,7 +76,7 @@ namespace Server.Mobiles
|
|||
if (m_LastHidden != master.Hidden)
|
||||
Hidden = m_LastHidden = master.Hidden;
|
||||
|
||||
if (AIObject != null && AIObject.WalkMobileRange(master, 5, true, 1, 1))
|
||||
if (AIObject?.WalkMobileRange(master, 5, true, 1, 1) == true)
|
||||
{
|
||||
Warmode = master.Warmode;
|
||||
Combatant = master.Combatant;
|
||||
|
|
@ -107,7 +108,7 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual void EndRelease(Mobile from)
|
||||
{
|
||||
if (from == null || !Deleted && Controlled && from == ControlMaster && from.CheckAlive())
|
||||
if (from?.CheckAlive() != false && !Deleted && Controlled && from == ControlMaster)
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x3728, 1, 13,
|
||||
2100, 3, 5042, 0);
|
||||
|
|
@ -171,4 +172,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,10 +52,7 @@ namespace Server.Mobiles
|
|||
|
||||
m_NextRestore = DateTime.UtcNow + TimeSpan.FromSeconds(2.0);
|
||||
|
||||
Mobile caster = ControlMaster;
|
||||
|
||||
if (caster == null)
|
||||
caster = SummonMaster;
|
||||
Mobile caster = ControlMaster ?? SummonMaster;
|
||||
|
||||
if (caster != null)
|
||||
++caster.Stam;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.ContextMenus;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
|
|
@ -73,18 +73,12 @@ namespace Server.Mobiles
|
|||
if (pack == null)
|
||||
return;
|
||||
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
foreach (Item item in GetItemsInRange(2))
|
||||
if (item.Movable && item.Stackable)
|
||||
list.Add(item);
|
||||
IEnumerable<Item> eable = GetItemsInRange(2).Where(item => item.Movable && item.Stackable);
|
||||
|
||||
int pickedUp = 0;
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
foreach (Item item in eable)
|
||||
{
|
||||
Item item = list[i];
|
||||
|
||||
if (!pack.CheckHold(this, item, false, true))
|
||||
return;
|
||||
|
||||
|
|
@ -193,4 +187,4 @@ namespace Server.Mobiles
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
|
|
@ -62,19 +62,13 @@ namespace Server.Mobiles
|
|||
|
||||
private void Flare()
|
||||
{
|
||||
Mobile caster = ControlMaster;
|
||||
|
||||
if (caster == null)
|
||||
caster = SummonMaster;
|
||||
Mobile caster = ControlMaster ?? SummonMaster;
|
||||
|
||||
if (caster == null)
|
||||
return;
|
||||
|
||||
List<Mobile> list = new List<Mobile>();
|
||||
|
||||
foreach (Mobile m in GetMobilesInRange(5))
|
||||
if (m.Player && m.Alive && !m.IsDeadBondedPet && m.Karma <= 0 && m.AccessLevel < AccessLevel.Counselor)
|
||||
list.Add(m);
|
||||
List<Mobile> list = GetMobilesInRange(5).Where(m =>
|
||||
m.Player && m.Alive && !m.IsDeadBondedPet && m.Karma <= 0 && m.AccessLevel < AccessLevel.Counselor).ToList();
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
|
|
@ -109,4 +103,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,7 @@ namespace Server.Mobiles
|
|||
|
||||
private Mobile m_Focus;
|
||||
|
||||
[Constructible]
|
||||
public ArcherGuard() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public ArcherGuard(Mobile target) : base(target)
|
||||
public ArcherGuard(Mobile target = null) : base(target)
|
||||
{
|
||||
InitStats(100, 125, 25);
|
||||
Title = "the guard";
|
||||
|
|
@ -99,7 +94,7 @@ namespace Server.Mobiles
|
|||
|
||||
Combatant = value;
|
||||
|
||||
if (oldFocus != null && !oldFocus.Alive)
|
||||
if (oldFocus?.Alive == false)
|
||||
Say("Thou hast suffered thy punishment, scoundrel.");
|
||||
|
||||
if (value != null)
|
||||
|
|
@ -139,7 +134,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool OnBeforeDeath()
|
||||
{
|
||||
if (m_Focus != null && m_Focus.Alive)
|
||||
if (m_Focus?.Alive == true)
|
||||
new AvengeTimer(m_Focus).Start(); // If a guard dies, three more guards will spawn
|
||||
|
||||
return base.OnBeforeDeath();
|
||||
|
|
@ -396,4 +391,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,14 +22,9 @@ namespace Server.Mobiles
|
|||
|
||||
public abstract Mobile Focus{ get; set; }
|
||||
|
||||
public static void Spawn(Mobile caller, Mobile target)
|
||||
public static void Spawn(Mobile caller, Mobile target, int amount = 1, bool onlyAdditional = false)
|
||||
{
|
||||
Spawn(caller, target, 1, false);
|
||||
}
|
||||
|
||||
public static void Spawn(Mobile caller, Mobile target, int amount, bool onlyAdditional)
|
||||
{
|
||||
if (target == null || target.Deleted)
|
||||
if (target?.Deleted != false)
|
||||
return;
|
||||
|
||||
foreach (Mobile m in target.GetMobilesInRange(15))
|
||||
|
|
|
|||
|
|
@ -9,12 +9,7 @@ namespace Server.Mobiles
|
|||
|
||||
private Mobile m_Focus;
|
||||
|
||||
[Constructible]
|
||||
public WarriorGuard() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public WarriorGuard(Mobile target) : base(target)
|
||||
public WarriorGuard(Mobile target = null) : base(target)
|
||||
{
|
||||
InitStats(1000, 1000, 1000);
|
||||
Title = "the guard";
|
||||
|
|
@ -135,7 +130,7 @@ namespace Server.Mobiles
|
|||
|
||||
Combatant = value;
|
||||
|
||||
if (oldFocus != null && !oldFocus.Alive)
|
||||
if (oldFocus?.Alive == false)
|
||||
Say("Thou hast suffered thy punishment, scoundrel.");
|
||||
|
||||
if (value != null)
|
||||
|
|
@ -175,7 +170,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool OnBeforeDeath()
|
||||
{
|
||||
if (m_Focus != null && m_Focus.Alive)
|
||||
if (m_Focus?.Alive == true)
|
||||
new AvengeTimer(m_Focus).Start(); // If a guard dies, three more guards will spawn
|
||||
|
||||
return base.OnBeforeDeath();
|
||||
|
|
@ -386,4 +381,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace Server.Mobiles
|
|||
|
||||
private DateTime m_NextResurrect;
|
||||
|
||||
public BaseHealer() : base(null)
|
||||
public BaseHealer()
|
||||
{
|
||||
if (!IsInvulnerable)
|
||||
{
|
||||
|
|
@ -155,4 +155,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,7 @@ namespace Server.Mobiles
|
|||
public class PricedHealer : BaseHealer
|
||||
{
|
||||
[Constructible]
|
||||
public PricedHealer() : this(5000)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public PricedHealer(int price)
|
||||
public PricedHealer(int price = 5000)
|
||||
{
|
||||
Price = price;
|
||||
|
||||
|
|
@ -74,4 +69,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ namespace Server.Mobiles
|
|||
|
||||
Container pack = to.Backpack;
|
||||
|
||||
if (pack == null || !pack.TryDropItem(to, artifact, false))
|
||||
if (pack?.TryDropItem(to, artifact, false) != true)
|
||||
to.BankBox.DropItem(artifact);
|
||||
|
||||
to.SendLocalizedMessage(
|
||||
|
|
@ -287,4 +287,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile combatant = Combatant;
|
||||
|
||||
if (DateTime.UtcNow < m_NextAbilityTime || combatant == null || combatant.Deleted || combatant.Map != Map ||
|
||||
if (DateTime.UtcNow < m_NextAbilityTime || combatant?.Deleted != false || combatant.Map != Map ||
|
||||
!InRange(combatant, 3) || !CanBeHarmful(combatant) || !InLOS(combatant))
|
||||
return;
|
||||
|
||||
|
|
@ -176,4 +176,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,14 +65,15 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnDamagedBySpell(Mobile from)
|
||||
{
|
||||
if (from != null && from.Alive && 0.4 > Utility.RandomDouble()) ThrowHatchet(from);
|
||||
if (from?.Alive == true && 0.4 > Utility.RandomDouble())
|
||||
ThrowHatchet(from);
|
||||
}
|
||||
|
||||
public override void OnGotMeleeAttack(Mobile attacker)
|
||||
{
|
||||
base.OnGotMeleeAttack(attacker);
|
||||
|
||||
if (attacker != null && attacker.Alive && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble())
|
||||
if (attacker?.Alive == true && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble())
|
||||
ThrowHatchet(attacker);
|
||||
}
|
||||
|
||||
|
|
@ -96,4 +97,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Items;
|
||||
using Server.Spells;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
using System.Collections;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class Succubus : BaseCreature
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ namespace Server.Mobiles
|
|||
break;
|
||||
}
|
||||
|
||||
Utility.AssignRandomHair(this, true);
|
||||
Utility.AssignRandomHair(this);
|
||||
}
|
||||
|
||||
public ElfBrigand(Serial serial) : base(serial)
|
||||
|
|
@ -132,4 +132,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile combatant = Combatant;
|
||||
|
||||
if (combatant == null || combatant.Deleted || combatant.Map != Map || !InRange(combatant, 12) ||
|
||||
if (combatant?.Deleted != false || combatant.Map != Map || !InRange(combatant, 12) ||
|
||||
!CanBeHarmful(combatant) || !InLOS(combatant))
|
||||
return;
|
||||
|
||||
|
|
@ -154,4 +154,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,16 +110,16 @@ namespace Server.Mobiles
|
|||
return;
|
||||
|
||||
IPooledEnumerable<OrcishLord> eable = GetMobilesInRange<OrcishLord>(10);
|
||||
int orcs = eable.Count();
|
||||
eable.Free();
|
||||
|
||||
if (orcs < 10)
|
||||
if (eable.Count() < 10)
|
||||
{
|
||||
BaseCreature orc = new SpawnedOrcishLord{ Team = Team };
|
||||
|
||||
orc.MoveToWorld(map.GetRandomNearbyLocation(target.Location), map);
|
||||
orc.Combatant = target;
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnDamagedBySpell(Mobile from)
|
||||
{
|
||||
if (from != null && from.Alive && 0.4 > Utility.RandomDouble()) SendEBolt(from);
|
||||
if (from?.Alive == true && 0.4 > Utility.RandomDouble()) SendEBolt(from);
|
||||
|
||||
if (!FieldActive)
|
||||
{
|
||||
|
|
@ -144,7 +144,7 @@ namespace Server.Mobiles
|
|||
attacker.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
|
||||
}
|
||||
|
||||
if (attacker != null && attacker.Alive && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble())
|
||||
if (attacker?.Alive == true && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble())
|
||||
SendEBolt(attacker);
|
||||
}
|
||||
|
||||
|
|
@ -192,4 +192,4 @@ namespace Server.Mobiles
|
|||
Name = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnDamagedBySpell(Mobile from)
|
||||
{
|
||||
if (from != null && from.Alive && 0.4 > Utility.RandomDouble()) SendEBolt(from);
|
||||
if (from?.Alive == true && 0.4 > Utility.RandomDouble()) SendEBolt(from);
|
||||
|
||||
if (!FieldActive)
|
||||
{
|
||||
|
|
@ -134,7 +134,7 @@ namespace Server.Mobiles
|
|||
attacker.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
|
||||
}
|
||||
|
||||
if (attacker != null && attacker.Alive && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble())
|
||||
if (attacker?.Alive == true && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble())
|
||||
SendEBolt(attacker);
|
||||
}
|
||||
|
||||
|
|
@ -182,4 +182,4 @@ namespace Server.Mobiles
|
|||
Name = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnDamage(int amount, Mobile from, bool willKill)
|
||||
{
|
||||
if (from != null && !willKill && amount > 5 && from.Player && 5 > Utility.Random(100))
|
||||
if (!willKill && amount > 5 && from?.Player == true && 5 > Utility.Random(100))
|
||||
{
|
||||
string[] toSay =
|
||||
{
|
||||
|
|
@ -122,4 +122,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnThink()
|
||||
{
|
||||
if (SummonMaster == null || SummonMaster.Deleted)
|
||||
if (SummonMaster?.Deleted != false)
|
||||
{
|
||||
Delete();
|
||||
}
|
||||
|
|
@ -252,10 +252,7 @@ namespace Server.Mobiles
|
|||
private bool Combat(Mobile mobile)
|
||||
{
|
||||
Mobile combatant = mobile.Combatant;
|
||||
if (combatant == null || combatant.Deleted || combatant.IsDeadBondedPet || !combatant.Alive)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return combatant?.Deleted == false && !combatant.IsDeadBondedPet && combatant.Alive;
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
|
|
@ -282,4 +279,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Items;
|
||||
using Server.Spells;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
|
@ -95,9 +94,7 @@ namespace Server.Mobiles
|
|||
private void DoAreaLeech_Finish()
|
||||
{
|
||||
IPooledEnumerable<Mobile> eable = GetMobilesInRange(6);
|
||||
|
||||
List<Mobile> list = eable.Where(m => CanBeHarmful(m) && IsEnemy(m)).ToList();
|
||||
|
||||
eable.Free();
|
||||
|
||||
if (list.Count == 0)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
|
@ -96,7 +95,7 @@ namespace Server.Mobiles
|
|||
m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(20, 30));
|
||||
|
||||
if (combatant is BaseCreature bc)
|
||||
if (bc.Controlled && bc.ControlMaster != null && !bc.ControlMaster.Deleted && bc.ControlMaster.Alive)
|
||||
if (bc.Controlled && bc.ControlMaster?.Deleted == false && bc.ControlMaster.Alive)
|
||||
if (bc.ControlMaster.Map == Map && bc.ControlMaster.InRange(this, 12) &&
|
||||
!UnderEffect(bc.ControlMaster))
|
||||
Combatant = combatant = bc.ControlMaster;
|
||||
|
|
|
|||
|
|
@ -5,12 +5,8 @@ namespace Server.Mobiles
|
|||
public class CuSidhe : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public CuSidhe() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public CuSidhe(string name) : base(name, 277, 0x3E91, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public CuSidhe(string name = null) :
|
||||
base(name, 277, 0x3E91, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
double chance = Utility.RandomDouble() * 23301;
|
||||
|
||||
|
|
@ -150,4 +146,4 @@ namespace Server.Mobiles
|
|||
Name = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Linq;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class InterredGrizzle : BaseCreature
|
||||
|
|
@ -134,16 +136,8 @@ namespace Server.Mobiles
|
|||
for (int j = 0; j < 5; j++)
|
||||
{
|
||||
p = GetSpawnPosition(2);
|
||||
bool found = false;
|
||||
|
||||
foreach (Item item in Map.GetItemsInRange(p, 0))
|
||||
if (item is StainedOoze)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
if (!Map.GetItemsInRange(p, 0).OfType<StainedOoze>().Any())
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -171,4 +165,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,11 +116,8 @@ namespace Server.Mobiles
|
|||
|
||||
public bool IsValidTarget(PlayerMobile m)
|
||||
{
|
||||
if (m != null && m.PeacedUntil < DateTime.UtcNow && !m.Hidden && m.AccessLevel == AccessLevel.Player &&
|
||||
CanBeHarmful(m))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return m?.PeacedUntil < DateTime.UtcNow && !m.Hidden && m.AccessLevel == AccessLevel.Player &&
|
||||
CanBeHarmful(m);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -135,7 +132,7 @@ namespace Server.Mobiles
|
|||
return;
|
||||
|
||||
foreach (Mobile m in GetMobilesInRange(RangePerception))
|
||||
if (m != null && m.Player && !m.Female && !m.Hidden && m.AccessLevel == AccessLevel.Player &&
|
||||
if (m?.Player == true && !m.Female && !m.Hidden && m.AccessLevel == AccessLevel.Player &&
|
||||
CanBeHarmful(m))
|
||||
{
|
||||
UndressItem(m, Layer.OuterTorso);
|
||||
|
|
@ -155,10 +152,10 @@ namespace Server.Mobiles
|
|||
{
|
||||
Item item = m.FindItemOnLayer(layer);
|
||||
|
||||
if (item != null && item.Movable)
|
||||
if (item?.Movable == true)
|
||||
m.PlaceInBackpack(item);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Engines.CannedEvil;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
|
@ -265,16 +265,8 @@ namespace Server.Mobiles
|
|||
for (int j = 0; j < 5; j++)
|
||||
{
|
||||
p = GetSpawnPosition(2);
|
||||
bool found = false;
|
||||
|
||||
foreach (Item item in Map.GetItemsInRange(p, 0))
|
||||
if (item is StainedOoze)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
if (!Map.GetItemsInRange(p, 0).OfType<StainedOoze>().Any())
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Engines.CannedEvil;
|
||||
using Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Mobiles
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,12 +9,8 @@ namespace Server.Mobiles
|
|||
private bool m_Stunning;
|
||||
|
||||
[Constructible]
|
||||
public Golem() : this(false, 1.0)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Golem(bool summoned, double scalar) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.4, 0.8)
|
||||
public Golem(bool summoned = false, double scalar = 1.0) :
|
||||
base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.4, 0.8)
|
||||
{
|
||||
Body = 752;
|
||||
|
||||
|
|
@ -192,12 +188,9 @@ namespace Server.Mobiles
|
|||
{
|
||||
if (Controlled || Summoned)
|
||||
{
|
||||
Mobile master = ControlMaster;
|
||||
Mobile master = ControlMaster ?? SummonMaster;
|
||||
|
||||
if (master == null)
|
||||
master = SummonMaster;
|
||||
|
||||
if (master != null && master.Player && master.Map == Map && master.InRange(Location, 20))
|
||||
if (master?.Player == true && master.Map == Map && master.InRange(Location, 20))
|
||||
{
|
||||
if (master.Mana >= amount)
|
||||
{
|
||||
|
|
@ -227,4 +220,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,10 +205,10 @@ namespace Server.Mobiles
|
|||
|
||||
foreach (Corpse item in eable)
|
||||
// Ensure that the corpse was killed by us
|
||||
if (item.Killer == this && item.Owner != null)
|
||||
if (!item.DevourCorpse() && !item.Devoured)
|
||||
PublicOverheadMessage(MessageType.Emote, 0x3B2,
|
||||
1053032); // * The plague beast attempts to absorb the remains, but cannot! *
|
||||
if (item.Killer == this && item.Owner != null && !item.DevourCorpse() && !item.Devoured)
|
||||
PublicOverheadMessage(MessageType.Emote, 0x3B2,
|
||||
1053032); // * The plague beast attempts to absorb the remains, but cannot! *
|
||||
|
||||
eable.Free();
|
||||
}
|
||||
|
||||
|
|
@ -245,4 +245,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile m = state.Mobile;
|
||||
|
||||
if (m != null && m.Player && m != from)
|
||||
if (m?.Player == true && m != from)
|
||||
PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1071919, from.Name,
|
||||
m.NetState); // * ~1_VAL~ slices through the plague beast's amorphous tissue *
|
||||
}
|
||||
|
|
@ -305,7 +305,7 @@ namespace Server.Mobiles
|
|||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (m_Lord == null || m_Lord.Deleted)
|
||||
if (m_Lord?.Deleted != false)
|
||||
{
|
||||
Stop();
|
||||
return;
|
||||
|
|
@ -350,4 +350,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,8 @@ namespace Server.Mobiles
|
|||
{
|
||||
public class PlagueSpawn : BaseCreature
|
||||
{
|
||||
[Constructible]
|
||||
public PlagueSpawn() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public PlagueSpawn(Mobile owner) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public PlagueSpawn(Mobile owner = null) :
|
||||
base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
Owner = owner;
|
||||
ExpireTime = DateTime.UtcNow + TimeSpan.FromMinutes(1.0);
|
||||
|
|
@ -132,4 +128,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile combatant = Combatant;
|
||||
|
||||
if (combatant == null || combatant.Deleted || combatant.Map != Map || !InRange(combatant, 12) ||
|
||||
if (combatant?.Deleted != false || combatant.Map != Map || !InRange(combatant, 12) ||
|
||||
!CanBeHarmful(combatant) || !InLOS(combatant))
|
||||
return;
|
||||
|
||||
|
|
@ -109,4 +109,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,7 @@ namespace Server.Mobiles
|
|||
public class AgapiteElemental : BaseCreature
|
||||
{
|
||||
[Constructible]
|
||||
public AgapiteElemental() : this(2)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public AgapiteElemental(int oreAmount) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public AgapiteElemental(int oreAmount = 2) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
Body = 107;
|
||||
BaseSoundID = 268;
|
||||
|
|
@ -74,4 +69,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,8 @@ namespace Server.Mobiles
|
|||
public class BronzeElemental : BaseCreature
|
||||
{
|
||||
[Constructible]
|
||||
public BronzeElemental() : this(2)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public BronzeElemental(int oreAmount) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public BronzeElemental(int oreAmount = 2) :
|
||||
base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
// TODO: Gas attack
|
||||
Body = 108;
|
||||
|
|
@ -76,4 +72,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,7 @@ namespace Server.Mobiles
|
|||
public class CopperElemental : BaseCreature
|
||||
{
|
||||
[Constructible]
|
||||
public CopperElemental() : this(2)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public CopperElemental(int oreAmount) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public CopperElemental(int oreAmount = 2) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
Body = 109;
|
||||
BaseSoundID = 268;
|
||||
|
|
@ -79,4 +74,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,8 @@ namespace Server.Mobiles
|
|||
public class DullCopperElemental : BaseCreature
|
||||
{
|
||||
[Constructible]
|
||||
public DullCopperElemental() : this(2)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public DullCopperElemental(int oreAmount) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public DullCopperElemental(int oreAmount = 2) :
|
||||
base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
Body = 110;
|
||||
BaseSoundID = 268;
|
||||
|
|
@ -74,4 +70,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,8 @@ namespace Server.Mobiles
|
|||
public class GoldenElemental : BaseCreature
|
||||
{
|
||||
[Constructible]
|
||||
public GoldenElemental() : this(2)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public GoldenElemental(int oreAmount) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public GoldenElemental(int oreAmount = 2) :
|
||||
base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
Body = 166;
|
||||
BaseSoundID = 268;
|
||||
|
|
@ -74,4 +70,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,7 @@ namespace Server.Mobiles
|
|||
public class ShadowIronElemental : BaseCreature
|
||||
{
|
||||
[Constructible]
|
||||
public ShadowIronElemental() : this(2)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public ShadowIronElemental(int oreAmount) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public ShadowIronElemental(int oreAmount = 2) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
Body = 111;
|
||||
BaseSoundID = 268;
|
||||
|
|
@ -92,4 +87,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,7 @@ namespace Server.Mobiles
|
|||
public class ValoriteElemental : BaseCreature
|
||||
{
|
||||
[Constructible]
|
||||
public ValoriteElemental() : this(2)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public ValoriteElemental(int oreAmount) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public ValoriteElemental(int oreAmount = 2) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
// TODO: Gas attack
|
||||
Body = 112;
|
||||
|
|
@ -90,4 +85,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,7 @@ namespace Server.Mobiles
|
|||
public class VeriteElemental : BaseCreature
|
||||
{
|
||||
[Constructible]
|
||||
public VeriteElemental() : this(2)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public VeriteElemental(int oreAmount) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public VeriteElemental(int oreAmount = 2) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
Body = 113;
|
||||
BaseSoundID = 268;
|
||||
|
|
@ -75,4 +70,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,12 +6,8 @@ namespace Server.Mobiles
|
|||
public class Leviathan : BaseCreature
|
||||
{
|
||||
[Constructible]
|
||||
public Leviathan() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Leviathan(Mobile fisher) : base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public Leviathan(Mobile fisher = null) :
|
||||
base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
Fisher = fisher;
|
||||
|
||||
|
|
@ -171,4 +167,4 @@ namespace Server.Mobiles
|
|||
Fisher = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Items;
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile combatant = Combatant;
|
||||
|
||||
if (combatant == null || combatant.Deleted || combatant.Map != Map || !InRange(combatant, 12) ||
|
||||
if (combatant?.Deleted != false || combatant.Map != Map || !InRange(combatant, 12) ||
|
||||
!CanBeHarmful(combatant) || !InLOS(combatant))
|
||||
return;
|
||||
|
||||
|
|
@ -158,4 +158,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Items;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Items;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Mobiles
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Items;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Mobiles
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Items;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Items;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System.Collections;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Accounting;
|
||||
|
|
@ -259,6 +258,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -283,6 +283,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -445,12 +446,13 @@ namespace Server.Mobiles
|
|||
{
|
||||
IPooledEnumerable<Mobile> mobiles = Map.GetMobilesInRange(location, 0);
|
||||
|
||||
foreach (Mobile m in mobiles)
|
||||
if (m.Z >= location.Z && m.Z < location.Z + 16 && (!m.Hidden || m.AccessLevel == AccessLevel.Player))
|
||||
{
|
||||
mobiles.Free();
|
||||
return false;
|
||||
}
|
||||
bool found = mobiles.Any(m =>
|
||||
m.Z >= location.Z && m.Z < location.Z + 16 && (!m.Hidden || m.AccessLevel == AccessLevel.Player));
|
||||
|
||||
mobiles.Free();
|
||||
|
||||
if (found)
|
||||
return false;
|
||||
|
||||
mobiles.Free();
|
||||
}
|
||||
|
|
@ -819,12 +821,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (drop)
|
||||
{
|
||||
string name = weapon.Name;
|
||||
|
||||
if (name == null)
|
||||
name = $"#{weapon.LabelNumber}";
|
||||
|
||||
from.SendLocalizedMessage(1062001, name); // You can no longer wield your ~1_WEAPON~
|
||||
from.SendLocalizedMessage(1062001, weapon.Name ?? $"#{weapon.LabelNumber}"); // You can no longer wield your ~1_WEAPON~
|
||||
from.AddToBackpack(weapon);
|
||||
moved = true;
|
||||
}
|
||||
|
|
@ -861,10 +858,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (drop)
|
||||
{
|
||||
string name = armor.Name;
|
||||
|
||||
if (name == null)
|
||||
name = $"#{armor.LabelNumber}";
|
||||
string name = armor.Name ?? $"#{armor.LabelNumber}";
|
||||
|
||||
if (armor is BaseShield)
|
||||
from.SendLocalizedMessage(1062003, name); // You can no longer equip your ~1_SHIELD~
|
||||
|
|
@ -902,12 +896,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (drop)
|
||||
{
|
||||
string name = clothing.Name;
|
||||
|
||||
if (name == null)
|
||||
name = $"#{clothing.LabelNumber}";
|
||||
|
||||
from.SendLocalizedMessage(1062002, name); // You can no longer wear your ~1_ARMOR~
|
||||
from.SendLocalizedMessage(1062002, clothing.Name ?? $"#{clothing.LabelNumber}"); // You can no longer wear your ~1_ARMOR~
|
||||
|
||||
from.AddToBackpack(clothing);
|
||||
moved = true;
|
||||
|
|
@ -1200,10 +1189,8 @@ namespace Server.Mobiles
|
|||
public override bool AllowItemUse(Item item)
|
||||
{
|
||||
#region Dueling
|
||||
|
||||
if (DuelContext != null && !DuelContext.AllowItemUse(this, item))
|
||||
if (DuelContext?.AllowItemUse(this, item) == false)
|
||||
return false;
|
||||
|
||||
#endregion
|
||||
|
||||
return DesignContext.Check(this);
|
||||
|
|
@ -1220,10 +1207,8 @@ namespace Server.Mobiles
|
|||
}
|
||||
|
||||
#region Dueling
|
||||
|
||||
if (DuelContext != null && !DuelContext.AllowSkillUse(this, skill))
|
||||
if (DuelContext?.AllowSkillUse(this, skill) == false)
|
||||
return false;
|
||||
|
||||
#endregion
|
||||
|
||||
return DesignContext.Check(this);
|
||||
|
|
@ -1324,7 +1309,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
NetState ns = from.NetState;
|
||||
|
||||
if (ns != null && ns.ExtendedStatus)
|
||||
if (ns?.ExtendedStatus == true)
|
||||
list.Add(new CallbackEntry(RefuseTrades ? 1154112 : 1154113,
|
||||
ToggleTrades)); // Allow Trades / Refuse Trades
|
||||
}
|
||||
|
|
@ -1383,7 +1368,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(this);
|
||||
|
||||
if (CheckAlive() && house != null && house.IsOwner(this) && house.InternalizedVendors.Count > 0)
|
||||
if (CheckAlive() && house?.IsOwner(this) == true && house.InternalizedVendors.Count > 0)
|
||||
{
|
||||
CloseGump<ReclaimVendorGump>();
|
||||
SendGump(new ReclaimVendorGump(house));
|
||||
|
|
@ -1432,7 +1417,7 @@ namespace Server.Mobiles
|
|||
|
||||
#region Dueling
|
||||
|
||||
if (DuelContext != null && !DuelContext.AllowItemEquip(this, item))
|
||||
if (DuelContext?.AllowItemEquip(this, item) == false)
|
||||
return false;
|
||||
|
||||
#endregion
|
||||
|
|
@ -1524,9 +1509,9 @@ namespace Server.Mobiles
|
|||
plusWeight += cont.TotalWeight;
|
||||
}
|
||||
|
||||
if (Backpack == null || !Backpack.CheckHold(this, item, false, checkItems, plusItems, plusWeight))
|
||||
if (Backpack?.CheckHold(this, item, false, checkItems, plusItems, plusWeight) != true)
|
||||
msgNum = 1004040; // You would not be able to hold this if the trade failed.
|
||||
else if (to.Backpack == null || !to.Backpack.CheckHold(to, item, false, checkItems, plusItems, plusWeight))
|
||||
else if (to.Backpack?.CheckHold(to, item, false, checkItems, plusItems, plusWeight) != true)
|
||||
msgNum = 1004039; // The recipient of this trade would not be able to carry this.
|
||||
else
|
||||
msgNum = CheckContentForTrade(item);
|
||||
|
|
@ -1698,7 +1683,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (!Core.AOS)
|
||||
disruptThreshold = 0;
|
||||
else if (from != null && from.Player)
|
||||
else if (from?.Player == true)
|
||||
disruptThreshold = 18;
|
||||
else
|
||||
disruptThreshold = 25;
|
||||
|
|
@ -1759,7 +1744,7 @@ namespace Server.Mobiles
|
|||
|
||||
DropHolding();
|
||||
|
||||
if (Core.AOS && Backpack != null && !Backpack.Deleted)
|
||||
if (Core.AOS && Backpack?.Deleted == false)
|
||||
{
|
||||
Backpack.FindItemsByType<Item>(FindItems_Callback).ForEach(item => Backpack.AddItem(item));
|
||||
}
|
||||
|
|
@ -1798,8 +1783,8 @@ namespace Server.Mobiles
|
|||
|
||||
#region Dueling
|
||||
|
||||
if (m_DuelPlayer != null && DuelContext != null && DuelContext.Registered && DuelContext.Started &&
|
||||
!m_DuelPlayer.Eliminated)
|
||||
if (DuelContext?.Registered == true && DuelContext.Started &&
|
||||
m_DuelPlayer?.Eliminated != true)
|
||||
return true;
|
||||
|
||||
#endregion
|
||||
|
|
@ -2060,7 +2045,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile mob = ns.Mobile;
|
||||
|
||||
if (mob != null && mob.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > from.AccessLevel)
|
||||
if (mob?.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > from.AccessLevel)
|
||||
{
|
||||
if (p == null)
|
||||
p = Packet.Acquire(new UnicodeMessage(from.Serial, from.Body, MessageType.Regular, from.SpeechHue, 3,
|
||||
|
|
@ -2634,8 +2619,7 @@ namespace Server.Mobiles
|
|||
if (m is PlayerMobile mobile && mobile.VisibilityList.Contains(this))
|
||||
return true;
|
||||
|
||||
if (DuelContext != null && m_DuelPlayer != null && !DuelContext.Finished && DuelContext.m_Tournament != null &&
|
||||
!m_DuelPlayer.Eliminated)
|
||||
if (DuelContext?.Finished == false && DuelContext.m_Tournament != null && m_DuelPlayer?.Eliminated == false)
|
||||
{
|
||||
Mobile owner = m;
|
||||
|
||||
|
|
@ -2662,10 +2646,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool CanSee(Item item)
|
||||
{
|
||||
if (DesignContext != null && DesignContext.Foundation.IsHiddenToCustomizer(item))
|
||||
return false;
|
||||
|
||||
return base.CanSee(item);
|
||||
return DesignContext?.Foundation.IsHiddenToCustomizer(item) != true && base.CanSee(item);
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
|
|
@ -2820,11 +2801,10 @@ namespace Server.Mobiles
|
|||
continue;
|
||||
}
|
||||
|
||||
if (pet is IMount mount && mount.Rider != null)
|
||||
if ((pet as IMount)?.Rider != null)
|
||||
continue;
|
||||
|
||||
if ((pet is PackLlama || pet is PackHorse || pet is Beetle) && pet.Backpack != null &&
|
||||
pet.Backpack.Items.Count > 0)
|
||||
if ((pet is PackLlama || pet is PackHorse || pet is Beetle) && pet.Backpack?.Items.Count > 0)
|
||||
continue;
|
||||
|
||||
if (pet is BaseEscortable)
|
||||
|
|
@ -2969,24 +2949,11 @@ namespace Server.Mobiles
|
|||
|
||||
public bool NinjaWepCooldown{ get; set; }
|
||||
|
||||
public List<Mobile> AllFollowers
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_AllFollowers == null)
|
||||
m_AllFollowers = new List<Mobile>();
|
||||
return m_AllFollowers;
|
||||
}
|
||||
}
|
||||
public List<Mobile> AllFollowers => m_AllFollowers ?? (m_AllFollowers = new List<Mobile>());
|
||||
|
||||
public RankDefinition GuildRank
|
||||
{
|
||||
get
|
||||
{
|
||||
if (AccessLevel >= AccessLevel.GameMaster)
|
||||
return RankDefinition.Leader;
|
||||
return m_GuildRank;
|
||||
}
|
||||
get => AccessLevel >= AccessLevel.GameMaster ? RankDefinition.Leader : m_GuildRank;
|
||||
set => m_GuildRank = value;
|
||||
}
|
||||
|
||||
|
|
@ -3456,14 +3423,13 @@ namespace Server.Mobiles
|
|||
AddImageTiled(6, 116, 228, 20, 0xA40);
|
||||
AddAlphaRegion(6, 6, 228, 142);
|
||||
|
||||
AddHtmlLocalized(8, 8, 228, 100, 1071021, 0x7FFF, false,
|
||||
false); // You are about to disable inventory insurance auto-renewal.
|
||||
AddHtmlLocalized(8, 8, 228, 100, 1071021, 0x7FFF); // You are about to disable inventory insurance auto-renewal.
|
||||
|
||||
AddButton(6, 116, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(40, 118, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
|
||||
AddButton(6, 116, 0xFB1, 0xFB2, 0);
|
||||
AddHtmlLocalized(40, 118, 450, 20, 1060051, 0x7FFF); // CANCEL
|
||||
|
||||
AddButton(114, 116, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(148, 118, 450, 20, 1071022, 0x7FFF, false, false); // DISABLE IT!
|
||||
AddButton(114, 116, 0xFA5, 0xFA7, 1);
|
||||
AddHtmlLocalized(148, 118, 450, 20, 1071022, 0x7FFF); // DISABLE IT!
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -3550,24 +3516,24 @@ namespace Server.Mobiles
|
|||
AddImageTiled(10, 415, 500, 80, 0xA40);
|
||||
AddAlphaRegion(10, 10, 500, 485);
|
||||
|
||||
AddButton(15, 470, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 472, 80, 20, 1011012, 0x7FFF, false, false); // CANCEL
|
||||
AddButton(15, 470, 0xFB1, 0xFB2, 0);
|
||||
AddHtmlLocalized(50, 472, 80, 20, 1011012, 0x7FFF); // CANCEL
|
||||
|
||||
if (from.AutoRenewInsurance)
|
||||
AddButton(360, 10, 9723, 9724, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(360, 10, 9723, 9724, 1);
|
||||
else
|
||||
AddButton(360, 10, 9720, 9722, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(360, 10, 9720, 9722, 1);
|
||||
|
||||
AddHtmlLocalized(395, 14, 105, 20, 1114122, 0x7FFF, false, false); // AUTO REINSURE
|
||||
AddHtmlLocalized(395, 14, 105, 20, 1114122, 0x7FFF); // AUTO REINSURE
|
||||
|
||||
AddButton(395, 470, 0xFA5, 0xFA6, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(430, 472, 50, 20, 1006044, 0x7FFF, false, false); // OK
|
||||
AddButton(395, 470, 0xFA5, 0xFA6, 2);
|
||||
AddHtmlLocalized(430, 472, 50, 20, 1006044, 0x7FFF); // OK
|
||||
|
||||
AddHtmlLocalized(10, 14, 150, 20, 1114121, 0x7FFF, false, false); // <CENTER>ITEM INSURANCE MENU</CENTER>
|
||||
AddHtmlLocalized(10, 14, 150, 20, 1114121, 0x7FFF); // <CENTER>ITEM INSURANCE MENU</CENTER>
|
||||
|
||||
AddHtmlLocalized(45, 54, 70, 20, 1062214, 0x7FFF, false, false); // Item
|
||||
AddHtmlLocalized(250, 54, 70, 20, 1061038, 0x7FFF, false, false); // Cost
|
||||
AddHtmlLocalized(400, 54, 70, 20, 1114311, 0x7FFF, false, false); // Insured
|
||||
AddHtmlLocalized(45, 54, 70, 20, 1062214, 0x7FFF); // Item
|
||||
AddHtmlLocalized(250, 54, 70, 20, 1061038, 0x7FFF); // Cost
|
||||
AddHtmlLocalized(400, 54, 70, 20, 1114311, 0x7FFF); // Insured
|
||||
|
||||
int balance = Banker.GetBalance(from);
|
||||
int cost = 0;
|
||||
|
|
@ -3576,14 +3542,14 @@ namespace Server.Mobiles
|
|||
if (insure[i])
|
||||
cost += GetInsuranceCost(items[i]);
|
||||
|
||||
AddHtmlLocalized(15, 420, 300, 20, 1114310, 0x7FFF, false, false); // GOLD AVAILABLE:
|
||||
AddHtmlLocalized(15, 420, 300, 20, 1114310, 0x7FFF); // GOLD AVAILABLE:
|
||||
AddLabel(215, 420, 0x481, balance.ToString());
|
||||
AddHtmlLocalized(15, 435, 300, 20, 1114123, 0x7FFF, false, false); // TOTAL COST OF INSURANCE:
|
||||
AddHtmlLocalized(15, 435, 300, 20, 1114123, 0x7FFF); // TOTAL COST OF INSURANCE:
|
||||
AddLabel(215, 435, 0x481, cost.ToString());
|
||||
|
||||
if (cost != 0)
|
||||
{
|
||||
AddHtmlLocalized(15, 450, 300, 20, 1114125, 0x7FFF, false, false); // NUMBER OF DEATHS PAYABLE:
|
||||
AddHtmlLocalized(15, 450, 300, 20, 1114125, 0x7FFF); // NUMBER OF DEATHS PAYABLE:
|
||||
AddLabel(215, 450, 0x481, (balance / cost).ToString());
|
||||
}
|
||||
|
||||
|
|
@ -3598,26 +3564,26 @@ namespace Server.Mobiles
|
|||
|
||||
if (insure[i])
|
||||
{
|
||||
AddButton(400, y, 9723, 9724, 100 + i, GumpButtonType.Reply, 0);
|
||||
AddButton(400, y, 9723, 9724, 100 + i);
|
||||
AddLabel(250, y, 0x481, GetInsuranceCost(item).ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
AddButton(400, y, 9720, 9722, 100 + i, GumpButtonType.Reply, 0);
|
||||
AddButton(400, y, 9720, 9722, 100 + i);
|
||||
AddLabel(250, y, 0x66C, GetInsuranceCost(item).ToString());
|
||||
}
|
||||
}
|
||||
|
||||
if (page >= 1)
|
||||
{
|
||||
AddButton(15, 380, 0xFAE, 0xFAF, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 380, 450, 20, 1044044, 0x7FFF, false, false); // PREV PAGE
|
||||
AddButton(15, 380, 0xFAE, 0xFAF, 3);
|
||||
AddHtmlLocalized(50, 380, 450, 20, 1044044, 0x7FFF); // PREV PAGE
|
||||
}
|
||||
|
||||
if ((page + 1) * 4 < items.Length)
|
||||
{
|
||||
AddButton(400, 380, 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(435, 380, 70, 20, 1044045, 0x7FFF, false, false); // NEXT PAGE
|
||||
AddButton(400, 380, 0xFA5, 0xFA7, 4);
|
||||
AddHtmlLocalized(435, 380, 70, 20, 1044045, 0x7FFF); // NEXT PAGE
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3703,14 +3669,13 @@ namespace Server.Mobiles
|
|||
AddImageTiled(6, 116, 228, 20, 0xA40);
|
||||
AddAlphaRegion(6, 6, 228, 142);
|
||||
|
||||
AddHtmlLocalized(8, 8, 228, 100, 1114300, 0x7FFF, false,
|
||||
false); // Do you wish to insure all newly selected items?
|
||||
AddHtmlLocalized(8, 8, 228, 100, 1114300, 0x7FFF); // Do you wish to insure all newly selected items?
|
||||
|
||||
AddButton(6, 116, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(40, 118, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
|
||||
AddButton(6, 116, 0xFB1, 0xFB2, 0);
|
||||
AddHtmlLocalized(40, 118, 450, 20, 1060051, 0x7FFF); // CANCEL
|
||||
|
||||
AddButton(114, 116, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(148, 118, 450, 20, 1073996, 0x7FFF, false, false); // ACCEPT
|
||||
AddButton(114, 116, 0xFA5, 0xFA7, 1);
|
||||
AddHtmlLocalized(148, 118, 450, 20, 1073996, 0x7FFF); // ACCEPT
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -3870,7 +3835,7 @@ namespace Server.Mobiles
|
|||
get => m_DuelPlayer;
|
||||
set
|
||||
{
|
||||
bool wasInTourney = DuelContext != null && !DuelContext.Finished && DuelContext.m_Tournament != null;
|
||||
bool wasInTourney = DuelContext?.Finished == false && DuelContext.m_Tournament != null;
|
||||
|
||||
m_DuelPlayer = value;
|
||||
|
||||
|
|
@ -3879,7 +3844,7 @@ namespace Server.Mobiles
|
|||
else
|
||||
DuelContext = m_DuelPlayer.Participant.Context;
|
||||
|
||||
bool isInTourney = DuelContext != null && !DuelContext.Finished && DuelContext.m_Tournament != null;
|
||||
bool isInTourney = DuelContext?.Finished == false && DuelContext.m_Tournament != null;
|
||||
|
||||
if (wasInTourney != isInTourney)
|
||||
SendEverything();
|
||||
|
|
@ -3999,7 +3964,7 @@ namespace Server.Mobiles
|
|||
|
||||
TransformContext context = TransformationSpellHelper.GetContext(this);
|
||||
|
||||
if (context != null && context.Type == typeof(ReaperFormSpell))
|
||||
if (context?.Type == typeof(ReaperFormSpell))
|
||||
return WalkFoot;
|
||||
|
||||
bool running = (dir & Direction.Running) != 0;
|
||||
|
|
@ -4008,7 +3973,7 @@ namespace Server.Mobiles
|
|||
|
||||
AnimalFormContext animalContext = AnimalForm.GetContext(this);
|
||||
|
||||
if (onHorse || animalContext != null && animalContext.SpeedBoost)
|
||||
if (onHorse || animalContext?.SpeedBoost == true)
|
||||
return running ? RunMount : WalkMount;
|
||||
|
||||
return running ? RunFoot : WalkFoot;
|
||||
|
|
@ -4262,7 +4227,7 @@ namespace Server.Mobiles
|
|||
if (from is BaseCreature creature && creature.IgnoreYoungProtection)
|
||||
return false;
|
||||
|
||||
if (Quest != null && Quest.IgnoreYoungProtection(from))
|
||||
if (Quest?.IgnoreYoungProtection(from) == true)
|
||||
return false;
|
||||
|
||||
if (DateTime.UtcNow - m_LastYoungMessage > TimeSpan.FromMinutes(1.0))
|
||||
|
|
|
|||
|
|
@ -107,12 +107,12 @@ namespace Server.Mobiles
|
|||
{
|
||||
Item disarm = m.FindItemOnLayer(Layer.OneHanded);
|
||||
|
||||
if (disarm != null && disarm.Movable)
|
||||
if (disarm?.Movable == true)
|
||||
m.AddToBackpack(disarm);
|
||||
|
||||
disarm = m.FindItemOnLayer(Layer.TwoHanded);
|
||||
|
||||
if (disarm != null && disarm.Movable)
|
||||
if (disarm?.Movable == true)
|
||||
m.AddToBackpack(disarm);
|
||||
|
||||
m.BodyMod = 42;
|
||||
|
|
@ -166,7 +166,7 @@ namespace Server.Mobiles
|
|||
|
||||
public void DoSpecialAbility(Mobile target)
|
||||
{
|
||||
if (target == null || target.Deleted) //sanity
|
||||
if (target?.Deleted != false) //sanity
|
||||
return;
|
||||
|
||||
if (0.6 >= Utility.RandomDouble()) // 60% chance to polymorph attacker into a ratman
|
||||
|
|
|
|||
|
|
@ -7,11 +7,8 @@ namespace Server.Mobiles
|
|||
{
|
||||
public abstract class BaseChampion : BaseCreature
|
||||
{
|
||||
public BaseChampion(AIType aiType) : this(aiType, FightMode.Closest)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseChampion(AIType aiType, FightMode mode) : base(aiType, mode, 18, 1, 0.1, 0.2)
|
||||
public BaseChampion(AIType aiType, FightMode mode = FightMode.Closest) :
|
||||
base(aiType, mode, 18, 1, 0.1, 0.2)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -166,54 +163,56 @@ namespace Server.Mobiles
|
|||
}
|
||||
else
|
||||
{
|
||||
if (m.Corpse != null && !m.Corpse.Deleted)
|
||||
if (m.Corpse?.Deleted == false)
|
||||
m.Corpse.DropItem(ps);
|
||||
else
|
||||
m.AddToBackpack(ps);
|
||||
}
|
||||
|
||||
if (m is PlayerMobile pm)
|
||||
for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
|
||||
if (!(m is PlayerMobile pm))
|
||||
return;
|
||||
|
||||
for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
|
||||
{
|
||||
Mobile prot = pm.JusticeProtectors[j];
|
||||
|
||||
if (prot.Map != pm.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(pm, prot))
|
||||
continue;
|
||||
|
||||
int chance = 0;
|
||||
|
||||
switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
|
||||
{
|
||||
Mobile prot = pm.JusticeProtectors[j];
|
||||
case VirtueLevel.Seeker:
|
||||
chance = 60;
|
||||
break;
|
||||
case VirtueLevel.Follower:
|
||||
chance = 80;
|
||||
break;
|
||||
case VirtueLevel.Knight:
|
||||
chance = 100;
|
||||
break;
|
||||
}
|
||||
|
||||
if (prot.Map != pm.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(pm, prot))
|
||||
continue;
|
||||
if (chance > Utility.Random(100))
|
||||
{
|
||||
PowerScroll powerScroll = new PowerScroll(ps.Skill, ps.Value);
|
||||
|
||||
int chance = 0;
|
||||
prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!
|
||||
|
||||
switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
|
||||
if (!Core.SE || prot.Alive)
|
||||
{
|
||||
case VirtueLevel.Seeker:
|
||||
chance = 60;
|
||||
break;
|
||||
case VirtueLevel.Follower:
|
||||
chance = 80;
|
||||
break;
|
||||
case VirtueLevel.Knight:
|
||||
chance = 100;
|
||||
break;
|
||||
prot.AddToBackpack(powerScroll);
|
||||
}
|
||||
|
||||
if (chance > Utility.Random(100))
|
||||
else
|
||||
{
|
||||
PowerScroll powerScroll = new PowerScroll(ps.Skill, ps.Value);
|
||||
|
||||
prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!
|
||||
|
||||
if (!Core.SE || prot.Alive)
|
||||
{
|
||||
prot.AddToBackpack(powerScroll);
|
||||
}
|
||||
if (prot.Corpse?.Deleted == false)
|
||||
prot.Corpse.DropItem(powerScroll);
|
||||
else
|
||||
{
|
||||
if (prot.Corpse != null && !prot.Corpse.Deleted)
|
||||
prot.Corpse.DropItem(powerScroll);
|
||||
else
|
||||
prot.AddToBackpack(powerScroll);
|
||||
}
|
||||
prot.AddToBackpack(powerScroll);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnBeforeDeath()
|
||||
|
|
@ -328,4 +327,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Items;
|
||||
using Server.Spells;
|
||||
|
||||
|
|
@ -388,7 +388,7 @@ namespace Server.Mobiles
|
|||
|
||||
public void RegisterDamage(Mobile from, int amount)
|
||||
{
|
||||
if (from == null || !from.Player)
|
||||
if (from?.Player != true)
|
||||
return;
|
||||
|
||||
m_DamageEntries[from] = amount + (m_DamageEntries.TryGetValue(from, out int value) ? value : 0);
|
||||
|
|
@ -437,7 +437,7 @@ namespace Server.Mobiles
|
|||
|
||||
Container pack = to.Backpack;
|
||||
|
||||
if (pack == null || !pack.TryDropItem(to, artifact, false))
|
||||
if (pack?.TryDropItem(to, artifact, false) != true)
|
||||
artifact.Delete();
|
||||
else
|
||||
to.SendLocalizedMessage(
|
||||
|
|
@ -446,8 +446,8 @@ namespace Server.Mobiles
|
|||
|
||||
public bool IsEligible(Mobile m, Item Artifact)
|
||||
{
|
||||
return m.Player && m.Alive && m.InRange(Location, 32) && m.Backpack != null &&
|
||||
m.Backpack.CheckHold(m, Artifact, false);
|
||||
return m.Player && m.Alive && m.InRange(Location, 32) &&
|
||||
m.Backpack?.CheckHold(m, Artifact, false) == true;
|
||||
}
|
||||
|
||||
public Item GetArtifact()
|
||||
|
|
@ -526,61 +526,55 @@ namespace Server.Mobiles
|
|||
if (0.25 < Utility.RandomDouble())
|
||||
return;
|
||||
|
||||
Mobile toTeleport = null;
|
||||
Mobile toTeleport = m_Owner.GetMobilesInRange(16)
|
||||
.FirstOrDefault(mob => mob != m_Owner && mob.Player && m_Owner.CanBeHarmful(mob) && m_Owner.CanSee(mob));
|
||||
|
||||
foreach (Mobile m in m_Owner.GetMobilesInRange(16))
|
||||
if (m != m_Owner && m.Player && m_Owner.CanBeHarmful(m) && m_Owner.CanSee(m))
|
||||
if (toTeleport == null)
|
||||
return;
|
||||
|
||||
int offset = Utility.Random(8) * 2;
|
||||
|
||||
Point3D to = m_Owner.Location;
|
||||
|
||||
for (int i = 0; i < m_Offsets.Length; i += 2)
|
||||
{
|
||||
int x = m_Owner.X + m_Offsets[(offset + i) % m_Offsets.Length];
|
||||
int y = m_Owner.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];
|
||||
|
||||
if (map.CanSpawnMobile(x, y, m_Owner.Z))
|
||||
{
|
||||
toTeleport = m;
|
||||
to = new Point3D(x, y, m_Owner.Z);
|
||||
break;
|
||||
}
|
||||
|
||||
if (toTeleport != null)
|
||||
{
|
||||
int offset = Utility.Random(8) * 2;
|
||||
int z = map.GetAverageZ(x, y);
|
||||
|
||||
Point3D to = m_Owner.Location;
|
||||
|
||||
for (int i = 0; i < m_Offsets.Length; i += 2)
|
||||
if (map.CanSpawnMobile(x, y, z))
|
||||
{
|
||||
int x = m_Owner.X + m_Offsets[(offset + i) % m_Offsets.Length];
|
||||
int y = m_Owner.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];
|
||||
|
||||
if (map.CanSpawnMobile(x, y, m_Owner.Z))
|
||||
{
|
||||
to = new Point3D(x, y, m_Owner.Z);
|
||||
break;
|
||||
}
|
||||
|
||||
int z = map.GetAverageZ(x, y);
|
||||
|
||||
if (map.CanSpawnMobile(x, y, z))
|
||||
{
|
||||
to = new Point3D(x, y, z);
|
||||
break;
|
||||
}
|
||||
to = new Point3D(x, y, z);
|
||||
break;
|
||||
}
|
||||
|
||||
Mobile m = toTeleport;
|
||||
|
||||
Point3D from = m.Location;
|
||||
|
||||
m.Location = to;
|
||||
|
||||
SpellHelper.Turn(m_Owner, toTeleport);
|
||||
SpellHelper.Turn(toTeleport, m_Owner);
|
||||
|
||||
m.ProcessDelta();
|
||||
|
||||
Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10,
|
||||
2023);
|
||||
Effects.SendLocationParticles(EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10,
|
||||
5023);
|
||||
|
||||
m.PlaySound(0x1FE);
|
||||
|
||||
m_Owner.Combatant = toTeleport;
|
||||
}
|
||||
|
||||
Mobile m = toTeleport;
|
||||
|
||||
Point3D from = m.Location;
|
||||
|
||||
m.Location = to;
|
||||
|
||||
SpellHelper.Turn(m_Owner, toTeleport);
|
||||
SpellHelper.Turn(toTeleport, m_Owner);
|
||||
|
||||
m.ProcessDelta();
|
||||
|
||||
Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10,
|
||||
2023);
|
||||
Effects.SendLocationParticles(EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10,
|
||||
5023);
|
||||
|
||||
m.PlaySound(0x1FE);
|
||||
|
||||
m_Owner.Combatant = toTeleport;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
|
|
@ -8,12 +6,8 @@ namespace Server.Mobiles
|
|||
{
|
||||
private DrainTimer m_Timer;
|
||||
|
||||
[Constructible]
|
||||
public HarrowerTentacles() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public HarrowerTentacles(Mobile harrower) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public HarrowerTentacles(Mobile harrower = null) :
|
||||
base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
Harrower = harrower;
|
||||
Body = 129;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Engines.CannedEvil;
|
||||
using Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Engines.CannedEvil;
|
||||
using Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Engines.CannedEvil;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Items;
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Say(500381); // Thou canst not withdraw so much at one time!
|
||||
}
|
||||
else if (pack == null || pack.Deleted || !(pack.TotalWeight < pack.MaxWeight) ||
|
||||
else if (pack?.Deleted != false || !(pack.TotalWeight < pack.MaxWeight) ||
|
||||
!(pack.TotalItems < pack.MaxItems))
|
||||
{
|
||||
Say(1048147); // Your backpack can't hold anything else.
|
||||
|
|
@ -426,4 +426,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue