MArcomage

Free multiplayer on-line fantasy card game

Please log in


5 C
Shadow wolf
Shadow wolf

Beast Illusion

Attack: 4
Discard highest rarity discarding or replacing non-rare card from opponent's hand

Id
627
Name
Shadow wolf
Rarity
Common
Keywords
Cost (B / G / R)
0 / 5 / 0
Modes
0
Level
10
Created
24. Apr, 2011
Modified
24. Dec, 2011
Played
1754 / 11098
Discarded
923 / 7317
Drawn
3508 / 22866

BB code

Effect

Attack: 4
Discard highest rarity discarding or replacing non-rare card from opponent's hand

Code

    $t->hisData()->attack(4);
    $storage = ['Common' => array(), 'Uncommon' => array()];
    $target_cards = array_merge($t->getList(['advanced'=>"Discard "]), $t->getList(['advanced'=>'Replace ']));
    
    for ($i = 1; $i <= $t->handSize(); $i++) {
      if (in_array($t->hisData()->Hand[$i], $target_cards)) {
        $dis_card = $t->getCard($t->hisData()->Hand[$i]);
        $dis_rarity = $dis_card->getRarity();
        if ($dis_rarity != 'Rare') {
          $storage[$dis_rarity][] = $i;
        }
      }
    }

    if ((count($storage['Common']) + count($storage['Uncommon'])) > 0) {
      shuffle($storage['Common']); shuffle($storage['Uncommon']);
      $storage_temp = array_merge($storage['Common'], $storage['Uncommon']);
      $discarded_pos = array_pop($storage_temp);
      $t->setCard('his', $discarded_pos, $t->drawCard($t->hisDeck(), $t->hisData()->Hand, $discarded_pos, 'drawCardDifferent'));
    }