1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
| unit Unit2;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
FMX.TabControl, Math;
type
TForm2 = class(TForm)
TabControl1: TTabControl;
TabItem2: TTabItem;
TabItem3: TTabItem;
TabItem4: TTabItem;
Деньги: TTabItem;
Тесты: TTabItem;
Button9: TButton;
Button12: TButton;
Button13: TButton;
Button14: TButton;
Button10: TButton;
Button11: TButton;
Литература: TButton;
Button8: TButton;
Button15: TButton;
Button16: TButton;
Button17: TButton;
Button18: TButton;
Button19: TButton;
Button20: TButton;
Button22: TButton;
Button21: TButton;
Button23: TButton;
Button24: TButton;
Button29: TButton;
Button25: TButton;
Button26: TButton;
Button27: TButton;
Button28: TButton;
Button30: TButton;
TabItem1: TTabItem;
Timer1: TTimer;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
money,fat,smile,health,brain:integer;
implementation
{$R *.fmx}
procedure TForm2.Button4Click(Sender: TObject);
begin
money:=money-20;
health:=health-RandomRange(0,3);
smile:=smile + RandomRange(2,5);
fat:=fat+RandomRange(3,5);
if money<20 then
begin
ShowMessage('У вас мало денег,Стасику не по карману');
end;
if health>100 then
health:=100;
if smile>100 then
smile:=100;
if fat>100 then
fat:=100;
if brain>100 then
brain:=100;
//Если значение меньши нуля
if health<0 then
health:=0;
if smile<0 then
smile:=0;
if fat<0 then
fat:=0;
if brain<0 then
brain:=0;
//Что будет,если показатели равно нуля
if health=0 then
begin
ShowMessage('Стасик умер из-за проблем с здоровьем');
health:=50;
brain:=50;
money:=500;
smile:=50;
fat:=50;
end;
if brain=0 then
begin
ShowMessage('Стасик отупел,вы плохой игрок');
health:=50;
brain:=50;
money:=500;
smile:=50;
fat:=50;
if fat=0 then
begin
ShowMessage('Штазик умер из-за ожирения');
health:=50;
brain:=50;
money:=500;
smile:=50;
fat:=50;
end;
if smile=0 then
begin
ShowMessage('Стасон впал в депрессию и умер');
health:=50;
brain:=50;
money:=500;
smile:=50;
fat:=50;
end;
end.//Конец копирования
procedure TForm2.Button5Click(Sender: TObject);
begin
smile:=smile-RandomRange(0,2);
health:=health-RandomRange(0,2);
fat:=fat+RandomRange(2,4);
end;
//Если значение больше нуля(Начало)
if health>100 then
health:=100;
if smile>100 then
smile:=100;
if fat>100 then
fat:=100;
if brain>100 then
brain:=100;
//Если значение меньши нуля
if health<0 then
health:=0;
if smile<0 then
smile:=0;
if fat<0 then
fat:=0;
if brain<0 then
brain:=0;
//Что будет,если показатели равно нуля
if health=0 then
begin
ShowMessage('Стасик умер из-за проблем с здоровьем');
health:=50;
brain:=50;
money:=500;
smile:=50;
fat:=50;
end;
if brain=0 then
begin
ShowMessage('Стасик отупел,вы плохой игрок');
health:=50;
brain:=50;
money:=500;
smile:=50;
fat:=50;
if fat=0 then
begin
ShowMessage('Штазик умер из-за ожирения');
health:=50;
brain:=50;
money:=500;
smile:=50;
fat:=50;
end;
if smile=0 then
begin
ShowMessage('Стасон впал в депрессию и умер');
health:=50;
brain:=50;
money:=500;
smile:=50;
fat:=50;
end;
end. //Конец копирования
procedure TForm2.FormCreate(Sender: TObject);
begin
//Значение переменных
money:=500;
brain:=50;
smile:=50;
health:=50;
fat:=50;
end;
procedure TForm2.Timer1Timer(Sender: TObject);
begin
//Придаём значение лэйблам
Label1.Text:='Здоровье' +IntToStr(health);
Label3.Text:='Настроение'+IntToStr(smile);
Label2.Text:='Ум'+IntToStr(brain);
Label4.Text:='Сытость'+IntToStr(fat);
end;
end. |