/** * It is only the increment based on first level of specific profession. * There are other increments like race, size etc., solved in different library. * * @param BaseProperty $baseProperty * @param Profession $profession * @throws \DrdPlus\Person\ProfessionLevels\Exceptions\InvalidFirstLevelPropertyValue */ protected function checkPropertyIncrement(BaseProperty $baseProperty, Profession $profession) { $propertyFirstLevelModifier = static::getBasePropertyFirstLevelModifier($baseProperty->getCode(), $profession); if ($baseProperty->getValue() !== $propertyFirstLevelModifier) { throw new Exceptions\InvalidFirstLevelPropertyValue("On first level has to be {$baseProperty->getCode()} of value {$propertyFirstLevelModifier}" . ", got {$baseProperty->getValue()}"); } }
protected function checkPropertyIncrement(BaseProperty $baseProperty, Profession $profession) { if ($baseProperty->getValue() < 0) { throw new Exceptions\NegativeNextLevelProperty("Next level property increment can not be negative, got {$baseProperty->getValue()}"); } if ($baseProperty->getValue() > self::MAX_NEXT_LEVEL_PROPERTY_MODIFIER) { throw new Exceptions\TooHighNextLevelPropertyIncrement('Next level property increment has to be at most ' . self::MAX_NEXT_LEVEL_PROPERTY_MODIFIER . ", got {$baseProperty->getValue()}"); } }
/** * @param BaseProperty $baseProperty * @param Profession $profession * @throws Exceptions\InvalidZeroLevelPropertyValue */ protected function checkPropertyIncrement(BaseProperty $baseProperty, Profession $profession) { if ($baseProperty->getValue() !== 0) { throw new Exceptions\InvalidZeroLevelPropertyValue('Expected 0 as base property "increment" for zero level, got ' . $baseProperty->getValue()); } }
/** * @param Race $race * @param GenderCode $genderCode * @param Tables $tables * @param BaseProperty $baseProperty * @return int * @throws \DrdPlus\Races\Exceptions\UnknownPropertyCode */ private function getBasePropertyLimit(Race $race, GenderCode $genderCode, Tables $tables, BaseProperty $baseProperty) { return $race->getProperty($baseProperty->getCode(), $genderCode, $tables) + self::INITIAL_PROPERTY_INCREASE_LIMIT; }
private function checkChosenProperty(ProfessionLevel $professionLevel, ExceptionalityFate $fate, BaseProperty $chosenProperty) { if ($chosenProperty->getValue() > $fate->getUpToSingleProperty()) { throw new Exceptions\InvalidValueOfChosenProperty("Requested {$chosenProperty->getCode()} value {$chosenProperty->getValue()} is higher than allowed" . " maximum {$fate->getUpToSingleProperty()} for profession {$professionLevel->getProfession()->getValue()}" . " and fate {$fate::getCode()}"); } }
/** * @param ProfessionLevel $searchedThroughProfessionLevel * @param BaseProperty $patternPropertyIncrement * @return Charisma|Intelligence|Knack|Will */ private function getSamePropertyIncrement(ProfessionLevel $searchedThroughProfessionLevel, BaseProperty $patternPropertyIncrement) { return $searchedThroughProfessionLevel->getBasePropertyIncrement($patternPropertyIncrement->getCode()); }