/**
  * @test
  * @return WoundBoundary
  */
 public function I_can_get_property_easily()
 {
     /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
     $woundsLimit = new WoundBoundary(new Toughness(Strength::getIt($strength = 6), RaceCode::getIt(RaceCode::DWARF), SubRaceCode::getIt(SubRaceCode::MOUNTAIN), new RacesTable()), new WoundsTable());
     self::assertSame(22, $woundsLimit->getValue());
     return $woundsLimit;
 }
 /**
  * #@test
  */
 public function I_can_get_property_easily()
 {
     $toughness = new Toughness($this->getStrength($strengthValue = 123), RaceCode::getIt(RaceCode::DWARF), SubRaceCode::getIt(SubRaceCode::WOOD), new RacesTable());
     self::assertSame('toughness', $toughness->getCode());
     self::assertSame('toughness', Toughness::TOUGHNESS);
     self::assertSame($strengthValue + 1, $toughness->getValue());
     self::assertSame((string) ($strengthValue + 1), "{$toughness}");
     return $toughness;
 }
 /**
  * @test
  * @dataProvider provideSubraceCodesAndClass
  * @param string $raceCodeValue
  * @param string $subraceCodeValue
  * @param string $expectedSubraceClass
  */
 public function I_can_create_subrace_by_its_codes($raceCodeValue, $subraceCodeValue, $expectedSubraceClass)
 {
     $raceCode = RaceCode::getIt($raceCodeValue);
     $subraceCode = SubRaceCode::getIt($subraceCodeValue);
     $subrace = RacesFactory::getSubRaceByCodes($raceCode, $subraceCode);
     self::assertInstanceOf($expectedSubraceClass, $subrace);
     self::assertSame($raceCode, $subrace->getRaceCode());
     self::assertSame($subraceCode, $subrace->getSubraceCode());
 }
 /**
  * @return SubRaceCode
  */
 public function getSubraceCode()
 {
     return SubRaceCode::getIt(self::COMMON);
 }
 /**
  * @return SubRaceCode
  */
 private function getSubraceCode()
 {
     $subraceCodeString = str_replace($this->getRaceCode(), '', strtolower($this->getSubraceBaseName()));
     return SubRaceCode::getIt($subraceCodeString);
 }
 /**
  * @return SubRaceCode
  */
 public function getSubraceCode()
 {
     return SubRaceCode::getIt(self::MOUNTAIN);
 }
 /**
  * @test
  * @dataProvider getCombination
  *
  * @param Race $race
  * @param GenderCode $genderCode
  * @param ExceptionalityProperties $exceptionalityProperties
  * @param ProfessionLevels $professionLevels
  * @param Tables $tables
  * @param WeightInKg $weightInKgAdjustment
  * @param HeightInCm $heightInCmAdjustment
  * @param Age $age
  * @param int $expectedStrength
  * @param int $expectedAgility
  * @param int $expectedKnack
  * @param int $expectedWill
  * @param int $expectedIntelligence
  * @param int $expectedCharisma
  */
 public function I_can_create_properties_for_any_combination(Race $race, GenderCode $genderCode, ExceptionalityProperties $exceptionalityProperties, ProfessionLevels $professionLevels, Tables $tables, WeightInKg $weightInKgAdjustment, HeightInCm $heightInCmAdjustment, Age $age, $expectedStrength, $expectedAgility, $expectedKnack, $expectedWill, $expectedIntelligence, $expectedCharisma)
 {
     $properties = new PropertiesByLevels($race, $genderCode, $exceptionalityProperties, $professionLevels, $weightInKgAdjustment, $heightInCmAdjustment, $age, $tables);
     self::assertInstanceOf(FirstLevelProperties::class, $properties->getFirstLevelProperties());
     self::assertInstanceOf(NextLevelsProperties::class, $properties->getNextLevelsProperties());
     self::assertSame($expectedStrength, $properties->getStrength()->getValue(), "{$race} {$genderCode}");
     self::assertSame($expectedAgility, $properties->getAgility()->getValue(), "{$race} {$genderCode}");
     self::assertSame($expectedKnack, $properties->getKnack()->getValue(), "{$race} {$genderCode}");
     self::assertSame($expectedWill, $properties->getWill()->getValue(), "{$race} {$genderCode}");
     self::assertSame($expectedIntelligence, $properties->getIntelligence()->getValue(), "{$race} {$genderCode}");
     self::assertSame($expectedCharisma, $properties->getCharisma()->getValue(), "{$race} {$genderCode}");
     self::assertSame($weightInKgAdjustment, $properties->getWeightInKgAdjustment());
     self::assertGreaterThan($weightInKgAdjustment->getValue(), $properties->getWeightInKg()->getValue(), "{$race} {$genderCode}");
     self::assertSame($heightInCmAdjustment, $properties->getHeightInCmAdjustment());
     self::assertGreaterThan($heightInCmAdjustment->getValue(), $properties->getHeightInCm()->getValue(), "{$race} {$genderCode}");
     self::assertEquals($expectedHeight = new Height($properties->getHeightInCm(), $tables->getDistanceTable()), $properties->getHeight());
     self::assertSame($age, $properties->getAge());
     $expectedToughness = new Toughness(Strength::getIt($expectedStrength), $race->getRaceCode(), $race->getSubraceCode(), $tables->getRacesTable());
     self::assertInstanceOf(Toughness::class, $properties->getToughness());
     self::assertSame($expectedToughness->getValue(), $properties->getToughness()->getValue(), "{$race} {$genderCode}");
     $expectedEndurance = new Endurance(Strength::getIt($expectedStrength), Will::getIt($expectedWill));
     self::assertInstanceOf(Endurance::class, $properties->getEndurance());
     self::assertSame($expectedEndurance->getValue(), $properties->getEndurance()->getValue(), "{$race} {$genderCode}");
     $expectedSize = Size::getIt($race->getSize($genderCode, $tables) + 1);
     /* size bonus by strength */
     self::assertInstanceOf(Size::class, $properties->getSize(), "{$race} {$genderCode}");
     self::assertSame($expectedSize->getValue(), $properties->getSize()->getValue(), "{$race} {$genderCode}");
     $expectedSpeed = new Speed(Strength::getIt($expectedStrength), Agility::getIt($expectedAgility), $expectedHeight);
     self::assertInstanceOf(Speed::class, $properties->getSpeed(), "{$race} {$genderCode}");
     self::assertSame($expectedSpeed->getValue(), $properties->getSpeed()->getValue(), "{$race} {$genderCode}");
     $expectedSenses = new Senses(Knack::getIt($expectedKnack), RaceCode::getIt($race->getRaceCode()), SubRaceCode::getIt($race->getSubraceCode()), $tables->getRacesTable());
     self::assertInstanceOf(Senses::class, $properties->getSenses());
     self::assertSame($expectedSenses->getValue(), $properties->getSenses()->getValue(), "{$race} {$genderCode}");
     $expectedBeauty = new Beauty(Agility::getIt($expectedAgility), Knack::getIt($expectedKnack), Charisma::getIt($expectedCharisma));
     self::assertInstanceOf(Beauty::class, $properties->getBeauty());
     self::assertSame($expectedBeauty->getValue(), $properties->getBeauty()->getValue(), "{$race} {$genderCode}");
     $expectedDangerousness = new Dangerousness(Strength::getIt($expectedStrength), Will::getIt($expectedWill), Charisma::getIt($expectedCharisma));
     self::assertInstanceOf(Dangerousness::class, $properties->getDangerousness());
     self::assertSame($expectedDangerousness->getValue(), $properties->getDangerousness()->getValue(), "{$race} {$genderCode}");
     $expectedDignity = new Dignity(Intelligence::getIt($expectedIntelligence), Will::getIt($expectedWill), Charisma::getIt($expectedCharisma));
     self::assertInstanceOf(Dignity::class, $properties->getDignity());
     self::assertSame($expectedDignity->getValue(), $properties->getDignity()->getValue(), "{$race} {$genderCode}");
     $expectedFightValue = $expectedAgility + (SumAndRound::ceil($expectedHeight->getValue() / 3) - 2);
     self::assertInstanceOf(FightNumber::class, $properties->getFightNumber());
     self::assertSame($expectedFightValue, $properties->getFightNumber()->getValue(), "{$race} {$genderCode} with height {$expectedHeight}");
     $expectedAttack = new Attack(Agility::getIt($expectedAgility));
     self::assertInstanceOf(Attack::class, $properties->getAttack());
     self::assertSame($expectedAttack->getValue(), $properties->getAttack()->getValue(), "{$race} {$genderCode}");
     $expectedShooting = new Shooting(Knack::getIt($expectedKnack));
     self::assertInstanceOf(Shooting::class, $properties->getShooting());
     self::assertSame($expectedShooting->getValue(), $properties->getShooting()->getValue(), "{$race} {$genderCode}");
     $expectedDefense = new DefenseNumber(Agility::getIt($expectedAgility));
     self::assertInstanceOf(DefenseNumber::class, $properties->getDefenseNumber());
     self::assertSame($expectedDefense->getValue(), $properties->getDefenseNumber()->getValue(), "{$race} {$genderCode}");
     $expectedDefenseAgainstShooting = new DefenseNumberAgainstShooting($expectedDefense, $expectedSize);
     self::assertInstanceOf(DefenseNumberAgainstShooting::class, $properties->getDefenseAgainstShooting());
     self::assertSame($expectedDefenseAgainstShooting->getValue(), $properties->getDefenseAgainstShooting()->getValue(), "{$race} {$genderCode}");
     $expectedWoundBoundary = new WoundBoundary($expectedToughness, $tables->getWoundsTable());
     self::assertInstanceOf(WoundBoundary::class, $properties->getWoundBoundary());
     self::assertSame($expectedWoundBoundary->getValue(), $properties->getWoundBoundary()->getValue());
     $expectedFatigueBoundary = new FatigueBoundary($expectedEndurance, $tables->getFatigueTable());
     self::assertInstanceOf(FatigueBoundary::class, $properties->getFatigueBoundary());
     self::assertSame($expectedFatigueBoundary->getValue(), $properties->getFatigueBoundary()->getValue());
 }
 /**
  * @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());
 }
Beispiel #9
0
 /**
  * @return SubRaceCode
  */
 public function getSubraceCode()
 {
     return SubRaceCode::getIt(self::DARK);
 }
