Exemplo n.º 1
0
Arquivo: Data.php Projeto: vincium/lot
 public static function searchByLevel($level, $experience, $playerId)
 {
     $options = [];
     $options['clearSelect'] = true;
     $options['select'][] = self::getList(['id', 'experience', 'user_id']);
     if ($level > 0) {
         $options['where'][] = ['player.experience BETWEEN ? AND ?', round($experience * 1.3), round($experience * 1.5 + 30)];
     } else {
         if ($level < 0) {
             $options['where'][] = ['player.experience BETWEEN ? AND ?', round($experience * 0.5 - 30), round($experience * 0.7)];
         } else {
             $options['where'][] = ['player.experience BETWEEN ? AND ?', round($experience * 0.7 - 30), round($experience * 1.3 + 30)];
         }
     }
     $options['where'][] = ['player.id != ?', $playerId];
     $options['where'][] = 'player.active = 1';
     $options['where'][] = 'player.is_in_match = 0';
     $options['where'][] = 'player.is_in_tournament = 0';
     $options['where'][] = 'player.accept_challenge = 1';
     $options['where'][] = 'player.mental >= 750';
     $players = self::loadAll($options);
     if (count($players) == 0) {
         return null;
     }
     $pick = Engine::dice(0, count($players) - 1);
     return $players[$pick];
 }
Exemplo n.º 2
0
 public function renderInfo()
 {
     $html = '';
     $info = json_decode($this->info);
     foreach ($info as $line) {
         switch ($line[0]) {
             case 'surface':
                 $html .= '+' . $line[1] . ' ' . \Own\Bus\Surface::value($line[2]) . '<br>';
                 break;
             case 'endOfTheMonth':
             case 'endOfTheYear':
             case 'scheduledMatch':
                 $html .= Lang::lang($line[0]) . ': ' . $line[1]->format('smart') . '<br>';
                 break;
             case 'leagueUp':
             case 'leagueDown':
                 $html .= Lang::lang($line[0]) . ': ' . \Own\Bus\Classification::value($line[1]) . '<br>';
                 break;
             case 'endRanking':
                 $html .= Lang::lang($line[0]) . ': ' . $line[1] . ' (' . $line[2] . ' pts)<br>';
                 break;
             case 'oldMatch':
                 $html .= Lang::lang('youHaveOldMatches', [$line[1]]) . ' (<a href="/match/history">' . Lang::lang('view') . '</a>)';
                 break;
             default:
                 $html .= \Own\Bus\Engine::plusMinus($line[1]) . ' ' . Lang::lang($line[0]) . '<br>';
         }
     }
     return $html;
 }
Exemplo n.º 3
0
 public static function fillCPU($tournament)
 {
     $need = $tournament->getSize() - count($tournament->getTournamentPlayers());
     $db = new Util\Data();
     if ($need > 0) {
         $sqlBusyPlayer = 'SELECT DISTINCT tp.player_id
             FROM bus_tournament_player tp
             JOIN bus_tournament t ON t.id = tp.tournament_id
             WHERE t.status < 3';
         $rows = $db->select($sqlBusyPlayer);
         $busyPlayers = [0];
         if (count($rows) > 0) {
             $list = $rows->fetchAll(\PDO::FETCH_COLUMN);
             foreach ($list as $key => $value) {
                 $busyPlayers[] = $value;
             }
         }
         $sql = 'SELECT DISTINCT p.id
             FROM bus_player p
             LEFT JOIN bus_tournament_player tp ON tp.player_id = p.id
             WHERE p.active = 1
             AND p.user_id = 0
             AND (tp.player_id IS NULL OR tp.player_id NOT IN (?))
             ORDER BY p.tour_ranking';
         $players = $db->select($sql, [implode(',', $busyPlayers)]);
         if (count($players) == 0) {
             Util\Log::log(Util\Code::CRON, 'Not enough CPU, tournamentId: ' . $tournament->getId() . ', 0 / ' . $need, __FILE__, __LINE__);
             return false;
         }
         $players = $players->fetchAll(\PDO::FETCH_ASSOC);
         if (count($players) < $need) {
             Util\Log::log(Util\Code::CRON, 'Not enough CPU, tournamentId: ' . $tournament->getId() . ', ' . count($players) . ' / ' . $need, __FILE__, __LINE__);
             return false;
         }
         $playerIds = Engine::findCPU($players, $need, $tournament->getClassification());
         if (count($playerIds) < $need) {
             Util\Log::log(Util\Code::CRON, 'Not enough CPU found, tournamentId: ' . $tournament->getId() . ', ' . count($playerIds) . ' / ' . $need, __FILE__, __LINE__);
             return false;
         }
         $options = [];
         $options['clearSelect'] = true;
         $options['select'][] = \Own\Bus\Player\Data::getList(['id']);
         $options['where'][] = 'player.id IN (' . implode(',', $playerIds) . ')';
         $players = \Own\Bus\Player\Data::loadAll($options);
         foreach ($players as $player) {
             $tp = new \Own\Bus\TournamentPlayer\Model();
             $tp->setTournamentId($tournament->getId());
             $tp->setPlayerId($player->getId());
             $tp->save();
         }
     }
     return true;
 }
