/**
  * @test
  */
 public function I_can_create_it_for_range_weapon()
 {
     $maximalRange = MaximalRange::createForRangedWeapon($this->createEncounterRange(123));
     self::assertInstanceOf(MaximalRange::class, $maximalRange);
     self::assertInstanceOf(CombatGameCharacteristic::class, $maximalRange);
     self::assertSame(135, $maximalRange->getValue(), 'Value should be increased by twelve');
 }
示例#2
0
 /**
  * Ranged weapons can be used for indirect shooting and those have much longer maximal and still somehow
  * controllable
  * (more or less - depends on weapon) range.
  * Others have their maximal (and still controllable) range same as encounter range.
  * See PPH page 104 left column.
  *
  * @param WeaponlikeCode $weaponlikeCode
  * @param Strength $currentStrength
  * @param Speed $currentSpeed
  * @return MaximalRange
  * @throws CanNotUseWeaponBecauseOfMissingStrength
  * @throws UnknownArmament
  * @throws UnknownRangedWeapon
  * @throws UnknownBow
  */
 public function getMaximalRangeWithWeaponlike(WeaponlikeCode $weaponlikeCode, Strength $currentStrength, Speed $currentSpeed)
 {
     $encounterRange = $this->getEncounterRangeWithWeaponlike($weaponlikeCode, $currentStrength, $currentSpeed);
     if ($weaponlikeCode->isMelee()) {
         /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
         return MaximalRange::createForMeleeWeapon($encounterRange);
         // that is without change and that is zero
     }
     assert($weaponlikeCode->isRanged());
     return MaximalRange::createForRangedWeapon($encounterRange);
 }
 /**
  * @test
  */
 public function I_can_get_maximal_range_same_as_encounter_for_melee_weapon()
 {
     $armourer = new Armourer($this->createTables());
     foreach ($this->getMeleeWeaponlikeGroups() as $meleeWeaponlikeGroup) {
         $maximalRange = $armourer->getMaximalRangeWithWeaponlike($this->createMeleeWeaponlikeCode('foo', $meleeWeaponlikeGroup), $this->createStrength(), $this->createSpeed());
         self::assertInstanceOf(MaximalRange::class, $maximalRange);
         self::assertSame(MaximalRange::createForMeleeWeapon(new EncounterRange(0))->getValue(), $maximalRange->getValue());
     }
 }