Ejemplo n.º 1
0
 /**
  * @param int $teamIndex
  *
  * @return Trainer
  */
 protected function createEntity($teamIndex)
 {
     $trainer = new Trainer();
     $trainer->setPreferredTraining(rand(1, 3));
     $trainer->setSkill(max(1, min(100, round(rand(1, 100) / $teamIndex * 5))));
     return $trainer;
 }
Ejemplo n.º 2
0
 public function testTrainByOffensiveTrainerWithSkill100()
 {
     $this->setUpPlayer(0, 0);
     $this->setUpTrainer(100, Trainer::PREFERRED_TRAINING_OFFENSIVE);
     $this->trainer->train($this->player);
     $this->assertEquals(25, $this->player->getTrainingValueDefense());
     $this->assertEquals(75, $this->player->getTrainingValueOffense());
 }
Ejemplo n.º 3
0
 public function train()
 {
     if (!$this->hasTrainer()) {
         return;
     }
     foreach ($this->players as $player) {
         $this->trainer->train($player);
     }
 }