Exemplo n.º 4
0
Arquivo: Home.php Projeto: vincium/lot
 public function index()
 {
     if (isset($_POST['sign-out'])) {
         \Rebond\Core\UserSecurity\Service::signOut($this->signedUser);
     }
     // main
     $tplMain = new Util\Template(Util\Template::SITE, ['www']);
     if ($this->player->getId() == 0) {
         $tpl = 'index-guest';
         $matchView = \Own\Bus\Match\Data::loadLastMatch();
     } else {
         $tpl = 'index';
         $matchView = \Own\Bus\Match\Data::loadRecentByPlayerId($this->player->getId());
         $nextMatch = \Own\Bus\Match\Data::loadNextMatchByPlayerId($this->player->getId());
         $soon = isset($nextMatch) && $nextMatch->getScheduled() < time() + Engine::DAY * 360 ? true : false;
         $tplMain->set('player', $this->player);
         $tplMain->set('notificationCount', \Own\Bus\Notification\Data::countByPlayerId($this->player->getId()));
         $tplMain->set('isBonusDayXp', $this->player->isBonusDayXp());
         $tplMain->set('nextBonusDayXp', $this->player->getNextBonusDayXp());
         $tplMain->set('nextMatch', $nextMatch);
         $tplMain->set('soon', $soon);
     }
     $tplMain->set('matchView', $matchView);
     $options = [];
     $options['where'][] = 'configuration.property = \'nextWeek\'';
     $nextWeek = \Own\Bus\Configuration\Data::load($options);
     $options = [];
     $options['where'][] = 'configuration.property = \'nextMonth\'';
     $nextMonth = \Own\Bus\Configuration\Data::load($options);
     $options = [];
     $options['where'][] = 'configuration.property = \'nextYear\'';
     $nextYear = \Own\Bus\Configuration\Data::load($options);
     if (!isset($nextWeek, $nextMonth, $nextYear)) {
         Util\error::kill(Util\Code::UNHANDLED_ERROR, 'nextWeek, nextMonth or nextYear is not set in bus_configuration', __FILE__, __LINE__);
     }
     $tplMain->set('gameTime', Engine::renderTime($this->app->site()->getCreatedDate()));
     $tplMain->set('endWeek', (new Util\DateTime())->setTimestamp($nextWeek->getValue()));
     $tplMain->set('endMonth', (new Util\DateTime())->setTimestamp($nextMonth->getValue()));
     $tplMain->set('endYear', (new Util\DateTime())->setTimestamp($nextYear->getValue()));
     // view
     $this->setTpl();
     // layout
     $this->tplLayout->set('column1', $tplMain->render($tpl));
     // template
     $this->tplMaster->set('layout', $this->tplLayout->render('layout-center'));
     return $this->tplMaster->render('tpl-default');
 }
