BombSpider.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using Server.MirDatabase;
  2. using Server.MirEnvir;
  3. namespace Server.MirObjects.Monsters
  4. {
  5. public class BombSpider : MonsterObject
  6. {
  7. public long ExplosionTime;
  8. protected internal BombSpider(MonsterInfo info)
  9. : base(info)
  10. {
  11. ExplosionTime = Envir.Time + 1000 * 60 * 5;
  12. }
  13. protected override void ProcessTarget()
  14. {
  15. if (Target == null) { Die(); return; }
  16. if (InAttackRange()) { Die(); return; }
  17. if (Envir.Time > ExplosionTime) { Die(); return; }
  18. if (Envir.Time < ShockTime)
  19. {
  20. Target = null;
  21. return;
  22. }
  23. MoveTo(Target.CurrentLocation);
  24. }
  25. public override void Die()
  26. {
  27. ActionList.Add(new DelayedAction(DelayedType.Die, Envir.Time + 500));
  28. base.Die();
  29. }
  30. protected override void CompleteDeath(IList<object> data)
  31. {
  32. List<MapObject> targets = FindAllTargets(1, CurrentLocation, false);
  33. if (targets.Count == 0) return;
  34. for (int i = 0; i < targets.Count; i++)
  35. {
  36. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  37. if (damage == 0) return;
  38. if (targets[i].Attacked(this, damage, DefenceType.ACAgility) <= 0) continue;
  39. if (Envir.Random.Next(Settings.PoisonResistWeight) >= targets[i].Stats[Stat.PoisonResist])
  40. {
  41. if (Envir.Random.Next(5) == 0)
  42. {
  43. targets[i].ApplyPoison(new Poison { Owner = this, Duration = 5, PType = PoisonType.Green, Value = GetAttackPower(Stats[Stat.MinSC], Stats[Stat.MaxSC]), TickSpeed = 2000 }, this);
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }