public function shoot(Ship $target, Weapon $weapon) { if ($weapon->getCharges() > 1) { $dice = rand(1, 6); $range = $this->check_range($target, $weapon); if ($range == 1 && $dice >= 4) { $target->receive_dmg(); } else { if ($range == 2 && $dice >= 5) { $target->receive_dmg(); } else { if ($range == 3 && $dice >= 6) { $target->receive_dmg(); } } } $weapon->subCharge(); } }