Replace a common card in hand of player(s) with most common cards with a rare card from his deck
$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'));
}