MArcomage

Free multiplayer on-line fantasy card game

Please log in


1 U
Moon priestess
Moon priestess

Replace highest and lowest cost card in opponent's hand with Moon shrine, Moon castle or Magic sanctuary

Id
433
Name
Moon priestess
Rarity
Uncommon
Keywords
Cost (B / G / R)
0 / 1 / 0
Modes
0
Level
9
Created
11. Apr, 2009
Modified
26. Sep, 2015
Played
6282 / 9840
Discarded
441 / 1512
Drawn
7217 / 12447

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)]);