|
|
|
@ -10,10 +10,7 @@ BOMB holders can randomly mail bombs to other owners
|
|
|
|
|
chaos ensues until 1000 survivors - the game stops
|
|
|
|
|
********/
|
|
|
|
|
|
|
|
|
|
import {ERC721} from "solmate/tokens/ERC721.sol";
|
|
|
|
|
import {Owned} from "solmate/auth/Owned.sol";
|
|
|
|
|
import {LibString} from "solmate/utils/LibString.sol";
|
|
|
|
|
|
|
|
|
|
import {Unaboomer} from "./Unaboomer.sol";
|
|
|
|
|
import {Mailbomb} from "./Mailbomb.sol";
|
|
|
|
|
|
|
|
|
@ -60,8 +57,11 @@ contract UnaboomerCommon is Owned {
|
|
|
|
|
// Modifiers
|
|
|
|
|
// =========================================================================
|
|
|
|
|
|
|
|
|
|
modifier missionCompleted {
|
|
|
|
|
require(unaboomer.killCount() <= unaboomer.SURVIVOR_COUNT(), "mission already completed");
|
|
|
|
|
modifier missionNotCompleted {
|
|
|
|
|
require(
|
|
|
|
|
unaboomer.killCount() <= (unaboomer.MAX_SUPPLY() - unaboomer.SURVIVOR_COUNT()),
|
|
|
|
|
"mission already completed"
|
|
|
|
|
);
|
|
|
|
|
_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -69,26 +69,24 @@ contract UnaboomerCommon is Owned {
|
|
|
|
|
// Tokens
|
|
|
|
|
// =========================================================================
|
|
|
|
|
|
|
|
|
|
/// Radicalize a boomer to become a Unaboomer
|
|
|
|
|
function radicalizeBoomers(uint256 _amount) external payable missionCompleted {
|
|
|
|
|
// check if game halted
|
|
|
|
|
/// Radicalize a boomer to become a Unaboomer - start with 2 bombs
|
|
|
|
|
function radicalizeBoomers(uint256 _amount) external payable missionNotCompleted {
|
|
|
|
|
require(msg.value >= _amount * boomerPrice, "not enough ether");
|
|
|
|
|
unaboomer.mint(msg.sender, _amount);
|
|
|
|
|
mailbomb.mint(msg.sender, _amount * 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Assemble additional mailbombs to kill targets
|
|
|
|
|
function assembleBombs(uint256 _amount) external payable missionCompleted {
|
|
|
|
|
// check if game halted
|
|
|
|
|
function assembleBombs(uint256 _amount) external payable missionNotCompleted {
|
|
|
|
|
require(msg.value >= _amount * bombPrice, "not enough ether");
|
|
|
|
|
mailbomb.mint(msg.sender, _amount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Send N bombs to pseudo-random Unaboomer tokenIds to potentially kill them.
|
|
|
|
|
/// If the Unaboomer is already dead, the bomb is a dud.
|
|
|
|
|
/// Send N bombs to pseudo-random Unaboomer tokenIds to kill them.
|
|
|
|
|
/// If the Unaboomer is already dead, the bomb is considered a dud.
|
|
|
|
|
/// @dev Pick a pseudo-random tokenID from Unaboomer contract and toggle a mapping value
|
|
|
|
|
/// @dev The likelihood of killing a boomer decreases as time goes on - i.e. more duds
|
|
|
|
|
function sendBombs(uint256[] calldata tokenIds) external missionCompleted returns (bool[] memory results) {
|
|
|
|
|
function sendBombs(uint256[] calldata tokenIds) external missionNotCompleted returns (bool[] memory results) {
|
|
|
|
|
require(tokenIds.length <= mailbomb.balanceOf(msg.sender));
|
|
|
|
|
bool[] memory res = new bool[](tokenIds.length);
|
|
|
|
|
uint256 boomerSupply = unaboomer.totalSupply();
|
|
|
|
|