RedMoonEvil.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using Server.MirDatabase;
  2. using Server.MirEnvir;
  3. using S = ServerPackets;
  4. namespace Server.MirObjects.Monsters
  5. {
  6. public class RedMoonEvil : MonsterObject
  7. {
  8. protected override bool CanMove { get { return false; } }
  9. protected override bool CanRegen { get { return false; } }
  10. protected internal RedMoonEvil(MonsterInfo info) : base(info)
  11. {
  12. Direction = MirDirection.Up;
  13. ActionTime = Envir.Time + 300;
  14. AttackTime = Envir.Time + AttackSpeed;
  15. }
  16. protected override bool InAttackRange()
  17. {
  18. if (Target.CurrentMap != CurrentMap) return false;
  19. return Target.CurrentLocation != CurrentLocation && Functions.InRange(CurrentLocation, Target.CurrentLocation, Info.ViewRange);
  20. }
  21. public override void Turn(MirDirection dir)
  22. {
  23. }
  24. public override bool Walk(MirDirection dir) { return false; }
  25. protected override void ProcessTarget()
  26. {
  27. if (!CanAttack) return;
  28. List<MapObject> targets = FindAllTargets(Info.ViewRange, CurrentLocation);
  29. if (targets.Count == 0) return;
  30. ShockTime = 0;
  31. Broadcast(new S.ObjectAttack {ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation});
  32. for (int i = 0; i < targets.Count; i++)
  33. {
  34. Target = targets[i];
  35. Attack();
  36. }
  37. ActionTime = Envir.Time + 300;
  38. AttackTime = Envir.Time + AttackSpeed;
  39. }
  40. protected override void Attack()
  41. {
  42. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  43. if (damage == 0) return;
  44. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility);
  45. ActionList.Add(action);
  46. Broadcast(new S.ObjectEffect{ ObjectID = Target.ObjectID, Effect = SpellEffect.RedMoonEvil});
  47. }
  48. }
  49. }