PurpleFaeFlower.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using Server.MirDatabase;
  2. using Server.MirEnvir;
  3. using S = ServerPackets;
  4. namespace Server.MirObjects.Monsters
  5. {
  6. class PurpleFaeFlower : ZumaMonster
  7. {
  8. protected override bool CanMove { get { return false; } }
  9. protected internal PurpleFaeFlower(MonsterInfo info)
  10. : base(info)
  11. {
  12. }
  13. protected override bool InAttackRange()
  14. {
  15. return CurrentMap == Target.CurrentMap && CanFly(Target.CurrentLocation) && Functions.InRange(CurrentLocation, Target.CurrentLocation, Info.ViewRange);
  16. // ADDED CANFLY SO THAT PROJECTILE MOBS CANNOT SHOOT THROUGH WALLS
  17. }
  18. protected override void Attack()
  19. {
  20. if (!Target.IsAttackTarget(this))
  21. {
  22. Target = null;
  23. return;
  24. }
  25. ActionTime = Envir.Time + 300;
  26. AttackTime = Envir.Time + AttackSpeed;
  27. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  28. ShockTime = 0;
  29. Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
  30. bool ranged = CurrentLocation == Target.CurrentLocation || !Functions.InRange(CurrentLocation, Target.CurrentLocation, 1);
  31. if (!ranged)
  32. {
  33. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation });
  34. if (damage == 0) return;
  35. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.AC);
  36. ActionList.Add(action);
  37. }
  38. else
  39. {
  40. Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID, Type = 0 });
  41. AttackTime = Envir.Time + AttackSpeed + 500;
  42. if (damage == 0) return;
  43. int delay = Functions.MaxDistance(CurrentLocation, Target.CurrentLocation) * 50 + 500; //50 MS per Step
  44. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, Target, damage, DefenceType.MAC);
  45. ActionList.Add(action);
  46. }
  47. }
  48. public override bool Walk(MirDirection dir) { return false; }
  49. protected override void ProcessRoam() { }
  50. }
  51. }