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