コード例 #1
0
 /**
  * Casting level to experiences is mostly lossy conversion!
  * Gives experiences needed from previous (current -1) to given level.
  * @param Level $level
  * @return Experiences
  */
 public function toExperiences(Level $level)
 {
     if ($level->getValue() > 1) {
         $woundsBonus = new WoundsBonus($this->levelToBonusValue($level), $this->woundsTable);
         $wounds = $this->woundsTable->toWounds($woundsBonus);
         $experiencesValue = $wounds->getValue();
     } else {
         $experiencesValue = 0;
         // including first level which is for free for main profession
     }
     return new Experiences($experiencesValue, $this);
 }
コード例 #2
0
 /**
  * @test
  * @expectedException \DrdPlus\Tables\Measurements\Partials\Exceptions\RequestedDataOutOfTableRange
  */
 public function I_can_not_convert_too_high_value_to_bonus()
 {
     $woundsTable = new WoundsTable();
     $woundsTable->toBonus(new Wounds(28001, $woundsTable));
 }
コード例 #3
0
 /**
  * @return Wounds
  */
 public function getWounds()
 {
     return $this->woundsTable->toWounds($this);
 }
コード例 #4
0
 /**
  * @param FatigueBonus $bonus
  *
  * @return Fatigue
  */
 public function toFatigue(FatigueBonus $bonus)
 {
     return new Fatigue($this->woundsTable->toWounds(new WoundsBonus($bonus->getValue(), $this->woundsTable))->getValue(), Fatigue::FATIGUE, $this);
 }
コード例 #5
0
 /**
  * @test
  */
 public function I_get_values_same_as_from_wounds_table()
 {
     $experiencesTable = new ExperiencesTable($woundsTable = new WoundsTable());
     self::assertEquals($woundsTable->getValues(), $experiencesTable->getValues());
     self::assertEquals($woundsTable->getIndexedValues(), $experiencesTable->getIndexedValues());
 }
コード例 #6
0
 /**
  * @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());
 }
コード例 #7
0
 /**
  * @return WoundsBonus
  */
 public function getBonus()
 {
     return $this->woundsTable->toBonus($this);
 }