MArcomage

Free multiplayer on-line fantasy card game

Please log in

Keywords > Demonic

Icon

Demonic

Effect

Wicked soul - player suffers one random penalty chosen from played card cost (Bricks - lose N random resources, Gems - N tower damage, Recruits - N wall damage), N based on played card's rarity (Common - 2 , Uncommon - 3, Rare - 4).

Lore

Long ago Demons were the rulers of the world; some of them, the Darklords, were so powerful that even the Gods were afraid of them. For this reason the Gods sealed the Darklords and their armies in an empty dimension: the Void. But now, after many centuries, the seal has weakened and some Demons were able to return in this world to unleash an unspeakable evil.

Demons are dangerous creatures with an incredible destructive power that it's impossible to control: not even Myr the Magelord could use them without great sacrificies.

Code

    $penalties = array();
    foreach (['Bricks', 'Gems', 'Recruits'] as $resource) {
      if ($t->card()->getResources($resource) > 0) {
        $penalties[] = $resource;
      }
    }
    if (count($penalties) > 0) {
      $rarities = ['Common' => 2, 'Uncommon' => 3, 'Rare' => 4];
      $amount = $rarities[$t->card()->getRarity()];
      $penalty = $penalties[$this->arrayRand($penalties)];

      if ($penalty == 'Bricks') {
        $t->myData()->addRandomResources(-$amount);
      }
      elseif ($penalty == 'Gems') {
        $t->myData()->addTower(-$amount); 
      }
      elseif ($penalty == 'Recruits') {
        $t->myData()->addWall(-$amount); 
      }
    }