Skip to content

Commit

Permalink
Revert "Fixed a few bug with matches, and more bugs fixed for roulette"
Browse files Browse the repository at this point in the history
  • Loading branch information
Ne02ptzero authored Feb 9, 2017
1 parent 228d752 commit fff7484
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 40 deletions.
2 changes: 1 addition & 1 deletion modules/matches/matches.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def removeMatches(self, Morphux, infos):
if (self.currentPlayer != infos['nick']):
Morphux.sendMessage("Not you!")
else:
if (len(infos['args']) > 0 and infos['args'][0].isdigit() and int(infos['args'][0]) >= 1 and int(infos['args'][0]) <= 3):
if (int(infos['args'][0]) >= 1 and int(infos['args'][0]) <= 3):
self.matchesNumber -= int(infos['args'][0])
if (self.matchesNumber <= 0):
Morphux.sendMessage(infos['nick'] + " just lost the game!")
Expand Down
47 changes: 8 additions & 39 deletions modules/roulette/roulette.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ def command(self):
"command": {
"rinit": {
"function": self.init,

"usage": "rinit players bullets",

"usage": "rinit",
"help": "Init the Russian Roulette"
},
"rjoin": {
Expand All @@ -36,16 +34,8 @@ def command(self):

def init(self, Morphux, infos):
if (self.onGame == 0):

Morphux.sendMessage(infos['nick'] + " just started the Russian Roulette ! Type !rjoin if you want to die :)")
if len(infos['args']) > 0:
if infos['args'][0].isdigit() == True and int(infos['args'][0]) > 0:
self.base = int(infos['args'][0])
if len(infos['args']) > 1:
if infos['args'][1].isdigit == True and int(infos['args'][1]) > 0:
self.bullet = int(infos['args'][1])
self.users.append(infos['nick'])

Morphux.sendMessage(infos['nick'] + " just init the Russian Roulette ! Type !rjoin if you want to die :)")
self.users[self.count] = infos['nick']
self.onGame = 1
self.count = 1
elif (self.onGame == 1):
Expand All @@ -65,19 +55,7 @@ def join(self, Morphux, infos):
self.onGame = 2
self.count = 0
Morphux.sendMessage("Your turn, type !rshot", self.users[self.count])
else:
Morphux.sendMessage("You're already in!", infos['nick'])


def start(self, Morphux, infos):
if self.onGame == 1:
Morphux.sendMessage("Let's begin...")
self.base = self.count
self.onGame = 2
self.count = 0
Morphux.sendMessage("Your turn, type !rshot", self.users[self.count])
if self.onGame == 0:

else:
Morphux.sendMessage("Init the roulette first !", infos['nick'])

def shot(self, Morphux, infos):
Expand All @@ -97,16 +75,7 @@ def shot(self, Morphux, infos):
else:
Morphux.sendMessage("Ur so lucky.", infos['nick'])
self.bullet -= 1
Morphux.sendMessage("Ur so lucky. " + str(self.bullet) + " bullets left", infos['nick'])

def passTheGun(self, Morphux, infos):
if self.onGame == 2:
if infos['nick'] == self.users[self.count]:
self.count += 1
if (self.count >= self.base):
self.count = 0
Morphux.sendMessage("Your turn ! ("+ str(self.bullet)+" bullets)", self.users[self.count])
else:
Morphux.sendMessage("Not your turn! Currently playing is "+self.users[self.count], infos['nick'])
else:
Morphux.sendMessage("You need to init/start the roulette first", infos['nick'])
self.count += 1
if (self.count == self.base):
self.count = 0
Morphux.sendMessage("Your turn ! ("+ str(self.bullet)+" bullets)", self.users[self.count])

0 comments on commit fff7484

Please sign in to comment.