/**
  * @param MovementTypesTable $movementTypesTable
  * @param string $movementTypeCode
  * @param SpeedTable $speedTable
  * @param string $terrainCode
  * @param TerrainDifficultyPercents $terrainDifficultyPercents
  * @param ImpassibilityOfTerrainTable $impassibilityOfTerrainTable
  * @return SpeedBonus
  * @throws \DrdPlus\Tables\Body\MovementTypes\Exceptions\UnknownMovementType
  * @throws \DrdPlus\Tables\Environments\Exceptions\UnknownTerrainCode
  * @throws \DrdPlus\Tables\Environments\Exceptions\InvalidTerrainCodeFormat
  */
 public function getCurrentSpeedBonus(MovementTypesTable $movementTypesTable, $movementTypeCode, SpeedTable $speedTable, $terrainCode, TerrainDifficultyPercents $terrainDifficultyPercents, ImpassibilityOfTerrainTable $impassibilityOfTerrainTable)
 {
     $movementTypeBonus = $movementTypesTable->getSpeedBonus($movementTypeCode);
     $terrainMalus = $impassibilityOfTerrainTable->getSpeedMalusOnTerrain($terrainCode, $speedTable, $terrainDifficultyPercents);
     /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
     return new SpeedBonus($this->getValue() + $movementTypeBonus->getValue() + $terrainMalus->getValue(), $speedTable);
 }
 /**
  * @test
  */
 public function I_got_malus_rounded_on_border_values()
 {
     $impassibilityOfTerrainTable = new ImpassibilityOfTerrainTable();
     $speedTable = new SpeedTable();
     $jungleAlmostSixthBonus = $impassibilityOfTerrainTable->getSpeedMalusOnTerrain('jungle', $speedTable, new TerrainDifficultyPercents(8));
     self::assertSame(-6, $jungleAlmostSixthBonus->getValue());
     $jungleSixthBonus = $impassibilityOfTerrainTable->getSpeedMalusOnTerrain('jungle', $speedTable, new TerrainDifficultyPercents(9));
     self::assertSame(-7, $jungleSixthBonus->getValue());
 }