Exemplo n.º 5
0
Arquivo: Data.php Projeto: vincium/lot
 public static function updatePlayerPoints($playerIds, $createdDate)
 {
     // tour
     $db = new Util\Data();
     $sql = 'SELECT player_id, SUM(tp.points) as points, COUNT(player_id) as total
         FROM bus_tournament_player tp
         JOIN bus_tournament t ON t.id = tp.tournament_id
         WHERE t.start_date > NOW() - INTERVAL ' . Engine::DAY * 336 . ' HOUR
         AND tp.points > 0
         AND player_id IN (' . implode(',', $playerIds) . ')
         GROUP BY player_id
         ORDER BY points DESC';
     $result = $db->select($sql);
     if (count($result) == 0) {
         return;
     }
     while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
         if ($row['total'] <= 18) {
             \Own\Bus\Player\Data::updateTourPointsByPlayerId($row['player_id'], $row['points']);
             continue;
         }
         $sql = 'SELECT SUM(points) as points
             FROM (
                 SELECT points
                 FROM bus_tournament_player tp
                 JOIN bus_tournament t ON t.id = tp.tournament_id
                 WHERE player_id = ?
                 AND t.start_date > NOW() - INTERVAL ? HOUR
                 ORDER BY points DESC
                 LIMIT 18
             ) AS subquery';
         $subRow = $db->selectOne($sql, [$row['player_id'], Engine::DAY * 336]);
         if (isset($subRow)) {
             \Own\Bus\Player\Data::updateTourPointsByPlayerId($row['player_id'], $subRow['points']);
         }
     }
     // race
     $startYearDate = \Own\Bus\Engine::getStartYearDate($createdDate);
     $sql = 'SELECT player_id, SUM(tp.points) as points, COUNT(player_id) as total
         FROM bus_tournament_player tp
         JOIN bus_tournament t ON t.id = tp.tournament_id
         WHERE t.start_date > \'' . $startYearDate . '\'
         AND tp.points > 0
         AND player_id IN (' . implode(',', $playerIds) . ')
         GROUP BY player_id
         ORDER BY points DESC';
     $result = $db->execute($sql);
     if (count($result) == 0) {
         return;
     }
     while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
         if ($row['total'] <= 18) {
             \Own\Bus\Player\Data::updateRacePointsByPlayerId($row['player_id'], $row['points']);
             continue;
         }
         $sql = 'SELECT SUM(points) as points
             FROM (
                 SELECT points
                 FROM bus_tournament_player tp
                 JOIN bus_tournament t ON t.id = tp.tournament_id
                 WHERE player_id = ? AND t.start_date > ?
                 ORDER BY points DESC
                 LIMIT 18
             ) AS subquery';
         $subRow = $db->selectOne($sql, [$row['player_id'], $startYearDate]);
         if (isset($subRow)) {
             \Own\Bus\Player\Data::updateRacePointsByPlayerId($row['player_id'], $subRow['points']);
         }
     }
 }
