コード例 #1
0
 private function checkLevelsAgainstExperiences(ProfessionLevels $professionLevels, Memories $memories, ExperiencesTable $experiencesTable)
 {
     $highestLevelRank = $professionLevels->getCurrentLevel()->getLevelRank();
     $requiredExperiences = $experiencesTable->toTotalExperiences(new LevelBonus($highestLevelRank->getValue(), $experiencesTable));
     $availableExperiences = $memories->getExperiences($experiencesTable);
     if ($availableExperiences->getValue() < $requiredExperiences->getValue()) {
         throw new Exceptions\InsufficientExperiences("Given level {$highestLevelRank} needs at least {$requiredExperiences} experiences, got only {$availableExperiences}");
     }
 }