smrealms /
smr
We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php declare(strict_types=1); |
||||
| 2 | |||||
| 3 | class SmrScoutDrones extends AbstractSmrCombatWeapon { |
||||
| 4 | |||||
| 5 | use Traits\CombatWeaponForce; |
||||
| 6 | |||||
| 7 | public function __construct(int $numberOfSDs) { |
||||
| 8 | $this->amount = $numberOfSDs; |
||||
| 9 | $this->name = 'Scout Drones'; |
||||
| 10 | $this->shieldDamage = 20; |
||||
| 11 | $this->armourDamage = 20; |
||||
| 12 | $this->accuracy = 100; |
||||
| 13 | $this->damageRollover = false; |
||||
| 14 | } |
||||
| 15 | |||||
| 16 | public function getModifiedAccuracy(): float { |
||||
| 17 | return $this->getBaseAccuracy(); |
||||
| 18 | } |
||||
| 19 | |||||
| 20 | public function getModifiedForceAccuracyAgainstPlayer(SmrForce $forces, AbstractSmrPlayer $targetPlayer): float { |
||||
| 21 | return $this->getModifiedForceAccuracyAgainstPlayerUsingRandom($forces, $targetPlayer, rand(1, 7) * rand(1, 7)); |
||||
| 22 | } |
||||
| 23 | |||||
| 24 | protected function getModifiedForceAccuracyAgainstPlayerUsingRandom(SmrForce $forces, AbstractSmrPlayer $targetPlayer, int $random): float { |
||||
|
0 ignored issues
–
show
|
|||||
| 25 | $modifiedAccuracy = $this->getModifiedAccuracy(); |
||||
| 26 | $modifiedAccuracy -= $targetPlayer->getLevelID() + $random; |
||||
| 27 | |||||
| 28 | return max(0, min(100, $modifiedAccuracy)); |
||||
| 29 | } |
||||
| 30 | |||||
| 31 | public function getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces): never { |
||||
| 32 | throw new Exception('This weapon should not be used in this context'); |
||||
| 33 | } |
||||
| 34 | |||||
| 35 | public function getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port): never { |
||||
| 36 | throw new Exception('This weapon should not be used in this context'); |
||||
| 37 | } |
||||
| 38 | |||||
| 39 | public function getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet): never { |
||||
| 40 | throw new Exception('This weapon should not be used in this context'); |
||||
| 41 | } |
||||
| 42 | |||||
| 43 | public function getModifiedDamageAgainstPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer): never { |
||||
| 44 | throw new Exception('This weapon should not be used in this context'); |
||||
| 45 | } |
||||
| 46 | |||||
| 47 | public function getModifiedPortDamageAgainstPlayer(AbstractSmrPort $port, AbstractSmrPlayer $targetPlayer): never { |
||||
| 48 | throw new Exception('This weapon should not be used in this context'); |
||||
| 49 | } |
||||
| 50 | |||||
| 51 | public function getModifiedPlanetDamageAgainstPlayer(SmrPlanet $planet, AbstractSmrPlayer $targetPlayer): never { |
||||
| 52 | throw new Exception('This weapon should not be used in this context'); |
||||
| 53 | } |
||||
| 54 | |||||
| 55 | public function getModifiedForceDamageAgainstPlayer(SmrForce $forces, AbstractSmrPlayer $targetPlayer): array { |
||||
| 56 | if (!$this->canShootTraders()) { // If we can't shoot traders then just return a damageless array and don't waste resources calculated any damage mods. |
||||
| 57 | return ['Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()]; |
||||
| 58 | } |
||||
| 59 | $damage = $this->getDamage(); |
||||
| 60 | $damage['Launched'] = ICeil($this->getAmount() * $this->getModifiedForceAccuracyAgainstPlayer($forces, $targetPlayer) / 100); |
||||
|
0 ignored issues
–
show
The function
ICeil was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 61 | $damage['Shield'] = ICeil($damage['Launched'] * $damage['Shield']); |
||||
| 62 | $damage['Armour'] = ICeil($damage['Launched'] * $damage['Armour']); |
||||
| 63 | return $damage; |
||||
| 64 | } |
||||
| 65 | |||||
| 66 | public function shootForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces): never { |
||||
| 67 | throw new Exception('This weapon should not be used in this context'); |
||||
| 68 | } |
||||
| 69 | |||||
| 70 | public function shootPlayer(AbstractSmrPlayer $weaponPlayer, AbstractSmrPlayer $targetPlayer): never { |
||||
| 71 | throw new Exception('This weapon should not be used in this context'); |
||||
| 72 | } |
||||
| 73 | |||||
| 74 | public function shootPlayerAsForce(SmrForce $forces, AbstractSmrPlayer $targetPlayer): array { |
||||
| 75 | $return = ['Weapon' => $this, 'TargetPlayer' => $targetPlayer, 'Hit' => true]; |
||||
| 76 | $return = $this->doForceDamageToPlayer($return, $forces, $targetPlayer); |
||||
| 77 | $this->amount -= $return['WeaponDamage']['Launched']; // kamikaze |
||||
| 78 | return $return; |
||||
| 79 | } |
||||
| 80 | |||||
| 81 | } |
||||
| 82 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.