func: function swapCardForReward(address _by, uint8 _rank)
      onlyCard
      whenNotPaused
      public
      returns (uint256)
    {
      
      
      
      require(tx.origin != _by && tx.origin != msg.sender);
  
      
      var _randomValue = random(10000, 0);
  
      
      uint8 _heroRankToMint = 0; 
  
      if (_rank == 0) { 
        if (_randomValue < 8500) {
          _heroRankToMint = 3;
        } else {
          _heroRankToMint = 4;
        }
      } else if (_rank == 3) { 
        if (_randomValue < 6500) {
          _heroRankToMint = 1;
        } else if (_randomValue < 9945) {
          _heroRankToMint = 2;
        }  else if (_randomValue < 9995) {
          _heroRankToMint = 3;
        } else {
          _heroRankToMint = 4;
        }
      } else { 
        _heroRankToMint = 0;
      }
      
      
      return summonHero(tx.origin, _heroRankToMint);
  
    }