Exemple #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;
 }
Exemple #2
0
 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;
 }
Exemple #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;
 }
Exemple #4
0
 /**
  * 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));
 }