示例#1
0
文件: Character.php 项目: Berdir/dnd
 /**
  * Short description for function
  *
  * Long description (if any) ...
  *
  * @param  object $feat Parameter description (if any) ...
  * @return void
  * @access public
  */
 public function addFeat(iFeat $feat)
 {
     Logger::info('Character %s learns the feat %s', array($this->getName(), $feat->getName()));
     if ($feat->isActive()) {
         if (!isset($this->activeFeats[$feat->getName()])) {
             $this->activeFeats[$feat->getName()] = $feat;
         }
     } else {
         if (!isset($this->passiveFeats[$feat->getName()])) {
             $this->passiveFeats[$feat->getName()] = $feat;
         }
         $feat->activate($this);
     }
 }
示例#2
0
文件: Level.php 项目: Berdir/dnd
 /**
  * Short description for function
  *
  * Long description (if any) ...
  *
  * @param  object                          $feat Parameter description (if any) ...
  * @return object                          Return description (if any) ...
  * @access public
  * @throws Exception_NotAviableAtThisLevel Exception description (if any) ...
  * @throws Exception_PrerequitesNotMet     Exception description (if any) ...
  */
 public function chooseFeat(iFeat $feat)
 {
     if (!isset($this->gain[self::FEAT])) {
         throw new Exception_NotAviableAtThisLevel($feat);
     }
     if (!$feat->arePrerequisitesMet($this->char)) {
         throw new Exception\PrerequisitesNotMet($feat->getPrerequisites(), $this->char);
     }
     $this->gain[self::FEAT]--;
     if ($this->gain[self::FEAT] == 0) {
         unset($this->gain[self::FEAT]);
     }
     Logger::debug('Still aviable at this level: ' . $this->getAviable());
     $this->feats[] = $feat;
     return $feat;
 }