🎲
This commit is contained in:
@ -3,6 +3,11 @@ import json, random
|
||||
from funcs import getName, logThis
|
||||
from . import monopolyDraw
|
||||
|
||||
rulesAndTerms = {
|
||||
"pass go money" : 200,
|
||||
"money term" : "GP"
|
||||
}
|
||||
|
||||
def monopolyStart(channel):
|
||||
logThis("Starting a monopoly game")
|
||||
with open("resources/games/monopolyGames.json", "r") as f:
|
||||
@ -83,7 +88,10 @@ def monopolyContinue(channel):
|
||||
turn = 0
|
||||
|
||||
else:
|
||||
turn = (data[channel]["turn"])%len(data[channel]["player list"])
|
||||
if data[channel]["last roll"][0] == data[channel]["last roll"][1]:
|
||||
turn = data[channel]["turn"]
|
||||
else:
|
||||
turn = (data[channel]["turn"] + 1)%len(data[channel]["player list"])
|
||||
data[channel]["turn"] = turn
|
||||
playerList = list(data[channel]["players"].keys())
|
||||
|
||||
@ -107,8 +115,17 @@ def monopolyRoll(channel,user):
|
||||
|
||||
if user == currentPlayer:
|
||||
rolls = [random.randint(1,6),random.randint(1,6)]
|
||||
message = getName(user)+" rolled a "+str(rolls[0])+" and a "+str(rolls[1])+"."
|
||||
if rolls[0] == rolls[1]:
|
||||
message += " Doubbles!"
|
||||
|
||||
roll = rolls[0] + rolls[1]
|
||||
newPosition = (data[channel]["players"][user]["position"] + roll)%40
|
||||
oldPosition = data[channel]["players"][user]["position"]
|
||||
newPosition = (oldPosition + roll)%40
|
||||
if newPosition < oldPosition:
|
||||
data[channel]["players"][user]["money"] += rulesAndTerms["pass go money"]
|
||||
message += "\nYou passed go and got "+str(rulesAndTerms["pass go money"])+" "+rulesAndTerms["money term"]+"."
|
||||
|
||||
data[channel]["players"][user]["position"] = newPosition
|
||||
data[channel]["last roll"] = rolls
|
||||
|
||||
@ -120,5 +137,5 @@ def monopolyRoll(channel,user):
|
||||
except:
|
||||
logThis("Error drawing board (error code 1640)")
|
||||
|
||||
return "Rolled a "+str(rolls[0])+" and a "+str(rolls[1])+".", True, True, False, True
|
||||
return message, True, True, False, True
|
||||
else: return "", False, False, False, False
|
||||
|
@ -212,7 +212,7 @@ async def runMonopoly(channel, command, user):
|
||||
if gameStarted:
|
||||
await asyncio.sleep(60)
|
||||
else:
|
||||
await asyncio.sleep(5)
|
||||
await asyncio.sleep(3)
|
||||
response, showImage, deleteImage, gameDone = monopolyContinue(str(channel.id))
|
||||
em = discord.Embed(description=response,colour = 0x59f442)
|
||||
await channel.send(embed=em)
|
||||
|
BIN
resources/games/monopolyProperties/R1.png
Normal file
BIN
resources/games/monopolyProperties/R1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
resources/games/monopolyProperties/R2.png
Normal file
BIN
resources/games/monopolyProperties/R2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
resources/games/monopolyProperties/R3.png
Normal file
BIN
resources/games/monopolyProperties/R3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
resources/games/monopolyProperties/Y1.png
Normal file
BIN
resources/games/monopolyProperties/Y1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
resources/games/monopolyProperties/Y2.png
Normal file
BIN
resources/games/monopolyProperties/Y2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
resources/games/monopolyProperties/Y3.png
Normal file
BIN
resources/games/monopolyProperties/Y3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
Reference in New Issue
Block a user