Ejemplo n.º 1
0
 public function start()
 {
     Logger::info('Starting an encounter with the following beings:');
     foreach ($this->involved as $being) {
         Logger::info(' - %s (Perception: %s, Hitpoints %s)', array($being->getName(), DisplayHelper::displayInt($being->checkSkill(C\Skills::PERCEPTION, TRUE)), DisplayHelper::displayInt($being->getHitpoints())));
     }
     $this->state = Encounter::STATE_ACTIVE;
 }
Ejemplo n.º 2
0
Archivo: Dice.php Proyecto: Berdir/dnd
 private function doRoll()
 {
     $results = array();
     for ($i = 0; $i < $this->repeat; $i++) {
         $results[] = $roll = rand(1, $this->sides);
         Logger::debug('Rolled %d', array($roll));
     }
     if (!is_null($this->keep)) {
         switch ($this->use) {
             case iDice::USE_HIGH:
                 sort($results);
                 break;
             case iDice::USE_LOW:
                 rsort($results);
                 break;
         }
         for ($i = $this->repeat; $i <= $this->keep; $i--) {
             array_shift($results);
         }
     }
     $result = array_sum($results) + $this->modifier;
     Logger::info('Roll result for %dd%d + %d: %d', array($this->repeat, $this->sides, $this->modifier, $result));
     return $result;
 }
Ejemplo n.º 3
0
 /**
  * Short description for function
  *
  * Long description (if any) ...
  *
  * @param  unknown $bonus Parameter description (if any) ...
  * @return void
  * @access public
  */
 public function updateDamageBonus($bonus)
 {
     Logger::info('Damage bonus of Character %s has been changed: %s (new total: %s)', array($this->getName(), DisplayHelper::displayInt($bonus), DisplayHelper::displayInt($this->damageBonus + $bonus)));
     $this->damageBonus += $bonus;
 }
Ejemplo n.º 4
0
Archivo: Level.php Proyecto: Berdir/dnd
 /**
  * Short description for function
  *
  * Long description (if any) ...
  *
  * @return void
  * @access public
  */
 public function finish()
 {
     if (!empty($this->gain)) {
         //throw new Exception_NotEverythingChosen($this->gain);
     }
     foreach ($this->feats as $feat) {
         $this->char->addFeat($feat);
     }
     Logger::info('Character %s has finished the Levelup to %s', array($this->char->getName(), $this->newLevel));
 }