Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
Saransh-255 committed Sep 29, 2022
1 parent ba8f8c0 commit 0364b19
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
Binary file modified black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 16 additions & 12 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ async def gameStart():

game['playing'] = list(game['players'])

queen = game['playing'].pop(random.randint( 0,len(game['playing'])-1 ))
queen = game['playing'].pop(random.randint( 0, len(game['playing'])-1 ))

for player in game['playing']:
playerObj = ryver.get_user(username=player['name'])
Expand All @@ -802,7 +802,7 @@ async def gameStart():
for index, card in enumerate(player['cards']):
cardList += f"{str(index+1)}. {card} \n"
await send_message(
f"**This is your current set of cards:**\n {cardList}",
f"**This is your current set of cards:**\n *Send `!card <card number>` in the game chat to select a card.* \n\n {cardList}",
ryver.get_chat(id=playerObj.get_id())
)

Expand Down Expand Up @@ -840,7 +840,7 @@ async def gameStart():
game['waitingForJoin'] = True
else:
await send_message(
"Missing Arguments: Must add the number of rounds after command",
"Missing Arguments: Must add the number of rounds after command. `!cah <number of rounds>`",
bot_chat
)

Expand All @@ -864,7 +864,7 @@ async def gameStart():
)

if((not game['running']) and msg.text.lower().startswith("!start")):
if(len(game['players']) >= 2):
if(len(game['players']) >= 3):
game['waitingForJoin'] = False
for player in game['players']:
whiteCards = []
Expand All @@ -891,7 +891,7 @@ async def gameStart():
userInfo = next((player for player in game['players'] if player['name'] == user.get_username()), None)
playerInfo = next((player for player in game['playing'] if player['name'] == user.get_username()), None)

if(userInfo):
if(playerInfo):
selectedCard = userInfo['cards'].pop(int(selected)-1)
userInfo['cards'].append(random.choice(cah['white'])['text'])

Expand Down Expand Up @@ -952,8 +952,10 @@ async def gameStart():
'running': False,
'waitingForJoin': False,
'readCommands': False,
'selectionTime': False,
'players': [],
'playing': [],
'roundsLeft': 2,
'selectionTime': False,
'cardQueen': '' #username of card queen
}

Expand All @@ -971,12 +973,14 @@ async def gameStart():

elif(msg.text.lower().startswith("!end")):
game = {
'running': False,
'waitingForJoin': False,
'readCommands': False,
'selectionTime': False,
'players': [],
'cardQueen': '' #username of card queen
'running': False,
'waitingForJoin': False,
'readCommands': False,
'players': [],
'playing': [],
'roundsLeft': 2,
'selectionTime': False,
'cardQueen': '' #username of card queen
}
await send_message(
f"@{user.get_username()} ended the game.",
Expand Down

0 comments on commit 0364b19

Please sign in to comment.