Ejemplo n.º 1
0
 /**
  * See PPH page 91, right column
  *
  * @param ArmamentCode $armamentCode
  * @param Size $bodySize
  * @param Strength $currentStrength
  * @return int positive number
  * @throws \DrdPlus\Tables\Armaments\Exceptions\UnknownArmament
  */
 public function getMissingStrengthForArmament(ArmamentCode $armamentCode, Strength $currentStrength, Size $bodySize)
 {
     $requiredStrength = $this->tables->getArmamentsTableByArmamentCode($armamentCode)->getRequiredStrengthOf($armamentCode);
     $missingStrength = $requiredStrength - $currentStrength->getValue();
     if ($armamentCode instanceof ArmorCode) {
         // only armor weight is related to body size
         $missingStrength += $bodySize->getValue();
     }
     if ($missingStrength < 0) {
         // missing strength can not be negative, of course
         return 0;
     }
     return $missingStrength;
 }