Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.77 KB | None | 0 0
  1. if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= range || pass)
  2. {
  3. attack.Effect1 = Attack.AttackEffects1.None;
  4. #region DragonPunch
  5. if (attacker.DragonWarrior())
  6. {
  7. if (attacker.Owner.Spells.ContainsKey(12240))
  8. {
  9. var spell = Database.SpellTable.GetSpell(12240, attacker.Owner);
  10. if (spell != null)
  11. {
  12. spell.CanKill = true;
  13. if (Kernel.Rate(spell.Percent))
  14. {
  15. SpellUse suse = new SpellUse(true);
  16. suse.Attacker = attacker.UID;
  17. suse.SpellID = spell.ID;
  18. suse.SpellLevel = spell.Level;
  19. suse.X = attacker.X;
  20. suse.Y = attacker.Y;
  21. IMapObject lastAttacked = attacker;
  22. if (Handle.CanAttack(attacker, attacked, spell, false))
  23. {
  24. lastAttacked = attacked;
  25. uint damages = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
  26. suse.Effect1 = attack.Effect1;
  27. Handle.ReceiveAttack(attacker, attacked, attack, ref damages, spell);
  28. suse.AddTarget(attacked.UID, damages, attack);
  29. }
  30. foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
  31. {
  32. if (_obj == null) continue;
  33. if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
  34. {
  35. if (_obj.UID == attacked.UID) continue;
  36. var attacked1 = _obj as Entity;
  37. if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attacked1.X, attacked1.Y) <= 5)
  38. {
  39. if (Handle.CanAttack(attacker, attacked1, spell, false))
  40. {
  41. lastAttacked = attacked1;
  42. uint damages = Game.Attacking.Calculate.Melee(attacker, attacked1, spell, ref attack);
  43. suse.Effect1 = attack.Effect1;
  44. if (damages == 0) break;
  45. Handle.ReceiveAttack(attacker, attacked1, attack, ref damages, spell);
  46. suse.AddTarget(attacked1.UID, damages, attack);
  47. }
  48. }
  49. }
  50. else if (_obj.MapObjType == MapObjectType.SobNpc)
  51. {
  52. attackedsob = _obj as SobNpcSpawn;
  53.  
  54. if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attackedsob.X, attackedsob.Y) <= 5)
  55. {
  56. if (Handle.CanAttack(attacker, attackedsob, spell))
  57. {
  58. lastAttacked = attackedsob;
  59. uint damages = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
  60. suse.Effect1 = attack.Effect1;
  61. if (damages == 0) break;
  62. Handle.ReceiveAttack(attacker, attackedsob, attack, damages, spell);
  63. suse.AddTarget(attackedsob.UID, damages, attack);
  64. }
  65. }
  66. }
  67. }
  68. attacker.Owner.SendScreen(suse, true);
  69. return;
  70. }
  71. }
  72.  
  73. }
  74.  
  75. }
  76. #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement