@@ -84,7 +84,7 @@ |
||
84 | 84 | |
85 | 85 | (new Table($output)) |
86 | 86 | ->setHeaders(['Level', 'Attack IV', 'Defense IV', 'Stamina IV', 'Perfection']) |
87 | - ->setRows($pokemon->getIvCombinaisons()->map(function (IvCombinaison $combinaison) { |
|
87 | + ->setRows($pokemon->getIvCombinaisons()->map(function(IvCombinaison $combinaison) { |
|
88 | 88 | return [ |
89 | 89 | $combinaison->getLevel()->getLevel(), |
90 | 90 | $combinaison->getAttack(), |
@@ -24,13 +24,13 @@ |
||
24 | 24 | $collection = $this->getGameMasterJsonCollection(); |
25 | 25 | |
26 | 26 | $finded = $collection |
27 | - ->filter(function ($line) { |
|
27 | + ->filter(function($line) { |
|
28 | 28 | if (isset($line->pokemonSettings)) { |
29 | 29 | return true; |
30 | 30 | } |
31 | 31 | return false; |
32 | 32 | }) |
33 | - ->filter(function ($line) use ($name) { |
|
33 | + ->filter(function($line) use ($name) { |
|
34 | 34 | return $line->pokemonSettings->pokemonId === strtoupper($name); |
35 | 35 | }) |
36 | 36 | ->first() |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | ->getIntervalLevelFiltered($pokemon, $trainer); |
29 | 29 | |
30 | 30 | $levels |
31 | - ->each(function ($level) use (&$dusts, &$loop, $trainer) { |
|
31 | + ->each(function($level) use (&$dusts, &$loop, $trainer) { |
|
32 | 32 | $loop += 0.5; |
33 | 33 | $dusts += $level->dust * 2; |
34 | 34 | }); |
35 | 35 | |
36 | - if ($pokemon*2 % 2 === 1) { |
|
36 | + if ($pokemon * 2 % 2 === 1) { |
|
37 | 37 | $dusts -= $levels->first()->dust; |
38 | 38 | } |
39 | 39 | |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | ->getIntervalLevelFiltered($pokemon, $trainer); |
59 | 59 | |
60 | 60 | $levels |
61 | - ->each(function ($level) use (&$candies, &$loop, $trainer) { |
|
61 | + ->each(function($level) use (&$candies, &$loop, $trainer) { |
|
62 | 62 | $loop += 0.5; |
63 | 63 | $candies += $level->candy * 2; |
64 | 64 | }); |
65 | 65 | |
66 | - if ($pokemon*2 % 2 === 1) { |
|
66 | + if ($pokemon * 2 % 2 === 1) { |
|
67 | 67 | $candies -= $levels->first()->candy; |
68 | 68 | } |
69 | 69 |
@@ -46,8 +46,8 @@ |
||
46 | 46 | public function getIntervalLevelFiltered(float $min, float $max) |
47 | 47 | { |
48 | 48 | return $this->getGameMasterJsonCollection() |
49 | - ->filter(function ($level) use ($min, $max) { |
|
50 | - return (int)$min<=$level->level && $level->level<=(int)$max ? true: false; |
|
49 | + ->filter(function($level) use ($min, $max) { |
|
50 | + return (int) $min <= $level->level && $level->level <= (int) $max ? true : false; |
|
51 | 51 | }); |
52 | 52 | } |
53 | 53 | } |
@@ -172,15 +172,15 @@ discard block |
||
172 | 172 | { |
173 | 173 | $this->potentialCombinaisons = $this->potentialCombinaisons |
174 | 174 | // Eliminate impossible combinaison for global combinaison |
175 | - ->filter(function ($combinaison) use ($global) { |
|
175 | + ->filter(function($combinaison) use ($global) { |
|
176 | 176 | if ($combinaison->getTotal() <= $this->getMaxGlobalEvaluation($global) && |
177 | - $combinaison->getTotal() > $this->getMaxGlobalEvaluation($global-1)) { |
|
177 | + $combinaison->getTotal() > $this->getMaxGlobalEvaluation($global - 1)) { |
|
178 | 178 | return true; |
179 | 179 | } |
180 | 180 | return false; |
181 | 181 | }) |
182 | 182 | // Eliminate impossible combinaisons with best stats |
183 | - ->filter(function ($combinaison) use ($bestStats) { |
|
183 | + ->filter(function($combinaison) use ($bestStats) { |
|
184 | 184 | $nonBestStats = array_diff(self::AVAILABLE_OPTIONS, $bestStats); |
185 | 185 | foreach ($nonBestStats as $nonBestStat) { |
186 | 186 | if ($combinaison->getAbbreviated($nonBestStat) >= $combinaison->getMaximalIv()) { |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | return true; |
191 | 191 | }) |
192 | 192 | // Eliminate impossible combinaisons with equals best stats |
193 | - ->filter(function ($combinaison) use ($bestStats) { |
|
193 | + ->filter(function($combinaison) use ($bestStats) { |
|
194 | 194 | foreach ($bestStats as $bestStat) { |
195 | 195 | if ($combinaison->getAbbreviated($bestStat) != $combinaison->getMaximalIv()) { |
196 | 196 | return false; |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | * Return the minimum of perfection of a Pokemon |
87 | 87 | * @return IvCombinaison|null |
88 | 88 | */ |
89 | - public function getMinimumCombinaison(): ?IvCombinaison |
|
89 | + public function getMinimumCombinaison(): ? IvCombinaison |
|
90 | 90 | { |
91 | 91 | return $this->getIvCombinaisons() |
92 | 92 | ->sortBy( |
93 | - function (IvCombinaison $combinaison) { |
|
93 | + function(IvCombinaison $combinaison) { |
|
94 | 94 | return $combinaison->getPerfection(); |
95 | 95 | }) |
96 | 96 | ->last(); |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | * Return the maximum of perfection of a Pokemon |
101 | 101 | * @return IvCombinaison|null |
102 | 102 | */ |
103 | - public function getMaximumCombinaison(): ?IvCombinaison |
|
103 | + public function getMaximumCombinaison(): ? IvCombinaison |
|
104 | 104 | { |
105 | 105 | return $this->getIvCombinaisons() |
106 | 106 | ->sortBy( |
107 | - function (IvCombinaison $combinaison) { |
|
107 | + function(IvCombinaison $combinaison) { |
|
108 | 108 | return $combinaison->getPerfection(); |
109 | 109 | }) |
110 | 110 | ->first(); |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | * Return the average perfection of a Pokemon |
115 | 115 | * @return float|null |
116 | 116 | */ |
117 | - public function getAveragePerfection(): ?float |
|
117 | + public function getAveragePerfection(): ? float |
|
118 | 118 | { |
119 | 119 | return $this->getIvCombinaisons()->average( |
120 | - function (IvCombinaison $combinaison) { |
|
120 | + function(IvCombinaison $combinaison) { |
|
121 | 121 | return $combinaison->getPerfection(); |
122 | 122 | }); |
123 | 123 | } |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | * Return the min attack of a Pokemon |
127 | 127 | * @return int |
128 | 128 | */ |
129 | - public function getMinAttack(): ?int |
|
129 | + public function getMinAttack(): ? int |
|
130 | 130 | { |
131 | 131 | return $this->getIvCombinaisons()->min( |
132 | - function (IvCombinaison $combinaison) { |
|
132 | + function(IvCombinaison $combinaison) { |
|
133 | 133 | return $combinaison->getAttack(); |
134 | 134 | }); |
135 | 135 | } |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | * Return the max attack of a Pokemon |
139 | 139 | * @return int |
140 | 140 | */ |
141 | - public function getMaxAttack(): ?int |
|
141 | + public function getMaxAttack(): ? int |
|
142 | 142 | { |
143 | 143 | return $this->getIvCombinaisons()->max( |
144 | - function (IvCombinaison $combinaison) { |
|
144 | + function(IvCombinaison $combinaison) { |
|
145 | 145 | return $combinaison->getAttack(); |
146 | 146 | }); |
147 | 147 | } |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | * Return the min defense of a Pokemon |
151 | 151 | * @return int |
152 | 152 | */ |
153 | - public function getMinDefense(): ?int |
|
153 | + public function getMinDefense(): ? int |
|
154 | 154 | { |
155 | 155 | return $this->getIvCombinaisons()->min( |
156 | - function (IvCombinaison $combinaison) { |
|
156 | + function(IvCombinaison $combinaison) { |
|
157 | 157 | return $combinaison->getDefense(); |
158 | 158 | }); |
159 | 159 | } |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | * Return the max defense of a Pokemon |
163 | 163 | * @return int |
164 | 164 | */ |
165 | - public function getMaxDefense(): ?int |
|
165 | + public function getMaxDefense(): ? int |
|
166 | 166 | { |
167 | 167 | return $this->getIvCombinaisons()->max( |
168 | - function (IvCombinaison $combinaison) { |
|
168 | + function(IvCombinaison $combinaison) { |
|
169 | 169 | return $combinaison->getDefense(); |
170 | 170 | }); |
171 | 171 | } |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | * Return the min stamina of a Pokemon |
175 | 175 | * @return int |
176 | 176 | */ |
177 | - public function getMinStamina(): ?int |
|
177 | + public function getMinStamina(): ? int |
|
178 | 178 | { |
179 | 179 | return $this->getIvCombinaisons()->min( |
180 | - function (IvCombinaison $combinaison) { |
|
180 | + function(IvCombinaison $combinaison) { |
|
181 | 181 | return $combinaison->getStamina(); |
182 | 182 | }); |
183 | 183 | } |
@@ -186,10 +186,10 @@ discard block |
||
186 | 186 | * Return the max stamina of a Pokemon |
187 | 187 | * @return int |
188 | 188 | */ |
189 | - public function getMaxStamina(): ?int |
|
189 | + public function getMaxStamina(): ? int |
|
190 | 190 | { |
191 | 191 | return $this->getIvCombinaisons()->max( |
192 | - function (IvCombinaison $combinaison) { |
|
192 | + function(IvCombinaison $combinaison) { |
|
193 | 193 | return $combinaison->getStamina(); |
194 | 194 | }); |
195 | 195 | } |
@@ -198,13 +198,13 @@ discard block |
||
198 | 198 | * Return the min level of a Pokemon |
199 | 199 | * @return float |
200 | 200 | */ |
201 | - public function getMinLevel(): ?float |
|
201 | + public function getMinLevel(): ? float |
|
202 | 202 | { |
203 | 203 | return $this->getIvCombinaisons() |
204 | - ->map(function (IvCombinaison $combinaison) { |
|
204 | + ->map(function(IvCombinaison $combinaison) { |
|
205 | 205 | return $combinaison->getLevel()->getLevel(); |
206 | 206 | }) |
207 | - ->sortBy(function ($value) { |
|
207 | + ->sortBy(function($value) { |
|
208 | 208 | return $value; |
209 | 209 | }) |
210 | 210 | ->first(); |
@@ -214,13 +214,13 @@ discard block |
||
214 | 214 | * Return the max level of a Pokemon |
215 | 215 | * @return float |
216 | 216 | */ |
217 | - public function getMaxLevel(): ?float |
|
217 | + public function getMaxLevel(): ? float |
|
218 | 218 | { |
219 | 219 | return $this->getIvCombinaisons() |
220 | - ->map(function (IvCombinaison $combinaison) { |
|
220 | + ->map(function(IvCombinaison $combinaison) { |
|
221 | 221 | return $combinaison->getLevel()->getLevel(); |
222 | 222 | }) |
223 | - ->sortBy(function ($value) { |
|
223 | + ->sortBy(function($value) { |
|
224 | 224 | return $value; |
225 | 225 | }) |
226 | 226 | ->last(); |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * |
286 | 286 | * @return int|null |
287 | 287 | */ |
288 | - public function getCp(): ?int |
|
288 | + public function getCp(): ? int |
|
289 | 289 | { |
290 | 290 | return $this->cp; |
291 | 291 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * |
309 | 309 | * @return int|null |
310 | 310 | */ |
311 | - public function getHp(): ?int |
|
311 | + public function getHp(): ? int |
|
312 | 312 | { |
313 | 313 | return $this->hp; |
314 | 314 | } |