Moon priestess
Replace highest and lowest cost card in opponent's hand with Moon shrine, Moon castle or Magic sanctuary
Cost (B / G / R)
0 / 1 / 0
BB code
Effect
Replace highest and lowest cost card in opponent's hand with Moon shrine, Moon castle or Magic sanctuary
Code
$low = $high = $costs = array();
$min = 1000; $max = 0;
for ($i = 1; $i <= $t->handSize(); $i++) {
$cur_cost = $costs[$i] = $t->getCard($t->hisData()->Hand[$i])->getResources();
if ($cur_cost < $min) {
$min = $cur_cost;
}
if ($cur_cost > $max) {
$max = $cur_cost;
}
}
for ($i = 1; $i <= $t->handSize(); $i++) {
$cur_cost = $costs[$i];
if ($cur_cost == $min) {
$low[] = $i;
}
if ($cur_cost == $max) {
$high[] = $i;
}
}
if ($min == $max) {
shuffle($high);
$low_dis = array_pop($high);
$high_dis = array_pop($high);
}
else {
$low_dis = $low[$t->arrayRand($low)];
$high_dis = $high[$t->arrayRand($high)];
}
$storage = [487, 583, 486];
$chosen = $storage[$t->arrayRand($storage)];
$storage = array_diff($storage, [$chosen]);
$t->setCard('his', $low_dis, $chosen);
$t->setCard('his', $high_dis, $storage[$t->arrayRand($storage)]);