/** * @param ProfessionZeroLevel $zeroLevel * @param ProfessionFirstLevel $firstLevel * * @return ProfessionLevels */ private function createProfessionLevelsWith(ProfessionZeroLevel $zeroLevel, ProfessionFirstLevel $firstLevel) { $professionLevels = new ProfessionLevels($zeroLevel, $firstLevel); self::assertSame($firstLevel, $professionLevels->getFirstLevel()); self::assertEquals([$zeroLevel, $firstLevel], $professionLevels->getSortedProfessionLevels()); return $professionLevels; }
/** * @test * @dataProvider provideProfessionLevelsWithTooLowPropertyIncrease * @expectedException \DrdPlus\Skills\Exceptions\HigherSkillRanksFromNextLevelsThanPossible * @param ProfessionLevels $professionLevels */ public function I_can_not_increase_skills_by_next_levels_more_than_provides_property_increments(ProfessionLevels $professionLevels) { $nextLevel = $professionLevels->getProfessionNextLevels()->last(); $physicalSkills = $this->createPhysicalSkillsByNextLevelPropertyIncrease($nextLevel); $psychicalSkills = $this->createPsychicalSkillsByNextLevelPropertyIncrease($nextLevel); $combinedSkills = $this->createCombinedSkillsByNextLevelPropertyIncrease($nextLevel); $backgroundSkillPoints = $this->createBackgroundSkillPoints($professionLevels->getFirstLevel()->getProfession()); Skills::createSkills($professionLevels, $backgroundSkillPoints, new Tables(), $physicalSkills, $psychicalSkills, $combinedSkills); }
/** * @param Race $race * @param GenderCode $genderCode * @param ExceptionalityProperties $exceptionalityProperties * @param ProfessionLevels $professionLevels * @param WeightInKg $weightInKgAdjustment * @param HeightInCm $heightInCm * @param Age $age * @param Tables $tables * @throws Exceptions\TooLowStrengthAdjustment */ public function __construct(Race $race, GenderCode $genderCode, ExceptionalityProperties $exceptionalityProperties, ProfessionLevels $professionLevels, WeightInKg $weightInKgAdjustment, HeightInCm $heightInCm, Age $age, Tables $tables) { $this->firstLevelProperties = new FirstLevelProperties($race, $genderCode, $exceptionalityProperties, $professionLevels, $weightInKgAdjustment, $heightInCm, $age, $tables); $this->nextLevelsProperties = new NextLevelsProperties($professionLevels); $this->strength = Strength::getIt($this->firstLevelProperties->getFirstLevelStrength()->getValue() + $this->nextLevelsProperties->getNextLevelsStrength()->getValue()); $this->agility = Agility::getIt($this->firstLevelProperties->getFirstLevelAgility()->getValue() + $this->nextLevelsProperties->getNextLevelsAgility()->getValue()); $this->knack = Knack::getIt($this->firstLevelProperties->getFirstLevelKnack()->getValue() + $this->nextLevelsProperties->getNextLevelsKnack()->getValue()); $this->will = Will::getIt($this->firstLevelProperties->getFirstLevelWill()->getValue() + $this->nextLevelsProperties->getNextLevelsWill()->getValue()); $this->intelligence = Intelligence::getIt($this->firstLevelProperties->getFirstLevelIntelligence()->getValue() + $this->nextLevelsProperties->getNextLevelsIntelligence()->getValue()); $this->charisma = Charisma::getIt($this->firstLevelProperties->getFirstLevelCharisma()->getValue() + $this->nextLevelsProperties->getNextLevelsCharisma()->getValue()); // delivered properties $this->toughness = new Toughness($this->getStrength(), $race->getRaceCode(), $race->getSubraceCode(), $tables->getRacesTable()); $this->endurance = new Endurance($this->getStrength(), $this->getWill()); $this->speed = new Speed($this->getStrength(), $this->getAgility(), $this->getHeight()); $this->senses = new Senses($this->getKnack(), RaceCode::getIt($race->getRaceCode()), SubRaceCode::getIt($race->getSubraceCode()), $tables->getRacesTable()); // aspects of visage $this->beauty = new Beauty($this->getAgility(), $this->getKnack(), $this->getCharisma()); $this->dangerousness = new Dangerousness($this->getStrength(), $this->getWill(), $this->getCharisma()); $this->dignity = new Dignity($this->getIntelligence(), $this->getWill(), $this->getCharisma()); /** @noinspection ExceptionsAnnotatingAndHandlingInspection */ $this->fightNumber = new FightNumber(ProfessionCode::getIt($professionLevels->getFirstLevel()->getProfession()->getValue()), $this, $this->getHeight()); $this->attack = new Attack($this->getAgility()); $this->shooting = new Shooting($this->getKnack()); $this->defenseNumber = new DefenseNumber($this->getAgility()); $this->defenseAgainstShooting = new DefenseNumberAgainstShooting($this->getDefenseNumber(), $this->getSize()); $this->woundsLimit = new WoundBoundary($this->getToughness(), $tables->getWoundsTable()); $this->fatigueLimit = new FatigueBoundary($this->getEndurance(), $tables->getFatigueTable()); }
/** * @param ProfessionLevels $professionLevels * @param BackgroundSkillPoints $backgroundSkillPoints * @param Tables $tables * @param PhysicalSkills $physicalSkills , * @param PsychicalSkills $psychicalSkills , * @param CombinedSkills $combinedSkills */ private static function checkPaymentForSkillPoints(ProfessionLevels $professionLevels, BackgroundSkillPoints $backgroundSkillPoints, Tables $tables, PhysicalSkills $physicalSkills, PsychicalSkills $psychicalSkills, CombinedSkills $combinedSkills) { $paymentsFoSkills = self::extractPropertyPayments($physicalSkills, $psychicalSkills, $combinedSkills); self::checkFirstLevelPayment($paymentsFoSkills['firstLevel'], $professionLevels->getFirstLevel(), $backgroundSkillPoints, $tables); self::checkNextLevelsPayment($paymentsFoSkills['nextLevels'], $professionLevels); }