MArcomage

Free multiplayer on-line fantasy card game

Please log in


0 U
Legacy of Barbz
Legacy of Barbz

Replace a common card in hand of player(s) with most common cards with a rare card from his deck

Id
528
Name
Legacy of Barbz
Rarity
Uncommon
Keywords
Cost (B / G / R)
0 / 0 / 0
Modes
0
Level
10
Created
14. Mar, 2010
Modified
24. Jan, 2011
Played
231 / 3981
Discarded
199 / 2823
Drawn
536 / 8185

BB code

Effect

Replace a common card in hand of player(s) with most common cards with a rare card from his deck

Code

    $my_storage = $his_storage = array();
    for ($i = 1; $i <= $t->handSize(); $i++) {
      if ($t->getCard($t->myData()->Hand[$i])->getRarity() == 'Common') {
        $my_storage[] = $i;
      }
      if ($t->getCard($t->hisData()->Hand[$i])->getRarity() == 'Common') {
        $his_storage[] = $i;
      }
    }
    if (count($my_storage) > 0 && count($my_storage) >= count($his_storage)) {
      $pos = $my_storage[$t->arrayRand($my_storage)];
      $t->setCard('my', $pos, $t->drawCard($t->myDeck()->Rare, $t->myData()->Hand, $pos, 'drawCardList'));
    }
    if (count($his_storage) > 0 && count($my_storage) <= count($his_storage)) {
      $pos = $his_storage[$t->arrayRand($his_storage)];
      $t->setCard('his', $pos, $t->drawCard($t->hisDeck()->Rare, $t->hisData()->Hand, $pos, 'drawCardList'));
    }