/** * @param ProfessionFirstLevel $professionFirstLevel * @param Tables $tables * @param BackgroundSkillPoints $backgroundSkillPoints * * @return bool * @throws \DrdPlus\Skills\Exceptions\EmptyFirstLevelBackgroundSkillPoints */ private function checkPayByFirstLevelBackgroundSkillPoints(ProfessionFirstLevel $professionFirstLevel, Tables $tables, BackgroundSkillPoints $backgroundSkillPoints) { $relatedProperties = $this->sortAlphabetically($this->getRelatedProperties()); $firstLevelSkillPoints = 0; switch ($relatedProperties) { case $this->sortAlphabetically([Strength::STRENGTH, Agility::AGILITY]): $firstLevelSkillPoints = $backgroundSkillPoints->getPhysicalSkillPoints($professionFirstLevel->getProfession(), $tables); break; case $this->sortAlphabetically([Will::WILL, Intelligence::INTELLIGENCE]): $firstLevelSkillPoints = $backgroundSkillPoints->getPsychicalSkillPoints($professionFirstLevel->getProfession(), $tables); break; case $this->sortAlphabetically([Knack::KNACK, Charisma::CHARISMA]): $firstLevelSkillPoints = $backgroundSkillPoints->getCombinedSkillPoints($professionFirstLevel->getProfession(), $tables); break; } if ($firstLevelSkillPoints < 1) { throw new Exceptions\EmptyFirstLevelBackgroundSkillPoints('First level skill point has to come from the background.' . ' No skill point for properties ' . implode(',', $relatedProperties) . ' is available.'); } return true; }