/** * @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; }
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()); }
public function train() { if (!$this->hasTrainer()) { return; } foreach ($this->players as $player) { $this->trainer->train($player); } }