/** * @return Height */ public function getHeight() { // there is no more height adjustments than on first level return $this->firstLevelProperties->getFirstLevelHeight(); }
/** * @test * @dataProvider provideBasePropertyValues * @param $strength * @param $agility * @param $knack * @param $will * @param $intelligence * @param $charisma */ public function I_can_get_every_property_both_limited_and_unlimited($strength, $agility, $knack, $will, $intelligence, $charisma) { $race = CommonHuman::getIt(); $female = GenderCode::getIt(GenderCode::FEMALE); $exceptionalityProperties = $this->createExceptionalityProperties($strength, $agility, $knack, $will, $intelligence, $charisma); $professionLevels = $this->createProfessionLevels(); $weightInKgAdjustment = WeightInKg::getIt(12.3); $heightInCmAdjustment = HeightInCm::getIt(123.45); $age = Age::getIt(32); $tables = new Tables(); $firstLevelProperties = new FirstLevelProperties($race, $female, $exceptionalityProperties, $professionLevels, $weightInKgAdjustment, $heightInCmAdjustment, $age, $tables); self::assertSame($exceptionalityProperties, $firstLevelProperties->getExceptionalityProperties()); $expectedStrength = min($strength, 3) - 1; /* female */ self::assertInstanceOf(Strength::class, $firstLevelProperties->getFirstLevelStrength()); self::assertSame($expectedStrength, $firstLevelProperties->getFirstLevelStrength()->getValue()); self::assertSame(max(0, $strength - 3), $firstLevelProperties->getStrengthLossBecauseOfLimit()); $expectedAgility = min($agility, 3); self::assertInstanceOf(Agility::class, $firstLevelProperties->getFirstLevelAgility()); self::assertEquals($expectedAgility, $firstLevelProperties->getFirstLevelAgility()->getValue()); self::assertSame(max(0, $agility - 3), $firstLevelProperties->getAgilityLossBecauseOfLimit()); $expectedKnack = min($knack, 3); self::assertInstanceOf(Knack::class, $firstLevelProperties->getFirstLevelKnack()); self::assertEquals($expectedKnack, $firstLevelProperties->getFirstLevelKnack()->getValue()); self::assertSame(max(0, $knack - 3), $firstLevelProperties->getKnackLossBecauseOfLimit()); $expectedWill = min($will, 3); self::assertInstanceOf(Will::class, $firstLevelProperties->getFirstLevelWill()); self::assertEquals($expectedWill, $firstLevelProperties->getFirstLevelWill()->getValue()); self::assertSame(max(0, $will - 3), $firstLevelProperties->getWillLossBecauseOfLimit()); $expectedIntelligence = min($intelligence, 3); self::assertInstanceOf(Intelligence::class, $firstLevelProperties->getFirstLevelIntelligence()); self::assertEquals($expectedIntelligence, $firstLevelProperties->getFirstLevelIntelligence()->getValue()); self::assertSame(max(0, $intelligence - 3), $firstLevelProperties->getIntelligenceLossBecauseOfLimit()); $expectedCharisma = min($charisma, 3) + 1; /* female */ self::assertInstanceOf(Charisma::class, $firstLevelProperties->getFirstLevelCharisma()); self::assertEquals($expectedCharisma, $firstLevelProperties->getFirstLevelCharisma()->getValue()); self::assertSame(max(0, $charisma - 3), $firstLevelProperties->getCharismaLossBecauseOfLimit()); $expectedSize = -1; /* female */ if ($strength === 0) { $expectedSize--; } else { if ($strength > 1) { $expectedSize++; } } self::assertInstanceOf(Size::class, $firstLevelProperties->getFirstLevelSize()); self::assertSame($expectedSize, $firstLevelProperties->getFirstLevelSize()->getValue()); self::assertSame($weightInKgAdjustment, $firstLevelProperties->getFirstLevelWeightInKgAdjustment()); self::assertEquals(WeightInKg::getIt(70 + $weightInKgAdjustment->getValue()), $firstLevelProperties->getFirstLevelWeightInKg()); self::assertSame($heightInCmAdjustment, $firstLevelProperties->getFirstLevelHeightInCmAdjustment()); self::assertSame($heightInCm = HeightInCm::getIt(180 + $heightInCmAdjustment->getValue()), $firstLevelProperties->getFirstLevelHeightInCm()); self::assertEquals(new Height($heightInCm, $tables->getDistanceTable()), $firstLevelProperties->getFirstLevelHeight()); self::assertSame($age, $firstLevelProperties->getFirstLevelAge()); }