MArcomage

Free multiplayer on-line fantasy card game

Please log in


0 U
Samurai
Samurai

Discard highest cost non-Durable keyword card from opponent's hand

Id
51
Name
Samurai
Rarity
Uncommon
Keywords
Cost (B / G / R)
0 / 0 / 0
Modes
0
Level
10
Created
1. May, 2006
Modified
1. Nov, 2010
Played
1667 / 19304
Discarded
324 / 2985
Drawn
2135 / 23934

BB code

Effect

Discard highest cost non-Durable keyword card from opponent's hand

Code

    $card_costs = $max_cards = array(); $max = 0;
    for ($i = 1; $i <= $t->handSize(); $i++) {
      $cur_card = $t->getCard($t->hisData()->Hand[$i]);
      if (!$cur_card->hasKeyword('Durable') && $cur_card->hasKeyword('any')) {
        $cur_cost = $card_costs[$i] = $cur_card->getResources();
        if ($cur_cost > $max) {
          $max = $cur_cost;
        }
      }
    }
    if (count($card_costs) > 0) {
      foreach ($card_costs as $i => $cost) {
        if ($cost == $max) {
          $max_cards[] = $i;
        }
      }
      $dis_pos = $max_cards[$t->arrayRand($max_cards)];
      $t->setCard('his', $dis_pos, $t->drawCard($t->hisDeck(), $t->hisData()->Hand, $dis_pos, 'drawCardDifferent'));
    }