MArcomage

Free multiplayer on-line fantasy card game

Please log in

Keywords > Holy

Icon

Holy

Effect

Basic gain 25, bonus gain 5, Holy song - gain random resources based on played card rarity (Common - 1, Uncommon - 2, Rare - 5). Replace highest rarity Demonic or Undead card from opponent's hand of the same or lower rarity as the played card with Pile of ashes.

Lore

People with spiritual talents who dislike the corrupting nature of magic often decide to become priests instead of mages. Priests use their talents to heal and protect their allies, also at a time of need they are able to call to their deity for intervention. In addition, they are the most effective weapon against both demons and the undead. An undead killed by a priest can't be reanimated ever again.

Code

    // target card is discarded only if it has same or lower rarity than the played card
    $rarities = ['Common' => 0, 'Uncommon' => 1, 'Rare' => 2];
    $storage = ['Common' => array(), 'Uncommon' => array(), 'Rare' => array()];
    $resources = ['Common' => 1, 'Uncommon' => 2, 'Rare' => 5];
    $played_rank = $rarities[$t->card()->getRarity()];
    $t->myData()->addRandomResources($resources[$t->card()->getRarity()]);

    for ($i = 1; $i <= $t->handSize(); $i++) {
      $dis_card = $this->getCard($t->hisData()->Hand[$i]);
      $dis_rarity = $dis_card->getRarity();
      $dis_rank = $rarities[$dis_rarity];

      // pick only cards that can be discarded by played card
      if (($dis_card->hasKeyword('Demonic') || $dis_card->hasKeyword('Undead')) && $dis_rank <= $played_rank) {
        $storage[$dis_rarity][] = $i;
      }
    }

    if ((count($storage['Common']) + count($storage['Uncommon']) + count($storage['Rare'])) > 0) {
      // pick preferably cards with higher rarity, but choose random card within the rarity group
      shuffle($storage['Common']); shuffle($storage['Uncommon']); shuffle($storage['Rare']);
      $storage_temp = array_merge($storage['Common'], $storage['Uncommon'], $storage['Rare']);
      $discarded_pos = array_pop($storage_temp);
      $this->setCard('his', $discarded_pos, 381, ['reveal' => true]);
    }