change randomness to less shifting vars

master
lza_menace 2 years ago
parent 6d532ecfac
commit d46097d9c2

@ -236,10 +236,11 @@ contract Main is Owned {
function sendBombs(uint256 _amount) external missionNotCompleted {
// Ensure _amount will not exceed wallet balance of bombs, Unaboomer supply, and active Unaboomers
uint256 supply = unaboomersRadicalized();
require(_amount <= bombBalance(msg.sender), "not enough bombs");
uint256 bal = bombBalance(msg.sender);
require(_amount <= bal, "not enough bombs");
for (uint256 i; i < _amount; i++) {
// Pick a pseudo-random Unaboomer token - imperfectly derives token IDs so that repeats are probable
uint256 randomBoomer = (uint256(keccak256(abi.encodePacked(i, block.timestamp, msg.sender))) % supply) + 1;
uint256 randomBoomer = (uint256(keccak256(abi.encodePacked(i, supply, bal, msg.sender))) % supply) + 1;
// Capture owner
address _owner = unaboomer.ownerOf(randomBoomer);
// Check if it was already killed

Loading…
Cancel
Save