コード例 #1
0
 /**
  * (non-PHPdoc)
  * @see ISimulationObserver::onFreeKick()
  */
 public function onFreeKick(SimulationMatch $match, SimulationPlayer $player, SimulationPlayer $goaly, $successful)
 {
     $player->setShoots($player->getShoots() + 1);
     // adapt grades
     if ($successful) {
         $player->improveMark(MARK_IMPROVE_GOAL_SCORER);
         // do not decrease goaly's grade since it is probably not his fault, poor guy..
         // update goals
         $player->team->setGoals($player->team->getGoals() + 1);
         $player->setGoals($player->getGoals() + 1);
     } else {
         $player->downgradeMark(MARK_DOWNGRADE_SHOOTFAILURE);
         $goaly->improveMark(MARK_IMPROVE_SHOOTFAILURE_GOALY);
     }
 }