Пример #1
0
async def rollCombo(message, d6s):
    if d6s > 6:
        await deleteMessage(message)
        raise Exception(
            "Attempted to roll more than 6 stats with d6s. Please try select a number less than 6"
        )
    if d6s < 0:
        raise Exception(
            "{0}, what the f**k are you trying to do? You can't roll a negative amount of dice."
            .format(str(message.author).split("#")[0]))
        await deleteMessage(message)
    diceparser.killFudge()
    stats = []
    for i in range(d6s):
        stats.append(sum(
            sorted([diceparser.rollDie(6) for x in range(4)])[1:]))
    for i in range(6 - d6s):
        stats.append(
            sum(sorted([diceparser.rollDie(4) for x in range(6)])[:-1]))
    saveStats(stats, message.author, "Combo: {0} with d6s".format(d6s))
    await message.channel.send(
        "{0}, your stats are ({1}), with {2} rolled with d6s".format(
            str(message.author).split("#")[0],
            str(stats)[1:-1], d6s))
    await deleteMessage(message)
Пример #2
0
async def handleAdDis(tmp, message):
    rolls = [diceparser.rollDie(20), diceparser.rollDie(20)]

    ans = " ({0}, {1})".format(rolls[0], rolls[1])
    if tmp == "+":
        message.content = message.content.replace("+", "with advantage")
        await sendMessage(message, str(max(rolls)) + ans)
    elif tmp == "-":
        message.content = message.content.replace("-", "with disadvantage")
        await sendMessage(message, str(min(rolls)) + ans)
Пример #3
0
async def roll_6d4(message):
    stats = []
    for i in range(6):
        stats.append(
            sum(sorted([diceparser.rollDie(4) for x in range(6)])[:-1]))

    saveStats(stats, message.author, "6d4 drop highest")
    await message.channel.send("{0}, your stats are ({1}) with d4s".format(
        str(message.author).split("#")[0],
        str(stats)[1:-1]))
    await deleteMessage(message)
Пример #4
0
async def handleRoll(tmp, message):
    if tmp == "help":
        await message.channel.send(
            helpMessage.format(str(message.author).split("#")[0]))
        await deleteMessage(message)
    elif tmp.startswith("stats"):
        await handleStats(tmp[5::], message)
    elif tmp == "":
        await sendMessage(message, str(diceparser.rollDie(20)), False)
    elif tmp == "+" or tmp == "-":
        await handleAdDis(tmp, message)
    else:
        await handleArbitraryRoll(tmp, message)