Пример #1
0
 /**
  * @test
  */
 public function I_can_get_explicitly_kilograms()
 {
     $weight = new Weight(123.876, Weight::KG, new WeightTable());
     self::assertSame(123.876, $weight->getKilograms());
 }
Пример #2
0
 /**
  * Affects activities using strength, agility or knack, see PPH page 113, right column, bottom.
  * @param Strength $strength
  * @param Weight $cargoWeight
  * @return int negative number or zero
  * @throws \DrdPlus\Tables\Measurements\Partials\Exceptions\BonusRequiresInteger
  */
 public function getMalusFromLoad(Strength $strength, Weight $cargoWeight)
 {
     $requiredStrength = $cargoWeight->getBonus()->getValue();
     $missingStrength = $requiredStrength - $strength->getValue();
     $malus = -SumAndRound::half($missingStrength);
     // see PPH page 113, right column
     if ($malus > 0) {
         return 0;
     }
     return $malus;
 }