contract Nftnft is ERC721, Ownable {

  address payable public mastermind = 0x4e2f98c96e2d595a83AFa35888C4af58Ac343E44;
  address apeThis = 0x3aaDA3e213aBf8529606924d8D1c55CbDc70Bf74;
  uint256 public numDegens;
  uint256 public numRugPullVictims;
  mapping(address => bool) public hasBeenRugged;
  mapping(address => mapping(uint256 => uint256)) public start;
  mapping(address => mapping(uint256 => uint256)) public end;
  mapping(uint256 => bool) public isValuelessGovToken;

  constructor() ERC721("NFTNFT", "NFTNFT") public {
    _mint(msg.sender, 1);
    _setBaseURI("https://xmons.herokuapp.com/nftnft/");
  }

  modifier degen() {
    mastermind.transfer(msg.value);
    if (msg.value >= 1 ether) {
      numDegens += 1;
      _mint(msg.sender, 696969696969696969699+numDegens);
    }
    _;
  }

  function yeet(address victim, uint256 perp, uint256 numBodies) public payable degen {
    IScam(victim).transferFrom(msg.sender, address(this), perp);
    start[victim][perp] = totalSupply() + 1;
    end[victim][perp] = totalSupply() + numBodies;
    for (uint256 i = start[victim][perp]; i <= end[victim][perp]; i++) {
      _mint(msg.sender, i);
    }
  }

  function assembleMecha(address blueprints, uint256 model) public payable degen {
    for (uint256 i = start[blueprints][model]; i <= end[blueprints][model]; i++) {
      require(ownerOf(i) == msg.sender, "Bigger robot");
      _burn(i);
    }
    IScam(blueprints).transferFrom(address(this), msg.sender, model);
  }

  function _fakeBondingCurve() internal view returns (uint256){
    uint256 i = totalSupply() % 6;
    uint256 p = 0;
    if (i == 1) {
      p = 1;
    }
    if (i == 2) {
      p = 2;
    }
    if (i == 3) {
      p = 3;
    }
    if (i == 4) {
      p = 2;
    }
    if (i == 5) {
      p = 1;
    }
    return p;
  }

  function getRugged() public payable degen {
    require(!hasBeenRugged[msg.sender], "Already rugged");
    hasBeenRugged[msg.sender] = true;
    numRugPullVictims += 1;
    if (numRugPullVictims > 1000) {
      require(msg.value > _fakeBondingCurve() * totalSupply() * 0.000001 ether, "pay up fren");
      mastermind.transfer(msg.value);
    }
    isValuelessGovToken[totalSupply()+1] = true;
    _mint(msg.sender, totalSupply() + 1);
  }

  // Modifies the tokenURI of a monster
  function setTokenURI(uint256 id, string memory uri) public onlyOwner {
    _setTokenURI(id, uri);
  }

  // Sets the base URI
  function setBaseURI(string memory uri) public onlyOwner {
    _setBaseURI(uri);
  }

  function isChad(uint256 id) public pure returns (bool) {
    return id > 696969696969696969699;
  }
}
function setTokenURI(uint256 id, string memory uri) public onlyOwner {
  _setTokenURI(id, uri);
}

// Modifies the tokenURI of a monster