ToxicGhoul.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using Server.MirDatabase;
  2. using Server.MirEnvir;
  3. using S = ServerPackets;
  4. namespace Server.MirObjects.Monsters
  5. {
  6. public class ToxicGhoul : HarvestMonster
  7. {
  8. protected internal ToxicGhoul(MonsterInfo info)
  9. : base(info)
  10. {
  11. }
  12. protected override void Attack()
  13. {
  14. ShockTime = 0;
  15. if (!Target.IsAttackTarget(this))
  16. {
  17. Target = null;
  18. return;
  19. }
  20. Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
  21. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation });
  22. ActionTime = Envir.Time + 300;
  23. AttackTime = Envir.Time + AttackSpeed;
  24. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  25. if (damage == 0) return;
  26. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.MACAgility);
  27. ActionList.Add(action);
  28. }
  29. protected override void CompleteAttack(IList<object> data)
  30. {
  31. MapObject target = (MapObject)data[0];
  32. int damage = (int)data[1];
  33. DefenceType defence = (DefenceType)data[2];
  34. if (target == null || !target.IsAttackTarget(this) || target.CurrentMap != CurrentMap || target.Node == null) return;
  35. if (target.Attacked(this, damage, defence) <= 0) return;
  36. PoisonTarget(target, 8, 5, PoisonType.Green, 2000);
  37. }
  38. public override void Die()
  39. {
  40. if (Info.Effect == 1)
  41. {
  42. ActionList.Add(new DelayedAction(DelayedType.Die, Envir.Time + 1000));
  43. }
  44. base.Die();
  45. }
  46. protected override void CompleteDeath(IList<object> data)
  47. {
  48. List<MapObject> targets = FindAllTargets(1, CurrentLocation, false);
  49. if (targets.Count == 0) return;
  50. for (int i = 0; i < targets.Count; i++)
  51. {
  52. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  53. if (damage == 0) return;
  54. if (targets[i].Attacked(this, damage, DefenceType.ACAgility) <= 0) return;
  55. PoisonTarget(targets[i], 5, 5, PoisonType.Green, 2000);
  56. }
  57. }
  58. }
  59. }