Exemplo n.º 6
0
Arquivo: Cron.php Projeto: vincium/lot
 public function endTime()
 {
     $options = [];
     $options['where'][] = ['configuration.property = ?', 'nextWeek'];
     $nextWeek = \Own\Bus\Configuration\Data::load($options);
     $options = [];
     $options['where'][] = ['configuration.property = ?', 'nextMonth'];
     $nextMonth = \Own\Bus\Configuration\Data::load($options);
     $options = [];
     $options['where'][] = ['configuration.property = ?', 'nextYear'];
     $nextYear = \Own\Bus\Configuration\Data::load($options);
     // week (day * 7)
     if ((int) $nextWeek->getValue() < time()) {
         \Own\Bus\League\Data::updateSurfaceBatch();
         \Own\Bus\Player\Data::resetLeagueDiff();
         $this->log('leagues surface', true);
         // award achievements
     }
     // 2 days before the end of the month
     if ((int) $nextMonth->getValue() < time() + 2 * Engine::DAY * 3600) {
         \Own\Bus\Notification\Service::createForAll('endOfTheMonth', [['endOfTheMonth', $nextMonth->getValue()]]);
     }
     // month (day * 7 * 4)
     if ((int) $nextMonth->getValue() < time()) {
         // change players league
         $options = [];
         $options['clearSelect'] = true;
         $options['select'][] = \Own\Bus\League\Data::getList(['id', 'classification']);
         $options['order'][] = 'league.classification';
         $leagues = \Own\Bus\League\Data::loadAll($options);
         $leaguesInfo = [];
         $moved = [];
         foreach ($leagues as $league) {
             $leaguesInfo[$league->getId()] = [];
             $leaguesInfo[$league->getId()]['classification'] = $league->getClassification();
             $leaguesInfo[$league->getId()]['up'] = Engine::classificationMove(true, $league->getClassification());
             $leaguesInfo[$league->getId()]['down'] = Engine::classificationMove(false, $league->getClassification());
             $options = [];
             $options['where'][] = ['player.league_id = ?', $league->getId()];
             $options['where'][] = 'player.active = 1';
             $leaguesInfo[$league->getId()]['count'] = \Own\Bus\Player\Data::count($options);
         }
         // going down
         foreach ($leagues as $league) {
             if ($league->getClassification() != Classification::AMATEUR) {
                 $options = [];
                 $options['clearSelect'] = true;
                 $options['select'][] = \Own\Bus\Player\Data::getList(['id', 'league_id']);
                 $options['where'][] = 'player.active = 1';
                 $options['where'][] = ['player.league_id = ?', $league->getId()];
                 if (count($moved) > 0) {
                     $options['where'][] = ['player.id NOT IN (?)', $moved];
                 }
                 $options['order'][] = 'player.league_ranking DESC';
                 $options['limit'][] = Engine::classificationMove(false, $league->getClassification());
                 $players = \Own\Bus\Player\Data::loadAll($options);
                 foreach ($players as $player) {
                     $leagueId = Engine::findLeagueId(false, $player->getLeagueId(), $leaguesInfo);
                     $player->setLeagueId($leagueId);
                     $player->save();
                     $moved[] = $player->getId();
                     if ($player->getUserId() != 0) {
                         \Own\Bus\Notification\Service::create($this->getId(), 0, 'leagueDown', [['leagueDown', $leaguesInfo[$leagueId]['classification']]]);
                     }
                 }
             }
         }
         // going up
         foreach ($leagues as $league) {
             if ($league->getClassification() != Classification::MASTERS) {
                 $options = [];
                 $options['clearSelect'] = true;
                 $options['select'][] = \Own\Bus\Player\Data::getList(['id', 'league_id']);
                 $options['where'][] = 'player.active = 1';
                 $options['where'][] = ['player.league_id = ?', $league->getId()];
                 if (count($moved) > 0) {
                     $options['where'][] = ['player.id NOT IN (?)', $moved];
                 }
                 $options['order'][] = 'player.league_ranking ASC';
                 $options['limit'][] = Engine::classificationMove(true, $league->getClassification());
                 $players = \Own\Bus\Player\Data::loadAll($options);
                 foreach ($players as $player) {
                     $leagueId = Engine::findLeagueId(true, $player->getLeagueId(), $leaguesInfo);
                     $player->setLeagueId($leagueId);
                     $player->save();
                     if ($player->getUserId() != 0) {
                         \Own\Bus\Notification\Service::create($this->getId(), 0, 'leagueUp', [['leagueUp', $leaguesInfo[$leagueId]['classification']]]);
                     }
                 }
             }
         }
         \Own\Bus\Player\Data::resetLeagueRanking();
         $this->log('players leagues update');
         // reset tour and race diff
         \Own\Bus\Player\Data::resetTourAndRaceDiff();
         $this->log('reset tour and race diff', true);
         // remove/add player
         \Own\Bus\Player\Service::removeAndAddPlayer();
         $this->log('remove/add player');
         // award achievements
     }
     // one month before the end of the year
     if ((int) $nextYear->getValue() < time() + Engine::DAY * 28 * 3600) {
         \Own\Bus\Notification\Service::createForAll('endOfTheYear', [['endOfTheYear', $nextYear->getValue()]]);
     }
     // year
     if ((int) $nextYear->getValue() < time()) {
         \Own\Bus\Notification\Service::createForAll('endRanking');
         // reset race ranking
         \Own\Bus\Player\Data::resetRaceRanking();
         $this->log('race ranking reset', true);
         // award achievements
     }
     if ((int) $nextYear->getValue() < time()) {
         $nextYear->setValue((int) $nextYear->getValue() + 336 * Engine::DAY * 60 * 60);
         $nextYear->save();
     }
     if ((int) $nextMonth->getValue() < time()) {
         $nextMonth->setValue((int) $nextMonth->getValue() + 7 * 4 * Engine::DAY * 60 * 60);
         $nextMonth->save();
     }
     if ((int) $nextWeek->getValue() < time()) {
         $nextWeek->setValue((int) $nextWeek->getValue() + 7 * Engine::DAY * 60 * 60);
         $nextWeek->save();
     }
 }
