|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Stu\Module\Ship\Lib\Battle\Party; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\Collection; |
|
6
|
|
|
use Stu\Module\Ship\Lib\FleetWrapperInterface; |
|
7
|
|
|
use Stu\Module\Ship\Lib\ShipWrapperFactoryInterface; |
|
8
|
|
|
use Stu\Module\Ship\Lib\ShipWrapperInterface; |
|
9
|
|
|
use Stu\Orm\Entity\ShipInterface; |
|
10
|
|
|
use Stu\Orm\Repository\ShipRepositoryInterface; |
|
11
|
|
|
|
|
12
|
|
|
class BattlePartyFactory implements BattlePartyFactoryInterface |
|
13
|
|
|
{ |
|
14
|
|
|
public function __construct( |
|
15
|
|
|
private ShipRepositoryInterface $shipRepository, |
|
16
|
|
|
private ShipWrapperFactoryInterface $shipWrapperFactory |
|
17
|
|
|
) { |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
public function createAlertStateBattleParty( |
|
21
|
|
|
ShipWrapperInterface $leaderWrapper |
|
22
|
|
|
): AlertStateBattleParty { |
|
23
|
|
|
return new AlertStateBattleParty($leaderWrapper); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function createIncomingBattleParty( |
|
27
|
|
|
ShipWrapperInterface $leaderWrapper |
|
28
|
|
|
): IncomingBattleParty { |
|
29
|
|
|
return new IncomingBattleParty($leaderWrapper); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function createRoundBasedBattleParty( |
|
33
|
|
|
BattlePartyInterface $battleParty |
|
34
|
|
|
): RoundBasedBattleParty { |
|
35
|
|
|
return new RoundBasedBattleParty($battleParty, $this->shipRepository); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function createAttackingBattleParty( |
|
39
|
|
|
ShipWrapperInterface|FleetWrapperInterface $wrapper |
|
40
|
|
|
): AttackingBattleParty { |
|
41
|
|
|
return new AttackingBattleParty($wrapper); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function createAttackedBattleParty( |
|
45
|
|
|
ShipWrapperInterface $wrapper |
|
46
|
|
|
): AttackedBattleParty { |
|
47
|
|
|
return new AttackedBattleParty($wrapper); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function createSingletonBattleParty( |
|
51
|
|
|
ShipWrapperInterface $wrapper |
|
52
|
|
|
): SingletonBattleParty { |
|
53
|
|
|
return new SingletonBattleParty($wrapper); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function createMixedBattleParty( |
|
57
|
|
|
Collection $wrappers |
|
58
|
|
|
): MixedBattleParty { |
|
59
|
|
|
return new MixedBattleParty($wrappers); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function createColonyDefendingBattleParty( |
|
63
|
|
|
ShipInterface $leader |
|
64
|
|
|
): ColonyDefendingBattleParty { |
|
65
|
|
|
return new ColonyDefendingBattleParty( |
|
66
|
|
|
$this->shipWrapperFactory->wrapShip($leader) |
|
67
|
|
|
); |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|