MArcomage

Free multiplayer on-line fantasy card game

Please log in

Keywords > Illusion

Icon

Illusion

Effect

Suggestion - if an Illusion card is played after playing a different non-common Illusion card, lowest rarity card in hand is replaced with a rare card from opponent's deck.

Lore

Illusion magic manipulates the environment rather than the target. Within the changed environment the target becomes confused and often the whole damage done by the spell is done by the target itself. Illusion mages often play important rules in political intrigues.

Code

    if ($t->myLastCard()->hasKeyword('Illusion') && $t->myLastAction() == 'play'
      && $t->myLastCard()->getRarity() != 'Common' && $t->card()->id() != $t->myLastCard()->id()) {
      $storage = ['Common' => array(), 'Uncommon' => array(), 'Rare' => array()];
      for ($i = 1; $i <= $t->handSize(); $i++) {
        $cur_card = $this->getCard($t->myData()->Hand[$i]);
        $rarity = $cur_card->getRarity();
        if ($i != $t->cardPos()) {
          $storage[$rarity][] = $i;
        }
      }
      if ((count($storage['Common']) + count($storage['Uncommon']) + count($storage['Rare'])) > 0) {
        shuffle($storage['Common']);
        shuffle($storage['Uncommon']);
        shuffle($storage['Rare']);
        $storage_temp = array_merge($storage['Common'], $storage['Uncommon'], $storage['Rare']);
        $discarded_pos = array_shift($storage_temp);
        $this->setCard('my', $discarded_pos, $this->drawCard($t->hisDeck()->Rare, $t->myData()->Hand, $discarded_pos, 'drawCardList'));
      }
    }