def leave(args): table = user.table table.leave(user) channels.do_tinfo(table, "{} has left the table.".format(user.name)) user.table = None if len(table.users) < 1: del table
def tutor(args): if args is None: do_help(user, ['table', 'tutor']) return card_name = ' '.join(args) if user.table.tutor(user, card_name): channels.do_tinfo(user.table, "{} tutored {} from their library.".format(user.name, card_name)) else: user.presenter.show_msg("Failed to find '{}' in your library.".format(card_name))
def life(args): if args is None: user.presenter.show_msg("Do what with your life total?") return if not is_int(args[0]): do_help(user, ['table', 'hp']) return user.table.life_totals[user] += int(args[0]) channels.do_tinfo(user.table, "{} set their life total to {}.".format(user.name, user.table.life_totals[user]))
def discard(args): table = user.table if not is_int(args[0]): do_help(user, ['table', 'play']) card_index = int(args[0]) if card_index >= len(table.hands[user]): user.presenter.show_msg("Out of range!") return card = table.hands[user][int(args[0])] table.discard(user, card) channels.do_tinfo(user.table, "{} discards {}.".format(user.name, card.name))
def dice(args): if args is not None: if str(args[0]).isdigit(): die_size = int(args[0]) else: do_help(user, ['table', 'dice']) return else: die_size = 6 # Default dice size roll = randint(1, die_size) channels.do_tinfo(user.table, "{} rolled {} on a {} sided dice.".format(user.name, roll, die_size))
def grexile(args): table = user.table if args is None or not is_int(args[0]): do_help(user, ['table', 'grexile']) return card_index = int(args[0]) if card_index >= len(table.graveyards[user]): user.presenter.show_msg("Out of range!") return card = table.graveyards[user][card_index] table.grexile(user, card) channels.do_tinfo(user.table, "exiles {} from their graveyard.".format(user.name, card.name))
def unearth(args): table = user.table if args is None or not is_int(args[0]): do_help(user, ['table', 'unearth']) return card_index = int(args[0]) if card_index >= len(table.graveyards[user]): user.presenter.show_msg("Out of range!") return card = table.graveyards[user][card_index] table.unearth(user, card) channels.do_tinfo(user.table, "{} unearths their {}.".format(user.name, card.name))
def return_(args): table = user.table if args is None or not is_int(args[0]): do_help(user, ['table', 'return']) return card_index = int(args[0]) if card_index >= len(table.battlefields[user]): user.presenter.show_msg("Out of range!") return card = table.battlefields[user][card_index] table.return_(user, card) channels.do_tinfo(user.table, "{} returns {} to their hand.".format(user.name, card.name))
def join(args): if args is None: do_help(user, ['table', 'join']) return table_name = ' '.join(args) for t in user.room.tables: if table_name == t.name: if len(t.users) < 2 or user in t.users: t.join(user) user.table = t channels.do_tinfo(user.table, "{} has joined the table.".format(t.name)) return user.presenter.show_msg("Could not find table '{}'.".format(table_name))
def draw(args): if len(user.table.libraries[user]) < 1: user.presenter.show_msg("Your library is empty!") return if args is None: user.table.draw(user) channels.do_tinfo(user.table, "{} draws a card.".format(user.name)) return if not is_int(args[0]): do_help(user, ['table', 'draw']) return no_cards = int(args[0]) if no_cards < 1: user.presenter.show_msg("Ummm... how would you even... Uhh... I don't... No. Just, no.") return user.table.draw(user, no_cards) channels.do_tinfo(user.table, "{} draws {} cards.".format(user.name, no_cards))
def untap(args): table = user.table if args is None: do_help(user, ['table', 'untap']) return if is_int(args[0]): card_index = int(args[0]) if card_index >= len(table.battlefields[user]): user.presenter.show_msg("Out of range!") return card = table.battlefields[user][card_index] if not card.tapped: user.presenter.show_msg("'{}' is not tapped.".format(card.name)) return card.untap() channels.do_tinfo(user.table, "{} untaps {}.".format(user.name, card.name)) elif args[0] == "all": for card in table.battlefields[user]: card.untap() channels.do_tinfo(user.table, "{} untaps all their cards.".format(user.name)) else: do_help(user, ['table', 'tap'])
def scoop(args): if user.table is None: user.presenter.show_msg("You're not at a table!") return user.table.scoop(user) channels.do_tinfo(user.table, "{} scoops it up!".format(user.name))
def shuffle(args): user.table.shuffle(user) channels.do_tinfo(user.table, "{} shuffled their library.".format(user.name))