예제 #1
0
 public function testUpdateSkill()
 {
     $this->setUpPlayer(20, 50, 100, -100);
     $this->player->updateSkills();
     $this->assertGreaterThanOrEqual(20, $this->player->getSkillDefense());
     $this->assertLessThanOrEqual(30, $this->player->getSkillDefense());
     $this->assertEquals(0, $this->player->getTrainingValueDefense());
     $this->assertGreaterThanOrEqual(0, $this->player->getSkillChangeDefense());
     $this->assertLessThanOrEqual(10, $this->player->getSkillChangeDefense());
     $this->assertGreaterThanOrEqual(40, $this->player->getSkillOffense());
     $this->assertLessThanOrEqual(50, $this->player->getSkillOffense());
     $this->assertEquals(0, $this->player->getTrainingValueOffense());
     $this->assertGreaterThanOrEqual(-10, $this->player->getSkillChangeOffense());
     $this->assertLessThanOrEqual(0, $this->player->getSkillChangeOffense());
 }
예제 #2
0
 /**
  * @param Player $player
  *
  * @return float
  */
 private function calculateBaseValue(Player $player)
 {
     $skill = $player->getSkillDefense() * $this->manager->getTransferFactorDefensiveSkill() + $player->getSkillOffense() * $this->manager->getTransferFactorOffensiveSkill();
     return $skill / ($this->manager->getTransferFactorDefensiveSkill() + $this->manager->getTransferFactorOffensiveSkill());
 }