MArcomage

Free multiplayer on-line fantasy card game

Please log in

Keywords > Flare blitz

Icon

Flare blitz

Effect

Replace up to N lowest rarity non-Burning cards in each player's hand with Searing fire, N based on played card rarity (Common - 1, Uncommon - 2, Rare - 4).

Lore

Many believe that flare blitz is only a legend, because thus far no one has ever seen one cast and survived. Only the most powerful legendary creatures are able to perform such a feat - often razing entire cities to the ground. There were multiple attempts to artificially replicate it based on ancient texts but the results would pale in comparison to the original effect.

Code

    foreach (['my' => $t->myData(), 'his' => $t->hisData()] as $dataKey => $data) {
      $storage = ['Common' => [], 'Uncommon' => [], 'Rare' => []];
      $rarities = ['Common' => 1, 'Uncommon' => 2, 'Rare' => 4];
      $count = $rarities[$t->card()->getRarity()];
      for ($i = 1; $i <= $t->handSize(); $i++) {
        if ($dataKey == 'my' && $i == $t->cardPos()) {
          continue;
        }

        $currentCard = $t->getCard($data->Hand[$i]);
        if (!$currentCard->hasKeyword('Burning')) {
          $storage[$currentCard->getRarity()][] = $i;
        }
      }

      shuffle($storage['Common']);
      shuffle($storage['Uncommon']);
      shuffle($storage['Rare']);
      $storage = array_merge($storage['Common'], $storage['Uncommon'], $storage['Rare']);

      while ($count > 0 && count($storage) > 0) {
        $cardPos = array_shift($storage);
        $t->setCard($dataKey, $cardPos, 248);
        $count--;
      }
    }