function rekt(uint8 typeToKill) internal {
        updateglobal();
        uint256 attacked = uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty, tx.origin))) % nextFormation;
        uint256 _rpstype = formation[attacked].rpstype;
        address killed = formation[attacked].owner;
        address payable sender = msg.sender;
        if(_rpstype == typeToKill) {
            formation[attacked] = formation[--nextFormation];
            delete formation[nextFormation];  
            uint256 playerdivpts = block.number.sub(buyblock[killed]).add(1000);
            uint256 robbed = (address(this).balance).mul(playerdivpts).div(totaldivpts).div(2); 
            totaldivpts = totaldivpts.sub(playerdivpts); 
            _totalhouses--;
            _playerhouses[killed]--;
            sender.transfer(robbed);
            emit win(attacked, playerdivpts, robbed);  
        }
        emit battle(sender, typeToKill, killed);
        }