/**
  * @test
  * @depends I_can_get_property_easily
  * @param AbstractDerivedProperty $derivedProperty
  */
 public function I_can_add_and_remove_value_from_property(AbstractDerivedProperty $derivedProperty)
 {
     $increased = $derivedProperty->add(123);
     self::assertNotEquals($derivedProperty, $increased);
     self::assertSame($derivedProperty->getValue() + 123, $increased->getValue());
     $decreased = $derivedProperty->sub(456);
     self::assertNotEquals($derivedProperty, $decreased);
     self::assertSame($derivedProperty->getValue() - 456, $decreased->getValue());
 }
Пример #2
0
 /**
  * @param Strength $strength
  * @param Agility $agility
  * @param Height $height
  */
 public function __construct(Strength $strength, Agility $agility, Height $height)
 {
     /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
     parent::__construct(SumAndRound::average($strength->getValue(), $agility->getValue()) + SumAndRound::ceil($height->getValue() / 3) - 2);
 }
Пример #3
0
 /**
  * @param Strength $strength
  * @param Will $will
  */
 public function __construct(Strength $strength, Will $will)
 {
     /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
     parent::__construct(SumAndRound::average($strength->getValue(), $will->getValue()));
 }
Пример #4
0
 /**
  * @param Knack $knack
  * @param RaceCode $raceCode
  * @param SubRaceCode $subRaceCode
  * @param RacesTable $racesTable
  */
 public function __construct(Knack $knack, RaceCode $raceCode, SubRaceCode $subRaceCode, RacesTable $racesTable)
 {
     /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
     parent::__construct($knack->getValue() + $racesTable->getSenses($raceCode, $subRaceCode));
 }
Пример #5
0
 /**
  * @param Strength $strength
  * @param RaceCode $raceCode
  * @param SubRaceCode $subraceCode
  * @param RacesTable $racesTable
  */
 public function __construct(Strength $strength, RaceCode $raceCode, SubRaceCode $subraceCode, RacesTable $racesTable)
 {
     /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
     parent::__construct($strength->getValue() + $racesTable->getToughness($raceCode, $subraceCode));
 }
 /**
  * @param IntegerInterface $firstProperty
  * @param IntegerInterface $secondProperty
  * @param Charisma $charisma
  */
 protected function __construct(IntegerInterface $firstProperty, IntegerInterface $secondProperty, Charisma $charisma)
 {
     /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
     parent::__construct(SumAndRound::average($firstProperty->getValue(), $secondProperty->getValue()) + SumAndRound::half($charisma->getValue()));
 }
 /**
  * @param Endurance $endurance
  * @param FatigueTable $fatigueTable
  */
 public function __construct(Endurance $endurance, FatigueTable $fatigueTable)
 {
     /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
     parent::__construct($fatigueTable->toFatigue(new FatigueBonus($endurance->getValue() + 10, $fatigueTable))->getValue());
 }
 /**
  * @param Speed $speed
  */
 public function __construct(Speed $speed)
 {
     /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
     parent::__construct(SumAndRound::half($speed->getValue()));
 }
 /**
  * @param Toughness $toughness
  * @param WoundsTable $woundsTable
  */
 public function __construct(Toughness $toughness, WoundsTable $woundsTable)
 {
     /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
     parent::__construct($woundsTable->toWounds(new WoundsBonus($toughness->getValue() + 10, $woundsTable))->getValue());
 }
 /**
  * @param Strength $strength
  * @param Athletics $athletics
  */
 public function __construct(Strength $strength, Athletics $athletics)
 {
     /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
     parent::__construct($strength->getValue() + 21 + $athletics->getAthleticsBonus()->getValue());
 }