async def slot(self, ctx, amount): """ Roll the slot machine """ emojis = [":tangerine:", ":lemon:", ":banana:", ":watermelon:", ":strawberry:", ":peach:", ":cherries:", ":pineapple:", ":apple:"] player = get_player(ctx.message.author.id) a = random.choice(emojis) b = random.choice(emojis) c = random.choice(emojis) slotmachine = f"**{a}{b}{c}\n{ctx.author.name}**," if player['bank'] == 0: await ctx.send("Bank account is empty.") return elif int(amount) > player['bank']: await ctx.send("Not enough coins.") return else: if a == b == c: update_bank(ctx.message.author, int(amount) * 10) player = get_player(ctx.message.author.id) await ctx.send(f"{slotmachine} All matching, you won!\nBank Account: %s coins" % (player['bank'])) elif (a == b) or (a == c) or (b == c): update_bank(ctx.message.author, int(amount) * 5) player = get_player(ctx.message.author.id) await ctx.send(f"{slotmachine} 2 in a row, you won!\nBank Account: %s coins" % (player['bank'])) else: update_bank(ctx.message.author, -int(amount)) player = get_player(ctx.message.author.id) await ctx.send(f"{slotmachine} No match, you lost.\nBank Account: %s coins" % (player['bank']))
def run_game(): (conn1, conn2) = s.poll() name1 = s.get_player_name(conn1) name2 = s.get_player_name(conn2) p1 = database.get_player(name1) p1['conn'] = conn1 p2 = database.get_player(name2) p2['conn'] = conn2 print(p1) on = p1 off = p2 on['lead'] = s.choose_lead(on) off['lead'] = s.choose_lead(off) while not((p1loss = has_lost(p1)) or has_lost(p2)): s.send_state(get_state(p1, p2), p1, p2) if on['lead'].hp > 0: action = s.choose_action(on) else: action = 'switch' if action == 'attack': attack = s.choose_attack(on) defender = off['lead'] defender.hp -= (on['lead'].stats['phys_strength'] / 10.0) * attack['damage'] if defender.hp <= 0: off['monsters'].remove (defender) elif action == 'switch': on['lead'] = s.choose_lead(on) elif action == 'state': on['lead'].current_state = s.choose_state(on) on, off = off, on
async def craft(self, ctx, hero_id): """Craft your favorite hero""" player = get_player(ctx.message.author.id) hero = display_worry() if player['inventory_slot_one'] is None or player['inventory_slot_two'] is None \ or player['inventory_slot_three'] is None or player['inventory_slot_four'] is None: for element in hero: if element['ID'] == int(hero_id): item1 = element['Item1'] item2 = element['Item2'] worry = element['Worry'] member = ctx.message.author if (player['inventory_slot_one'] == item1 or player['inventory_slot_two'] == item1 or player['inventory_slot_three'] == item1 or player['inventory_slot_four'] == item1) and ( player['inventory_slot_one'] == item2 or player['inventory_slot_two'] == item2 or player['inventory_slot_three'] == item2 or player['inventory_slot_four'] == item2): add_to_inventory(member, worry) await ctx.send('Craft successful') else: await ctx.send( "You don't have the necessary items. Check craft table for more info." ) else: await ctx.send("Your inventory is full")
async def coin_flip(self, ctx, user_guess): """Flip a coin to win a big prize. You lose 200 coins per try.""" member = ctx.message.author player = get_player(ctx.message.author.id) if player['bank'] == 0: await ctx.send("Bank account is empty.") return else: update_bank(member, -200) if user_guess.upper() == 'T' or user_guess.upper() == 'H': roll = random.randint(1, 2) if roll == 1: comp_guess = 'T' else: comp_guess = 'H' if user_guess == comp_guess: await ctx.send("It was {}\nYOU WON 500 coins {}!!".format(comp_guess, member.mention)) update_bank(member, 500) return else: await ctx.send("It was {} \nYOU LOST {}".format(comp_guess, member.mention)) return else: await ctx.send("The input is not valid.\nExiting...") return
async def dice_roll(self, ctx, user_guess): """Roll a dice and guess the number to win a big prize. You lose 100 coins per try.""" member = ctx.message.author player = get_player(ctx.message.author.id) if player['bank'] == 0: await ctx.send("Bank account is empty.") return else: update_bank(member, -100) max_value = 12 if int(user_guess) > max_value: await ctx.send("The input is higher than the max value.\nExiting...") return else: first_roll = random.randint(1, max_value) second_roll = random.randint(1, max_value) await ctx.send("Rolling... :game_die:") await asyncio.sleep(2) await ctx.send("First roll is: %d" % first_roll) await asyncio.sleep(1) await ctx.send("Second roll is: %d" % second_roll) total_roll = first_roll + second_roll await ctx.send("Total roll is: %d" % total_roll) await ctx.send("Result...:game_die:") if int(user_guess) > total_roll: await ctx.send("YOU WON 1000 coins {}!!".format(member.mention)) update_bank(member, 1000) return else: await ctx.send("YOU LOST {}".format(member.mention)) return
async def stats(self, ctx): """Check your inventory.""" player = get_player(ctx.message.author.id) await ctx.send( "Joined server: %s\nBank Account: %s coins\nInventory: 1.%s\n2.%s\n3.%s\n4.%s" % (player['join_server_date'], player['bank'], player['inventory_slot_one'], player['inventory_slot_two'], player['inventory_slot_three'], player['inventory_slot_four']))
async def buy(self, ctx, item_id): """Buy an item from the shop using the ID""" player = get_player(ctx.message.author.id) item = display_shop() if player['inventory_slot_one'] is None or player['inventory_slot_two'] is None \ or player['inventory_slot_three'] is None or player['inventory_slot_four'] is None: for element in item: if element['ID'] == int(item_id): item = element['Item'] member = ctx.message.author add_to_inventory(member, item) price = element['Price'] update_bank(member, -int(price)) await ctx.send("You bought %s" % (element['Item'])) else: await ctx.send("Your inventory is full")
async def buy_ticket(self, ctx): user = ctx.message.author player = get_player(ctx.message.author.id) if player['bank'] == 0: await ctx.send("Bank account is empty.") return else: update_bank(user, -1000) if self.ticketCounter == self.winningTicket: self.generate_tickets(100) update_bank(user, self.prizePool) await ctx.send("{}, Congratulations, you won the lottery with a prizepool of ".format(user.mention) + str(self.prizePool)) else: self.ticketCounter += 1 await ctx.send("{}, You lost, better luck next time!".format(user.mention))
async def rock_paper_scissors(self, ctx, user_choice): """Rock, paper, scissors game. Beat the AI to win a big prize. You lose 500 coins per try.""" member = ctx.message.author player = get_player(ctx.message.author.id) if player['bank'] == 0: await ctx.send("Bank account is empty.") return else: update_bank(member, -500) # Options list which will not change OPTIONS = ["R", "P", "S"] # Messages to user LOSE_MESSAGE = "\nYou Lost!" WIN_MESSAGE = "\nYou Won 2000 coins!" user_choice = user_choice.upper() if user_choice == "P" or user_choice == "R" or user_choice == "S": computer_choice = OPTIONS[random.randint(0, len(OPTIONS) - 1)] else: await ctx.send("Invalid choice\nExiting...") return user_choice_index = OPTIONS.index(user_choice) computer_choice_index = OPTIONS.index(computer_choice) if user_choice_index == computer_choice_index: # Set a draw if both indexes are the same await asyncio.sleep(1) await ctx.send("\nDRAW!") elif (user_choice_index == 0 and computer_choice_index == 2) or ( user_choice_index == 1 and computer_choice_index == 0) or ( user_choice_index == 2 and computer_choice_index == 1): # One condition to handle all the events where the user will win await ctx.send(WIN_MESSAGE) update_bank(member, 2000) return else: await ctx.send(LOSE_MESSAGE) return
def main(): op = -1 os.system('cls') while op != '0': op = input( 'Welcome to the legend of the adventure!\n0.Exit\n1.Create character\n2.Load character\n3.Delete Character\n4.Credits\n5.Set Database\nR.' ) player = c.player('') os.system('cls') if op == '1': # Creating character print('Creating character') name = input('Name: ') totalC = db.get_all_classes() print() print('Choose your class!') print('id - name - con - str - int - spd') for i in totalC: print(i.id, '-', i.name, '-', i.con, '-', i.str, '-', i.int, '-', i.spd) clas_id = input('Class id: ') print('You have chosen ' + db.get_class(clas_id).name) totalR = db.get_all_races() print('\nChoose your race!') print('id - name - con - str - int - spd') for i in totalR: print(i.id, '-', i.name, '-', i.con, '-', i.str, '-', i.int, '-', i.spd) race_id = input('Race id: ') print('You have chosen ' + db.get_race(race_id).name) p = c.player(name, id_class=clas_id, id_race=race_id) db.create_player(p) p = db.get_player(p.name, 'name') p.show() op = input('\nAre u sure?\n1.Yes\n2.No\nR.') if op == '1': os.system('cls') print(p.name + ' created!') elif op == '2': db.delete_player(p) os.system('cls') print('Operation aborted') elif op == '2': op = '123456' while int(op) > len(db.get_all_players()): # Loading character os.system('cls') print('loading character') # Creating character print('Choose yout character') print('0 - EXIT') totalP = db.get_all_players() for i in totalP: print(i.id, '-', i.name) op = input('Select your character id: ') os.system('cls') if op == '0': op = 'null' break if db.get_player(op): player = db.get_player(op) player.show() op = input('\nAre you sure?\n1.Yes\n2.No\nR.') os.system('cls') if op == '1': print(player.name + ' selected!') db.update_last_login(player) play(player) break elif op == '2': print('Operation aborted') op = len(db.get_all_players()) + 1 break elif op == '3': # Delete character op = '123456' while int(op) > len(db.get_all_players()): # Loading character os.system('cls') print('deleting character') # Deleting a character print('Choose yout character') print('0 - EXIT') totalP = db.get_all_players() for i in totalP: print(i.id, '-', i.name) op = input('Select your character id: ') os.system('cls') if op == '0': op = 'null' break if db.get_player(op): player = db.get_player(op) os.system('cls') player.show() op = input('\nAre you sure?\n1.Yes\n2.No\nR.') if op == '1': os.system('cls') print(player.name + ' deleted!') db.delete_player(player) break elif op == '2': print('Operation aborted') op = len(db.get_all_players()) + 1 break elif op == '4': # Credits print('This game is made full of love ♥') print('Version: 0.15 Alfa') elif op == '5': # Set default values try: with open('database.db', 'r') as f: print('Database already setted!') default_values() except IOError: print('Setting database...\nDone!') default_values() elif op == '0': print('see you next time') pass else: print('invalid option!')
def play(player): op = -1 while op != '0': op = input( 'Here you start your adventure!\n0.Exit\n1.Stash\n2.Combat\n3.View character\n4.Level up\nR.' ) os.system('cls') if op == '0': return elif op == '1': items = db.get_player_items(player) if items: # IF player have items on statsh print('Welcome to stash!!') print('This is your items:') for i in items: print(i.id, '-', i.name) op = input('Select your item to equip: ') item = db.get_item(op) os.system('cls') db.equip_item(player, item) print(item.name + ' equipped!') player = db.get_player(player.id) else: # Player dont have any items on stash print('You have no items :(\nKill some mobs to get some items') elif op == '2': os.system('cls') print('1.Floresta\n2.Deserto\n3.Caverna') op = input('R.') os.system('cls') if op == '1' and db.get_player_caves(player, 0) == '0': print('You have entered into the forest.') t.sleep(1.5) enemy1 = c.player('Mosquito', 1, 5, 1, 1, 5, 5) enemy2 = c.player('Cobra', 2, 10, 1, 1, 10, 15) enemy3 = c.player('Urso', 3, 15, 1, 1, 15, 13, 13) enemy4 = c.player('Leão', 4, 20, 1, 1, 20, 15, 15) enemy5 = c.player('Ent', 5, 40, 1, 1, 40, 17, 17, item_equipped=1) if player.fight(enemy1) == True: if player.fight(enemy2) == True: if player.fight(enemy3) == True: if player.fight(enemy4) == True: if player.fight(enemy5) == True: item = db.get_item(1) os.system('cls') print('You complete the Forest, Gratzz!') print('Here is your reward!') print(item.name + ' has been added to your stash!') db.att_item(player, item) db.update_player_caves(player, 0, '1') db.update_player_caves(player, 1, '0') t.sleep(3.5) elif op == '2' and db.get_player_caves(player, 1) == '0': print('You have entered into the deserto.') t.sleep(1.5) enemy1 = c.player('Calango', 1, 5, 1, 1, 5, 5) enemy2 = c.player('Camelo', 2, 10, 1, 1, 10, 15) enemy3 = c.player('Babuíno', 3, 15, 1, 1, 15, 13, 13) enemy4 = c.player('Minhocão', 4, 20, 1, 1, 20, 15, 15) enemy5 = c.player('Escorpião Gigante', 5, 40, 1, 1, 40, 17, 17) enemy6 = c.player('Mumia', 6, 60, 1, 1, 60, 19, 19) enemy7 = c.player('Esfinge', 7, 80, 1, 1, 80, 21, 21, item_equipped=2) if player.fight(enemy1): if player.fight(enemy2): if player.fight(enemy3): if player.fight(enemy4): if player.fight(enemy5): if player.fight(enemy6): if player.fight(enemy7): item = db.get_item(3) os.system('cls') print( 'You complete the deserto, Gratzz!' ) # colocar condição se o item já existir no inventário do jogador print('Here is your reward!') print( item.name + ' has been added to your stash!' ) db.att_item(player, item) player.lock_level(0) t.sleep(3.5) elif op == '3' and db.get_player_caves(player, 2) == '0': print('You have entered into the caverna.') t.sleep(1.5) enemy1 = c.player('Rato', 1, 5, 1, 1, 5, 5) enemy2 = c.player('Morcego', 2, 10, 1, 1, 10, 15) enemy3 = c.player('Goblin', 3, 15, 1, 1, 15, 13, 13) enemy4 = c.player('Kobold', 4, 20, 1, 1, 20, 15, 15) enemy5 = c.player('Esqueleto', 5, 40, 1, 1, 40, 17, 17) enemy6 = c.player('Orc', 6, 60, 1, 1, 60, 19, 19) enemy7 = c.player('Troll', 7, 80, 1, 1, 80, 21, 2, item_equipped=2) enemy8 = c.player('O ex da sua mãe', 8, 100, 1, 1, 100, 23, 23) enemy9 = c.player('Dragão', 9, 110, 1, 1, 110, 23, 23, item_equipped=3) if player.fight(enemy1): if player.fight(enemy2): if player.fight(enemy3): if player.fight(enemy4): if player.fight(enemy5): if player.fight(enemy6): if player.fight(enemy7): if player.fight(enemy8): if player.fight(enemy9): item = db.get_item(3) os.system('cls') print( 'You complete the caverna, Gratzz!' ) print( 'Here is your reward!') print( item.name + ' has been added to your stash!' ) db.att_item(player, item) t.sleep(3.5) elif op == '3': # Show player ifo player.show() print() elif op == '4': # Level up! player.levelUp() else: print('invalid option')
async def iworrywar(self, ctx, human: discord.Member): """Challenge the Worry AI to a Worry War. Will you be the first to defeat it?""" await ctx.send("Welcome to the Worry Wars!") computer = Player("**Supreme Worry**") emoji = get(ctx.message.guild.emojis, name='worry') emoji2 = get(ctx.message.guild.emojis, name='worrythanos') emoji3 = get(ctx.message.guild.emojis, name='worrycool') emoji4 = get(ctx.message.guild.emojis, name='waifuworry') emoji5 = get(ctx.message.guild.emojis, name='worrywe') emoji6 = get(ctx.message.guild.emojis, name='worrythink') await ctx.send("%s Select your hero:" % human.mention) await ctx.send("For {} press 1.\n" "For {} press 2.\n" "For {} press 3.\n" "For {} press 4.\n" "For {} press 5.\n" "For {} press 6.\n".format(emoji, emoji2, emoji3, emoji4, emoji5, emoji6)) await ctx.send("Please enter your choice: ") def check(m): return (m.content == '1' or m.content == '2' or m.content == '3' or m.content == '4' or m.content == '5' or m.content == '6') and \ m.channel == ctx.channel and m.author == human async def get_input_of_type(): while True: try: msg = await self.bot.wait_for('message', check=check) return int(msg.content) except ValueError: continue player = get_player(human.id) hero = await get_input_of_type() if hero == 1: if player['inventory_slot_one'] == ':worry:' or player['inventory_slot_two'] == ':worry:' \ or player['inventory_slot_three'] == ':worry:' \ or player['inventory_slot_four'] == ':worry:': ids = human.id human = Worry(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return elif hero == 2: if player['inventory_slot_one'] == ':worrythanos:' or player['inventory_slot_two'] == ':worrythanos:' \ or player['inventory_slot_three'] == ':worrythanos:' \ or player['inventory_slot_four'] == ':worrythanos:': ids = human.id human = WorryThanos(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return elif hero == 3: if player['inventory_slot_one'] == ':worrycool:' or player['inventory_slot_two'] == ':worrycool:' \ or player['inventory_slot_three'] == ':worrycool:' \ or player['inventory_slot_four'] == ':worrycool:': ids = human.id human = WorryCool(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return elif hero == 4: if player['inventory_slot_one'] == ':waifuworry:' or player['inventory_slot_two'] == ':waifuworry:' \ or player['inventory_slot_three'] == ':waifuworry:' \ or player['inventory_slot_four'] == ':waifuworry:': ids = human.id human = WaifuWorry(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return elif hero == 5: if player['inventory_slot_one'] == ':worrywe:' or player['inventory_slot_two'] == ':worrywe:' \ or player['inventory_slot_three'] == ':worrywe:' \ or player['inventory_slot_four'] == ':worrywe:': ids = human.id human = Worrywe(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return elif hero == 6: if player['inventory_slot_one'] == ':worrythink:' or player['inventory_slot_two'] == ':worrythink:' \ or player['inventory_slot_three'] == ':worrythink:' \ or player['inventory_slot_four'] == ':worrythink:': ids = human.id human = WorryThink(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return game_in_progress = True current_player = computer while game_in_progress: # swap the current player each round if current_player == computer: current_player = human else: current_player = computer await ctx.send( "{2} has *{0}* health remaining and the " "**Supreme Worry** has *{1}* health remaining.".format( human.health, computer.health, human.name)) if current_player == human: await ctx.send( "Available attacks: \n" ":one: **Stare** - *Causes moderate damage*\n" ":two: **Lucky Strike** - *high or low damage*\n" ":three: **ULTIMATE**: " + human.ultimate + "\n:four: **Panacea** - *Restores a moderate amount of health*" ) await ctx.send("Select an attack: ") def check(m): return ( m.content == '1' or m.content == '2' or m.content == '3' or m.content == '4' ) and m.channel == ctx.channel and m.author.id == human.id async def get_selection(): while True: try: msg = await self.bot.wait_for('message', check=check) return int(msg.content) except ValueError: continue move = await get_selection() else: move = await get_computer_selection(ctx, computer.health) if move == 1: damage = random.randrange(1800, 2500) if current_player == human: await computer.calculate_damage(ctx, damage, human.name, human.intensifier) else: await human.calculate_damage(ctx, damage, computer.name, computer.intensifier) elif move == 2: damage = random.randrange(1000, 3500) if current_player == human: await computer.calculate_damage(ctx, damage, human.name, human.intensifier) else: await human.calculate_damage(ctx, damage, computer.name, computer.intensifier) elif move == 4: heal = random.randrange(10000, 15000) if current_player == human and human.health < 150000: await human.calculate_heal(ctx, heal, human.heal_intensifier) elif current_player == human and human.health > 150000: await human.normal_heal(ctx, heal) elif current_player == computer: await computer.calculate_heal(ctx, heal, computer.heal_intensifier) elif move == 3: if current_player == human and human.health < 150000: damage = random.randrange(10000, 20000) await computer.calculate_ultimate(ctx, damage, human.name, human.ultimate, human.ulti_intensifier) elif current_player == computer and computer.health < 150000: damage = random.randrange(10000, 20000) await human.calculate_ultimate(ctx, damage, computer.name, computer.ultimate, computer.ulti_intensifier) else: await ctx.send("Ultimate not ready!") else: await ctx.send( "The input was not valid. Please select a choice again.") if human.health == 0: await ctx.send("Sorry, you lose!") game_in_progress = False if computer.health == 0: await ctx.send("Congratulations, you beat the computer!") game_in_progress = False
async def worrywar(self, ctx, human1: discord.Member, human2: discord.Member): """Two player duel game. Challenge your opponent and engage in a Worry War after selecting your favorite worry hero """ await ctx.send("Welcome to the Worry Wars!") emoji = get(ctx.message.guild.emojis, name='worry') emoji2 = get(ctx.message.guild.emojis, name='worrythanos') emoji3 = get(ctx.message.guild.emojis, name='worrycool') emoji4 = get(ctx.message.guild.emojis, name='waifuworry') emoji5 = get(ctx.message.guild.emojis, name='worrywe') emoji6 = get(ctx.message.guild.emojis, name='worrythink') await ctx.send("%s Select your hero:" % human1.mention) await ctx.send("For {} press 1.\n" "For {} press 2.\n" "For {} press 3.\n" "For {} press 4.\n" "For {} press 5.\n" "For {} press 6.\n".format(emoji, emoji2, emoji3, emoji4, emoji5, emoji6)) await ctx.send("Please enter your choice: ") def check(m): return (m.content == '1' or m.content == '2' or m.content == '3' or m.content == '4' or m.content == '5' or m.content == '6') and \ m.channel == ctx.channel and m.author == human1 async def get_input_of_type(): while True: try: msg = await self.bot.wait_for('message', check=check) return int(msg.content) except ValueError: continue player = get_player(human1.id) hero1 = await get_input_of_type() if hero1 == 1: if player['inventory_slot_one'] == ':worry:' or player['inventory_slot_two'] == ':worry:' \ or player['inventory_slot_three'] == ':worry:' \ or player['inventory_slot_four'] == ':worry:': ids = human1.id human1 = Worry(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return elif hero1 == 2: if player['inventory_slot_one'] == ':worrythanos:' or player['inventory_slot_two'] == ':worrythanos:' \ or player['inventory_slot_three'] == ':worrythanos:' \ or player['inventory_slot_four'] == ':worrythanos:': ids = human1.id human1 = WorryThanos(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return elif hero1 == 3: if player['inventory_slot_one'] == ':worrycool:' or player['inventory_slot_two'] == ':worrycool:' \ or player['inventory_slot_three'] == ':worrycool:' \ or player['inventory_slot_four'] == ':worrycool:': ids = human1.id human1 = WorryCool(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return elif hero1 == 4: if player['inventory_slot_one'] == ':waifuworry:' or player['inventory_slot_two'] == ':waifuworry:' \ or player['inventory_slot_three'] == ':waifuworry:' \ or player['inventory_slot_four'] == ':waifuworry:': ids = human1.id human1 = WaifuWorry(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return elif hero1 == 5: if player['inventory_slot_one'] == ':worrywe:' or player['inventory_slot_two'] == ':worrywe:' \ or player['inventory_slot_three'] == ':worrywe:' \ or player['inventory_slot_four'] == ':worrywe:': ids = human1.id human1 = Worrywe(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return elif hero1 == 6: if player['inventory_slot_one'] == ':worrythink:' or player['inventory_slot_two'] == ':worrythink:' \ or player['inventory_slot_three'] == ':worrythink:' \ or player['inventory_slot_four'] == ':worrythink:': ids = human1.id human1 = WorryThink(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return await ctx.send("%s Select your hero:" % human2.mention) await ctx.send("For {} press 1.\n" "For {} press 2.\n" "For {} press 3.\n" "For {} press 4.\n" "For {} press 5.\n" "For {} press 6.\n".format(emoji, emoji2, emoji3, emoji4, emoji5, emoji6)) await ctx.send("Please enter your choice: ") def check(m): return (m.content == '1' or m.content == '2' or m.content == '3' or m.content == '5' or m.content == '5' or m.content == '6') and \ m.channel == ctx.channel and m.author == human2 async def get_input_of_type(): while True: try: msg = await self.bot.wait_for('message', check=check) return int(msg.content) except ValueError: continue player = get_player(human2.id) hero1 = await get_input_of_type() if hero1 == 1: if player['inventory_slot_one'] == ':worry:' or player['inventory_slot_two'] == ':worry:' \ or player['inventory_slot_three'] == ':worry:' \ or player['inventory_slot_four'] == ':worry:': ids = human2.id human2 = Worry(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return elif hero1 == 2: if player['inventory_slot_one'] == ':worrythanos:' or player['inventory_slot_two'] == ':worrythanos:' \ or player['inventory_slot_three'] == ':worrythanos:' \ or player['inventory_slot_four'] == ':worrythanos:': ids = human2.id human2 = WorryThanos(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return elif hero1 == 3: if player['inventory_slot_one'] == ':worrycool:' or player['inventory_slot_two'] == ':worrycool:' \ or player['inventory_slot_three'] == ':worrycool:' \ or player['inventory_slot_four'] == ':worrycool:': ids = human2.id human2 = WorryCool(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return elif hero1 == 4: if player['inventory_slot_one'] == ':waifuworry:' or player['inventory_slot_two'] == ':waifuworry:' \ or player['inventory_slot_three'] == ':waifuworry:' \ or player['inventory_slot_four'] == ':waifuworry:': ids = human2.id human2 = WaifuWorry(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return elif hero1 == 5: if player['inventory_slot_one'] == ':worrywe:' or player['inventory_slot_two'] == ':worrywe:' \ or player['inventory_slot_three'] == ':worrywe:' \ or player['inventory_slot_four'] == ':worrywe:': ids = human2.id human2 = Worrywe(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return elif hero1 == 6: if player['inventory_slot_one'] == ':worrythink:' or player['inventory_slot_two'] == ':worrythink:' \ or player['inventory_slot_three'] == ':worrythink:' \ or player['inventory_slot_four'] == ':worrythink:': ids = human2.id human2 = WorryThink(ctx, ids) else: await ctx.send("You don't own this hero. Please go craft it.") return game_in_progress = True choice = random.randint(0, 1) if choice == 1: current_player = human1 else: current_player = human2 while game_in_progress: # swap the current player each round if current_player == human1: current_player = human2 else: current_player = human1 await ctx.send("%s turn" % current_player.name) await ctx.send("{2} has {0} health remaining and " "{3} has {1} health remaining.".format( human1.health, human2.health, human1.name, human2.name)) if current_player == human1: await ctx.send( "Available attacks: \n" ":one: **Stare** - *Causes moderate damage*\n" ":two: **Lucky Strike** - *high or low damage*\n" ":three: **ULTIMATE**: " + human1.ultimate + "\n:four: **Panacea** - *Restores a moderate amount of health*" ) await ctx.send("Select an attack: ") def check(m): return ( m.content == '1' or m.content == '2' or m.content == '3' or m.content == '4' ) and m.channel == ctx.channel and m.author.id == human1.id async def get_selection1(): while True: try: msg = await self.bot.wait_for('message', check=check) return int(msg.content) except ValueError: continue move = await get_selection1() else: await ctx.send( "Available attacks: \n" ":one: **Stare** - *Causes moderate damage*\n" ":two: **Lucky Strike** - *high or low damage*\n" ":three: **ULTIMATE**: " + human2.ultimate + "\n:four: **Panacea** - *Restores a moderate amount of health*" ) await ctx.send("Select an attack: ") def check(m): return ( m.content == '1' or m.content == '2' or m.content == '3' or m.content == '4' ) and m.channel == ctx.channel and m.author.id == human2.id async def get_selection2(): while True: try: msg = await self.bot.wait_for('message', check=check) return int(msg.content) except ValueError: continue move = await get_selection2() if move == 1: damage = random.randrange(1800, 2500) if current_player == human1: await human2.calculate_damage(ctx, damage, human1.name, human1.intensifier) else: await human1.calculate_damage(ctx, damage, human2.name, human2.intensifier) elif move == 2: damage = random.randrange(1000, 3500) if current_player == human1: await human2.calculate_damage(ctx, damage, human1.name, human1.intensifier) else: await human1.calculate_damage(ctx, damage, human2.name, human2.intensifier) elif move == 4: heal = random.randrange(10000, 15000) if current_player == human1 and human1.health < 120000: await human1.calculate_heal(ctx, heal, human1.heal_intensifier) elif current_player == human1 and human1.health > 120000: await human1.normal_heal(ctx, heal) elif current_player == human2 and human2.health < 120000: await human2.calculate_heal(ctx, heal, human2.heal_intensifier) elif current_player == human2 and human2.health > 120000: await human2.normal_heal(ctx, heal) elif move == 3: if current_player == human1 and human1.health < 150000: damage = random.randrange(10000, 20000) await human2.calculate_ultimate(ctx, damage, human1.name, human1.ultimate, human1.ulti_intensifier) elif current_player == human2 and human2.health < 150000: damage = random.randrange(10000, 20000) await human1.calculate_ultimate(ctx, damage, human2.name, human2.ultimate, human2.ulti_intensifier) else: await ctx.send("Ultimate is not ready!") else: await ctx.send( "The input was not valid. Please select a choice again.") if human1.health == 0 and human2.health > 0: await ctx.send("{} you lose".format(human1.name)) game_in_progress = False elif human2.health == 0 and human1.health > 0: await ctx.send("{} you lose".format(human2.name)) game_in_progress = False