Exemple #1
0
 public static function getEffects(SR_Player $player)
 {
     // 		$b = chr(2);
     $e = $player->getEffects();
     if (count($e) === 0) {
         return Shadowrun4::lang('none');
     }
     $sorted = array();
     foreach ($e as $effect) {
         $effect instanceof SR_Effect;
         $t = $effect->getTimeEnd();
         $raw = $effect->getModifiersRaw();
         foreach ($raw as $k => $v) {
             if (isset($sorted[$k])) {
                 $sorted[$k][0] += $v;
                 if ($t < $sorted[$k][1]) {
                     $sorted[$k][1] = $t;
                 }
             } else {
                 $sorted[$k] = array($v, $t);
             }
         }
     }
     $t2 = Shadowrun4::getTime();
     $format = Shadowrun4::lang('fmt_effect');
     $back = '';
     foreach ($sorted as $k => $data) {
         list($v, $t) = $data;
         $back .= sprintf($format, $k, $v, GWF_Time::humanDuration($t - $t2));
         // 			$back .= sprintf(', %s:%s(%s)', $b.$k.$b, $v, GWF_Time::humanDuration($t-$t2));
     }
     return ltrim($back, ',; ');
 }
Exemple #2
0
 public function lowerSpellIncrement(SR_Player $target, $by, $field)
 {
     # Count number of effects with same field
     $count = 1;
     foreach ($target->getEffects() as $effect) {
         $effect instanceof SR_Effect;
         foreach ($effect->getModifiersRaw() as $k => $v) {
             if ($k === $field) {
                 $count++;
             }
         }
     }
     return round($by * 1 / $count, 2);
 }