function __construct(CatchPokemonResponse $response = null)
 {
     if ($response != null) {
         $this->captureAward = $response->getCaptureAward();
         $this->response = $response;
     } else {
         $this->setFailed(false);
     }
 }
 /**
  * @param $normalizedHitPosition
  * @param $normalizedReticleSize
  * @param $spinModifier
  * @param $type
  * @param $amount
  * @param $razberriesLimit
  * @return CatchResult
  */
 public function catchPokemonFunction($normalizedHitPosition, $normalizedReticleSize, $spinModifier, $type, $amount, $razberriesLimit)
 {
     if (!$this->isEncountered()) {
         return new CatchResult();
     }
     $razberries = 0;
     $numThrows = 0;
     do {
         if ($razberries < $razberriesLimit || $razberriesLimit == -1) {
             $this->useItem(ItemId::ITEM_RAZZ_BERRY);
             $razberries++;
         }
         $reqMsg = new CatchPokemonMessage();
         $reqMsg->setEncounterId($this->getEncounterId());
         $reqMsg->setHitPokemon(true);
         $reqMsg->setNormalizedHitPosition($normalizedHitPosition);
         $reqMsg->setNormalizedReticleSize($normalizedReticleSize);
         $reqMsg->setSpawnPointId($this->getSpawnPointId());
         $reqMsg->setSpinModifier($spinModifier);
         $reqMsg->setPokeball($type);
         $serverRequest = new ServerRequest(RequestType::CATCH_POKEMON, $reqMsg);
         $this->pokemonGoAPI->getRequestHandler()->sendServerRequests($serverRequest);
         $response = new CatchPokemonResponse($serverRequest->getData());
         if ($response->getStatus() != CatchPokemonResponse_CatchStatus::CATCH_ESCAPE && $response->getStatus() != CatchPokemonResponse_CatchStatus::CATCH_MISSED) {
             break;
         }
         $numThrows++;
     } while ($amount < 0 || $numThrows < $amount);
     $this->pokemonGoAPI->getInventories()->updateInventories(false);
     return new CatchResult($response);
 }