View difference between Paste ID: QiiCj14r and ED4Jhxzj
SHOW: | | - or go back to the newest paste.
1
using System;
2
using System.Threading;
3
4
namespace Delegates
5
{
6
    class Program
7
    {
8
        static void Main(string[] args)
9
        {
10
11
            ConsoleColor oldColor = Console.ForegroundColor;
12
            Console.ForegroundColor = ConsoleColor.Yellow;
13
            Console.WriteLine("Босс может атаковать в двух режимах: все атаки по очереди и случайной атакой");
14
            Console.ForegroundColor = oldColor;
15
16
            int Health = 1000;
17
            int Armor = 20;
18
19
            bool isRandomAttack = (DateTime.Now.Millisecond % 2) == 0;
20
21
            oldColor = Console.ForegroundColor;
22
            Console.ForegroundColor = ConsoleColor.Yellow;
23
            Console.WriteLine("Босс будет атаковать: " + (isRandomAttack ? "случайно" : "все атаки по очереди"));
24
            Console.ForegroundColor = oldColor;
25
26
            oldColor = Console.ForegroundColor;
27
            Console.ForegroundColor = ConsoleColor.Green;
28
            Console.WriteLine("Нажмите enter для начала боя");
29
            Console.ForegroundColor = oldColor;
30
            Console.ReadLine();
31
32
            int attackNumber = 0;
33
            while (Health > 0)
34
            {
35
                Console.Clear();
36
                oldColor = Console.ForegroundColor;
37
                Console.ForegroundColor = ConsoleColor.Red;
38
                Console.WriteLine("У вас здоровья: " + Health);
39
                Console.ForegroundColor = oldColor;
40
41
                if (isRandomAttack)
42
                {
43
                    int rand = DateTime.Now.Millisecond % 3;
44
                    if(rand == 0)
45
                    {
46
                        oldColor = Console.ForegroundColor;
47
                        Console.ForegroundColor = ConsoleColor.DarkRed;
48
                        Console.WriteLine("Босс атаковал с немыслимой яростью своими руками");
49
                        Console.ForegroundColor = oldColor;
50
51
                        Health = Health - (100 - Armor);
52
                    }
53
                    else if(rand == 1)
54
                    {
55
                        oldColor = Console.ForegroundColor;
56
                        Console.ForegroundColor = ConsoleColor.DarkMagenta;
57
                        Console.WriteLine("Босс исполнил новый альбом Ольги бузовой");
58
                        Console.ForegroundColor = oldColor;
59
                        Health = Health - (140 - Armor);
60
                    }
61
                    else if(rand == 2)
62
                    {
63
                        oldColor = Console.ForegroundColor;
64
                        Console.ForegroundColor = ConsoleColor.DarkGray;
65
                        Console.WriteLine("Босс приуныл и рассказал вам о своём долгом пути и дал пару советов, после выпил ритуальный стопарь боярки");
66
                        Console.ForegroundColor = oldColor;
67
                        Health = Health - (80 - Armor);
68
                    }
69
                }
70
                else
71
                {
72
                    if (attackNumber == 0)
73
                    {
74
                        oldColor = Console.ForegroundColor;
75
                        Console.ForegroundColor = ConsoleColor.DarkRed;
76
                        Console.WriteLine("Босс атаковал с немыслимой яростью своими руками");
77
                        Console.ForegroundColor = oldColor;
78
79
                        Health = Health - (100 - Armor);
80
                    }
81
                    else if (attackNumber == 1)
82
                    {
83
                        oldColor = Console.ForegroundColor;
84
                        Console.ForegroundColor = ConsoleColor.DarkMagenta;
85
                        Console.WriteLine("Босс исполнил новый альбом Ольги бузовой");
86
                        Console.ForegroundColor = oldColor;
87
                        Health = Health - (140 - Armor);
88
                    }
89
                    else if (attackNumber == 2)
90
                    {
91
                        oldColor = Console.ForegroundColor;
92
                        Console.ForegroundColor = ConsoleColor.DarkGray;
93
                        Console.WriteLine("Босс паник и рассказал вам о своём долгом пути и дал пару советов, после выпил ритуальный стопарь боярки");
94
                        Console.ForegroundColor = oldColor;
95
                        Health = Health - (80 - Armor);
96
                    }
97
98
                    attackNumber += 1;
99
                    if (attackNumber > 2)
100
                    {
101
                        attackNumber = 0;
102
                    }
103
                }
104
105
                Thread.Sleep(4000);
106
            }
107
108
            oldColor = Console.ForegroundColor;
109
            Console.ForegroundColor = ConsoleColor.DarkGray;
110
            Console.WriteLine("Бой закончен, вы погибли");
111
            Console.ForegroundColor = oldColor;
112
113
        }
114
115
    }
116
}