/**
  * 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);
 }
 /**
  * @test
  * @expectedException \OutOfRangeException
  */
 public function I_can_not_convert_too_high_bonus_to_too_detailed_unit()
 {
     $woundsTable = new WoundsTable();
     $woundsTable->toWounds(new WoundsBonus(80, $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);
 }
 /**
  * @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());
 }