/**
  * @see ISimulationObserver::onShootFailure()
  */
 public function onShootFailure(SimulationMatch $match, SimulationPlayer $scorer, SimulationPlayer $goaly)
 {
     // downgrade striker, if he isno hero yet (= scored at least two goals)
     if ($scorer->getGoals() < 3) {
         $scorer->downgradeMark(MARK_DOWNGRADE_SHOOTFAILURE);
     }
     $goaly->improveMark(MARK_IMPROVE_SHOOTFAILURE_GOALY);
     // consider goals against goaly, in order to prevent goalies in team of the day, even though team lost very high.
     if ($goaly->team->getGoals() > 3) {
         $goaly->setMark(max(2.0, $goaly->getMark()));
     }
     $scorer->setShoots($scorer->getShoots() + 1);
 }
 /**
  * Computes strength change after match, depending on player's grade/mark.
  * 
  * @param SimulationPlayer $player
  * @return int number of strength points which the player gained.
  */
 private function _computeStrengthChange(SimulationPlayer $player)
 {
     $mark = $player->getMark();
     if ($mark <= 1.3) {
         return $this->_websoccer->getConfig('youth_strengthchange_verygood');
     } else {
         if ($mark <= 2.3) {
             return $this->_websoccer->getConfig('youth_strengthchange_good');
         } else {
             if ($mark > 4.25 && $mark <= 5) {
                 return $this->_websoccer->getConfig('youth_strengthchange_bad');
             } else {
                 if ($mark > 5) {
                     return $this->_websoccer->getConfig('youth_strengthchange_verybad');
                 }
             }
         }
     }
     return 0;
 }
 private static function getPlayerColumns($matchId, SimulationPlayer $player, $fieldArea)
 {
     $columns['spiel_id'] = $matchId;
     $columns['spieler_id'] = $player->id;
     $columns['team_id'] = $player->team->id;
     $columns['name'] = $player->name;
     $columns['note'] = $player->getMark();
     $columns['minuten_gespielt'] = $player->getMinutesPlayed();
     $columns['karte_gelb'] = $player->yellowCards;
     $columns['karte_rot'] = $player->redCard;
     $columns['verletzt'] = $player->injured;
     $columns['gesperrt'] = $player->blocked;
     $columns['tore'] = $player->getGoals();
     $columns['feld'] = $fieldArea;
     $columns['position'] = $player->position;
     $columns['position_main'] = $player->mainPosition;
     $columns['age'] = $player->age;
     $columns['w_staerke'] = $player->strength;
     $columns['w_technik'] = $player->strengthTech;
     $columns['w_kondition'] = $player->strengthStamina;
     $columns['w_frische'] = $player->strengthFreshness;
     $columns['w_zufriedenheit'] = $player->strengthSatisfaction;
     $columns['ballcontacts'] = $player->getBallContacts();
     $columns['wontackles'] = $player->getWonTackles();
     $columns['losttackles'] = $player->getLostTackles();
     $columns['shoots'] = $player->getShoots();
     $columns['passes_successed'] = $player->getPassesSuccessed();
     $columns['passes_failed'] = $player->getPassesFailed();
     $columns['assists'] = $player->getAssists();
     return $columns;
 }