Exemplo n.º 7
0
 public function tour_points()
 {
     // auth
     Util\Auth::isAuthorized($this->signedUser, 'member', false, '/profile/sign-in');
     \Own\Bus\Match\Data::checkMatchToView($this->player->getId());
     $race = Util\Converter::toBool('race', 'get', true);
     // params
     $id = Util\Converter::toInt('id');
     if ($id == 0) {
         $player = $this->player;
     } else {
         $player = \Own\Bus\Player\Data::loadById($id);
         if (!isset($player)) {
             $player = $this->player;
         }
     }
     if ($race) {
         $options = [];
         $options['join'][] = 'bus_tournament tournament ON tournament.id = tournament_player.tournament_id';
         $options['where'][] = 'tournament.status = ' . TournamentStatus::FINISHED;
         $options['where'][] = 'tournament.start_date > \'' . Engine::getStartYearDate($this->app->site()->getCreatedDate()) . '\'';
         $options['order'][] = 'points DESC';
         $tournaments = \Own\Bus\TournamentPlayer\Data::loadAllByPlayerId($player->getId(), $options);
         $oldTournaments = null;
     } else {
         $options = [];
         $options['join'][] = 'bus_tournament tournament ON tournament.id = tournament_player.tournament_id';
         $options['where'][] = 'tournament.status = ' . TournamentStatus::FINISHED;
         $options['where'][] = 'tournament.start_date > NOW() - INTERVAL ' . Engine::DAY * 336 . ' HOUR';
         $options['order'][] = 'points DESC';
         $tournaments = \Own\Bus\TournamentPlayer\Data::loadAllByPlayerId($player->getId(), $options);
         $options = [];
         $options['join'][] = 'bus_tournament tournament ON tournament.id = tournament_player.tournament_id';
         $options['where'][] = 'tournament.status = ' . TournamentStatus::FINISHED;
         $options['where'][] = 'tournament.start_date < NOW() - INTERVAL ' . Engine::DAY * 336 . ' HOUR';
         $options['order'][] = 'tournament.start_date DESC';
         $oldTournaments = \Own\Bus\TournamentPlayer\Data::loadAllByPlayerId($player->getId(), $options);
     }
     // view
     $this->setTpl();
     // filter
     $tplFilter = new Util\Template(Util\Template::SITE, ['www']);
     $tplFilter->set('race', $race);
     $tplFilter->set('playerId', $player->getId());
     // main
     $tplMain = new Util\Template(Util\Template::SITE, ['www']);
     $tplMain->set('username', $player->getUsername());
     $tplMain->set('tournaments', $tournaments);
     $tplMain->set('oldTournaments', $oldTournaments);
     // layout
     $this->tplLayout->set('column1', $tplFilter->render('profile-tour-point-filter'));
     $this->tplLayout->add('column1', $tplMain->render('profile-tour-point'));
     // template
     $this->tplMaster->set('layout', $this->tplLayout->render('layout-center'));
     return $this->tplMaster->render('tpl-default');
 }
Exemplo n.º 8
0
 public static function removeAndAddPlayer()
 {
     $options = [];
     $options['clearSelect'] = true;
     $options['select'][] = \Own\Bus\Player\Data::getList(['id', 'username']);
     $options['where'][] = 'player.user_id = 0';
     $options['where'][] = 'player.active = 1';
     $players = \Own\Bus\Player\Data::loadAll($options);
     if (count($players) > 0) {
         $db = new Util\Data();
         $pick = \Own\Bus\Engine::dice(0, count($players) - 1);
         $remove = 'UPDATE bus_player SET active = 0 WHERE id = ' . $players[$pick]->getId();
         $db->execute($remove);
         Util\Log::log(Util\Code::CRON, 'player retired: ' . $players[$pick]->getUsername() . ' (' . $players[$pick]->getId() . ')', __FILE__, __LINE__);
         $leagues = \Own\Bus\League\Data::loadAll();
         $player = new \Own\Bus\Player\Model();
         $player->setRandom(1);
         $player->setActive(true);
         if (count($leagues) > 0) {
             $player->setLeagueId(\Own\Bus\Engine::findLeague($leagues, 1));
         }
         $player->save();
         Util\Log::log(Util\Code::CRON, 'new player: ' . $player->getUsername() . ' (' . $player->getId() . ')', __FILE__, __LINE__);
     }
 }
