using System; using System.Collections.Generic; using Server.Items; using Server.Network; namespace Server.Mobiles { public class MeerMage : BaseCreature { private static Dictionary m_Table = new Dictionary(); private DateTime m_NextAbilityTime; [Constructible] public MeerMage() : base(AIType.AI_Mage, FightMode.Evil, 10, 1, 0.2, 0.4) { Body = 770; SetStr(171, 200); SetDex(126, 145); SetInt(276, 305); SetHits(103, 120); SetDamage(24, 26); SetDamageType(ResistanceType.Physical, 100); SetResistance(ResistanceType.Physical, 45, 55); SetResistance(ResistanceType.Fire, 15, 25); SetResistance(ResistanceType.Cold, 50); SetResistance(ResistanceType.Poison, 25, 35); SetResistance(ResistanceType.Energy, 25, 35); SetSkill(SkillName.EvalInt, 100.0); SetSkill(SkillName.Magery, 70.1, 80.0); SetSkill(SkillName.Meditation, 85.1, 95.0); SetSkill(SkillName.MagicResist, 80.1, 100.0); SetSkill(SkillName.Tactics, 70.1, 90.0); SetSkill(SkillName.Wrestling, 60.1, 80.0); Fame = 8000; Karma = 8000; VirtualArmor = 16; m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(2, 5)); } public MeerMage(Serial serial) : base(serial) { } public override string CorpseName => "a meer's corpse"; public override string DefaultName => "a meer mage"; public override bool AutoDispel => true; public override Poison PoisonImmune => Poison.Lethal; public override bool CanRummageCorpses => true; public override int TreasureMapLevel => 3; public override bool InitialInnocent => true; public override void GenerateLoot() { AddLoot(LootPack.FilthyRich); AddLoot(LootPack.MedScrolls, 2); // TODO: Daemon bone ... } public override int GetHurtSound() { return 0x14D; } public override int GetDeathSound() { return 0x314; } public override int GetAttackSound() { return 0x75; } public override void OnThink() { if (DateTime.UtcNow >= m_NextAbilityTime) { Mobile combatant = Combatant; if (combatant != null && combatant.Map == Map && combatant.InRange(this, 12) && IsEnemy(combatant) && !UnderEffect(combatant)) { m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(20, 30)); if (combatant is BaseCreature bc) 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; if (Utility.RandomDouble() < .1) { int[][] coord = { new[] { -4, -6 }, new[] { 4, -6 }, new[] { 0, -8 }, new[] { -5, 5 }, new[] { 5, 5 } }; for (int i = 0; i < 5; i++) { int x = combatant.X + coord[i][0]; int y = combatant.Y + coord[i][1]; Point3D loc = new Point3D(x, y, combatant.Map.GetAverageZ(x, y)); if (!combatant.Map.CanSpawnMobile(loc)) continue; BaseCreature rabid; switch (i) { case 0: rabid = new EnragedRabbit(this); break; case 1: rabid = new EnragedHind(this); break; case 2: rabid = new EnragedHart(this); break; case 3: rabid = new EnragedBlackBear(this); break; default: rabid = new EnragedEagle(this); break; } rabid.FocusMob = combatant; rabid.MoveToWorld(loc, combatant.Map); } Say(1071932); //Creatures of the forest, I call to thee! Aid me in the fight against all that is evil! } else if (combatant.Player) { int count = 0; Say(true, "I call a plague of insects to sting your flesh!"); m_Table[combatant] = Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(7.0), () => DoEffect(combatant, count++)); } } } base.OnThink(); } public static bool UnderEffect(Mobile m) { return m_Table.ContainsKey(m); } public static void StopEffect(Mobile m, bool message) { if (m_Table.TryGetValue(m, out Timer timer)) { if (message) m.PublicOverheadMessage(MessageType.Emote, m.SpeechHue, true, "* The open flame begins to scatter the swarm of insects *"); timer.Stop(); m_Table.Remove(m); } } public void DoEffect(Mobile m, int count) { if (!m.Alive) StopEffect(m, false); else { if (m.FindItemOnLayer(Layer.TwoHanded) is Torch torch && torch.Burning) StopEffect(m, true); else { if (count % 4 == 0) { m.LocalOverheadMessage(MessageType.Emote, m.SpeechHue, true, "* The swarm of insects bites and stings your flesh! *"); m.NonlocalOverheadMessage(MessageType.Emote, m.SpeechHue, true, $"* {m.Name} is stung by a swarm of insects *"); } m.FixedParticles(0x91C, 10, 180, 9539, EffectLayer.Waist); m.PlaySound(0x00E); m.PlaySound(0x1BC); AOS.Damage(m, this, Utility.RandomMinMax(30, 40) - (Core.AOS ? 0 : 10), 100, 0, 0, 0, 0); if (!m.Alive) StopEffect(m, false); } } } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write(0); } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); } } }