/** * 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; }
/** * Despite rules this library deducts half of size from defense number, instead of adding to attack number, * because it is more practical from numbers-point-of-view * PPH page 104 right column top * * @param DefenseNumber $defense * @param Size $size */ public function __construct(DefenseNumber $defense, Size $size) { /** @noinspection ExceptionsAnnotatingAndHandlingInspection */ parent::__construct($defense->getValue() - SumAndRound::half($size->getValue())); }