1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Obblm\Core\Entity; |
4
|
|
|
|
5
|
|
|
use Obblm\Core\Helper\PlayerHelper; |
6
|
|
|
use Obblm\Core\Repository\PlayerVersionRepository; |
7
|
|
|
use Doctrine\ORM\Mapping as ORM; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* @ORM\Entity(repositoryClass=PlayerVersionRepository::class) |
11
|
|
|
* @ORM\Table(name="obblm_team_player_version") |
12
|
|
|
* @ORM\HasLifecycleCallbacks |
13
|
|
|
*/ |
14
|
|
|
class PlayerVersion |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @ORM\Id() |
18
|
|
|
* @ORM\GeneratedValue() |
19
|
|
|
* @ORM\Column(type="integer") |
20
|
|
|
*/ |
21
|
|
|
private $id; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @ORM\ManyToOne(targetEntity=Player::class, inversedBy="versions", cascade={"persist"}) |
25
|
|
|
* @ORM\JoinColumn(nullable=false) |
26
|
|
|
*/ |
27
|
|
|
private $player; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @ORM\ManyToOne(targetEntity=TeamVersion::class, inversedBy="playerVersions") |
31
|
|
|
* @ORM\JoinColumn(nullable=false) |
32
|
|
|
*/ |
33
|
|
|
private $teamVersion; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @ORM\Column(type="array") |
37
|
|
|
*/ |
38
|
|
|
private $characteristics = []; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @ORM\Column(type="array") |
42
|
|
|
*/ |
43
|
|
|
private $skills = []; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @ORM\Column(type="array", nullable=true) |
47
|
|
|
*/ |
48
|
|
|
private $additionalSkills = []; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @ORM\Column(type="array", nullable=true) |
52
|
|
|
*/ |
53
|
|
|
private $injuries = []; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @ORM\Column(type="array", nullable=true) |
57
|
|
|
*/ |
58
|
|
|
private $actions = []; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @ORM\Column(type="boolean") |
62
|
|
|
*/ |
63
|
|
|
private $missingNextGame = false; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @ORM\Column(type="boolean") |
67
|
|
|
*/ |
68
|
|
|
private $dead = false; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @ORM\Column(type="boolean") |
72
|
|
|
*/ |
73
|
|
|
private $fire = false; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @ORM\Column(type="boolean") |
77
|
|
|
*/ |
78
|
|
|
private $hiredStarPlayer = false; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @ORM\Column(type="boolean") |
82
|
|
|
*/ |
83
|
|
|
private $mercenary = false; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @ORM\Column(type="integer") |
87
|
|
|
*/ |
88
|
|
|
private $spp = 0; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @ORM\Column(type="string", length=255) |
92
|
|
|
*/ |
93
|
|
|
private $sppLevel; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @ORM\Column(type="integer") |
97
|
|
|
*/ |
98
|
|
|
private $value; |
99
|
|
|
|
100
|
|
|
public function getId(): ?int |
101
|
|
|
{ |
102
|
|
|
return $this->id; |
103
|
|
|
} |
104
|
|
|
|
105
|
1 |
|
public function getPlayer(): ?Player |
106
|
|
|
{ |
107
|
1 |
|
return $this->player; |
108
|
|
|
} |
109
|
|
|
|
110
|
1 |
|
public function setPlayer(?Player $player): self |
111
|
|
|
{ |
112
|
1 |
|
$this->player = $player; |
113
|
|
|
|
114
|
1 |
|
return $this; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
public function getCharacteristics(): ?array |
118
|
|
|
{ |
119
|
|
|
return $this->characteristics; |
120
|
|
|
} |
121
|
|
|
|
122
|
1 |
|
public function setCharacteristics(array $characteristics): self |
123
|
|
|
{ |
124
|
1 |
|
$this->characteristics = $characteristics; |
125
|
|
|
|
126
|
1 |
|
return $this; |
127
|
|
|
} |
128
|
|
|
|
129
|
1 |
|
public function getSkills(): ?array |
130
|
|
|
{ |
131
|
1 |
|
return $this->skills; |
132
|
|
|
} |
133
|
|
|
|
134
|
1 |
|
public function setSkills(array $skills): self |
135
|
|
|
{ |
136
|
1 |
|
$this->skills = $skills; |
137
|
|
|
|
138
|
1 |
|
return $this; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
public function getAdditionalSkills(): ?array |
142
|
|
|
{ |
143
|
|
|
return $this->additionalSkills; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
public function setAdditionalSkills(array $additionalSkills): self |
147
|
|
|
{ |
148
|
|
|
$this->additionalSkills = $additionalSkills; |
149
|
|
|
|
150
|
|
|
return $this; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
public function getInjuries(): ?array |
154
|
|
|
{ |
155
|
|
|
return $this->injuries; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
public function setInjuries(array $injuries): self |
159
|
|
|
{ |
160
|
|
|
$this->injuries = $injuries; |
161
|
|
|
|
162
|
|
|
return $this; |
163
|
|
|
} |
164
|
|
|
|
165
|
1 |
|
public function getValue(): ?int |
166
|
|
|
{ |
167
|
1 |
|
return $this->value; |
168
|
|
|
} |
169
|
|
|
|
170
|
1 |
|
public function setValue(int $value): self |
171
|
|
|
{ |
172
|
1 |
|
$this->value = $value; |
173
|
|
|
|
174
|
1 |
|
return $this; |
175
|
|
|
} |
176
|
|
|
|
177
|
1 |
|
public function getMissingNextGame(): ?bool |
178
|
|
|
{ |
179
|
1 |
|
return $this->missingNextGame; |
180
|
|
|
} |
181
|
|
|
|
182
|
1 |
|
public function isMissingNextGame(): ?bool |
183
|
|
|
{ |
184
|
1 |
|
return $this->getMissingNextGame(); |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
public function setMissingNextGame(bool $missingNextGame): self |
188
|
|
|
{ |
189
|
|
|
$this->missingNextGame = $missingNextGame; |
190
|
|
|
return $this; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
public function getDead(): ?bool |
194
|
|
|
{ |
195
|
|
|
return $this->dead; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
public function isDead(): ?bool |
199
|
|
|
{ |
200
|
|
|
return $this->getDead(); |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
public function setDead(bool $dead): self |
204
|
|
|
{ |
205
|
|
|
$this->dead = $dead; |
206
|
|
|
$this->getPlayer()->setDead($this->dead); |
207
|
|
|
return $this; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
public function getFire(): ?bool |
211
|
|
|
{ |
212
|
|
|
return $this->fire; |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
public function isFire(): ?bool |
216
|
|
|
{ |
217
|
|
|
return $this->getFire(); |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
public function setFire(bool $fire): self |
221
|
|
|
{ |
222
|
|
|
$this->fire = $fire; |
223
|
|
|
$this->getPlayer()->setFire($this->fire); |
224
|
|
|
return $this; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
public function getHiredStarPlayer(): ?bool |
228
|
|
|
{ |
229
|
|
|
return $this->hiredStarPlayer; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
public function isHiredStarPlayer(): ?bool |
233
|
|
|
{ |
234
|
|
|
return $this->getHiredStarPlayer(); |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
public function setHiredStarPlayer(bool $hiredStarPlayer): self |
238
|
|
|
{ |
239
|
|
|
$this->hiredStarPlayer = $hiredStarPlayer; |
240
|
|
|
return $this; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
public function getMercenary(): ?bool |
244
|
|
|
{ |
245
|
|
|
return $this->mercenary; |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
public function isMercenary(): ?bool |
249
|
|
|
{ |
250
|
|
|
return $this->getMercenary(); |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
public function setMercenary(bool $mercenary): self |
254
|
|
|
{ |
255
|
|
|
$this->mercenary = $mercenary; |
256
|
|
|
return $this; |
257
|
|
|
} |
258
|
|
|
|
259
|
1 |
|
public function getSpp(): ?int |
260
|
|
|
{ |
261
|
1 |
|
return $this->spp; |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
public function setSpp(int $spp): self |
265
|
|
|
{ |
266
|
|
|
$this->spp = $spp; |
267
|
|
|
|
268
|
|
|
return $this; |
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
public function getActions(): ?array |
272
|
|
|
{ |
273
|
|
|
return $this->actions; |
274
|
|
|
} |
275
|
|
|
|
276
|
1 |
|
public function setActions(?array $actions): self |
277
|
|
|
{ |
278
|
1 |
|
$this->actions = $actions; |
279
|
|
|
|
280
|
1 |
|
return $this; |
281
|
|
|
} |
282
|
|
|
|
283
|
|
|
public function getTeamVersion(): ?TeamVersion |
284
|
|
|
{ |
285
|
|
|
return $this->teamVersion; |
286
|
|
|
} |
287
|
|
|
|
288
|
1 |
|
public function setTeamVersion(?TeamVersion $teamVersion): self |
289
|
|
|
{ |
290
|
1 |
|
$this->teamVersion = $teamVersion; |
291
|
|
|
|
292
|
1 |
|
return $this; |
293
|
|
|
} |
294
|
|
|
|
295
|
|
|
/** |
296
|
|
|
* @ORM\PostLoad |
297
|
|
|
* @ORM\PrePersist |
298
|
|
|
* @ORM\PreUpdate |
299
|
|
|
*/ |
300
|
|
|
public function loadDefaultDatas(): void |
301
|
|
|
{ |
302
|
|
|
if ($this->getPlayer()) { |
303
|
|
|
if (!$this->getPlayer()->getTeam()) { |
304
|
|
|
$this->getPlayer()->setTeam($this->getTeamVersion()->getTeam()); |
305
|
|
|
} |
306
|
|
|
if (!$this->getCharacteristics()) { |
307
|
|
|
$this->setCharacteristics(PlayerHelper::getPlayerCharacteristics($this->getPlayer())); |
308
|
|
|
} |
309
|
|
|
if (!$this->getSkills()) { |
310
|
|
|
$this->setSkills(PlayerHelper::getPlayerSkills($this->getPlayer())); |
311
|
|
|
} |
312
|
|
|
} |
313
|
|
|
} |
314
|
|
|
|
315
|
|
|
public function getSppLevel(): ?string |
316
|
|
|
{ |
317
|
|
|
return $this->sppLevel; |
318
|
|
|
} |
319
|
|
|
|
320
|
1 |
|
public function setSppLevel(string $sppLevel): self |
321
|
|
|
{ |
322
|
1 |
|
$this->sppLevel = $sppLevel; |
323
|
|
|
|
324
|
1 |
|
return $this; |
325
|
|
|
} |
326
|
|
|
|
327
|
|
|
public function __toString() |
328
|
|
|
{ |
329
|
|
|
return $this->getPlayer()->getName() . "#" . $this->getId(); |
330
|
|
|
} |
331
|
|
|
} |
332
|
|
|
|