Advertisement
APXOHT

Untitled

Dec 1st, 2012
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.07 KB | None | 0 0
  1. using System;
  2.  
  3. class FighterAttack
  4. {
  5.     static void Main()
  6.     {
  7.         int px1 = int.Parse(Console.ReadLine());
  8.         int py1 = int.Parse(Console.ReadLine());
  9.         int px2 = int.Parse(Console.ReadLine());
  10.         int py2 = int.Parse(Console.ReadLine());
  11.         int fx = int.Parse(Console.ReadLine());
  12.         int fy = int.Parse(Console.ReadLine());
  13.         int d = int.Parse(Console.ReadLine());
  14.         int boomCentralX = fx + d;
  15.         int boomCentralY = fy;
  16.         int boomFrontX = boomCentralX + 1;
  17.         int boomFrontY = fy;
  18.         int boomLeftX = boomCentralX;
  19.         int boomLeftY = boomCentralY + 1;
  20.         int boomRightX = boomCentralX;
  21.         int boomRightY = boomCentralY - 1;
  22.         int rectangleLeft = 0;
  23.         int rectangleRight = 0;
  24.         int rectangleTop = 0;
  25.         int rectangleBottom = 0;
  26.         int damage = 0;
  27.         if (px1 > px2)
  28.         {
  29.             rectangleRight = px1;
  30.             rectangleLeft = px2;
  31.         }
  32.         else
  33.         {
  34.             rectangleRight = px2;
  35.             rectangleLeft = px1;
  36.         }
  37.         if (py1 > py2)
  38.         {
  39.             rectangleTop = py1;
  40.             rectangleBottom = py2;
  41.         }
  42.         else
  43.         {
  44.             rectangleTop = py2;
  45.             rectangleBottom = py1;
  46.         }
  47.         if (boomCentralX <= rectangleRight && boomCentralX >= rectangleLeft && boomCentralY <= rectangleTop && boomCentralY >= rectangleBottom)
  48.         {
  49.             damage += 100;
  50.         }
  51.         if (boomFrontX <= rectangleRight && boomFrontX >= rectangleLeft && boomFrontY <= rectangleTop && boomFrontY >= rectangleBottom)
  52.         {
  53.             damage += 75;
  54.         }
  55.         if (boomRightX <= rectangleRight && boomRightX >= rectangleLeft && boomRightY <= rectangleTop && boomRightY >= rectangleBottom)
  56.         {
  57.             damage += 50;
  58.         }
  59.         if (boomLeftX <= rectangleRight && boomLeftX >= rectangleLeft && boomLeftY <= rectangleTop && boomLeftY >= rectangleBottom)
  60.         {
  61.             damage += 50;
  62.         }
  63.         Console.WriteLine("{0}%", damage);
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement