Ejemplo n.º 1
0
 /**
  * @test
  */
 public function I_can_ask_it_if_is_male_or_female()
 {
     $female = GenderCode::getIt(GenderCode::FEMALE);
     self::assertTrue($female->isFemale());
     self::assertFalse($female->isMale());
     $male = GenderCode::getIt(GenderCode::MALE);
     self::assertTrue($male->isMale());
     self::assertFalse($male->isFemale());
 }
Ejemplo n.º 2
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));
 }
Ejemplo n.º 3
0
 /**
  * @param GenderCode $genderCode
  * @param WeightTable $weightTable
  * @return float
  */
 private function getExpectedWeight(GenderCode $genderCode, WeightTable $weightTable)
 {
     return (new Weight($this->getExpectedOtherProperty(PropertyCode::WEIGHT_IN_KG, $genderCode->getValue()), Weight::KG, $weightTable))->getValue();
 }
Ejemplo n.º 4
0
 /**
  * @param GenderCode $genderCode
  * @param Tables $tables
  * @return float
  */
 public function getWeightInKg(GenderCode $genderCode, Tables $tables)
 {
     if ($genderCode->isMale()) {
         /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
         return $tables->getRacesTable()->getMaleWeightInKg($this->getRaceCode(), $this->getSubraceCode());
     }
     /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
     return $tables->getRacesTable()->getFemaleWeightInKg($this->getRaceCode(), $this->getSubraceCode(), $tables->getFemaleModifiersTable(), $tables->getWeightTable());
 }
 public function getCombination()
 {
     $male = GenderCode::getIt(GenderCode::MALE);
     $female = GenderCode::getIt(GenderCode::FEMALE);
     $exceptionalityProperties = $this->createExceptionalityProperties();
     $professionLevels = $this->createProfessionLevels();
     $tables = new Tables();
     $weightInKgAdjustment = WeightInKg::getIt(0.001);
     $heightInCm = HeightInCm::getIt(123.4);
     $age = Age::getIt(15);
     $baseOfExpectedStrength = $professionLevels->getNextLevelsStrengthModifier() + 3;
     /* default max strength increment */
     $baseOfExpectedAgility = $professionLevels->getNextLevelsAgilityModifier() + 3;
     /* default max agility increment */
     $baseOfExpectedKnack = $professionLevels->getNextLevelsKnackModifier() + 3;
     /* default max knack increment */
     $baseOfExpectedWill = $professionLevels->getNextLevelsWillModifier() + 3;
     /* default max knack increment */
     $baseOfExpectedIntelligence = $professionLevels->getNextLevelsIntelligenceModifier() + 3;
     /* default max knack increment */
     $baseOfExpectedCharisma = $professionLevels->getNextLevelsCharismaModifier() + 3;
     /* default max charisma increment */
     return [[$commonHuman = CommonHuman::getIt(), $male, $exceptionalityProperties, $professionLevels, $tables, $weightInKgAdjustment, $heightInCm, $age, $baseOfExpectedStrength, $baseOfExpectedAgility, $baseOfExpectedKnack, $baseOfExpectedWill, $baseOfExpectedIntelligence, $baseOfExpectedCharisma], [$commonHuman, $female, $exceptionalityProperties, $professionLevels, $tables, $weightInKgAdjustment, $heightInCm, $age, $baseOfExpectedStrength - 1, $baseOfExpectedAgility, $baseOfExpectedKnack, $baseOfExpectedWill, $baseOfExpectedIntelligence, $baseOfExpectedCharisma + 1]];
 }
Ejemplo n.º 6
0
 public static function registerSelf()
 {
     parent::registerSelf();
     static::registerCodeAsSubType(GenderCode::getIt(GenderCode::FEMALE));
 }
 /**
  * @test
  * @expectedException \DrdPlus\PropertiesByLevels\Exceptions\TooLowStrengthAdjustment
  */
 public function I_can_not_get_it_with_too_low_strength()
 {
     $exceptionalityProperties = $this->createExceptionalityProperties(-1, 0, 0, 0, 0, 0);
     new FirstLevelProperties(CommonHuman::getIt(), GenderCode::getIt(GenderCode::MALE), $exceptionalityProperties, $this->createProfessionLevels(), WeightInKg::getIt(0), HeightInCm::getIt(123), Age::getIt(20), new Tables());
 }
Ejemplo n.º 8
0
 /**
  * @return GenderCode
  */
 public function getCode()
 {
     return GenderCode::getIt($this->getValue());
 }
Ejemplo n.º 9
0
 /**
  * @test
  * @dataProvider provideSizeOfRace
  *
  * @param string $race
  * @param string $subrace
  * @param int $maleSize
  * @param int $femaleSize
  */
 public function I_can_get_size_of_any_race($race, $subrace, $maleSize, $femaleSize)
 {
     $racesTable = new RacesTable();
     $femaleModifiersTable = new FemaleModifiersTable();
     self::assertSame($maleSize, $racesTable->getMaleSize(RaceCode::getIt($race), SubRaceCode::getIt($subrace)));
     self::assertSame($maleSize, $racesTable->getSize(RaceCode::getIt($race), SubRaceCode::getIt($subrace), GenderCode::getIt(GenderCode::MALE), $femaleModifiersTable));
     self::assertSame($femaleSize, $racesTable->getFemaleSize(RaceCode::getIt($race), SubRaceCode::getIt($subrace), $femaleModifiersTable));
     self::assertSame($femaleSize, $racesTable->getSize(RaceCode::getIt($race), SubRaceCode::getIt($subrace), GenderCode::getIt(GenderCode::FEMALE), $femaleModifiersTable));
 }