mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 10:34:19 +01:00
Make sure we don't start a game if the file doesn't exist. Also, complete
sentences are nice to have.
This commit is contained in:
parent
5728974ea2
commit
2952ed4d07
@ -217,7 +217,12 @@ class Words(callbacks.Privmsg):
|
|||||||
game.prefix = self.registryValue('hangman.prefix', channel)
|
game.prefix = self.registryValue('hangman.prefix', channel)
|
||||||
game.guessed = False
|
game.guessed = False
|
||||||
game.unused = copy.copy(self.validLetters)
|
game.unused = copy.copy(self.validLetters)
|
||||||
game.hidden = game.getWord()
|
try:
|
||||||
|
game.hidden = game.getWord()
|
||||||
|
except IOError, e:
|
||||||
|
self.games[channel] = None
|
||||||
|
irc.error(str(e))
|
||||||
|
return
|
||||||
game.guess = re.sub('[%s]' % string.ascii_lowercase, '_',
|
game.guess = re.sub('[%s]' % string.ascii_lowercase, '_',
|
||||||
game.hidden)
|
game.hidden)
|
||||||
self._hangmanReply(irc, channel,
|
self._hangmanReply(irc, channel,
|
||||||
@ -296,11 +301,12 @@ class Words(callbacks.Privmsg):
|
|||||||
# Verify if the user won or lost
|
# Verify if the user won or lost
|
||||||
if game.guessed and game.tries > 0:
|
if game.guessed and game.tries > 0:
|
||||||
self._hangmanReply(irc, channel,
|
self._hangmanReply(irc, channel,
|
||||||
'You win! The was indeed %r.' % game.hidden)
|
'You win! The word was indeed %r.' %
|
||||||
|
game.hidden)
|
||||||
self.endGame(channel)
|
self.endGame(channel)
|
||||||
elif not game.guessed and game.tries == 0:
|
elif not game.guessed and game.tries == 0:
|
||||||
self._hangmanReply(irc, channel,
|
self._hangmanReply(irc, channel,
|
||||||
'You lose! The was %r.' % game.hidden)
|
'You lose! The word was %r.' % game.hidden)
|
||||||
self.endGame(channel)
|
self.endGame(channel)
|
||||||
###
|
###
|
||||||
# END HANGMAN
|
# END HANGMAN
|
||||||
|
Loading…
Reference in New Issue
Block a user