protected override void OnTick() { if (m_Owner.Deleted) { Stop(); return; } foreach (Mobile m in m_Owner.GetMobilesInRange(9)) { if (m == m_Owner || m == m_Owner.Harrower || !m_Owner.CanBeHarmful(m)) { continue; } if (m is BaseCreature) { BaseCreature bc = m as BaseCreature; if (bc.Controlled || bc.Summoned) { m_ToDrain.Add(m); } } else if (m.Player) { m_ToDrain.Add(m); } } foreach (Mobile m in m_ToDrain) { m_Owner.DoHarmful(m); m.FixedParticles(0x374A, 10, 15, 5013, 0x455, 0, EffectLayer.Waist); m.PlaySound(0x1F1); int drain = Utility.RandomMinMax(14, 30); if (LifeShieldLotion.UnderEffect(m)) { double scale = Utility.RandomMinMax(50, 100) / 100.0; drain = (int)(drain * scale); } m_Owner.Hits += drain; if (m_Owner.Harrower != null) { m_Owner.Harrower.Hits += drain; } m.Damage(drain, m_Owner); } m_ToDrain.Clear(); }
public void DrainLife() { ArrayList list = new ArrayList(); foreach (Mobile m in this.GetMobilesInRange(2)) { if (m == this || !CanBeHarmful(m)) { continue; } if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned || ((BaseCreature)m).Team != this.Team)) { list.Add(m); } else if (m.IsPlayer) { list.Add(m); } } foreach (Mobile m in list) { DoHarmful(m); m.FixedParticles(0x374A, 10, 15, 5013, 0x496, 0, EffectLayer.Waist); m.PlaySound(0x231); m.SendAsciiMessage("You feel the life drain out of you!"); int toDrain = Utility.RandomMinMax(10, 40); if (LifeShieldLotion.UnderEffect(m)) { double scale = Utility.RandomMinMax(50, 100) / 100.0; toDrain = (int)(toDrain + scale); } Hits += toDrain; m.Damage(toDrain, this); } }