archangelmihail

fighterAttack

Dec 4th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.73 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace fighterAttack
  8. {
  9.     class fighterAttack
  10.     {
  11.         static void Main()
  12.         {
  13.             int x1 = int.Parse(Console.ReadLine());
  14.             int y1 = int.Parse(Console.ReadLine());
  15.             int x2 = int.Parse(Console.ReadLine());
  16.             int y2 = int.Parse(Console.ReadLine());
  17.             int f1 = int.Parse(Console.ReadLine());
  18.             int f2 = int.Parse(Console.ReadLine());
  19.             int distance = int.Parse(Console.ReadLine());
  20.             //plant position
  21.            
  22.             // correction for horizon
  23.             int top = y1 > y2 ? y1 : y2;
  24.             int bot = y1 < y2 ? y1 : y2;
  25.             int left = x1 < x2 ? x1 : x2;
  26.             int right = x1 > x2 ? x1 : x2;
  27.             int hor = f1 + distance;
  28.  
  29.             int damage = 0;
  30.             int dotX = f1 + distance;
  31.             int dotCenterY = f2; // 100%
  32.             int dotUpY = f2 + 1; // 50%
  33.             int dotDownY = f2 - 1; // 50%
  34.             int dotRightY = f2; // x = dotsX + 1; -> 75%
  35.             if (dotX >= left && dotX <= right)
  36.             {
  37.                 if (dotCenterY >= bot && dotCenterY <= top)
  38.                     damage += 100;
  39.  
  40.                 if (dotUpY >= bot && dotUpY <= top)
  41.                     damage += 50;
  42.  
  43.                 if (dotDownY >= bot && dotDownY <= top)
  44.                     damage += 50;
  45.             }
  46.  
  47.             if (dotX + 1 >= left && dotX + 1 <= right)
  48.             {
  49.                 if (dotRightY >= bot && dotRightY <= top)
  50.                     damage += 75;
  51.             }
  52.            
  53.             Console.WriteLine(damage + "%");
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment