Esempio n. 1
0
<?php

require_once dirname(__FILE__) . '/../bootstrap/unit.php';
$tests = array(1 => -5, 2 => -4, 3 => -4, 4 => -3, 5 => -3, 6 => -2, 7 => -2, 8 => -1, 9 => -1, 10 => 0, 11 => 0, 12 => 1, 13 => 1, 14 => 2, 15 => 2, 16 => 3, 17 => 3, 18 => 4, 19 => 4, 20 => 5);
$t = new lime_test(count($tests) + 1);
$t->info('->getModifier()');
foreach ($tests as $value => $modifier) {
    $v = new ccmAbility(array($value));
    $t->is($v->getModifier(), $modifier, '->getModifier() returns the right value');
}
$t->info('::getRandom()');
$value = ccmAbility::getRandom();
$t->ok($value <= 18 && $value >= 3, '::getRandom() returns a value between 3 and 18');
Esempio n. 2
0
 /**
  * Get random abilities.
  *
  * @return array
  */
 public static function getRandom()
 {
     $abilities = array(self::STRENGTH, self::DEXTERITY, self::CONSTITUTION, self::INTELLIGENCE, self::WISDOM, self::CHARISMA);
     $result = array();
     foreach ($abilities as $ability) {
         $result[$ability] = ccmAbility::getRandomAbility();
     }
     return $result;
 }