$my_storage = $his_storage = array();
for ($i = 1; $i <= $t->handSize(); $i++) {
if ($i != $t->cardPos() && $t->getCard($t->myData()->Hand[$i])->getRarity() != 'Rare') {
$my_storage[] = $i;
}
if ($t->getCard($t->hisData()->Hand[$i])->getRarity() != 'Rare') {
$his_storage[] = $i;
}
}
$my_count = min(count($my_storage), 3);
if ($my_count > 0) {
shuffle($my_storage);
for ($k = 0; $k < $my_count; $k++) {
$i = $my_storage[$k];
$t->setCard('my', $i, $t->drawCard($t->myDeck(), $t->myData()->Hand, $i, 'drawCardNoRare'));
}
}
$his_count = min(count($his_storage), 3);
if ($his_count > 0) {
shuffle($his_storage);
for ($k = 0; $k < $his_count; $k++) {
$i = $his_storage[$k];
$t->setCard('his', $i, $t->drawCard($t->hisDeck(), $t->hisData()->Hand, $i, 'drawCardNoRare'));
}
}