Beispiel #1
0
        static void Main()
        {
            //Reflector.ToTXT("CSLaba5.Hunter", "D:\\HunterInfo.txt");
            //Console.WriteLine("All methods:");
            //Reflector.ToConsole(Reflector.GetAllMeth("CSLaba5.Hunter"));
            //Console.WriteLine("\nAll fields & properties:");
            //Reflector.ToConsole(Reflector.GetFields("CSLaba5.Hunter"));
            //Console.WriteLine("\nAll interfaces:");
            //Reflector.ToConsole(Reflector.GetInterf("CSLaba5.Hunter"));
            //Reflector.GetMethWithParam("CSLaba5.Hunter", "Hunter[]");
            //Reflector.CallSomeMeth("CSLaba5.Hunter", "PrintSmth", "D:\\inf.txt");
            Hunter h = new Hunter();

            for (int i = 0; i < 100; i++)
            {
                if (i == 50)
                {
                    h.M();
                }
            }

            del myDelegate = x => x * x;
            int j          = myDelegate(5); //j = 25

            Console.WriteLine(myDelegate(10));

            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());
        }
Beispiel #2
0
 private Game()
 {
     for (int i = 0; i < 10; i++)
     {
         RArmy[i] = new Hunter(R.Next(100, 100), R.Next(10, 100));
         GArmy[i] = new Hunter(R.Next(100, 100), R.Next(10, 100));
     }
     chat[numbOfTerms] = "Game is started!!!\n First turn — Red team.";
 }
Beispiel #3
0
        public static Hunter operator +(Hunter h1, Hunter h2)
        {
            Hunter h = new Hunter();

            h.Damage    = h1.Damage + h2.Damage;
            h.maxHealth = h1.maxHealth + h2.maxHealth;
            h.maxMana   = h1.maxMana + h2.maxMana;
            h.Health    = h.maxHealth;
            h.Mana      = h.maxMana;
            return(h);
        }
Beispiel #4
0
 public void Attack(Hunter h)
 {
     if (h.Health <= Damage)
     {
         h.Health = 0;
     }
     else
     {
         h.Health = h.Health - (uint)Damage;
     }
 }
Beispiel #5
0
        public void HAttack()
        {
            if (queue % 2 == 0)
            {
                buffH = GFindAlive();
                buffH.Attack(RFindAlive());
                chat[numbOfTerms + 1] = "Green attacks Red for -" + buffH.Damage + "hp!\n  ***RED TEAM TURN!***";
            }
            else
            {
                buffH = RFindAlive();
                buffH.Attack(GFindAlive());
                chat[numbOfTerms + 1] = "Red attacks Green for -" + buffH.Damage + "hp!\n  ***GREEN TEAM TURN!***";
            }
            numbOfTerms++;
            queue++;

            Attack(this, new EventArgs());
        }
Beispiel #6
0
 public void RePrint(Form1 form)
 {
     form.textBox1.Lines = Hunter.ToArray(RArmy);
     form.textBox2.Lines = Hunter.ToArray(GArmy);
     form.textBox3.Lines = chat;
 }