ellapt

FighterAttack

Dec 18th, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. using System;
  2.  
  3. class FighterAttack
  4. {
  5. static void Main()
  6. {
  7. int px1 = Int32.Parse(Console.ReadLine());
  8. int py1 = Int32.Parse(Console.ReadLine());
  9. int px2 = Int32.Parse(Console.ReadLine());
  10. int py2 = Int32.Parse(Console.ReadLine());
  11. int fx = Int32.Parse(Console.ReadLine());
  12. int fy = Int32.Parse(Console.ReadLine());
  13. int d = Int32.Parse(Console.ReadLine());
  14.  
  15. int minPlantX = Math.Min(px1, px2);
  16. int maxPlantX = Math.Max(px1, px2);
  17. int minPlantY = Math.Min(py1, py2);
  18. int maxPlantY = Math.Max(py1, py2);
  19.  
  20. int hitX = fx + d;
  21. int hitY = fy;
  22. int hitUpX = hitX;
  23. int hitUpY = hitY + 1;
  24. int hitDownX = hitX;
  25. int hitDownY = hitY - 1;
  26. int hitRightX = hitX + 1;
  27. int hitRightY = hitY;
  28.  
  29. int damage = 0;
  30. if (hitX >= minPlantX && hitX <= maxPlantX && hitY >= minPlantY && hitY <= maxPlantY)
  31. {
  32. damage += 100;
  33. }
  34. if (hitUpX >= minPlantX && hitUpX <= maxPlantX && hitUpY >= minPlantY && hitUpY <= maxPlantY)
  35. {
  36. damage += 50;
  37. }
  38. if (hitDownX >= minPlantX && hitDownX <= maxPlantX && hitDownY >= minPlantY && hitDownY <= maxPlantY)
  39. {
  40. damage += 50;
  41. }
  42. if (hitRightX >= minPlantX && hitRightX <= maxPlantX && hitRightY >= minPlantY && hitRightY <= maxPlantY)
  43. {
  44. damage += 75;
  45. }
  46. Console.WriteLine(damage + "%");
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment