|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Commander |
|
5
|
|
|
* |
|
6
|
|
|
* @author Noé Zufferey |
|
7
|
|
|
* @copyright Expansion - le jeu |
|
8
|
|
|
* |
|
9
|
|
|
* @package Ares |
|
10
|
|
|
* @update 13.02.14_ |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace Asylamba\Modules\Ares\Model; |
|
14
|
|
|
|
|
15
|
|
|
use Asylamba\Modules\Athena\Resource\ShipResource; |
|
16
|
|
|
|
|
17
|
|
|
class Commander |
|
18
|
|
|
{ |
|
19
|
|
|
public $id = 0; |
|
20
|
|
|
public $name = ''; |
|
21
|
|
|
public $experience = 0; |
|
22
|
|
|
public $avatar = ''; |
|
23
|
|
|
public $rPlayer = 0; |
|
24
|
|
|
public $rBase = 0; |
|
25
|
|
|
public $comment = ''; |
|
26
|
|
|
public $sexe = 0; |
|
27
|
|
|
public $age = 0; |
|
28
|
|
|
public $level = 0; |
|
29
|
|
|
public $uExperience = 0; |
|
30
|
|
|
public $palmares = 0; |
|
31
|
|
|
public $statement = Commander::INSCHOOL; |
|
32
|
|
|
public $line = 1; |
|
33
|
|
|
public $dCreation = ''; |
|
34
|
|
|
public $dAffectation = ''; |
|
35
|
|
|
public $dDeath = ''; |
|
36
|
|
|
|
|
37
|
|
|
# variables de jointure quelconque |
|
38
|
|
|
public $oBName = ''; |
|
39
|
|
|
public $playerName = ''; |
|
40
|
|
|
public $playerColor = 0; |
|
41
|
|
|
|
|
42
|
|
|
# variables de combat |
|
43
|
|
|
public $squadronsIds = array(); |
|
44
|
|
|
public $armyInBegin = array(); |
|
45
|
|
|
public $armyAtEnd = array(); |
|
46
|
|
|
public $pevInBegin = 0; |
|
47
|
|
|
public $earnedExperience = 0; |
|
48
|
|
|
public $winner = FALSE; |
|
49
|
|
|
public $isAttacker = NULL; |
|
50
|
|
|
|
|
51
|
|
|
# variables de déplacement |
|
52
|
|
|
public $dStart = ''; |
|
53
|
|
|
public $dArrival = ''; |
|
54
|
|
|
public $resources = 0; |
|
55
|
|
|
public $travelType = 0; |
|
56
|
|
|
public $travelLength = 0; |
|
57
|
|
|
public $rStartPlace = 0; |
|
58
|
|
|
public $rDestinationPlace = 0; |
|
59
|
|
|
public $startPlaceName = ''; |
|
60
|
|
|
public $startPlacePop = 0; |
|
61
|
|
|
public $destinationPlaceName = ''; |
|
62
|
|
|
public $destinationPlacePop = 0; |
|
63
|
|
|
# Tableau d'objets squadron |
|
64
|
|
|
public $army = array(); |
|
65
|
|
|
|
|
66
|
|
|
public $uCommander = ''; |
|
67
|
|
|
public $hasToU = TRUE; |
|
68
|
|
|
public $hasArmySetted = FALSE; |
|
69
|
|
|
public $uMethodCtced = FALSE; |
|
70
|
|
|
public $lastUMethod = NULL; |
|
71
|
|
|
|
|
72
|
|
|
const COEFFSCHOOL = 100; |
|
73
|
|
|
const COEFFEARNEDEXP = 50; |
|
74
|
|
|
const COEFFEXPPLAYER = 100; |
|
75
|
|
|
const CMDBASELVL = 100; |
|
76
|
|
|
|
|
77
|
|
|
const FLEETSPEED = 35; |
|
78
|
|
|
|
|
79
|
|
|
const COEFFMOVEINSYSTEM = 584; |
|
80
|
|
|
const COEFFMOVEOUTOFSYSTEM = 600; |
|
81
|
|
|
const COEFFMOVEINTERSYSTEM = 50000; |
|
82
|
|
|
|
|
83
|
|
|
const LVLINCOMECOMMANDER = 200; |
|
84
|
|
|
|
|
85
|
|
|
const CREDITCOEFFTOCOLONIZE = 80000; |
|
86
|
|
|
const CREDITCOEFFTOCONQUER = 150000; |
|
87
|
|
|
|
|
88
|
|
|
# loot const |
|
89
|
|
|
const LIMITTOLOOT = 5000; |
|
90
|
|
|
const COEFFLOOT = 275; |
|
91
|
|
|
|
|
92
|
|
|
# Commander statements |
|
93
|
|
|
const INSCHOOL = 0; # dans l'école |
|
94
|
|
|
const AFFECTED = 1; # autour de la base |
|
95
|
|
|
const MOVING = 2; # en déplacement |
|
96
|
|
|
const DEAD = 3; # mort |
|
97
|
|
|
const DESERT = 4; # déserté |
|
98
|
|
|
const RETIRED = 5; # à la retraite |
|
99
|
|
|
const ONSALE = 6; # dans le marché |
|
100
|
|
|
const RESERVE = 7; # dans la réserve (comme à l'école mais n'apprend pas) |
|
101
|
|
|
|
|
102
|
|
|
# types of travel |
|
103
|
|
|
const MOVE = 0; # déplacement |
|
104
|
|
|
const LOOT = 1; # pillage |
|
105
|
|
|
const COLO = 2; # colo ou conquete |
|
106
|
|
|
const BACK = 3; # retour après une action |
|
107
|
|
|
|
|
108
|
|
|
const MAXTRAVELTIME = 57600; |
|
109
|
|
|
const DISTANCEMAX = 30; |
|
110
|
|
|
|
|
111
|
|
|
# Const de lineCoord |
|
112
|
|
|
public static $LINECOORD = array(1, 1, 1, 2, 2, 1, 2, 3, 3, 1, 2, 3, 4, 4, 2, 3, 4, 5, 5, 3, 4, 5, 6, 6, 4, 5, 6, 7, 7, 5, 6, 7); |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* @param int $id |
|
116
|
|
|
* @return $this |
|
117
|
|
|
*/ |
|
118
|
|
|
public function setId($id) |
|
119
|
|
|
{ |
|
120
|
|
|
$this->id = $id; |
|
121
|
|
|
|
|
122
|
|
|
return $this; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* @return int |
|
127
|
|
|
*/ |
|
128
|
|
|
public function getId() |
|
129
|
|
|
{ |
|
130
|
|
|
return $this->id; |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
/** |
|
134
|
|
|
* @param string $name |
|
135
|
|
|
* @return $this |
|
136
|
|
|
*/ |
|
137
|
|
|
public function setName($name) |
|
138
|
|
|
{ |
|
139
|
|
|
$this->name = $name; |
|
140
|
|
|
|
|
141
|
|
|
return $this; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* @return string |
|
146
|
|
|
*/ |
|
147
|
|
|
public function getName() |
|
148
|
|
|
{ |
|
149
|
|
|
return $this->name; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @param string $avatar |
|
154
|
|
|
* @return $this |
|
155
|
|
|
*/ |
|
156
|
|
|
public function setAvatar($avatar) |
|
157
|
|
|
{ |
|
158
|
|
|
$this->avatar = $avatar; |
|
159
|
|
|
|
|
160
|
|
|
return $this; |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
/** |
|
164
|
|
|
* @return string |
|
165
|
|
|
*/ |
|
166
|
|
|
public function getAvatar() |
|
167
|
|
|
{ |
|
168
|
|
|
return $this->avatar; |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* @param int $rPlayer |
|
173
|
|
|
* @return $this |
|
174
|
|
|
*/ |
|
175
|
|
|
public function setRPlayer($rPlayer) |
|
176
|
|
|
{ |
|
177
|
|
|
$this->rPlayer = $rPlayer; |
|
178
|
|
|
|
|
179
|
|
|
return $this; |
|
180
|
|
|
} |
|
181
|
|
|
|
|
182
|
|
|
/** |
|
183
|
|
|
* @return int |
|
184
|
|
|
*/ |
|
185
|
|
|
public function getRPlayer() |
|
186
|
|
|
{ |
|
187
|
|
|
return $this->rPlayer; |
|
188
|
|
|
} |
|
189
|
|
|
|
|
190
|
|
|
/** |
|
191
|
|
|
* @param string $playerName |
|
192
|
|
|
* @return $this |
|
193
|
|
|
*/ |
|
194
|
|
|
public function setPlayerName($playerName) |
|
195
|
|
|
{ |
|
196
|
|
|
$this->playerName = $playerName; |
|
197
|
|
|
|
|
198
|
|
|
return $this; |
|
199
|
|
|
} |
|
200
|
|
|
|
|
201
|
|
|
/** |
|
202
|
|
|
* @return string |
|
203
|
|
|
*/ |
|
204
|
|
|
public function getPlayerName() |
|
205
|
|
|
{ |
|
206
|
|
|
return $this->playerName; |
|
207
|
|
|
} |
|
208
|
|
|
|
|
209
|
|
|
/** |
|
210
|
|
|
* @param int $playerColor |
|
211
|
|
|
* @return $this |
|
212
|
|
|
*/ |
|
213
|
|
|
public function setPlayerColor($playerColor) |
|
214
|
|
|
{ |
|
215
|
|
|
$this->playerColor = $playerColor; |
|
216
|
|
|
|
|
217
|
|
|
return $this; |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
|
/** |
|
221
|
|
|
* @return int |
|
222
|
|
|
*/ |
|
223
|
|
|
public function getPlayerColor() |
|
224
|
|
|
{ |
|
225
|
|
|
return $this->playerColor; |
|
226
|
|
|
} |
|
227
|
|
|
|
|
228
|
|
|
/** |
|
229
|
|
|
* @param int $rBase |
|
230
|
|
|
* @return $this |
|
231
|
|
|
*/ |
|
232
|
|
|
public function setRBase($rBase) |
|
233
|
|
|
{ |
|
234
|
|
|
$this->rBase = $rBase; |
|
235
|
|
|
|
|
236
|
|
|
return $this; |
|
237
|
|
|
} |
|
238
|
|
|
|
|
239
|
|
|
/** |
|
240
|
|
|
* @return int |
|
241
|
|
|
*/ |
|
242
|
|
|
public function getRBase() |
|
243
|
|
|
{ |
|
244
|
|
|
return $this->rBase; |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* @param string $comment |
|
249
|
|
|
* @return $this |
|
250
|
|
|
*/ |
|
251
|
|
|
public function setComment($comment) |
|
252
|
|
|
{ |
|
253
|
|
|
$this->comment = $comment; |
|
254
|
|
|
|
|
255
|
|
|
return $this; |
|
256
|
|
|
} |
|
257
|
|
|
|
|
258
|
|
|
/** |
|
259
|
|
|
* @return string |
|
260
|
|
|
*/ |
|
261
|
|
|
public function getComment() |
|
262
|
|
|
{ |
|
263
|
|
|
return $this->comment; |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
/** |
|
267
|
|
|
* @param int $sexe |
|
268
|
|
|
* @return $this |
|
269
|
|
|
*/ |
|
270
|
|
|
public function setSexe($sexe) |
|
271
|
|
|
{ |
|
272
|
|
|
$this->sexe = $sexe; |
|
273
|
|
|
|
|
274
|
|
|
return $this; |
|
275
|
|
|
} |
|
276
|
|
|
|
|
277
|
|
|
/** |
|
278
|
|
|
* @return int |
|
279
|
|
|
*/ |
|
280
|
|
|
public function getSexe() |
|
281
|
|
|
{ |
|
282
|
|
|
return $this->sexe; |
|
283
|
|
|
} |
|
284
|
|
|
|
|
285
|
|
|
/** |
|
286
|
|
|
* @param int $age |
|
287
|
|
|
* @return $this |
|
288
|
|
|
*/ |
|
289
|
|
|
public function setAge($age) |
|
290
|
|
|
{ |
|
291
|
|
|
$this->age = $age; |
|
292
|
|
|
|
|
293
|
|
|
return $this; |
|
294
|
|
|
} |
|
295
|
|
|
|
|
296
|
|
|
/** |
|
297
|
|
|
* @return int |
|
298
|
|
|
*/ |
|
299
|
|
|
public function getAge() |
|
300
|
|
|
{ |
|
301
|
|
|
return $this->age; |
|
302
|
|
|
} |
|
303
|
|
|
|
|
304
|
|
|
/** |
|
305
|
|
|
* @param int $level |
|
306
|
|
|
* @return $this |
|
307
|
|
|
*/ |
|
308
|
|
|
public function setLevel($level) |
|
309
|
|
|
{ |
|
310
|
|
|
$this->level = $level; |
|
311
|
|
|
|
|
312
|
|
|
return $this; |
|
313
|
|
|
} |
|
|
|
|
|
|
314
|
|
|
|
|
315
|
|
|
/** |
|
316
|
|
|
* @return int |
|
317
|
|
|
*/ |
|
318
|
|
|
public function getLevel() |
|
319
|
|
|
{ |
|
320
|
|
|
return $this->level; |
|
321
|
|
|
} |
|
322
|
|
|
|
|
323
|
|
|
/** |
|
324
|
|
|
* @param int $experience |
|
325
|
|
|
* @return $this |
|
326
|
|
|
*/ |
|
327
|
|
|
public function setExperience($experience) |
|
328
|
|
|
{ |
|
329
|
|
|
$this->experience = $experience; |
|
330
|
|
|
|
|
331
|
|
|
return $this; |
|
332
|
|
|
} |
|
333
|
|
|
|
|
334
|
|
|
/** |
|
335
|
|
|
* @return int |
|
336
|
|
|
*/ |
|
337
|
|
|
public function getExperience() |
|
338
|
|
|
{ |
|
339
|
|
|
return $this->experience; |
|
340
|
|
|
} |
|
341
|
|
|
|
|
342
|
|
|
/** |
|
343
|
|
|
* @param int $earnedExperience |
|
344
|
|
|
* @return $this |
|
345
|
|
|
*/ |
|
346
|
|
|
public function setEarnedExperience($earnedExperience) |
|
347
|
|
|
{ |
|
348
|
|
|
$this->earnedExperience = $earnedExperience; |
|
349
|
|
|
|
|
350
|
|
|
return $this; |
|
351
|
|
|
} |
|
352
|
|
|
|
|
353
|
|
|
/** |
|
354
|
|
|
* @return int |
|
355
|
|
|
*/ |
|
356
|
|
|
public function getEarnedExperience() |
|
357
|
|
|
{ |
|
358
|
|
|
return $this->earnedExperience; |
|
359
|
|
|
} |
|
360
|
|
|
|
|
361
|
|
|
/** |
|
362
|
|
|
* @param string $updatedAt |
|
363
|
|
|
* @return $this |
|
364
|
|
|
*/ |
|
365
|
|
|
public function setUpdatedAt($updatedAt) |
|
366
|
|
|
{ |
|
367
|
|
|
$this->uCommander = $updatedAt; |
|
368
|
|
|
|
|
369
|
|
|
return $this; |
|
370
|
|
|
} |
|
371
|
|
|
|
|
372
|
|
|
/** |
|
373
|
|
|
* @return string |
|
374
|
|
|
*/ |
|
375
|
|
|
public function getUpdatedAt() |
|
376
|
|
|
{ |
|
377
|
|
|
return $this->uCommander; |
|
378
|
|
|
} |
|
379
|
|
|
|
|
380
|
|
|
/** |
|
381
|
|
|
* @param int $palmares |
|
382
|
|
|
* @return $this |
|
383
|
|
|
*/ |
|
384
|
|
|
public function setPalmares($palmares) |
|
385
|
|
|
{ |
|
386
|
|
|
$this->palmares = $palmares; |
|
387
|
|
|
|
|
388
|
|
|
return $this; |
|
389
|
|
|
} |
|
390
|
|
|
|
|
391
|
|
|
/** |
|
392
|
|
|
* @return int |
|
393
|
|
|
*/ |
|
394
|
|
|
public function getPalmares() |
|
395
|
|
|
{ |
|
396
|
|
|
return $this->palmares; |
|
397
|
|
|
} |
|
398
|
|
|
|
|
399
|
|
|
/** |
|
400
|
|
|
* @param int $travelType |
|
401
|
|
|
*/ |
|
402
|
|
|
public function setTravelType($travelType) |
|
403
|
|
|
{ |
|
404
|
|
|
$this->travelType = $travelType; |
|
405
|
|
|
|
|
406
|
|
|
return $this; |
|
407
|
|
|
} |
|
408
|
|
|
|
|
409
|
|
|
/** |
|
410
|
|
|
* @return int |
|
411
|
|
|
*/ |
|
412
|
|
|
public function getTravelType() |
|
413
|
|
|
{ |
|
414
|
|
|
return $this->travelType; |
|
415
|
|
|
} |
|
416
|
|
|
|
|
417
|
|
|
/** |
|
418
|
|
|
* @param int $travelLength |
|
419
|
|
|
* @return Commander |
|
420
|
|
|
*/ |
|
421
|
|
|
public function setTravelLength($travelLength) |
|
422
|
|
|
{ |
|
423
|
|
|
$this->travelLength = $travelLength; |
|
424
|
|
|
|
|
425
|
|
|
return $this; |
|
426
|
|
|
} |
|
427
|
|
|
|
|
428
|
|
|
/** |
|
429
|
|
|
* @return int |
|
430
|
|
|
*/ |
|
431
|
|
|
public function getTravelLength() |
|
432
|
|
|
{ |
|
433
|
|
|
return $this->travelLength; |
|
434
|
|
|
} |
|
435
|
|
|
|
|
436
|
|
|
/** |
|
437
|
|
|
* @param int $startPlaceId |
|
438
|
|
|
* @return Commander |
|
439
|
|
|
*/ |
|
440
|
|
|
public function setStartPlaceId($startPlaceId) |
|
441
|
|
|
{ |
|
442
|
|
|
$this->rStartPlace = $startPlaceId; |
|
443
|
|
|
|
|
444
|
|
|
return $this; |
|
445
|
|
|
} |
|
446
|
|
|
|
|
447
|
|
|
/** |
|
448
|
|
|
* @return int |
|
449
|
|
|
*/ |
|
450
|
|
|
public function getStartPlaceId() |
|
451
|
|
|
{ |
|
452
|
|
|
return $this->rStartPlace; |
|
453
|
|
|
} |
|
454
|
|
|
|
|
455
|
|
|
/** |
|
456
|
|
|
* @param int $rDestinationPlace |
|
457
|
|
|
* @return $this |
|
458
|
|
|
*/ |
|
459
|
|
|
public function setRPlaceDestination($rDestinationPlace) |
|
460
|
|
|
{ |
|
461
|
|
|
$this->rDestinationPlace = $rDestinationPlace; |
|
462
|
|
|
|
|
463
|
|
|
return $this; |
|
464
|
|
|
} |
|
465
|
|
|
|
|
466
|
|
|
/** |
|
467
|
|
|
* @return int |
|
468
|
|
|
*/ |
|
469
|
|
|
public function getRPlaceDestination() |
|
470
|
|
|
{ |
|
471
|
|
|
return $this->rDestinationPlace; |
|
472
|
|
|
} |
|
473
|
|
|
|
|
474
|
|
|
/** |
|
475
|
|
|
* @param int $resources |
|
476
|
|
|
* @return $this |
|
477
|
|
|
*/ |
|
478
|
|
|
public function setResources($resources) |
|
479
|
|
|
{ |
|
480
|
|
|
$this->resources = $resources; |
|
481
|
|
|
|
|
482
|
|
|
return $this; |
|
483
|
|
|
} |
|
484
|
|
|
|
|
485
|
|
|
/** |
|
486
|
|
|
* @return int |
|
487
|
|
|
*/ |
|
488
|
|
|
public function getResources() |
|
489
|
|
|
{ |
|
490
|
|
|
return $this->resources; |
|
491
|
|
|
} |
|
492
|
|
|
|
|
493
|
|
|
/** |
|
494
|
|
|
* @param int $statement |
|
495
|
|
|
* @return $this |
|
496
|
|
|
*/ |
|
497
|
|
|
public function setStatement($statement) |
|
498
|
|
|
{ |
|
499
|
|
|
$this->statement = $statement; |
|
500
|
|
|
|
|
501
|
|
|
return $this; |
|
502
|
|
|
} |
|
503
|
|
|
|
|
504
|
|
|
/** |
|
505
|
|
|
* @return int |
|
506
|
|
|
*/ |
|
507
|
|
|
public function getStatement() |
|
508
|
|
|
{ |
|
509
|
|
|
return $this->statement; |
|
510
|
|
|
} |
|
511
|
|
|
|
|
512
|
|
|
/** |
|
513
|
|
|
* @param string $dCreation |
|
514
|
|
|
* @return $this |
|
515
|
|
|
*/ |
|
516
|
|
|
public function setDCreation($dCreation) |
|
517
|
|
|
{ |
|
518
|
|
|
$this->dCreation = $dCreation; |
|
519
|
|
|
|
|
520
|
|
|
return $this; |
|
521
|
|
|
} |
|
522
|
|
|
|
|
523
|
|
|
/** |
|
524
|
|
|
* @return string |
|
525
|
|
|
*/ |
|
526
|
|
|
public function getDCreation() |
|
527
|
|
|
{ |
|
528
|
|
|
return $this->dCreation; |
|
529
|
|
|
} |
|
530
|
|
|
|
|
531
|
|
|
/** |
|
532
|
|
|
* @param string $dAffectation |
|
533
|
|
|
* @return $this |
|
534
|
|
|
*/ |
|
535
|
|
|
public function setDAffectation($dAffectation) |
|
536
|
|
|
{ |
|
537
|
|
|
$this->dAffectation = $dAffectation; |
|
538
|
|
|
|
|
539
|
|
|
return $this; |
|
540
|
|
|
} |
|
541
|
|
|
|
|
542
|
|
|
/** |
|
543
|
|
|
* @return string |
|
544
|
|
|
*/ |
|
545
|
|
|
public function getDAffectation() |
|
546
|
|
|
{ |
|
547
|
|
|
return $this->dAffectation; |
|
548
|
|
|
} |
|
549
|
|
|
|
|
550
|
|
|
/** |
|
551
|
|
|
* @param string $startedAt |
|
552
|
|
|
* @return \Asylamba\Modules\Ares\Model\Commander |
|
553
|
|
|
*/ |
|
554
|
|
|
public function setStartedAt($startedAt) |
|
555
|
|
|
{ |
|
556
|
|
|
$this->dStart = $startedAt; |
|
557
|
|
|
|
|
558
|
|
|
return $this; |
|
559
|
|
|
} |
|
560
|
|
|
|
|
561
|
|
|
/** |
|
562
|
|
|
* @return string |
|
563
|
|
|
*/ |
|
564
|
|
|
public function getStartedAt() |
|
565
|
|
|
{ |
|
566
|
|
|
return $this->dStart; |
|
567
|
|
|
} |
|
568
|
|
|
|
|
569
|
|
|
/** |
|
570
|
|
|
* @param string $arrivalDate |
|
571
|
|
|
* @return $this |
|
572
|
|
|
*/ |
|
573
|
|
|
public function setArrivalDate($arrivalDate) |
|
574
|
|
|
{ |
|
575
|
|
|
$this->dArrival = $arrivalDate; |
|
576
|
|
|
|
|
577
|
|
|
return $this; |
|
578
|
|
|
} |
|
579
|
|
|
|
|
580
|
|
|
/** |
|
581
|
|
|
* @return string |
|
582
|
|
|
*/ |
|
583
|
|
|
public function getArrivalDate() |
|
584
|
|
|
{ |
|
585
|
|
|
return $this->dArrival; |
|
586
|
|
|
} |
|
587
|
|
|
|
|
588
|
|
|
/** |
|
589
|
|
|
* @param string $dDeath |
|
590
|
|
|
* @return $this |
|
591
|
|
|
*/ |
|
592
|
|
|
public function setDDeath($dDeath) |
|
593
|
|
|
{ |
|
594
|
|
|
$this->dDeath = $dDeath; |
|
595
|
|
|
|
|
596
|
|
|
return $this; |
|
597
|
|
|
} |
|
598
|
|
|
|
|
599
|
|
|
/** |
|
600
|
|
|
* @return string |
|
601
|
|
|
*/ |
|
602
|
|
|
public function getDDeath() |
|
603
|
|
|
{ |
|
604
|
|
|
return $this->dDeath; |
|
605
|
|
|
} |
|
606
|
|
|
|
|
607
|
|
|
/** |
|
608
|
|
|
* @param int $lengthTravel |
|
609
|
|
|
* @return $this |
|
610
|
|
|
*/ |
|
611
|
|
|
public function setLengthTravel($lengthTravel) |
|
612
|
|
|
{ |
|
613
|
|
|
$this->lengthTravel = $lengthTravel; |
|
|
|
|
|
|
614
|
|
|
|
|
615
|
|
|
return $this; |
|
616
|
|
|
} |
|
617
|
|
|
|
|
618
|
|
|
/** |
|
619
|
|
|
* @return int |
|
620
|
|
|
*/ |
|
621
|
|
|
public function getLengthTravel() |
|
622
|
|
|
{ |
|
623
|
|
|
return $this->lengthTravel; |
|
624
|
|
|
} |
|
625
|
|
|
|
|
626
|
|
|
/** |
|
627
|
|
|
* @param string $oBName |
|
628
|
|
|
* @return $this |
|
629
|
|
|
*/ |
|
630
|
|
|
public function setBaseName($oBName) |
|
631
|
|
|
{ |
|
632
|
|
|
$this->oBName = $oBName; |
|
633
|
|
|
|
|
634
|
|
|
return $this; |
|
635
|
|
|
} |
|
636
|
|
|
|
|
637
|
|
|
/** |
|
638
|
|
|
* @return string |
|
639
|
|
|
*/ |
|
640
|
|
|
public function getBaseName() |
|
641
|
|
|
{ |
|
642
|
|
|
return $this->oBName; |
|
643
|
|
|
} |
|
644
|
|
|
|
|
645
|
|
|
/** |
|
646
|
|
|
* @param string $doName |
|
647
|
|
|
* @return $this |
|
648
|
|
|
*/ |
|
649
|
|
|
public function setDestinationPlaceName($doName) |
|
650
|
|
|
{ |
|
651
|
|
|
$this->destinationPlaceName = $doName; |
|
652
|
|
|
|
|
653
|
|
|
return $this; |
|
654
|
|
|
} |
|
655
|
|
|
|
|
656
|
|
|
/** |
|
657
|
|
|
* @return string |
|
658
|
|
|
*/ |
|
659
|
|
|
public function getDestinationPlaceName() |
|
660
|
|
|
{ |
|
661
|
|
|
return $this->destinationPlaceName; |
|
662
|
|
|
} |
|
663
|
|
|
|
|
664
|
|
|
/** |
|
665
|
|
|
* @param array $squadronsIds |
|
666
|
|
|
* @return $this |
|
667
|
|
|
*/ |
|
668
|
|
|
public function setSquadronsIds($squadronsIds) |
|
669
|
|
|
{ |
|
670
|
|
|
$this->squadronsIds = $squadronsIds; |
|
671
|
|
|
|
|
672
|
|
|
return $this; |
|
673
|
|
|
} |
|
674
|
|
|
|
|
675
|
|
|
/** |
|
676
|
|
|
* @param int $squadronId |
|
677
|
|
|
* @return $this |
|
678
|
|
|
*/ |
|
679
|
|
|
public function addSquadronId($squadronId) |
|
680
|
|
|
{ |
|
681
|
|
|
$this->squadronsIds[] = $squadronId; |
|
682
|
|
|
|
|
683
|
|
|
return $this; |
|
684
|
|
|
} |
|
685
|
|
|
|
|
686
|
|
|
/** |
|
687
|
|
|
* @return array |
|
688
|
|
|
*/ |
|
689
|
|
|
public function getSquadronsIds() |
|
690
|
|
|
{ |
|
691
|
|
|
return $this->squadronsIds; |
|
692
|
|
|
} |
|
693
|
|
|
|
|
694
|
|
|
/** |
|
695
|
|
|
* @param array $armyInBegin |
|
696
|
|
|
* @return $this |
|
697
|
|
|
*/ |
|
698
|
|
|
public function setArmyInBegin($armyInBegin) |
|
699
|
|
|
{ |
|
700
|
|
|
$this->armyInBegin = $armyInBegin; |
|
701
|
|
|
|
|
702
|
|
|
return $this; |
|
703
|
|
|
} |
|
704
|
|
|
|
|
705
|
|
|
/** |
|
706
|
|
|
* @param array $army |
|
707
|
|
|
* @return $this |
|
708
|
|
|
*/ |
|
709
|
|
|
public function addArmyInBegin($army) |
|
710
|
|
|
{ |
|
711
|
|
|
$this->armyInBegin[] = $army; |
|
712
|
|
|
|
|
713
|
|
|
return $this; |
|
714
|
|
|
} |
|
715
|
|
|
|
|
716
|
|
|
/** |
|
717
|
|
|
* @return array |
|
718
|
|
|
*/ |
|
719
|
|
|
public function getArmyInBegin() |
|
720
|
|
|
{ |
|
721
|
|
|
return $this->armyInBegin; |
|
722
|
|
|
} |
|
723
|
|
|
|
|
724
|
|
|
/** |
|
725
|
|
|
* @param bool $isAttacker |
|
726
|
|
|
* @return $this |
|
727
|
|
|
*/ |
|
728
|
|
|
public function setIsAttacker($isAttacker) |
|
729
|
|
|
{ |
|
730
|
|
|
$this->isAttacker = $isAttacker; |
|
731
|
|
|
|
|
732
|
|
|
return $this; |
|
733
|
|
|
} |
|
734
|
|
|
|
|
735
|
|
|
/** |
|
736
|
|
|
* @return bool |
|
737
|
|
|
*/ |
|
738
|
|
|
public function getIsAttacker() |
|
739
|
|
|
{ |
|
740
|
|
|
return $this->isAttacker; |
|
741
|
|
|
} |
|
742
|
|
|
|
|
743
|
|
|
public function setArmy() |
|
744
|
|
|
{ |
|
745
|
|
|
if (!$this->hasArmySetted) { |
|
746
|
|
|
for( $i = 0; $i < count($this->squadronsIds) AND $i < 25; $i++) { |
|
|
|
|
|
|
747
|
|
|
$this->army[$i] = new Squadron( |
|
748
|
|
|
$this->armyInBegin[$i], |
|
749
|
|
|
$this->squadronsIds[$i], |
|
750
|
|
|
self::$LINECOORD[$i], |
|
751
|
|
|
$i, |
|
752
|
|
|
$this->id); |
|
753
|
|
|
} |
|
754
|
|
|
$this->setPevInBegin(); |
|
755
|
|
|
$this->hasArmySetted = TRUE; |
|
756
|
|
|
} |
|
757
|
|
|
} |
|
758
|
|
|
|
|
759
|
|
|
public function getArmy() |
|
760
|
|
|
{ |
|
761
|
|
|
$this->setArmy(); |
|
762
|
|
|
return $this->army; |
|
763
|
|
|
} |
|
764
|
|
|
|
|
765
|
|
|
public function setPevInBegin() { |
|
766
|
|
|
$pev = 0; |
|
767
|
|
|
foreach ($this->armyInBegin as $squadron) { |
|
768
|
|
|
for ($i = 0; $i < 12; $i++) { |
|
769
|
|
|
$pev += $squadron[$i] * ShipResource::getInfo($i, 'pev'); |
|
770
|
|
|
} |
|
771
|
|
|
} |
|
772
|
|
|
$this->pevInBegin = $pev; |
|
|
|
|
|
|
773
|
|
|
} |
|
774
|
|
|
|
|
775
|
|
|
public function getPevInBegin() |
|
776
|
|
|
{ |
|
777
|
|
|
return $this->pevInBegin; |
|
778
|
|
|
} |
|
779
|
|
|
|
|
780
|
|
|
public function getPev() { |
|
781
|
|
|
$pev = 0; |
|
782
|
|
|
foreach ($this->armyInBegin as $squadron) { |
|
783
|
|
|
for ($i = 0; $i < 12; $i++) { |
|
784
|
|
|
$pev += $squadron[$i] * ShipResource::getInfo($i, 'pev'); |
|
785
|
|
|
} |
|
786
|
|
|
} |
|
787
|
|
|
return $pev; |
|
788
|
|
|
} |
|
789
|
|
|
|
|
790
|
|
|
public function setArmyAtEnd() |
|
791
|
|
|
{ |
|
792
|
|
|
$this->setArmy(); |
|
793
|
|
|
$i = 0; |
|
794
|
|
|
foreach ($this->army AS $squadron) { |
|
|
|
|
|
|
795
|
|
|
$this->armyAtEnd[$i] = $squadron->getArrayOfShips(); |
|
796
|
|
|
$i++; |
|
797
|
|
|
} |
|
798
|
|
|
} |
|
799
|
|
|
|
|
800
|
|
|
public function getArmyAtEnd() |
|
801
|
|
|
{ |
|
802
|
|
|
return $this->armyAtEnd; |
|
803
|
|
|
} |
|
804
|
|
|
|
|
805
|
|
|
public function getFormatLineCoord() |
|
806
|
|
|
{ |
|
807
|
|
|
$return = array(); |
|
808
|
|
|
|
|
809
|
|
|
for ($i = 0; $i < ($this->level + 1); $i++) { |
|
810
|
|
|
$return[] = self::$LINECOORD[$i]; |
|
811
|
|
|
} |
|
812
|
|
|
return $return; |
|
813
|
|
|
} |
|
814
|
|
|
|
|
815
|
|
|
public function getSizeArmy() |
|
816
|
|
|
{ |
|
817
|
|
|
return count($this->squadronsIds); |
|
818
|
|
|
} |
|
819
|
|
|
|
|
820
|
|
|
public function getPevToLoot() |
|
821
|
|
|
{ |
|
822
|
|
|
$pev = 0; |
|
823
|
|
|
foreach ($this->armyAtEnd as $squadron) { |
|
824
|
|
|
for ($i = 0; $i < 12; $i++) { |
|
825
|
|
|
$pev += $squadron[$i] * ShipResource::getInfo($i, 'pev'); |
|
826
|
|
|
} |
|
827
|
|
|
} |
|
828
|
|
|
|
|
829
|
|
|
if ($pev != 0) { |
|
830
|
|
|
return $pev; |
|
831
|
|
|
} else { |
|
832
|
|
|
return $this->getPev(); |
|
833
|
|
|
} |
|
834
|
|
|
} |
|
835
|
|
|
|
|
836
|
|
|
public function getSquadron($i) |
|
837
|
|
|
{ |
|
838
|
|
|
$this->setArmy(); |
|
839
|
|
|
if (!empty($this->army[$i])) { |
|
840
|
|
|
return $this->army[$i]; |
|
841
|
|
|
} else { |
|
842
|
|
|
return FALSE; |
|
843
|
|
|
} |
|
844
|
|
|
} |
|
845
|
|
|
|
|
846
|
|
|
# renvoie un tableau de nombre de vaisseaux |
|
847
|
|
|
public function getNbrShipByType() |
|
848
|
|
|
{ |
|
849
|
|
|
$array = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); |
|
850
|
|
|
foreach ($this->armyInBegin as $squadron) { |
|
851
|
|
|
for ($i = 0; $i < 12; $i++) { |
|
852
|
|
|
$array[$i] += $squadron[$i]; |
|
853
|
|
|
} |
|
854
|
|
|
} |
|
855
|
|
|
return $array; |
|
856
|
|
|
} |
|
857
|
|
|
} |