We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -41,8 +41,8 @@ |
||
41 | 41 | |
42 | 42 | function teamAttack(&$results, $fightingPlayers, $attack, $defend) { |
43 | 43 | foreach ($fightingPlayers[$attack] as $accountID => $teamPlayer) { |
44 | - $playerResults =& $teamPlayer->shootPlayers($fightingPlayers[$defend]); |
|
45 | - $results[$attack]['Traders'][$teamPlayer->getAccountID()] =& $playerResults; |
|
44 | + $playerResults = & $teamPlayer->shootPlayers($fightingPlayers[$defend]); |
|
45 | + $results[$attack]['Traders'][$teamPlayer->getAccountID()] = & $playerResults; |
|
46 | 46 | $results[$attack]['TotalDamage'] += $playerResults['TotalDamage']; |
47 | 47 | |
48 | 48 | // Award assists (if there are multiple attackers) |
@@ -72,18 +72,18 @@ |
||
72 | 72 | |
73 | 73 | // If mines are bumped, the forces shoot first. Otherwise player shoots first. |
74 | 74 | if ($bump) { |
75 | - $results['Forces'] =& $forces->shootPlayers($attackers, $bump); |
|
75 | + $results['Forces'] = & $forces->shootPlayers($attackers, $bump); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $results['Attackers'] = array('TotalDamage' => 0); |
79 | 79 | foreach ($attackers as $attacker) { |
80 | - $playerResults =& $attacker->shootForces($forces); |
|
81 | - $results['Attackers']['Traders'][$attacker->getAccountID()] =& $playerResults; |
|
80 | + $playerResults = & $attacker->shootForces($forces); |
|
81 | + $results['Attackers']['Traders'][$attacker->getAccountID()] = & $playerResults; |
|
82 | 82 | $results['Attackers']['TotalDamage'] += $playerResults['TotalDamage']; |
83 | 83 | } |
84 | 84 | |
85 | 85 | if (!$bump) { |
86 | - $results['Forces'] =& $forces->shootPlayers($attackers, $bump); |
|
86 | + $results['Forces'] = & $forces->shootPlayers($attackers, $bump); |
|
87 | 87 | $forces->updateExpire(); |
88 | 88 | } |
89 | 89 |
@@ -20,13 +20,13 @@ |
||
20 | 20 | const USER_SCORE_NAME = 'User Score'; |
21 | 21 | $hofTypes = array(DONATION_NAME=>true, USER_SCORE_NAME=>true); |
22 | 22 | while ($db->nextRecord()) { |
23 | - $hof =& $hofTypes; |
|
23 | + $hof = & $hofTypes; |
|
24 | 24 | $typeList = explode(':', $db->getField('type')); |
25 | 25 | foreach ($typeList as $type) { |
26 | 26 | if (!isset($hof[$type])) { |
27 | 27 | $hof[$type] = array(); |
28 | 28 | } |
29 | - $hof =& $hof[$type]; |
|
29 | + $hof = & $hof[$type]; |
|
30 | 30 | } |
31 | 31 | $hof = true; |
32 | 32 | } |
@@ -20,13 +20,13 @@ |
||
20 | 20 | const USER_SCORE_NAME = 'User Score'; |
21 | 21 | $hofTypes = array(DONATION_NAME=>true, USER_SCORE_NAME=>true); |
22 | 22 | while ($db->nextRecord()) { |
23 | - $hof =& $hofTypes; |
|
23 | + $hof = & $hofTypes; |
|
24 | 24 | $typeList = explode(':', $db->getField('type')); |
25 | 25 | foreach ($typeList as $type) { |
26 | 26 | if (!isset($hof[$type])) { |
27 | 27 | $hof[$type] = array(); |
28 | 28 | } |
29 | - $hof =& $hof[$type]; |
|
29 | + $hof = & $hof[$type]; |
|
30 | 30 | } |
31 | 31 | $hof = true; |
32 | 32 | } |
@@ -446,20 +446,20 @@ |
||
446 | 446 | |
447 | 447 | if ($this->hasMines()) { |
448 | 448 | $thisMines = new SmrMines($this->getGameID(), $this->getMines()); |
449 | - $results['Results']['Mines'] =& $thisMines->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)], $minesAreAttacker); |
|
449 | + $results['Results']['Mines'] = & $thisMines->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)], $minesAreAttacker); |
|
450 | 450 | $results['TotalDamage'] += $results['Results']['Mines']['ActualDamage']['TotalDamage']; |
451 | 451 | } |
452 | 452 | |
453 | 453 | if ($this->hasCDs()) { |
454 | 454 | $thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs()); |
455 | - $results['Results']['Drones'] =& $thisCDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]); |
|
455 | + $results['Results']['Drones'] = & $thisCDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]); |
|
456 | 456 | $results['TotalDamage'] += $results['Results']['Drones']['ActualDamage']['TotalDamage']; |
457 | 457 | } |
458 | 458 | |
459 | 459 | if (!$minesAreAttacker) { |
460 | 460 | if ($this->hasSDs()) { |
461 | 461 | $thisSDs = new SmrScoutDrones($this->getGameID(), $this->getSDs()); |
462 | - $results['Results']['Scouts'] =& $thisSDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]); |
|
462 | + $results['Results']['Scouts'] = & $thisSDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]); |
|
463 | 463 | $results['TotalDamage'] += $results['Results']['Scouts']['ActualDamage']['TotalDamage']; |
464 | 464 | } |
465 | 465 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * Access properties of structures that this planet type can build. |
42 | 42 | */ |
43 | - public function structureTypes($structureID=false) { |
|
43 | + public function structureTypes($structureID = false) { |
|
44 | 44 | if (!isset($this->structures)) { |
45 | 45 | foreach (static::STRUCTURES as $ID => $Info) { |
46 | 46 | $this->structures[$ID] = new SmrPlanetStructureType($ID, $Info); |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | 'exp_gain' => 540, |
78 | 78 | ], |
79 | 79 | ]; |
80 | - public function name() { return "Terran Planet"; } |
|
81 | - public function imageLink() { return "images/planet1.png"; } |
|
82 | - public function description() { return "A lush world, with forests, seas, sweeping meadows, and indigenous lifeforms."; } |
|
80 | + public function name() { return "Terran Planet"; } |
|
81 | + public function imageLink() { return "images/planet1.png"; } |
|
82 | + public function description() { return "A lush world, with forests, seas, sweeping meadows, and indigenous lifeforms."; } |
|
83 | 83 | public function maxAttackers() { return 10; } |
84 | - public function maxLanded() { return self::MAX_LANDED_UNLIMITED; } |
|
85 | - public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; } |
|
84 | + public function maxLanded() { return self::MAX_LANDED_UNLIMITED; } |
|
85 | + public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; } |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | class AridPlanet extends SmrPlanetType { |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | 'exp_gain' => 180, |
107 | 107 | ], |
108 | 108 | ]; |
109 | - public function name() { return "Arid Planet"; } |
|
110 | - public function imageLink() { return "images/planet2.png"; } |
|
111 | - public function description() { return "A world mostly devoid of surface water, but capable of supporting life."; } |
|
109 | + public function name() { return "Arid Planet"; } |
|
110 | + public function imageLink() { return "images/planet2.png"; } |
|
111 | + public function description() { return "A world mostly devoid of surface water, but capable of supporting life."; } |
|
112 | 112 | public function maxAttackers() { return 5; } |
113 | - public function maxLanded() { return 5; } |
|
114 | - public function menuOptions() { return ['CONSTRUCTION', 'DEFENSE', 'STOCKPILE', 'OWNERSHIP']; } |
|
113 | + public function maxLanded() { return 5; } |
|
114 | + public function menuOptions() { return ['CONSTRUCTION', 'DEFENSE', 'STOCKPILE', 'OWNERSHIP']; } |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | class DwarfPlanet extends SmrPlanetType { |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | 'exp_gain' => 540, |
136 | 136 | ], |
137 | 137 | ]; |
138 | - public function name() { return "Dwarf Planet"; } |
|
139 | - public function imageLink() { return "images/planet3.png"; } |
|
140 | - public function description() { return "A smaller than usual planet, with no native life present."; } |
|
138 | + public function name() { return "Dwarf Planet"; } |
|
139 | + public function imageLink() { return "images/planet3.png"; } |
|
140 | + public function description() { return "A smaller than usual planet, with no native life present."; } |
|
141 | 141 | public function maxAttackers() { return 5; } |
142 | - public function maxLanded() { return self::MAX_LANDED_UNLIMITED; } |
|
143 | - public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; } |
|
142 | + public function maxLanded() { return self::MAX_LANDED_UNLIMITED; } |
|
143 | + public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; } |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | class ProtoPlanet extends SmrPlanetType { |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | 'exp_gain' => 540, |
171 | 171 | ], |
172 | 172 | ]; |
173 | - public function name() { return "Protoplanet"; } |
|
174 | - public function imageLink() { return "images/planet5.png"; } |
|
175 | - public function description() { return "A developing planet, not yet able to support the infrastructure of advanced technologies."; } |
|
173 | + public function name() { return "Protoplanet"; } |
|
174 | + public function imageLink() { return "images/planet5.png"; } |
|
175 | + public function description() { return "A developing planet, not yet able to support the infrastructure of advanced technologies."; } |
|
176 | 176 | public function maxAttackers() { return 5; } |
177 | - public function maxLanded() { return 5; } |
|
178 | - public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; } |
|
177 | + public function maxLanded() { return 5; } |
|
178 | + public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; } |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | class DefenseWorld extends SmrPlanetType { |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | 'exp_gain' => 9, |
206 | 206 | ], |
207 | 207 | ]; |
208 | - public function name() { return "Defense World"; } |
|
209 | - public function imageLink() { return "images/planet4.png"; } |
|
210 | - public function description() { return "A fully armed and operational battle station loaded with excessive firepower."; } |
|
208 | + public function name() { return "Defense World"; } |
|
209 | + public function imageLink() { return "images/planet4.png"; } |
|
210 | + public function description() { return "A fully armed and operational battle station loaded with excessive firepower."; } |
|
211 | 211 | public function maxAttackers() { return 10; } |
212 | - public function maxLanded() { return self::MAX_LANDED_UNLIMITED; } |
|
213 | - public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; } |
|
212 | + public function maxLanded() { return self::MAX_LANDED_UNLIMITED; } |
|
213 | + public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; } |
|
214 | 214 | } |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | do { |
1181 | 1181 | $targetPlayer = $targetPlayers[array_rand($targetPlayers)]; |
1182 | 1182 | } while ($results['TotalShotsPerTargetPlayer'][$targetPlayer->getAccountID()] > min($results['TotalShotsPerTargetPlayer'])); |
1183 | - $results['Weapons'][$orderID] =& $weapon->shootPlayerAsPort($this, $targetPlayer); |
|
1183 | + $results['Weapons'][$orderID] = & $weapon->shootPlayerAsPort($this, $targetPlayer); |
|
1184 | 1184 | $results['TotalShotsPerTargetPlayer'][$targetPlayer->getAccountID()]++; |
1185 | 1185 | if ($results['Weapons'][$orderID]['Hit']) { |
1186 | 1186 | $results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage']; |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | } |
1190 | 1190 | if ($this->hasCDs()) { |
1191 | 1191 | $thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs(), true); |
1192 | - $results['Drones'] =& $thisCDs->shootPlayerAsPort($this, $targetPlayers[array_rand($targetPlayers)]); |
|
1192 | + $results['Drones'] = & $thisCDs->shootPlayerAsPort($this, $targetPlayers[array_rand($targetPlayers)]); |
|
1193 | 1193 | $results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage']; |
1194 | 1194 | $results['TotalDamagePerTargetPlayer'][$results['Drones']['TargetPlayer']->getAccountID()] += $results['Drones']['ActualDamage']['TotalDamage']; |
1195 | 1195 | } |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | $results['DeadBeforeShot'] = false; |
1147 | 1147 | $weapons = $this->getWeapons(); |
1148 | 1148 | foreach ($weapons as $orderID => $weapon) { |
1149 | - $results['Weapons'][$orderID] =& $weapon->shootPlayerAsPlanet($this, $targetPlayers[array_rand($targetPlayers)]); |
|
1149 | + $results['Weapons'][$orderID] = & $weapon->shootPlayerAsPlanet($this, $targetPlayers[array_rand($targetPlayers)]); |
|
1150 | 1150 | if ($results['Weapons'][$orderID]['Hit']) { |
1151 | 1151 | $results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage']; |
1152 | 1152 | $results['TotalDamagePerTargetPlayer'][$results['Weapons'][$orderID]['TargetPlayer']->getAccountID()] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage']; |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | } |
1155 | 1155 | if ($this->hasCDs()) { |
1156 | 1156 | $thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs(), true); |
1157 | - $results['Drones'] =& $thisCDs->shootPlayerAsPlanet($this, $targetPlayers[array_rand($targetPlayers)]); |
|
1157 | + $results['Drones'] = & $thisCDs->shootPlayerAsPlanet($this, $targetPlayers[array_rand($targetPlayers)]); |
|
1158 | 1158 | $results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage']; |
1159 | 1159 | $results['TotalDamagePerTargetPlayer'][$results['Drones']['TargetPlayer']->getAccountID()] += $results['Drones']['ActualDamage']['TotalDamage']; |
1160 | 1160 | } |
@@ -1,91 +1,91 @@ |
||
1 | 1 | <?php declare(strict_types=1); |
2 | -$template->assign('PageTopic','Combat Simulator'); |
|
2 | +$template->assign('PageTopic', 'Combat Simulator'); |
|
3 | 3 | |
4 | -$template->assign('EditDummysLink',SmrSession::getNewHREF(create_container('skeleton.php','edit_dummys.php'))); |
|
4 | +$template->assign('EditDummysLink', SmrSession::getNewHREF(create_container('skeleton.php', 'edit_dummys.php'))); |
|
5 | 5 | $template->assign('DummyNames', DummyPlayer::getDummyPlayerNames()); |
6 | 6 | |
7 | 7 | $duplicates = false; |
8 | 8 | $usedNames = array(); |
9 | 9 | $realAttackers = array(); |
10 | 10 | $attackers = array(); |
11 | -$i=1; |
|
12 | -if(isset($_POST['attackers'])) |
|
13 | - foreach($_POST['attackers'] as $attackerName) { |
|
14 | - if($attackerName=='none') |
|
11 | +$i = 1; |
|
12 | +if (isset($_POST['attackers'])) |
|
13 | + foreach ($_POST['attackers'] as $attackerName) { |
|
14 | + if ($attackerName == 'none') |
|
15 | 15 | continue; |
16 | - if(isset($usedNames[$attackerName])) { |
|
16 | + if (isset($usedNames[$attackerName])) { |
|
17 | 17 | $duplicates = true; |
18 | 18 | continue; |
19 | 19 | } |
20 | 20 | $usedNames[$attackerName] = true; |
21 | - $attackers[$i] =& DummyPlayer::getCachedDummyPlayer($attackerName); |
|
21 | + $attackers[$i] = & DummyPlayer::getCachedDummyPlayer($attackerName); |
|
22 | 22 | $attackers[$i]->setAllianceID(1); |
23 | - $realAttackers[$i] =& $attackers[$i]; |
|
23 | + $realAttackers[$i] = & $attackers[$i]; |
|
24 | 24 | ++$i; |
25 | 25 | } |
26 | 26 | |
27 | -for(;$i<=10;++$i) |
|
27 | +for (;$i <= 10; ++$i) |
|
28 | 28 | $attackers[$i] = null; |
29 | -$template->assign('Attackers',$attackers); |
|
29 | +$template->assign('Attackers', $attackers); |
|
30 | 30 | |
31 | -$i=1; |
|
31 | +$i = 1; |
|
32 | 32 | $realDefenders = array(); |
33 | 33 | $defenders = array(); |
34 | -if(isset($_POST['defenders'])) |
|
35 | - foreach($_POST['defenders'] as $defenderName) { |
|
36 | - if($defenderName=='none') |
|
34 | +if (isset($_POST['defenders'])) |
|
35 | + foreach ($_POST['defenders'] as $defenderName) { |
|
36 | + if ($defenderName == 'none') |
|
37 | 37 | continue; |
38 | - if(isset($usedNames[$defenderName])) { |
|
38 | + if (isset($usedNames[$defenderName])) { |
|
39 | 39 | $duplicates = true; |
40 | 40 | continue; |
41 | 41 | } |
42 | 42 | $usedNames[$attackerName] = true; |
43 | - $defenders[$i] =& DummyPlayer::getCachedDummyPlayer($defenderName); |
|
43 | + $defenders[$i] = & DummyPlayer::getCachedDummyPlayer($defenderName); |
|
44 | 44 | $defenders[$i]->setAllianceID(2); |
45 | - $realDefenders[$i] =& $defenders[$i]; |
|
45 | + $realDefenders[$i] = & $defenders[$i]; |
|
46 | 46 | ++$i; |
47 | 47 | } |
48 | 48 | |
49 | -for(;$i<=10;++$i) |
|
49 | +for (;$i <= 10; ++$i) |
|
50 | 50 | $defenders[$i] = null; |
51 | -$template->assign('Defenders',$defenders); |
|
51 | +$template->assign('Defenders', $defenders); |
|
52 | 52 | |
53 | -$template->assign('Duplicates',$duplicates); |
|
53 | +$template->assign('Duplicates', $duplicates); |
|
54 | 54 | |
55 | -$template->assign('CombatSimHREF',SmrSession::getNewHREF(create_container('skeleton.php','combat_simulator.php'))); |
|
55 | +$template->assign('CombatSimHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'combat_simulator.php'))); |
|
56 | 56 | |
57 | 57 | if (!empty($realAttackers) && !empty($realDefenders)) { |
58 | - if(isset($_REQUEST['run'])) { |
|
59 | - runAnAttack($realAttackers,$realDefenders); |
|
58 | + if (isset($_REQUEST['run'])) { |
|
59 | + runAnAttack($realAttackers, $realDefenders); |
|
60 | 60 | } |
61 | - if(isset($_REQUEST['death_run'])) { |
|
62 | - while(count($realAttackers)>0 && count($realDefenders)>0) { |
|
63 | - runAnAttack($realAttackers,$realDefenders); |
|
64 | - foreach($realAttackers as $key => &$teamPlayer) { |
|
65 | - if($teamPlayer->isDead()) |
|
61 | + if (isset($_REQUEST['death_run'])) { |
|
62 | + while (count($realAttackers) > 0 && count($realDefenders) > 0) { |
|
63 | + runAnAttack($realAttackers, $realDefenders); |
|
64 | + foreach ($realAttackers as $key => &$teamPlayer) { |
|
65 | + if ($teamPlayer->isDead()) |
|
66 | 66 | unset($realAttackers[$key]); |
67 | 67 | } unset($teamPlayer); |
68 | - foreach($realDefenders as $key => &$teamPlayer) { |
|
69 | - if($teamPlayer->isDead()) |
|
68 | + foreach ($realDefenders as $key => &$teamPlayer) { |
|
69 | + if ($teamPlayer->isDead()) |
|
70 | 70 | unset($realDefenders[$key]); |
71 | 71 | } unset($teamPlayer); |
72 | 72 | } |
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | -function runAnAttack($realAttackers,$realDefenders) { |
|
76 | +function runAnAttack($realAttackers, $realDefenders) { |
|
77 | 77 | global $template; |
78 | 78 | $results = array('Attackers' => array('Traders' => array(), 'TotalDamage' => 0), |
79 | 79 | 'Defenders' => array('Traders' => array(), 'TotalDamage' => 0)); |
80 | 80 | foreach ($realAttackers as $accountID => $teamPlayer) { |
81 | - $playerResults =& $teamPlayer->shootPlayers($realDefenders); |
|
82 | - $results['Attackers']['Traders'][] =& $playerResults; |
|
81 | + $playerResults = & $teamPlayer->shootPlayers($realDefenders); |
|
82 | + $results['Attackers']['Traders'][] = & $playerResults; |
|
83 | 83 | $results['Attackers']['TotalDamage'] += $playerResults['TotalDamage']; |
84 | 84 | } |
85 | 85 | foreach ($realDefenders as $accountID => $teamPlayer) { |
86 | - $playerResults =& $teamPlayer->shootPlayers($realAttackers); |
|
87 | - $results['Defenders']['Traders'][] =& $playerResults; |
|
86 | + $playerResults = & $teamPlayer->shootPlayers($realAttackers); |
|
87 | + $results['Defenders']['Traders'][] = & $playerResults; |
|
88 | 88 | $results['Defenders']['TotalDamage'] += $playerResults['TotalDamage']; |
89 | 89 | } |
90 | - $template->assign('TraderCombatResults',$results); |
|
90 | + $template->assign('TraderCombatResults', $results); |
|
91 | 91 | } |