SoLoOoM

Untitled

Jul 28th, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. case 6001:
  2. {
  3. if (CanUseSpell(spell, attacker.Owner))
  4. {
  5. PrepareSpell(spell, attacker.Owner);
  6.  
  7. SpellUse suse = new SpellUse(true);
  8. suse.Attacker = attacker.UID;
  9. suse.SpellID = spell.ID;
  10. suse.SpellLevel = spell.Level;
  11. suse.X = X;
  12. suse.Y = Y;
  13. //suse.SpellLevelHu = client_Spell.LevelHu2;
  14. if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance)
  15. {
  16. foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
  17. {
  18. if (_obj.MapObjType == MapObjectType.Player)
  19. {
  20. attacked = _obj as Entity;
  21. if (attacked.MapObjType == MapObjectType.Monster)
  22. if (attacked.MonsterInfo.Boss)
  23. continue;
  24. if (Kernel.GetDistance(X, Y, attacked.X, attacked.Y) <= spell.Range)
  25. {
  26. if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
  27. {
  28. int potDifference = attacker.BattlePower - attacked.BattlePower;
  29.  
  30. int rate = spell.Percent + potDifference - 20;
  31.  
  32. if (Kernel.Rate(rate))
  33. {
  34. attacked.ToxicFogStamp = Time32.Now;
  35. attacked.ToxicFogLeft = 20;
  36. attacked.ToxicFogPercent = spell.PowerPercent;
  37. attacked.AddFlag(Update.Flags.Poisoned);
  38. suse.AddTarget(attacked, 1, null);
  39. }
  40. else
  41. {
  42. suse.AddTarget(attacked, 0, null);
  43. suse.Targets[attacked.UID].Hit = false;
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. else
  51. {
  52. attacker.AttackPacket = null;
  53. }
  54. attacker.Owner.SendScreen(suse, true);
  55. }
  56. break;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment