|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Obblm\Core\Helper\Rule\Inducement; |
|
4
|
|
|
|
|
5
|
|
|
use Obblm\Core\Contracts\InducementInterface; |
|
6
|
|
|
use Obblm\Core\Contracts\PositionInterface; |
|
7
|
|
|
use Obblm\Core\Exception\NotFoundKeyException; |
|
8
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
|
9
|
|
|
|
|
10
|
|
|
class StarPlayer extends AbstractInducement implements PositionInterface |
|
11
|
|
|
{ |
|
12
|
|
|
/** @var array $characteristics */ |
|
13
|
|
|
protected $characteristics; |
|
14
|
|
|
/** @var array $skills */ |
|
15
|
|
|
protected $skills; |
|
16
|
|
|
|
|
17
|
1 |
|
protected function hydrateWithOptions() |
|
18
|
|
|
{ |
|
19
|
1 |
|
parent::hydrateWithOptions(); |
|
20
|
1 |
|
$this->characteristics = $this->options['characteristics']; |
|
21
|
1 |
|
$this->skills = $this->options['skills']; |
|
22
|
1 |
|
} |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @return array |
|
26
|
|
|
*/ |
|
27
|
|
|
public function getCharacteristics(): array |
|
28
|
|
|
{ |
|
29
|
|
|
return $this->characteristics; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @param array|null $characteristics |
|
34
|
|
|
* @return $this |
|
35
|
|
|
*/ |
|
36
|
|
|
public function setCharacteristics(?array $characteristics): self |
|
37
|
|
|
{ |
|
38
|
|
|
$this->characteristics = $characteristics; |
|
39
|
|
|
return $this; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @return array |
|
44
|
|
|
*/ |
|
45
|
|
|
public function getSkills(): array |
|
46
|
|
|
{ |
|
47
|
|
|
return $this->skills; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @param array|null $skills |
|
52
|
|
|
* @return $this |
|
53
|
|
|
*/ |
|
54
|
|
|
public function setSkills(?array $skills): self |
|
55
|
|
|
{ |
|
56
|
|
|
$this->skills = $skills; |
|
57
|
|
|
return $this; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function getCost(): int |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->getValue(); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function getMin(): int |
|
66
|
|
|
{ |
|
67
|
|
|
return 0; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public function getOption(string $key) |
|
71
|
|
|
{ |
|
72
|
|
|
if (!isset($this->options[$key])) { |
|
73
|
|
|
throw new NotFoundKeyException($key, 'options', self::class); |
|
74
|
|
|
} |
|
75
|
|
|
return $this->options[$key]; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function isJourneyMan(): bool |
|
79
|
|
|
{ |
|
80
|
|
|
return false; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
1 |
|
public function configureOptions(OptionsResolver $resolver):void |
|
84
|
|
|
{ |
|
85
|
1 |
|
parent::configureOptions($resolver); |
|
86
|
1 |
|
$resolver->setDefaults([ |
|
87
|
1 |
|
'characteristics' => [], |
|
88
|
|
|
'skills' => [], |
|
89
|
|
|
]) |
|
90
|
1 |
|
->setRequired(['characteristics']) |
|
91
|
1 |
|
->setAllowedTypes('characteristics', ['array']) |
|
92
|
1 |
|
->setAllowedTypes('skills', ['array']) |
|
93
|
|
|
; |
|
94
|
1 |
|
} |
|
95
|
|
|
} |
|
96
|
|
|
|