1
|
|
|
<?php
|
2
|
|
|
|
3
|
|
|
namespace OSS\CoreBundle\Entity;
|
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
6
|
|
|
|
7
|
|
|
/**
|
8
|
|
|
* @ORM\Entity
|
9
|
|
|
*/
|
10
|
|
|
class Trainer
|
11
|
|
|
{
|
12
|
|
|
/**
|
13
|
|
|
* @var int
|
14
|
|
|
*
|
15
|
|
|
* @ORM\Id
|
16
|
|
|
* @ORM\GeneratedValue
|
17
|
|
|
* @ORM\Column(type="integer")
|
18
|
|
|
*/
|
19
|
|
|
private $id;
|
20
|
|
|
|
21
|
|
|
/**
|
22
|
|
|
* @var string
|
23
|
|
|
*
|
24
|
|
|
* @ORM\Column(type="string")
|
25
|
|
|
*/
|
26
|
|
|
private $name;
|
27
|
|
|
|
28
|
|
|
/**
|
29
|
|
|
* @var int
|
30
|
|
|
*
|
31
|
|
|
* @ORM\Column(type="integer")
|
32
|
|
|
*/
|
33
|
|
|
private $trainingFactorTackling = 10;
|
34
|
|
|
|
35
|
|
|
/**
|
36
|
|
|
* @var int
|
37
|
|
|
*
|
38
|
|
|
* @ORM\Column(type="integer")
|
39
|
|
|
*/
|
40
|
|
|
private $trainingFactorPassing = 10;
|
41
|
|
|
|
42
|
|
|
/**
|
43
|
|
|
* @var int
|
44
|
|
|
*
|
45
|
|
|
* @ORM\Column(type="integer")
|
46
|
|
|
*/
|
47
|
|
|
private $trainingFactorShooting = 10;
|
48
|
|
|
|
49
|
|
|
/**
|
50
|
|
|
* @var int
|
51
|
|
|
*
|
52
|
|
|
* @ORM\Column(type="integer")
|
53
|
|
|
*/
|
54
|
|
|
private $trainingFactorHeading = 10;
|
55
|
|
|
|
56
|
|
|
/**
|
57
|
|
|
* @var int
|
58
|
|
|
*
|
59
|
|
|
* @ORM\Column(type="integer")
|
60
|
|
|
*/
|
61
|
|
|
private $trainingFactorSpeed = 10;
|
62
|
|
|
|
63
|
|
|
/**
|
64
|
|
|
* @var int
|
65
|
|
|
*
|
66
|
|
|
* @ORM\Column(type="integer")
|
67
|
|
|
*/
|
68
|
|
|
private $trainingFactorCrossing = 10;
|
69
|
|
|
|
70
|
|
|
/**
|
71
|
|
|
* @var int
|
72
|
|
|
*
|
73
|
|
|
* @ORM\Column(type="integer")
|
74
|
|
|
*/
|
75
|
|
|
private $trainingFactorTechnics = 10;
|
76
|
|
|
|
77
|
|
|
/**
|
78
|
|
|
* @var int
|
79
|
|
|
*
|
80
|
|
|
* @ORM\Column(type="integer")
|
81
|
|
|
*/
|
82
|
|
|
private $trainingFactorIntelligence = 10;
|
83
|
|
|
|
84
|
|
|
/**
|
85
|
|
|
* @var int
|
86
|
|
|
*
|
87
|
|
|
* @ORM\Column(type="integer")
|
88
|
|
|
*/
|
89
|
|
|
private $trainingFactorSafety = 10;
|
90
|
|
|
|
91
|
|
|
/**
|
92
|
|
|
* @var int
|
93
|
|
|
*
|
94
|
|
|
* @ORM\Column(type="integer")
|
95
|
|
|
*/
|
96
|
|
|
private $trainingFactorDribbling = 10;
|
97
|
|
|
|
98
|
|
|
/**
|
99
|
|
|
* @var int
|
100
|
|
|
*
|
101
|
|
|
* @ORM\Column(type="integer")
|
102
|
|
|
*/
|
103
|
|
|
private $skill = 1;
|
104
|
|
|
|
105
|
|
|
/**
|
106
|
|
|
* @var Team
|
107
|
|
|
*
|
108
|
|
|
* @ORM\OneToOne(targetEntity="Team", inversedBy="trainer")
|
109
|
|
|
*/
|
110
|
|
|
private $team;
|
111
|
|
|
|
112
|
|
|
/**
|
113
|
|
|
* @return int
|
114
|
|
|
*/
|
115
|
2 |
|
public function getId()
|
116
|
|
|
{
|
117
|
2 |
|
return $this->id;
|
118
|
|
|
}
|
119
|
|
|
|
120
|
|
|
/**
|
121
|
|
|
* @param int $id
|
122
|
|
|
*/
|
123
|
1 |
|
public function setId($id)
|
124
|
|
|
{
|
125
|
1 |
|
$this->id = $id;
|
126
|
1 |
|
}
|
127
|
|
|
|
128
|
|
|
/**
|
129
|
|
|
* @return string
|
130
|
|
|
*/
|
131
|
2 |
|
public function getName()
|
132
|
|
|
{
|
133
|
2 |
|
return $this->name;
|
134
|
|
|
}
|
135
|
|
|
|
136
|
|
|
/**
|
137
|
|
|
* @param string $name
|
138
|
|
|
*/
|
139
|
1 |
|
public function setName($name)
|
140
|
|
|
{
|
141
|
1 |
|
$this->name = $name;
|
142
|
1 |
|
}
|
143
|
|
|
|
144
|
|
|
/**
|
145
|
|
|
* @return int
|
146
|
|
|
*/
|
147
|
2 |
|
public function getSkill()
|
148
|
|
|
{
|
149
|
2 |
|
return $this->skill;
|
150
|
|
|
}
|
151
|
|
|
|
152
|
|
|
/**
|
153
|
|
|
* @param int $skill
|
154
|
|
|
*/
|
155
|
3 |
|
public function setSkill($skill)
|
156
|
|
|
{
|
157
|
3 |
|
$this->skill = $skill;
|
158
|
3 |
|
}
|
159
|
|
|
|
160
|
|
|
/**
|
161
|
|
|
* @param Team $team
|
162
|
|
|
*/
|
163
|
4 |
|
public function setTeam(Team $team)
|
164
|
|
|
{
|
165
|
4 |
|
$this->team = $team;
|
166
|
4 |
|
if (null === $team->getTrainer()) {
|
167
|
1 |
|
$team->setTrainer($this);
|
168
|
1 |
|
}
|
169
|
4 |
|
}
|
170
|
|
|
|
171
|
|
|
/**
|
172
|
|
|
* @return Team
|
173
|
|
|
*/
|
174
|
5 |
|
public function getTeam()
|
175
|
|
|
{
|
176
|
5 |
|
return $this->team;
|
177
|
|
|
}
|
178
|
|
|
|
179
|
|
|
/**
|
180
|
|
|
* @param PlayerSkills $skills
|
181
|
|
|
*/
|
182
|
5 |
|
public function train(PlayerSkills $skills)
|
183
|
|
|
{
|
184
|
5 |
|
$skills->addTrainingValueTackling($this->getTrainingAddValue($this->trainingFactorTackling));
|
185
|
5 |
|
$skills->addTrainingValuePassing($this->getTrainingAddValue($this->trainingFactorPassing));
|
186
|
5 |
|
$skills->addTrainingValueShooting($this->getTrainingAddValue($this->trainingFactorShooting));
|
187
|
5 |
|
$skills->addTrainingValueHeading($this->getTrainingAddValue($this->trainingFactorHeading));
|
188
|
5 |
|
$skills->addTrainingValueSpeed($this->getTrainingAddValue($this->trainingFactorSpeed));
|
189
|
5 |
|
$skills->addTrainingValueCrossing($this->getTrainingAddValue($this->trainingFactorCrossing));
|
190
|
5 |
|
$skills->addTrainingValueTechnics($this->getTrainingAddValue($this->trainingFactorTechnics));
|
191
|
5 |
|
$skills->addTrainingValueIntelligence($this->getTrainingAddValue($this->trainingFactorIntelligence));
|
192
|
5 |
|
$skills->addTrainingValueSafety($this->getTrainingAddValue($this->trainingFactorSafety));
|
193
|
5 |
|
$skills->addTrainingValueDribbling($this->getTrainingAddValue($this->trainingFactorDribbling));
|
194
|
5 |
|
}
|
195
|
|
|
|
196
|
|
|
/**
|
197
|
|
|
* @param int $trainingFactor
|
198
|
|
|
*
|
199
|
|
|
* @return int
|
200
|
|
|
*/
|
201
|
5 |
|
private function getTrainingAddValue($trainingFactor)
|
202
|
|
|
{
|
203
|
5 |
|
return ceil($this->skill * 5 * $trainingFactor / 100);
|
204
|
|
|
}
|
205
|
|
|
|
206
|
|
|
/**
|
207
|
|
|
* @return int
|
208
|
|
|
*/
|
209
|
1 |
|
public function getTrainingFactorTackling()
|
210
|
|
|
{
|
211
|
1 |
|
return $this->trainingFactorTackling;
|
212
|
|
|
}
|
213
|
|
|
|
214
|
|
|
/**
|
215
|
|
|
* @param int $factor
|
216
|
|
|
*/
|
217
|
1 |
|
public function setTrainingFactorTackling($factor)
|
218
|
|
|
{
|
219
|
1 |
|
$this->trainingFactorTackling = $factor;
|
220
|
1 |
|
}
|
221
|
|
|
|
222
|
|
|
/**
|
223
|
|
|
* @return int
|
224
|
|
|
*/
|
225
|
1 |
|
public function getTrainingFactorPassing()
|
226
|
|
|
{
|
227
|
1 |
|
return $this->trainingFactorPassing;
|
228
|
|
|
}
|
229
|
|
|
|
230
|
|
|
/**
|
231
|
|
|
* @param int $factor
|
232
|
|
|
*/
|
233
|
1 |
|
public function setTrainingFactorPassing($factor)
|
234
|
|
|
{
|
235
|
1 |
|
$this->trainingFactorPassing = $factor;
|
236
|
1 |
|
}
|
237
|
|
|
|
238
|
|
|
/**
|
239
|
|
|
* @return int
|
240
|
|
|
*/
|
241
|
1 |
|
public function getTrainingFactorShooting()
|
242
|
|
|
{
|
243
|
1 |
|
return $this->trainingFactorShooting;
|
244
|
|
|
}
|
245
|
|
|
|
246
|
|
|
/**
|
247
|
|
|
* @param int $factor
|
248
|
|
|
*/
|
249
|
|
|
public function setTrainingFactorShooting($factor)
|
250
|
|
|
{
|
251
|
|
|
$this->trainingFactorShooting = $factor;
|
252
|
|
|
}
|
253
|
|
|
|
254
|
|
|
/**
|
255
|
|
|
* @return int
|
256
|
|
|
*/
|
257
|
1 |
|
public function getTrainingFactorHeading()
|
258
|
|
|
{
|
259
|
1 |
|
return $this->trainingFactorHeading;
|
260
|
|
|
}
|
261
|
|
|
|
262
|
|
|
/**
|
263
|
|
|
* @param int $factor
|
264
|
|
|
*/
|
265
|
|
|
public function setTrainingFactorHeading($factor)
|
266
|
|
|
{
|
267
|
|
|
$this->trainingFactorHeading = $factor;
|
268
|
|
|
}
|
269
|
|
|
|
270
|
|
|
/**
|
271
|
|
|
* @return int
|
272
|
|
|
*/
|
273
|
1 |
|
public function getTrainingFactorSpeed()
|
274
|
|
|
{
|
275
|
1 |
|
return $this->trainingFactorSpeed;
|
276
|
|
|
}
|
277
|
|
|
|
278
|
|
|
/**
|
279
|
|
|
* @param int $factor
|
280
|
|
|
*/
|
281
|
|
|
public function setTrainingFactorSpeed($factor)
|
282
|
|
|
{
|
283
|
|
|
$this->trainingFactorSpeed = $factor;
|
284
|
|
|
}
|
285
|
|
|
|
286
|
|
|
/**
|
287
|
|
|
* @return int
|
288
|
|
|
*/
|
289
|
1 |
|
public function getTrainingFactorCrossing()
|
290
|
|
|
{
|
291
|
1 |
|
return $this->trainingFactorCrossing;
|
292
|
|
|
}
|
293
|
|
|
|
294
|
|
|
/**
|
295
|
|
|
* @param int $factor
|
296
|
|
|
*/
|
297
|
|
|
public function setTrainingFactorCrossing($factor)
|
298
|
|
|
{
|
299
|
|
|
$this->trainingFactorCrossing = $factor;
|
300
|
|
|
}
|
301
|
|
|
|
302
|
|
|
/**
|
303
|
|
|
* @return int
|
304
|
|
|
*/
|
305
|
1 |
|
public function getTrainingFactorTechnics()
|
306
|
|
|
{
|
307
|
1 |
|
return $this->trainingFactorTechnics;
|
308
|
|
|
}
|
309
|
|
|
|
310
|
|
|
/**
|
311
|
|
|
* @param int $factor
|
312
|
|
|
*/
|
313
|
|
|
public function setTrainingFactorTechnics($factor)
|
314
|
|
|
{
|
315
|
|
|
$this->trainingFactorTechnics = $factor;
|
316
|
|
|
}
|
317
|
|
|
|
318
|
|
|
/**
|
319
|
|
|
* @return int
|
320
|
|
|
*/
|
321
|
1 |
|
public function getTrainingFactorIntelligence()
|
322
|
|
|
{
|
323
|
1 |
|
return $this->trainingFactorIntelligence;
|
324
|
|
|
}
|
325
|
|
|
|
326
|
|
|
/**
|
327
|
|
|
* @param int $factor
|
328
|
|
|
*/
|
329
|
|
|
public function setTrainingFactorIntelligence($factor)
|
330
|
|
|
{
|
331
|
|
|
$this->trainingFactorIntelligence = $factor;
|
332
|
|
|
}
|
333
|
|
|
|
334
|
|
|
/**
|
335
|
|
|
* @return int
|
336
|
|
|
*/
|
337
|
1 |
|
public function getTrainingFactorSafety()
|
338
|
|
|
{
|
339
|
1 |
|
return $this->trainingFactorSafety;
|
340
|
|
|
}
|
341
|
|
|
|
342
|
|
|
/**
|
343
|
|
|
* @param int $factor
|
344
|
|
|
*/
|
345
|
|
|
public function setTrainingFactorSafety($factor)
|
346
|
|
|
{
|
347
|
|
|
$this->trainingFactorSafety = $factor;
|
348
|
|
|
}
|
349
|
|
|
|
350
|
|
|
/**
|
351
|
|
|
* @return int
|
352
|
|
|
*/
|
353
|
1 |
|
public function getTrainingFactorDribbling()
|
354
|
|
|
{
|
355
|
1 |
|
return $this->trainingFactorDribbling;
|
356
|
|
|
}
|
357
|
|
|
|
358
|
|
|
/**
|
359
|
|
|
* @param int $factor
|
360
|
|
|
*/
|
361
|
|
|
public function setTrainingFactorDribbling($factor)
|
362
|
|
|
{
|
363
|
|
|
$this->trainingFactorDribbling = $factor;
|
364
|
|
|
}
|
365
|
|
|
|
366
|
|
|
}
|
367
|
|
|
|