コード例 #1
0
 /**
  * @param ProfessionLevel $excludedProfession
  *
  * @return \Mockery\MockInterface[]|ProfessionFirstLevel[]|ProfessionNextLevel[]
  */
 private function getLevelsExcept(ProfessionLevel $excludedProfession)
 {
     $professionLevels = $this->buildProfessionLevels();
     return array_filter($professionLevels, function (ProfessionLevel $level) use($excludedProfession) {
         return $level->getProfession()->getValue() !== $excludedProfession->getProfession()->getValue();
     });
 }
コード例 #2
0
 /**
  * @param ProfessionLevel $searchedThroughProfessionLevel
  * @param BaseProperty $patternPropertyIncrement
  * @return Charisma|Intelligence|Knack|Will
  */
 private function getSamePropertyIncrement(ProfessionLevel $searchedThroughProfessionLevel, BaseProperty $patternPropertyIncrement)
 {
     return $searchedThroughProfessionLevel->getBasePropertyIncrement($patternPropertyIncrement->getCode());
 }
 private function checkChosenPropertiesSum($primaryPropertiesSum, $secondaryPropertiesSum, ExceptionalityFate $fate, ProfessionLevel $professionLevel)
 {
     if ($primaryPropertiesSum !== $fate->getPrimaryPropertiesBonusOnChoice()) {
         throw new Exceptions\InvalidSumOfChosenProperties("Expected sum of primary properties is {$fate->getPrimaryPropertiesBonusOnChoice()}, got {$primaryPropertiesSum}" . " for profession {$professionLevel->getProfession()->getValue()} and fate {$fate::getCode()}");
     }
     if ($secondaryPropertiesSum !== $fate->getSecondaryPropertiesBonusOnChoice()) {
         throw new Exceptions\InvalidSumOfChosenProperties("Expected sum of secondary properties is {$fate->getSecondaryPropertiesBonusOnChoice()}, got {$secondaryPropertiesSum}" . " for profession {$professionLevel->getProfession()->getValue()} and fate {$fate::getCode()}");
     }
 }
コード例 #4
0
 private static function checkFirstLevelPayment(array $firstLevelPayments, ProfessionLevel $firstLevel, BackgroundSkillPoints $backgroundSkillPoints, Tables $tables)
 {
     foreach ($firstLevelPayments as $skillType => $payment) {
         if (!$payment['spentFirstLevelSkillPoints']) {
             continue;
             // no skills have been "bought" at all
         }
         $paymentBackgroundSkills = $payment['backgroundSkillPoints'];
         self::checkIfBackgroundSkillPointsAreTheSame($paymentBackgroundSkills, $backgroundSkillPoints);
         $availableSkillPoints = 0;
         switch ($skillType) {
             case self::PHYSICAL:
                 $availableSkillPoints = $backgroundSkillPoints->getPhysicalSkillPoints($firstLevel->getProfession(), $tables);
                 break;
             case self::PSYCHICAL:
                 $availableSkillPoints = $backgroundSkillPoints->getPsychicalSkillPoints($firstLevel->getProfession(), $tables);
                 break;
             case self::COMBINED:
                 $availableSkillPoints = $backgroundSkillPoints->getCombinedSkillPoints($firstLevel->getProfession(), $tables);
                 break;
         }
         if ($availableSkillPoints < $payment['spentFirstLevelSkillPoints']) {
             throw new Exceptions\HigherSkillRanksFromFirstLevelThanPossible("First level skills of type '{$skillType}' have higher ranks then possible." . " Expected spent {$availableSkillPoints} skill points at most, got " . $payment['spentFirstLevelSkillPoints']);
         }
     }
 }