MArcomage

Free multiplayer on-line fantasy card game

Please log in


3 3 3 C
Shifting mass
Shifting mass

Summons highest cost card in game (can't summon self)

Id
625
Name
Shifting mass
Rarity
Common
Keywords
Cost (B / G / R)
3 / 3 / 3
Modes
0
Level
10
Created
24. Apr, 2011
Modified
24. Dec, 2014
Played
1709 / 6674
Discarded
1373 / 6302
Drawn
3835 / 16165

BB code

Effect

Summons highest cost card in game (can't summon self)

Code

    $high = $costs = array();
    $max = 0;
    for ($i = 1; $i <= $t->handSize(); $i++) {
      if ($i != $t->cardPos() && $t->card()->id() != $t->myData()->Hand[$i]) {
        $cur_cost = $costs[$i] = $t->getCard($t->myData()->Hand[$i])->getResources();
        if ($cur_cost > $max) {
          $max = $cur_cost;
        }
      }
      if ($t->card()->id() != $t->hisData()->Hand[$i]) {
        $cur_cost = $costs[$i + 8] = $t->getCard($t->hisData()->Hand[$i])->getResources();
        if ($cur_cost > $max) {
          $max = $cur_cost;
        }
      }
    }
    for ($i = 1; $i <= $t->handSize(); $i++) {
      if ($i != $t->cardPos() && $t->card()->id() != $t->myData()->Hand[$i] && $costs[$i] == $max) {
        $high[] = $t->myData()->Hand[$i];
      }
      if ($t->card()->id() != $t->hisData()->Hand[$i] && $costs[$i + 8] == $max) {
        $high[] = $t->hisData()->Hand[$i];
      }
    }
    if (count($high) > 0) {
      $t->nextCard($high[$t->arrayRand($high)]);
    }