Beispiel #10
0
 public function getSubraceCode()
 {
     return SubRaceCode::getIt(self::SKURUT);
 }
Beispiel #11
0
 public static function registerSelf()
 {
     parent::registerSelf();
     // ARMAMENTS
     static::registerCodeAsSubType(ArrowCode::getIt(ArrowCode::BASIC_ARROW));
     static::registerCodeAsSubType(BodyArmorCode::getIt(BodyArmorCode::CHAINMAIL_ARMOR));
     static::registerCodeAsSubType(DartCode::getIt(DartCode::BASIC_DART));
     static::registerCodeAsSubType(HelmCode::getIt(HelmCode::BARREL_HELM));
     static::registerCodeAsSubType(MeleeWeaponCode::getIt(MeleeWeaponCode::HAND));
     static::registerCodeAsSubType(RangedWeaponCode::getIt(RangedWeaponCode::HEAVY_CROSSBOW));
     static::registerCodeAsSubType(ShieldCode::getIt(ShieldCode::BUCKLER));
     static::registerCodeAsSubType(SlingStoneCode::getIt(SlingStoneCode::SLING_STONE_HEAVIER));
     static::registerCodeAsSubType(WeaponCategoryCode::getIt(WeaponCategoryCode::ARROW));
     // BODY
     static::registerCodeAsSubType(ActivityAffectingHealingCode::getIt(ActivityAffectingHealingCode::LIGHT_ACTIVITY));
     static::registerCodeAsSubType(AfflictionByWoundDomainCode::getIt(AfflictionByWoundDomainCode::PHYSICAL));
     static::registerCodeAsSubType(ConditionsAffectingHealingCode::getIt(ConditionsAffectingHealingCode::BAD_CONDITIONS));
     static::registerCodeAsSubType(RestConditionsCode::getIt(RestConditionsCode::FOUL_CONDITIONS));
     static::registerCodeAsSubType(WoundsOriginCode::getIt(WoundsOriginCode::ELEMENTAL));
     static::registerCodeAsSubType(WoundTypeCode::getIt(WoundTypeCode::CRUSH));
     // COMBAT ACTIONS
     static::registerCodeAsSubType(CombatActionCode::getIt(CombatActionCode::ATTACKED_FROM_BEHIND));
     static::registerCodeAsSubType(MeleeCombatActionCode::getIt(MeleeCombatActionCode::COVER_OF_ALLY));
     static::registerCodeAsSubType(RangedCombatActionCode::getIt(RangedCombatActionCode::AIMED_SHOT));
     // ENVIRONMENT
     static::registerCodeAsSubType(LightConditionsCode::getIt(LightConditionsCode::STRONG_DAYLIGHT));
     static::registerCodeAsSubType(LightSourceCode::getIt(LightSourceCode::BALEFIRE));
     static::registerCodeAsSubType(LightSourceEnvironmentCode::getIt(LightSourceEnvironmentCode::MIRROR_BEHIND_LIGHT_SOURCE));
     static::registerCodeAsSubType(TerrainCode::getIt(TerrainCode::DESERT));
     // SKILLS
     static::registerCodeAsSubType(CombinedSkillCode::getIt(CombinedSkillCode::BIG_HANDWORK));
     static::registerCodeAsSubType(PhysicalSkillCode::getIt(PhysicalSkillCode::ATHLETICS));
     static::registerCodeAsSubType(PsychicalSkillCode::getIt(PsychicalSkillCode::ASTRONOMY));
     static::registerCodeAsSubType(SkillTypeCode::getIt(SkillTypeCode::COMBINED));
     // OTHERS
     static::registerCodeAsSubType(ElementCode::getIt(ElementCode::AIR));
     static::registerCodeAsSubType(GenderCode::getIt(GenderCode::FEMALE));
     static::registerCodeAsSubType(ItemHoldingCode::getIt(ItemHoldingCode::MAIN_HAND));
     static::registerCodeAsSubType(MovementTypeCode::getIt(MovementTypeCode::RUN));
     static::registerCodeAsSubType(ProfessionCode::getIt(ProfessionCode::COMMONER));
     static::registerCodeAsSubType(PropertyCode::getIt(PropertyCode::AGE));
     static::registerCodeAsSubType(RaceCode::getIt(RaceCode::DWARF));
     static::registerCodeAsSubType(RidingAnimalCode::getIt(RidingAnimalCode::BULL));
     static::registerCodeAsSubType(RidingAnimalMovementCode::getIt(RidingAnimalMovementCode::CANTER));
     static::registerCodeAsSubType(RidingAnimalPropertyCode::getIt(RidingAnimalPropertyCode::DEFIANCE));
     static::registerCodeAsSubType(SubRaceCode::getIt(SubRaceCode::COMMON));
     static::registerCodeAsSubType(TimeCode::getIt(TimeCode::DAY));
 }
 /**
  * @test
  * @dataProvider provideRequirementOfDmForRace
  *
  * @param string $race
  * @param string $subrace
  * @param bool $requiredDmAgreement
  */
 public function I_can_detect_requirement_of_dm_agreement_of_any_race($race, $subrace, $requiredDmAgreement)
 {
     $racesTable = new RacesTable();
     self::assertSame($requiredDmAgreement, $racesTable->requiresDmAgreement(RaceCode::getIt($race), SubRaceCode::getIt($subrace)));
 }
 /**
  * @return SubRaceCode
  */
 public function getSubraceCode()
 {
     return SubRaceCode::getIt(self::HIGHLANDER);
 }