private static function loadTeam(WebSoccer $websoccer, DbConnection $db, $matchId, SimulationTeam $team) { // get players $columns['spieler_id'] = 'player_id'; $columns['name'] = 'name'; $columns['note'] = 'mark'; $columns['minuten_gespielt'] = 'minutes_played'; $columns['karte_gelb'] = 'yellow_cards'; $columns['karte_rot'] = 'red_cards'; $columns['verletzt'] = 'injured'; $columns['gesperrt'] = 'blocked'; $columns['tore'] = 'goals'; $columns['feld'] = 'field_area'; $columns['position'] = 'position'; $columns['position_main'] = 'main_position'; $columns['age'] = 'age'; $columns['w_staerke'] = 'strength'; $columns['w_technik'] = 'strength_tech'; $columns['w_kondition'] = 'strength_stamina'; $columns['w_frische'] = 'strength_freshness'; $columns['w_zufriedenheit'] = 'strength_satisfaction'; $columns['ballcontacts'] = 'ballcontacts'; $columns['wontackles'] = 'wontackles'; $columns['losttackles'] = 'losttackles'; $columns['shoots'] = 'shoots'; $columns['passes_successed'] = 'passes_successed'; $columns['passes_failed'] = 'passes_failed'; $columns['assists'] = 'assists'; $fromTable = $websoccer->getConfig('db_prefix') . '_spiel_berechnung'; $whereCondition = 'spiel_id = %d AND team_id = %d ORDER BY id ASC'; $parameters = array($matchId, $team->id); $result = $db->querySelect($columns, $fromTable, $whereCondition, $parameters); while ($playerinfo = $result->fetch_array()) { $player = new SimulationPlayer($playerinfo['player_id'], $team, $playerinfo['position'], $playerinfo['main_position'], $playerinfo['mark'], $playerinfo['age'], $playerinfo['strength'], $playerinfo['strength_tech'], $playerinfo['strength_stamina'], $playerinfo['strength_freshness'], $playerinfo['strength_satisfaction']); $player->name = $playerinfo['name']; $player->setBallContacts($playerinfo['ballcontacts']); $player->setWonTackles($playerinfo['wontackles']); $player->setLostTackles($playerinfo['losttackles']); $player->setGoals($playerinfo['goals']); $player->setShoots($playerinfo['shoots']); $player->setPassesSuccessed($playerinfo['passes_successed']); $player->setPassesFailed($playerinfo['passes_failed']); $player->setAssists($playerinfo['assists']); $player->setMinutesPlayed($playerinfo['minutes_played'], FALSE); $player->yellowCards = $playerinfo['yellow_cards']; $player->redCard = $playerinfo['red_cards']; $player->injured = $playerinfo['injured']; $player->blocked = $playerinfo['blocked']; // add player self::$_addedPlayers[$player->id] = $player; if ($playerinfo['field_area'] == 'Ausgewechselt') { $team->removedPlayers[$player->id] = $player; } else { if ($playerinfo['field_area'] == 'Ersatzbank') { $team->playersOnBench[$player->id] = $player; } else { $team->positionsAndPlayers[$player->position][] = $player; } } } $result->free(); }
/** * @see ISimulationObserver::onBallPassFailure() */ public function onBallPassFailure(SimulationMatch $match, SimulationPlayer $player) { // show mercy when player already hit at least twice or assisted twice or both scored and assisted if ($player->getGoals() < 2 && $player->getAssists() < 2 && ($player->getGoals() == 0 || $player->getAssists() == 0)) { $player->downgradeMark(MARK_DOWNGRADE_BALLPASS_FAILURE); } $player->setPassesFailed($player->getPassesFailed() + 1); }