$discarded = 0;
for ($i = 1; $i <= $t->handSize(); $i++) {
if ($i != $t->cardPos() && $t->getCard($t->myData()->Hand[$i])->getResources() < 10) {
$t->setCard('my', $i, $t->drawCard($t->myDeck(), $t->myData()->Hand, $i, 'drawCardNoRare'));
$discarded++;
}
if ($t->getCard($t->hisData()->Hand[$i])->getResources() < 10) {
$t->setCard('his', $i, $t->drawCard($t->hisDeck(), $t->hisData()->Hand, $i, 'drawCardNoRare'));
$discarded++;
}
}
$t->myData()->addStock(round($discarded / 2));