|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
abstract class AbstractSmrCombatWeapon { |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Reduce the damage done to planets by this factor |
|
7
|
|
|
*/ |
|
8
|
|
|
protected const PLANET_DAMAGE_MOD = 0.2; |
|
9
|
|
|
|
|
10
|
|
|
protected bool $damageRollover; |
|
11
|
|
|
|
|
12
|
|
|
abstract public function getBaseAccuracy(): int; |
|
13
|
|
|
abstract public function getName(): string; |
|
14
|
|
|
abstract public function getShieldDamage(): int; |
|
15
|
|
|
abstract public function getArmourDamage(): int; |
|
16
|
|
|
|
|
17
|
|
|
public function isDamageRollover(): bool { |
|
18
|
|
|
return $this->damageRollover; |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
public function canShootForces(): bool { |
|
22
|
|
|
return true; |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
public function canShootPorts(): bool { |
|
26
|
|
|
return true; |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function canShootPlanets(): bool { |
|
30
|
|
|
return true; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function canShootTraders(): bool { |
|
34
|
|
|
return true; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @return WeaponDamageData |
|
|
|
|
|
|
39
|
|
|
*/ |
|
40
|
|
|
public function getDamage(): array { |
|
41
|
|
|
return ['Shield' => $this->getShieldDamage(), 'Armour' => $this->getArmourDamage(), 'Rollover' => $this->isDamageRollover()]; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @return WeaponDamageData |
|
46
|
|
|
*/ |
|
47
|
|
|
abstract public function getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces): array; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @return WeaponDamageData |
|
51
|
|
|
*/ |
|
52
|
|
|
abstract public function getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port): array; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @return WeaponDamageData |
|
56
|
|
|
*/ |
|
57
|
|
|
abstract public function getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet): array; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @return WeaponDamageData |
|
61
|
|
|
*/ |
|
62
|
|
|
abstract public function getModifiedPortDamageAgainstPlayer(AbstractSmrPort $port, AbstractSmrPlayer $targetPlayer): array; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @return WeaponDamageData |
|
66
|
|
|
*/ |
|
67
|
|
|
abstract public function getModifiedDamageAgainstPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer): array; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @return WeaponDamageData |
|
71
|
|
|
*/ |
|
72
|
|
|
abstract public function getModifiedForceDamageAgainstPlayer(SmrForce $forces, AbstractSmrPlayer $targetPlayer): array; |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @return WeaponDamageData |
|
76
|
|
|
*/ |
|
77
|
|
|
abstract public function getModifiedPlanetDamageAgainstPlayer(SmrPlanet $planet, AbstractSmrPlayer $targetPlayer): array; |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @param array<string, mixed> $return |
|
81
|
|
|
* @return array<string, mixed> |
|
82
|
|
|
*/ |
|
83
|
|
|
protected function doPlayerDamageToForce(array $return, AbstractSmrPlayer $weaponPlayer, SmrForce $forces): array { |
|
84
|
|
|
$return['WeaponDamage'] = $this->getModifiedDamageAgainstForces($weaponPlayer, $forces); |
|
85
|
|
|
$return['ActualDamage'] = $forces->takeDamage($return['WeaponDamage']); |
|
86
|
|
|
if ($return['ActualDamage']['KillingShot']) { |
|
87
|
|
|
$return['KillResults'] = $forces->killForcesByPlayer($weaponPlayer); |
|
88
|
|
|
} |
|
89
|
|
|
return $return; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @param array<string, mixed> $return |
|
94
|
|
|
* @return array<string, mixed> |
|
95
|
|
|
*/ |
|
96
|
|
|
protected function doPlayerDamageToPlayer(array $return, AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer): array { |
|
97
|
|
|
$return['WeaponDamage'] = $this->getModifiedDamageAgainstPlayer($weaponPlayer, $targetPlayer); |
|
98
|
|
|
$return['ActualDamage'] = $targetPlayer->getShip()->takeDamage($return['WeaponDamage']); |
|
99
|
|
|
|
|
100
|
|
|
if ($return['ActualDamage']['KillingShot']) { |
|
101
|
|
|
$return['KillResults'] = $targetPlayer->killPlayerByPlayer($weaponPlayer); |
|
102
|
|
|
} |
|
103
|
|
|
return $return; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @param array<string, mixed> $return |
|
108
|
|
|
* @return array<string, mixed> |
|
109
|
|
|
*/ |
|
110
|
|
|
protected function doPlayerDamageToPort(array $return, AbstractSmrPlayer $weaponPlayer, SmrPort $port): array { |
|
111
|
|
|
$return['WeaponDamage'] = $this->getModifiedDamageAgainstPort($weaponPlayer, $port); |
|
112
|
|
|
$return['ActualDamage'] = $port->takeDamage($return['WeaponDamage']); |
|
113
|
|
|
if ($return['ActualDamage']['KillingShot']) { |
|
114
|
|
|
$return['KillResults'] = $port->killPortByPlayer($weaponPlayer); |
|
115
|
|
|
} |
|
116
|
|
|
return $return; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* @param array<string, mixed> $return |
|
121
|
|
|
* @return array<string, mixed> |
|
122
|
|
|
*/ |
|
123
|
|
|
protected function doPlayerDamageToPlanet(array $return, AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet): array { |
|
124
|
|
|
$return['WeaponDamage'] = $this->getModifiedDamageAgainstPlanet($weaponPlayer, $planet); |
|
125
|
|
|
$return['ActualDamage'] = $planet->takeDamage($return['WeaponDamage']); |
|
126
|
|
|
if ($return['ActualDamage']['KillingShot']) { |
|
127
|
|
|
$return['KillResults'] = $planet->killPlanetByPlayer($weaponPlayer); |
|
128
|
|
|
} |
|
129
|
|
|
return $return; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* @param array<string, mixed> $return |
|
134
|
|
|
* @return array<string, mixed> |
|
135
|
|
|
*/ |
|
136
|
|
|
protected function doPortDamageToPlayer(array $return, AbstractSmrPort $port, AbstractSmrPlayer $targetPlayer): array { |
|
137
|
|
|
$return['WeaponDamage'] = $this->getModifiedPortDamageAgainstPlayer($port, $targetPlayer); |
|
138
|
|
|
$return['ActualDamage'] = $targetPlayer->getShip()->takeDamage($return['WeaponDamage']); |
|
139
|
|
|
|
|
140
|
|
|
if ($return['ActualDamage']['KillingShot']) { |
|
141
|
|
|
$return['KillResults'] = $targetPlayer->killPlayerByPort($port); |
|
142
|
|
|
} |
|
143
|
|
|
return $return; |
|
144
|
|
|
} |
|
145
|
|
|
|
|
146
|
|
|
/** |
|
147
|
|
|
* @param array<string, mixed> $return |
|
148
|
|
|
* @return array<string, mixed> |
|
149
|
|
|
*/ |
|
150
|
|
|
protected function doPlanetDamageToPlayer(array $return, SmrPlanet $planet, AbstractSmrPlayer $targetPlayer): array { |
|
151
|
|
|
$return['WeaponDamage'] = $this->getModifiedPlanetDamageAgainstPlayer($planet, $targetPlayer); |
|
152
|
|
|
$return['ActualDamage'] = $targetPlayer->getShip()->takeDamage($return['WeaponDamage']); |
|
153
|
|
|
|
|
154
|
|
|
if ($return['ActualDamage']['KillingShot']) { |
|
155
|
|
|
$return['KillResults'] = $targetPlayer->killPlayerByPlanet($planet); |
|
156
|
|
|
} |
|
157
|
|
|
return $return; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* @param array<string, mixed> $return |
|
162
|
|
|
* @return array<string, mixed> |
|
163
|
|
|
*/ |
|
164
|
|
|
protected function doForceDamageToPlayer(array $return, SmrForce $forces, AbstractSmrPlayer $targetPlayer): array { |
|
165
|
|
|
$return['WeaponDamage'] = $this->getModifiedForceDamageAgainstPlayer($forces, $targetPlayer); |
|
166
|
|
|
$return['ActualDamage'] = $targetPlayer->getShip()->takeDamage($return['WeaponDamage']); |
|
167
|
|
|
|
|
168
|
|
|
if ($return['ActualDamage']['KillingShot']) { |
|
169
|
|
|
$return['KillResults'] = $targetPlayer->killPlayerByForces($forces); |
|
170
|
|
|
} |
|
171
|
|
|
return $return; |
|
172
|
|
|
} |
|
173
|
|
|
|
|
174
|
|
|
/** |
|
175
|
|
|
* @return array<string, mixed> |
|
176
|
|
|
*/ |
|
177
|
|
|
abstract public function shootForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces): array; |
|
178
|
|
|
|
|
179
|
|
|
/** |
|
180
|
|
|
* @return array<string, mixed> |
|
181
|
|
|
*/ |
|
182
|
|
|
abstract public function shootPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer): array; |
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* @return array<string, mixed> |
|
186
|
|
|
*/ |
|
187
|
|
|
abstract public function shootPlayerAsForce(SmrForce $forces, AbstractSmrPlayer $targetPlayer): array; |
|
188
|
|
|
|
|
189
|
|
|
} |
|
190
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths