Adds style cop (#109)

This commit is contained in:
Kamron Batman 2020-04-26 00:16:02 -07:00 • committed by GitHub
parent 3e715bcb60
commit 556a17aba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1725 changed files with 33831 additions and 38046 deletions

View file

@ -6,7 +6,7 @@ namespace Server.Targets
{
public class AIControlMobileTarget : Target
{
private List<BaseAI> m_List;
private readonly List<BaseAI> m_List;
public AIControlMobileTarget(BaseAI ai, OrderType order) : base(-1, false,
order == OrderType.Attack ? TargetFlags.Harmful : TargetFlags.None)
@ -17,7 +17,7 @@ namespace Server.Targets
AddAI(ai);
}
public OrderType Order{ get; }
public OrderType Order { get; }
public void AddAI(BaseAI ai)
{

View file

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

View file

@ -74,7 +74,6 @@ namespace Server.Mobiles
return true;
}
// At 20% we should check if we must leave
if (m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100 && m_Mobile.CanFlee)
{

View file

@ -42,7 +42,7 @@ namespace Server.Mobiles
public abstract class BaseAI
{
private static SkillName[] m_KeywordTable =
private static readonly SkillName[] m_KeywordTable =
{
SkillName.Parry,
SkillName.Healing,
@ -61,7 +61,7 @@ namespace Server.Mobiles
SkillName.Cartography,
SkillName.Cooking,
SkillName.DetectHidden,
SkillName.Discordance, //??
SkillName.Discordance, // ??
SkillName.EvalInt,
SkillName.Fishing,
SkillName.Provocation,
@ -94,7 +94,7 @@ namespace Server.Mobiles
SkillName.Meditation
};
private static Queue<Item> m_Obstacles = new Queue<Item>();
private static readonly Queue<Item> m_Obstacles = new Queue<Item>();
protected ActionType m_Action;
public BaseCreature m_Mobile;
@ -138,7 +138,7 @@ namespace Server.Mobiles
}
}
public long NextMove{ get; set; }
public long NextMove { get; set; }
public virtual bool CanDetectHidden => m_Mobile.Skills.DetectHidden.Value > 0;
@ -433,76 +433,76 @@ namespace Server.Mobiles
switch (keyword)
{
case 0x164: // all come
{
if (!isOwner)
break;
if (m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Come;
}
if (!isOwner)
break;
return;
}
if (m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Come;
}
return;
}
case 0x165: // all follow
{
BeginPickTarget(e.Mobile, OrderType.Follow);
return;
}
{
BeginPickTarget(e.Mobile, OrderType.Follow);
return;
}
case 0x166: // all guard
case 0x16B: // all guard me
{
if (!isOwner)
break;
if (m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Guard;
}
if (!isOwner)
break;
return;
}
if (m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Guard;
}
return;
}
case 0x167: // all stop
{
if (m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Stop;
}
if (m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Stop;
}
return;
}
return;
}
case 0x168: // all kill
case 0x169: // all attack
{
if (!isOwner)
break;
{
if (!isOwner)
break;
BeginPickTarget(e.Mobile, OrderType.Attack);
return;
}
BeginPickTarget(e.Mobile, OrderType.Attack);
return;
}
case 0x16C: // all follow me
{
if (m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = e.Mobile;
m_Mobile.ControlOrder = OrderType.Follow;
}
if (m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = e.Mobile;
m_Mobile.ControlOrder = OrderType.Follow;
}
return;
}
return;
}
case 0x170: // all stay
{
if (m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Stay;
}
if (m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Stay;
}
return;
}
return;
}
}
}
@ -514,164 +514,164 @@ namespace Server.Mobiles
switch (keyword)
{
case 0x155: // *come
{
if (!isOwner)
break;
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Come;
}
if (!isOwner)
break;
return;
}
case 0x156: // *drop
{
if (!isOwner)
break;
if (!m_Mobile.IsDeadPet && !m_Mobile.Summoned && WasNamed(speech) &&
m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Drop;
}
return;
}
case 0x15A: // *follow
{
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
BeginPickTarget(e.Mobile, OrderType.Follow);
return;
}
case 0x15B: // *friend
{
if (!isOwner)
break;
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
if (m_Mobile.Summoned || m_Mobile is GrizzledMare)
e.Mobile.SendLocalizedMessage(
1005481); // Summoned creatures are loyal only to their summoners.
else if (e.Mobile.HasTrade)
e.Mobile.SendLocalizedMessage(
1070947); // You cannot friend a pet with a trade pending
else
BeginPickTarget(e.Mobile, OrderType.Friend);
}
return;
}
case 0x15C: // *guard
{
if (!isOwner)
break;
if (!m_Mobile.IsDeadPet && WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Guard;
}
return;
}
case 0x15D: // *kill
case 0x15E: // *attack
{
if (!isOwner)
break;
if (!m_Mobile.IsDeadPet && WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
BeginPickTarget(e.Mobile, OrderType.Attack);
return;
}
case 0x15F: // *patrol
{
if (!isOwner)
break;
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Patrol;
}
return;
}
case 0x161: // *stop
{
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Stop;
}
return;
}
case 0x163: // *follow me
{
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = e.Mobile;
m_Mobile.ControlOrder = OrderType.Follow;
}
return;
}
case 0x16D: // *release
{
if (!isOwner)
break;
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
if (!m_Mobile.Summoned)
{
e.Mobile.SendGump(new ConfirmReleaseGump(e.Mobile, m_Mobile));
}
else
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Release;
m_Mobile.ControlOrder = OrderType.Come;
}
}
return;
}
return;
}
case 0x156: // *drop
{
if (!isOwner)
break;
if (!m_Mobile.IsDeadPet && !m_Mobile.Summoned && WasNamed(speech) &&
m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Drop;
}
return;
}
case 0x15A: // *follow
{
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
BeginPickTarget(e.Mobile, OrderType.Follow);
return;
}
case 0x15B: // *friend
{
if (!isOwner)
break;
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
if (m_Mobile.Summoned || m_Mobile is GrizzledMare)
e.Mobile.SendLocalizedMessage(
1005481); // Summoned creatures are loyal only to their summoners.
else if (e.Mobile.HasTrade)
e.Mobile.SendLocalizedMessage(
1070947); // You cannot friend a pet with a trade pending
else
BeginPickTarget(e.Mobile, OrderType.Friend);
}
return;
}
case 0x15C: // *guard
{
if (!isOwner)
break;
if (!m_Mobile.IsDeadPet && WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Guard;
}
return;
}
case 0x15D: // *kill
case 0x15E: // *attack
{
if (!isOwner)
break;
if (!m_Mobile.IsDeadPet && WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
BeginPickTarget(e.Mobile, OrderType.Attack);
return;
}
case 0x15F: // *patrol
{
if (!isOwner)
break;
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Patrol;
}
return;
}
case 0x161: // *stop
{
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Stop;
}
return;
}
case 0x163: // *follow me
{
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = e.Mobile;
m_Mobile.ControlOrder = OrderType.Follow;
}
return;
}
case 0x16D: // *release
{
if (!isOwner)
break;
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
if (!m_Mobile.Summoned)
{
e.Mobile.SendGump(new ConfirmReleaseGump(e.Mobile, m_Mobile));
}
else
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Release;
}
}
return;
}
case 0x16E: // *transfer
{
if (!isOwner)
break;
if (!m_Mobile.IsDeadPet && WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
if (m_Mobile.Summoned || m_Mobile is GrizzledMare)
e.Mobile.SendLocalizedMessage(
1005487); // You cannot transfer ownership of a summoned creature.
else if (e.Mobile.HasTrade)
e.Mobile.SendLocalizedMessage(
1010507); // You cannot transfer a pet with a trade pending
else
BeginPickTarget(e.Mobile, OrderType.Transfer);
}
if (!isOwner)
break;
return;
}
if (!m_Mobile.IsDeadPet && WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
if (m_Mobile.Summoned || m_Mobile is GrizzledMare)
e.Mobile.SendLocalizedMessage(
1005487); // You cannot transfer ownership of a summoned creature.
else if (e.Mobile.HasTrade)
e.Mobile.SendLocalizedMessage(
1010507); // You cannot transfer a pet with a trade pending
else
BeginPickTarget(e.Mobile, OrderType.Transfer);
}
return;
}
case 0x16F: // *stay
{
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Stay;
}
if (WasNamed(speech) && m_Mobile.CheckControlChance(e.Mobile))
{
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.Stay;
}
return;
}
return;
}
}
}
}
@ -864,7 +864,7 @@ namespace Server.Mobiles
else if (Core.TickCount - m_NextStopGuard < 0)
{
m_Mobile.DebugSay("I am on guard");
//m_Mobile.Turn( Utility.Random(0, 2) - 1 );
// m_Mobile.Turn( Utility.Random(0, 2) - 1 );
}
else
{
@ -970,7 +970,7 @@ namespace Server.Mobiles
m_Mobile.Warmode = true;
m_Mobile.Combatant = null;
string petname = $"{m_Mobile.Name}";
m_Mobile.ControlMaster.SendLocalizedMessage(1049671, petname); //~1_PETNAME~ is now guarding you.
m_Mobile.ControlMaster.SendLocalizedMessage(1049671, petname); // ~1_PETNAME~ is now guarding you.
break;
case OrderType.Attack:
@ -1341,7 +1341,7 @@ namespace Server.Mobiles
if (attacker?.Deleted == false &&
attacker.GetDistanceToSqrt(m_Mobile) <= m_Mobile.RangePerception)
if (combatant == null || attacker.GetDistanceToSqrt(controlMaster) <
combatant.GetDistanceToSqrt(controlMaster))
combatant.GetDistanceToSqrt(controlMaster))
combatant = attacker;
}
@ -1483,7 +1483,7 @@ namespace Server.Mobiles
else
m_Mobile.DebugSay("My master told me to stay");
//m_Mobile.Direction = m_Mobile.GetDirectionTo( m_Mobile.ControlMaster );
// m_Mobile.Direction = m_Mobile.GetDirectionTo( m_Mobile.ControlMaster );
return true;
}
@ -1759,7 +1759,7 @@ namespace Server.Mobiles
MoveResult res = DoMoveImpl(d);
return res == MoveResult.Success || res == MoveResult.SuccessAutoTurn ||
badStateOk && res == MoveResult.BadState;
(badStateOk && res == MoveResult.BadState);
}
public virtual MoveResult DoMoveImpl(Direction d)
@ -2257,7 +2257,7 @@ namespace Server.Mobiles
if (bFacFriend && !m_Mobile.IsFriend(m))
continue;
//Ignore anyone under EtherealVoyage
// Ignore anyone under EtherealVoyage
if (TransformationSpellHelper.UnderTransformation(m, typeof(EtherealVoyageSpell)))
continue;
@ -2329,7 +2329,6 @@ namespace Server.Mobiles
return false;
}
public virtual void DetectHidden()
{
if (m_Mobile.Deleted || m_Mobile.Map == null)
@ -2422,10 +2421,10 @@ namespace Server.Mobiles
private class InternalEntry : ContextMenuEntry
{
private BaseAI m_AI;
private Mobile m_From;
private BaseCreature m_Mobile;
private OrderType m_Order;
private readonly BaseAI m_AI;
private readonly Mobile m_From;
private readonly BaseCreature m_Mobile;
private readonly OrderType m_Order;
public InternalEntry(Mobile from, int number, int range, BaseCreature mobile, BaseAI ai, OrderType order)
: base(number, range)
@ -2463,31 +2462,31 @@ namespace Server.Mobiles
case OrderType.Transfer:
case OrderType.Friend:
case OrderType.Unfriend:
{
if (m_Order == OrderType.Transfer && m_From.HasTrade)
m_From.SendLocalizedMessage(1010507); // You cannot transfer a pet with a trade pending
else if (m_Order == OrderType.Friend && m_From.HasTrade)
m_From.SendLocalizedMessage(1070947); // You cannot friend a pet with a trade pending
else
m_AI.BeginPickTarget(m_From, m_Order);
{
if (m_Order == OrderType.Transfer && m_From.HasTrade)
m_From.SendLocalizedMessage(1010507); // You cannot transfer a pet with a trade pending
else if (m_Order == OrderType.Friend && m_From.HasTrade)
m_From.SendLocalizedMessage(1070947); // You cannot friend a pet with a trade pending
else
m_AI.BeginPickTarget(m_From, m_Order);
break;
}
break;
}
case OrderType.Release:
{
if (m_Mobile.Summoned)
goto default;
m_From.SendGump(new ConfirmReleaseGump(m_From, m_Mobile));
{
if (m_Mobile.Summoned)
goto default;
m_From.SendGump(new ConfirmReleaseGump(m_From, m_Mobile));
break;
}
break;
}
default:
{
if (m_Mobile.CheckControlChance(m_From))
m_Mobile.ControlOrder = m_Order;
{
if (m_Mobile.CheckControlChance(m_From))
m_Mobile.ControlOrder = m_Order;
break;
}
break;
}
}
}
}
@ -2495,7 +2494,7 @@ namespace Server.Mobiles
private class TransferItem : Item
{
private BaseCreature m_Creature;
private readonly BaseCreature m_Creature;
public TransferItem(BaseCreature creature)
: base(ShrinkTable.Lookup(creature))
@ -2510,7 +2509,7 @@ namespace Server.Mobiles
creature.GetType().IsDefined(typeof(FriendlyNameAttribute), false) || creature is Reptalon)
Name = FriendlyNameAttribute.GetFriendlyNameFor(creature.GetType()).ToString();
//(As Per OSI)No name. Normally, set by the ItemID of the Shrink Item unless we either explicitly set it with an Attribute, or, no lookup found
// (As Per OSI)No name. Normally, set by the ItemID of the Shrink Item unless we either explicitly set it with an Attribute, or, no lookup found
Hue = creature.Hue & 0x0FFF;
}
@ -2652,7 +2651,7 @@ namespace Server.Mobiles
*/
private class AITimer : Timer
{
private BaseAI m_Owner;
private readonly BaseAI m_Owner;
public AITimer(BaseAI owner)
: base(TimeSpan.FromSeconds(Utility.RandomDouble()),
@ -2679,7 +2678,7 @@ namespace Server.Mobiles
return;
}
if (m_Owner.m_Mobile.PlayerRangeSensitive) //have to check this in the timer....
if (m_Owner.m_Mobile.PlayerRangeSensitive) // have to check this in the timer....
{
Sector sect = m_Owner.m_Mobile.Map.GetSector(m_Owner.m_Mobile);
if (!sect.Active)

View file

@ -8,13 +8,13 @@ namespace Server.Mobiles
{
public class HealerAI : BaseAI
{
private static NeedDelegate m_Cure = NeedCure;
private static NeedDelegate m_GHeal = NeedGHeal;
private static NeedDelegate m_LHeal = NeedLHeal;
private static NeedDelegate[] m_ACure = { m_Cure };
private static NeedDelegate[] m_AGHeal = { m_GHeal };
private static NeedDelegate[] m_ALHeal = { m_LHeal };
private static NeedDelegate[] m_All = { m_Cure, m_GHeal, m_LHeal };
private static readonly NeedDelegate m_Cure = NeedCure;
private static readonly NeedDelegate m_GHeal = NeedGHeal;
private static readonly NeedDelegate m_LHeal = NeedLHeal;
private static readonly NeedDelegate[] m_ACure = { m_Cure };
private static readonly NeedDelegate[] m_AGHeal = { m_GHeal };
private static readonly NeedDelegate[] m_ALHeal = { m_LHeal };
private static readonly NeedDelegate[] m_All = { m_Cure, m_GHeal, m_LHeal };
public HealerAI(BaseCreature m) : base(m)
{

View file

@ -19,7 +19,7 @@ namespace Server.Mobiles
private const double TeleportChance = 0.05; // 5% chance to teleport at gm magery
private const double DispelChance = 0.75; // 75% chance to dispel at gm magery
private static int[] m_Offsets =
private static readonly int[] m_Offsets =
{
-1, -1,
-1, 0,
@ -392,64 +392,64 @@ namespace Server.Mobiles
{
case 0:
case 1: // Poison them
{
if (c.Poisoned)
goto default;
{
if (c.Poisoned)
goto default;
m_Mobile.DebugSay("Attempting to poison");
m_Mobile.DebugSay("Attempting to poison");
spell = new PoisonSpell(m_Mobile);
break;
}
spell = new PoisonSpell(m_Mobile);
break;
}
case 2: // Bless ourselves
{
m_Mobile.DebugSay("Blessing myself");
{
m_Mobile.DebugSay("Blessing myself");
spell = new BlessSpell(m_Mobile);
break;
}
spell = new BlessSpell(m_Mobile);
break;
}
case 3:
case 4: // Curse them
{
m_Mobile.DebugSay("Attempting to curse");
{
m_Mobile.DebugSay("Attempting to curse");
spell = GetRandomCurseSpell();
break;
}
spell = GetRandomCurseSpell();
break;
}
case 5: // Paralyze them
{
if (c.Paralyzed || m_Mobile.Skills.Magery.Value <= 50.0)
goto default;
{
if (c.Paralyzed || m_Mobile.Skills.Magery.Value <= 50.0)
goto default;
m_Mobile.DebugSay("Attempting to paralyze");
m_Mobile.DebugSay("Attempting to paralyze");
spell = new ParalyzeSpell(m_Mobile);
break;
}
spell = new ParalyzeSpell(m_Mobile);
break;
}
case 6: // Drain mana
{
m_Mobile.DebugSay("Attempting to drain mana");
{
m_Mobile.DebugSay("Attempting to drain mana");
spell = GetRandomManaDrainSpell();
break;
}
spell = GetRandomManaDrainSpell();
break;
}
case 7: // Invis ourselves
{
if (Utility.RandomBool())
goto default;
{
if (Utility.RandomBool())
goto default;
m_Mobile.DebugSay("Attempting to invis myself");
m_Mobile.DebugSay("Attempting to invis myself");
spell = new InvisibilitySpell(m_Mobile);
break;
}
spell = new InvisibilitySpell(m_Mobile);
break;
}
default: // Damage them
{
m_Mobile.DebugSay("Just doing damage");
{
m_Mobile.DebugSay("Just doing damage");
spell = GetRandomDamageSpell();
break;
}
spell = GetRandomDamageSpell();
break;
}
}
return spell;
@ -463,50 +463,50 @@ namespace Server.Mobiles
switch (Utility.Random(3))
{
case 0: // Poison them
{
if (c.Poisoned)
goto case 1;
{
if (c.Poisoned)
goto case 1;
spell = new PoisonSpell(m_Mobile);
break;
}
spell = new PoisonSpell(m_Mobile);
break;
}
case 1: // Deal some damage
{
spell = GetRandomDamageSpell();
{
spell = GetRandomDamageSpell();
break;
}
break;
}
default: // Set up a combo
{
if (m_Mobile.Mana > 15 && m_Mobile.Mana < 40)
{
if (c.Paralyzed && !c.Poisoned && !m_Mobile.Meditating)
if (m_Mobile.Mana > 15 && m_Mobile.Mana < 40)
{
m_Mobile.DebugSay("I am going to meditate");
if (c.Paralyzed && !c.Poisoned && !m_Mobile.Meditating)
{
m_Mobile.DebugSay("I am going to meditate");
m_Mobile.UseSkill(SkillName.Meditation);
m_Mobile.UseSkill(SkillName.Meditation);
}
else if (!c.Poisoned)
{
spell = new ParalyzeSpell(m_Mobile);
}
}
else if (!c.Poisoned)
else if (m_Mobile.Mana > 60)
{
spell = new ParalyzeSpell(m_Mobile);
if (Utility.RandomBool() && !c.Paralyzed && !c.Frozen && !c.Poisoned)
{
m_Combo = 0;
spell = new ParalyzeSpell(m_Mobile);
}
else
{
m_Combo = 1;
spell = new ExplosionSpell(m_Mobile);
}
}
}
else if (m_Mobile.Mana > 60)
{
if (Utility.RandomBool() && !c.Paralyzed && !c.Frozen && !c.Poisoned)
{
m_Combo = 0;
spell = new ParalyzeSpell(m_Mobile);
}
else
{
m_Combo = 1;
spell = new ExplosionSpell(m_Mobile);
}
}
break;
}
break;
}
}
return spell;
@ -541,34 +541,34 @@ namespace Server.Mobiles
switch (Utility.Random(IsNecromancer ? 4 : 3))
{
case 0:
{
if (c.Int < c.Dex)
spell = new FeeblemindSpell(m_Mobile);
else
spell = new ClumsySpell(m_Mobile);
{
if (c.Int < c.Dex)
spell = new FeeblemindSpell(m_Mobile);
else
spell = new ClumsySpell(m_Mobile);
++m_Combo; // Move to next spell
++m_Combo; // Move to next spell
break;
}
break;
}
case 1:
{
spell = new EnergyBoltSpell(m_Mobile);
m_Combo = -1; // Reset combo state
break;
}
{
spell = new EnergyBoltSpell(m_Mobile);
m_Combo = -1; // Reset combo state
break;
}
case 2:
{
spell = new FlameStrikeSpell(m_Mobile);
m_Combo = -1; // Reset combo state
break;
}
{
spell = new FlameStrikeSpell(m_Mobile);
m_Combo = -1; // Reset combo state
break;
}
default:
{
spell = new PainSpikeSpell(m_Mobile);
m_Combo = -1; // Reset combo state
break;
}
{
spell = new PainSpikeSpell(m_Mobile);
m_Combo = -1; // Reset combo state
break;
}
}
}
else if (m_Combo == 4 && spell == null)
@ -711,8 +711,7 @@ namespace Server.Mobiles
{
spell = DoCombo(c);
}
else if (SmartAI && (c.Spell is HealSpell || c.Spell is GreaterHealSpell) && !c.Poisoned
) // They have a heal spell out
else if (SmartAI && (c.Spell is HealSpell || c.Spell is GreaterHealSpell) && !c.Poisoned) // They have a heal spell out
{
spell = new PoisonSpell(m_Mobile);
}

View file

@ -1,8 +1,3 @@
//
// This is a first simple AI
//
//
namespace Server.Mobiles
{
public class MeleeAI : BaseAI
@ -70,9 +65,9 @@ namespace Server.Mobiles
}
}
/*if ( !m_Mobile.InLOS( combatant ) )
/*if (!m_Mobile.InLOS( combatant ))
{
if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
if (AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ))
{
m_Mobile.Combatant = combatant = m_Mobile.FocusMob;
m_Mobile.FocusMob = null;

View file

@ -5,11 +5,11 @@ namespace Server
{
public class OppositionGroup
{
private Type[][] m_Types;
private readonly Type[][] m_Types;
public OppositionGroup(Type[][] types) => m_Types = types;
public static OppositionGroup TerathansAndOphidians{ get; } = new OppositionGroup(new[]
public static OppositionGroup TerathansAndOphidians { get; } = new OppositionGroup(new[]
{
new[]
{
@ -28,7 +28,7 @@ namespace Server
}
});
public static OppositionGroup SavagesAndOrcs{ get; } = new OppositionGroup(new[]
public static OppositionGroup SavagesAndOrcs { get; } = new OppositionGroup(new[]
{
new[]
{
@ -49,7 +49,7 @@ namespace Server
}
});
public static OppositionGroup FeyAndUndead{ get; } = new OppositionGroup(new[]
public static OppositionGroup FeyAndUndead { get; } = new OppositionGroup(new[]
{
new[]
{

View file

@ -1,9 +1,3 @@
/*
* PredatorAI, its an animal that can attack
* Dont flee but dont attack if not hurt or attacked
*
*/
namespace Server.Mobiles
{
public class PredatorAI : BaseAI

View file

@ -8,11 +8,11 @@ namespace Server
public class SpeedInfo
{
// Should we use the new method of speeds?
private static bool Enabled = true;
private static readonly bool Enabled = true;
private static Dictionary<Type, SpeedInfo> m_Table;
private static SpeedInfo[] m_Speeds =
private static readonly SpeedInfo[] m_Speeds =
{
/* Slow */
new SpeedInfo(0.3, 0.6, new[]
@ -43,11 +43,7 @@ namespace Server
typeof(DemonKnight), typeof(GiantBlackWidow), typeof(SummonedAirElemental),
typeof(LesserHiryu), typeof(Hiryu), typeof(LadyOfTheSnow),
typeof(RaiJu), typeof(Ronin), typeof(RuneBeetle),
typeof(Changeling),
#region ML named mobs - before Paragon speedboost
typeof(LadyJennifyr), typeof(LadyMarai), typeof(MasterJonath),
typeof(Changeling), typeof(LadyJennifyr), typeof(LadyMarai), typeof(MasterJonath),
typeof(MasterMikael), typeof(MasterTheophilus), typeof(RedDeath),
typeof(SirPatrick), typeof(Miasma), typeof(Rend),
typeof(Grobu), typeof(Gnaw), typeof(Guile),
@ -55,8 +51,6 @@ namespace Server
typeof(LadySabrix), typeof(Malefic), typeof(Silk),
typeof(Virulent)
// TODO: Where to put Lurg, Putrefier, Swoop and Pyre? They seem slower.
#endregion
}),
/* Very Fast */
new SpeedInfo(0.175, 0.350, new[]
@ -155,11 +149,11 @@ namespace Server
Types = types;
}
public double ActiveSpeed{ get; set; }
public double ActiveSpeed { get; set; }
public double PassiveSpeed{ get; set; }
public double PassiveSpeed { get; set; }
public Type[] Types{ get; set; }
public Type[] Types { get; set; }
public static bool Contains(object obj)
{

View file

@ -1,10 +1,5 @@
using Server.Items;
//
// This is a first simple AI
//
//
namespace Server.Mobiles
{
public class ThiefAI : BaseAI

View file

@ -1,8 +1,3 @@
//
// This is a first simple AI
//
//
namespace Server.Mobiles
{
public class VendorAI : BaseAI