using System; using System.Collections; namespace Server.Mobiles { [CorpseName("a abysmal wisp corpse")] public class AbysmalWisp : BaseCreature { private DateTime m_NextFlare; [Constructable] public AbysmalWisp() : base(AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4) { this.Body = 165; this.Hue = 0x901; this.Name = ("a abysmal wisp"); this.VirtualArmor = Utility.Random(0, 6); this.BaseSoundID = 466; this.SetStr(50); this.SetDex(60); this.SetInt(100); this.SetHits(50); this.SetStam(60); this.SetMana(0); this.SetDamage(5, 10); this.SetDamageType(ResistanceType.Energy, 100); this.SetResistance(ResistanceType.Physical, 10, 15); this.SetResistance(ResistanceType.Fire, 10, 15); this.SetResistance(ResistanceType.Cold, 10, 15); this.SetResistance(ResistanceType.Poison, 10, 15); this.SetResistance(ResistanceType.Energy, 99); this.Skills[SkillName.Wrestling].Base = (6); this.Skills[SkillName.Tactics].Base = (6); this.Skills[SkillName.MagicResist].Base = (5); this.Fame = Utility.Random(0, 1249); this.Karma = Utility.Random(0, -624); this.Tamable = true; this.ControlSlots = 1; this.MinTameSkill = 0.0; } public AbysmalWisp(Serial serial) : base(serial) { } public override int GetAngerSound() { return 0x1B; } public override int GetIdleSound() { return 0x1C; } public override int GetAttackSound() { return 0x1D; } public override int GetHurtSound() { return 0x1E; } public override int GetDeathSound() { return 0x1F; } public override void OnThink() { base.OnThink(); if (DateTime.UtcNow < this.m_NextFlare) return; this.m_NextFlare = DateTime.UtcNow + TimeSpan.FromSeconds(5.0 + (25.0 * Utility.RandomDouble())); this.FixedEffect(0x37C4, 1, 12, 1109, 6); this.PlaySound(0x1D3); Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerCallback(Flare)); } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write((int)0); } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); } private void Flare() { Mobile caster = this.ControlMaster; if (caster == null) caster = this.SummonMaster; if (caster == null) return; ArrayList list = new ArrayList(); IPooledEnumerable eable = GetMobilesInRange(5); foreach (Mobile m in eable) { if (m.Player && m.Alive && !m.IsDeadBondedPet && m.Karma <= 0 && m.IsPlayer()) list.Add(m); } eable.Free(); for (int i = 0; i < list.Count; ++i) { Mobile m = (Mobile)list[i]; bool friendly = true; for (int j = 0; friendly && j < caster.Aggressors.Count; ++j) friendly = (caster.Aggressors[j].Attacker != m); for (int j = 0; friendly && j < caster.Aggressed.Count; ++j) friendly = (caster.Aggressed[j].Defender != m); if (friendly) { m.FixedEffect(0x37C4, 1, 12, 1109, 3); // At player m.Mana += 1 - (m.Karma / 1000); } } } } }