$my_temp = $his_temp = array();
for ($i = 1; $i <= $t->handSize(); $i++) {
if ($t->getCard($t->myData()->Hand[$i])->hasKeyword('Unliving')) {
$my_temp[$i] = $i;
}
if ($t->getCard($t->hisData()->Hand[$i])->hasKeyword('Unliving')) {
$his_temp[$i] = $i;
}
}
shuffle($my_temp); shuffle($his_temp);
if (count($my_temp) > 0) {
for ($i = 0; $i < count($my_temp) && $i < 6; $i++) {
$t->setCard('my', $my_temp[$i], $t->drawCard($t->myDeck(), $t->myData()->Hand, $my_temp[$i], 'drawCardRandom'));
}
$amount = max(($i - 4), 0); $t->myData()->addBricks(-$amount * 10)->addQuarry(-$amount);
}
if (count($his_temp) > 0) {
for ($j = 0; $j < count($his_temp) && $j < 6; $j++) {
$t->setCard('his', $his_temp[$j], $t->drawCard($t->hisDeck(), $t->hisData()->Hand, $his_temp[$j], 'drawCardRandom'));
}
$amount = max(($j - 4), 0); $t->hisData()->addBricks(-$amount * 10)->addQuarry(-$amount);
}