Exemplo n.º 9
0
 public function matchLog()
 {
     $json = [];
     $json['result'] = \Rebond\Core\ResultType::ERROR;
     // check
     $matchId = Util\Converter::toInt('matchId', 'post');
     $debug = Util\Converter::toBool('debug', 'post', false);
     $options = [];
     $options['where'][] = ['match_id = ?', $matchId];
     $options['order'][] = 'id';
     $matchLog = \Own\Bus\Log\Data::loadAll($options);
     if (count($matchLog) == 0) {
         $json['message'] = Util\Lang::lang('noMatchLog');
         return json_encode($json);
     }
     $logs = [];
     foreach ($matchLog as $log) {
         $logs[] = $log->toArray();
     }
     $htmlLog = '';
     if (count($logs) > 0) {
         $htmlLog .= '<table class="list">';
         foreach ($logs as $log) {
             $htmlLog .= '<tr>';
             $htmlLog .= '<td class="score">' . \Own\Bus\Engine::renderScore($log['game'], $log['point1'], $log['point2']) . '</td>';
             $htmlLog .= '<td>' . \Own\Bus\Engine::renderDescription($log['description'], $debug);
             $htmlLog .= '<strong>' . Util\Lang::lang($log['result']) . '</strong></td>';
             $htmlLog .= '</tr>';
         }
         $htmlLog .= '</table>';
     }
     // layout
     $json['result'] = \Rebond\Core\ResultType::SUCCESS;
     $json['html'] = $htmlLog;
     return json_encode($json);
 }
Exemplo n.º 10
0
 public function selectServer()
 {
     $toss = Engine::dice(1, 2);
     if ($toss == 1) {
         if ($this->match->getPlayerMatch1()->getPlayer()->getToss() == 1) {
             $this->match->setServerId($this->match->getPlayerMatch1Id());
         } else {
             $this->match->setServerId($this->match->getPlayerMatch2Id());
         }
     } else {
         if ($this->match->getPlayerMatch2()->getPlayer()->getToss() == 1) {
             $this->match->setServerId($this->match->getPlayerMatch2Id());
         } else {
             $this->match->setServerId($this->match->getPlayerMatch1Id());
         }
     }
     return $toss;
 }
Exemplo n.º 11
0
 public function updateMasteries()
 {
     $total = $this->getExperienceLeft();
     $oldTactic = $this->getTacticValues();
     $masteries = Service::getMasteryList();
     while (count($masteries) > 0 && $total >= Service::masteryCost(1)) {
         $pick = Engine::dice(0, count($masteries) - 1);
         $mastery = $masteries[$pick];
         $cost = Service::masteryCost($mastery + 1);
         if ($total >= $cost) {
             $total -= $cost;
             $this->{$mastery}++;
             unset($masteries[$pick]);
             $masteries = array_values($masteries);
             // update tactic
             $value = $this->{$mastery} + Engine::dice(0, 2);
             switch ($mastery) {
                 case 'serve':
                     $this->tacticServe1 = $value;
                     $this->tacticServe2 = $value;
                     break;
                 case 'return':
                     $this->tacticReturn1 = $value;
                     $this->tacticReturn2 = $value;
                     break;
                 case 'forehand':
                 case 'backhand':
                 case 'turnAround':
                     $this->tacticTurnAround = 2 + min(3, abs($this->forehand - $this->backhand));
                     break;
                 case 'volley':
                 case 'netApproach':
                     $this->tacticNet = $value;
                     $this->tacticNetMove = round($value / 2);
                     break;
                 case 'serveVolley':
                     $this->tacticServeNet = round($value / 2);
                     break;
                 case 'dropsthot':
                     $this->tacticDropshot = round($value / 2);
                     break;
                 case 'endurance':
                     $this->tacticIntensity = $value;
                     break;
                 case 'counter':
                     $this->tacticCounter = round($value / 2);
                     break;
                 case 'offense':
                 case 'defense':
                     $this->tacticBaseline = 5 + $this->offense - $this->defense;
                     $this->tacticBaseline = min(10, max(1, $this->tacticBaseline));
                     break;
             }
         }
     }
     $this->changeTactic($oldTactic);
     return true;
 }
Exemplo n.º 12
0
 public function calculateServeSpeed()
 {
     $speed = 60 + round($this->point / 2) + Engine::dice(-10, 10);
     if ($this->isSuccess && $speed > $this->playerMatch->getFastestServe()) {
         $this->playerMatch->setFastestServe($speed);
     }
     return $speed;
 }