Repository: CryptoBlades/cryptoblades
File: contracts/cryptoblades.sol (Solidity)

Code before:
    ) public pure {

        uint32[4] memory targets = getTargetsInternal(
            getPlayerPower(playerBasePower, wepMultiplier, wepBonusPower),
            staminaTimestamp,
            hour
        );
        bool foundMatch = false;
        for(uint i = 0; i < targets.length; i++) {
            if(targets[i] == target) {
                foundMatch = true;
                i = targets.length;
            }
        }
        require(foundMatch, "Target invalid");
    }

    mapping (address => uint32) tickets;

    function spendTicket(uint32 num)
        public
    {
        require (tickets[msg.sender] >= num, "You don't have enough tickets");

        for (int i = 0; i < num; i++) {
            weapons.mint(msg.sender, randoms.getRandomSeed(msg.sender));
        }

        tickets[msg.sender] -= num;
    }
    
    function isUnlikely(uint24 pp, uint24 ep)
        private
        pure
        returns(bool)
    {
        int128 playerMin = ABDKMath64x64.fromUInt(pp).mul(ABDKMath64x64.fromUInt(90)).div(ABDKMath64x64.fromUInt(100));
        int128 playerMax = ABDKMath64x64.fromUInt(pp).mul(ABDKMath64x64.fromUInt(110)).div(ABDKMath64x64.fromUInt(100));
        int128 playerRange = playerMax.sub(playerMin);
        int128 enemyMin = ABDKMath64x64.fromUInt(ep).mul(ABDKMath64x64.fromUInt(90)).div(ABDKMath64x64.fromUInt(100));
        int128 enemyMax = ABDKMath64x64.fromUInt(ep).mul(ABDKMath64x64.fromUInt(110)).div(ABDKMath64x64.fromUInt(100));
        int128 enemyRange = enemyMax.sub(enemyMin);
        int256 rollingTotal = 0;
        
        if (playerMin >= enemyMin) {
            int128 temp = playerMin.sub(enemyMin).div(enemyRange);
            temp = temp.add(ABDKMath64x64.fromUInt(1).sub(temp).mul(playerMax.sub(enemyMax).div(playerRange)));
            temp = temp.add(ABDKMath64x64.fromUInt(1).sub(temp).mul(ABDKMath64x64.fromUInt(50).div(ABDKMath64x64.fromUInt(100))));
            rollingTotal = ABDKMath64x64.toInt(temp.mul(ABDKMath64x64.fromUInt(1000)));
        } else {
            int128 temp = enemyMin.sub(playerMin).div(playerRange);

Review comment (suggestion):
This will give every single weapon the exact same seed and thus make them identical. The random seed should be combined with `i` and passed to `keccak256()` to make a unique seed for each weapon.

Code after:
        uint24 playerBasePower,
        int128 wepMultiplier,
        uint24 wepBonusPower,
        uint64 staminaTimestamp,
        uint256 hour,
        uint32 target
    ) public pure {

        uint32[4] memory targets = getTargetsInternal(
            getPlayerPower(playerBasePower, wepMultiplier, wepBonusPower),
            staminaTimestamp,
            hour
        );
        bool foundMatch = false;
        for(uint i = 0; i < targets.length; i++) {
            if(targets[i] == target) {
                foundMatch = true;
                i = targets.length;
            }
        }
        require(foundMatch, "Target invalid");
    }

    function spendTicket(uint32 num)
        public
    {
        blacksmith.spendTicket(num);
    }

    function isUnlikely(uint24 pp, uint24 ep)
        private
        pure
        returns(bool)
    {
        int128 playerMin = ABDKMath64x64.fromUInt(pp).mul(ABDKMath64x64.fromUInt(90)).div(ABDKMath64x64.fromUInt(100));
        int128 playerMax = ABDKMath64x64.fromUInt(pp).mul(ABDKMath64x64.fromUInt(110)).div(ABDKMath64x64.fromUInt(100));
        int128 playerRange = playerMax.sub(playerMin);
        int128 enemyMin = ABDKMath64x64.fromUInt(ep).mul(ABDKMath64x64.fromUInt(90)).div(ABDKMath64x64.fromUInt(100));
        int128 enemyMax = ABDKMath64x64.fromUInt(ep).mul(ABDKMath64x64.fromUInt(110)).div(ABDKMath64x64.fromUInt(100));
        int128 enemyRange = enemyMax.sub(enemyMin);
        int256 rollingTotal = 0;

        if (playerMin > enemyMax) return false;
        if (playerMax < enemyMin) return true;

        if (playerMin >= enemyMin) {
            int128 temp = playerMin.sub(enemyMin).div(enemyRange);
            temp = temp.add(ABDKMath64x64.fromUInt(1).sub(temp).mul(playerMax.sub(enemyMax).div(playerRange)));
            temp = temp.add(ABDKMath64x64.fromUInt(1).sub(temp).mul(ABDKMath64x64.fromUInt(50).div(ABDKMath64x64.fromUInt(100))));
            rollingTotal = ABDKMath64x64.toInt(temp.mul(ABDKMath64x64.fromUInt(1000)));
        } else {