Changed to use a 6-barrel revolver.

This commit is contained in:
Jeremy Fincher 2004-07-31 07:01:46 +00:00
parent 750d6c5e5b
commit 9165c698e0
1 changed files with 21 additions and 5 deletions

View File

@ -338,23 +338,39 @@ class Fun(callbacks.Privmsg):
""" """
irc.reply(random.choice(self._eightballs)) irc.reply(random.choice(self._eightballs))
_rouletteChamber = random.randrange(0, 6)
_rouletteBullet = random.randrange(0, 6)
def roulette(self, irc, msg, args): def roulette(self, irc, msg, args):
"""takes no arguments """[spin]
Randomly picks a number from 1 to 6 and if it comes up 1, you get Fires the revolver. If the bullet was in the chamber, you're dead.
kicked. Otherwise -- *click* Tell me to spin the chambers and I will.
""" """
if args:
if args[0] != 'spin':
raise callbacks.ArgumentError
else:
self._rouletteBullet = random.randrange(0, 6)
irc.reply('*SPIN* Are you feeling lucky?', prefixName=False)
return
nick = msg.nick nick = msg.nick
channel = msg.args[0] channel = msg.args[0]
if not ircutils.isChannel(channel): if not ircutils.isChannel(channel):
irc.error('This message must be sent in a channel.') irc.error('This message must be sent in a channel.')
if random.randint(1, 6) == 1: return
if self._rouletteChamber == self._rouletteBullet:
self._rouletteBullet = random.randrange(0, 6)
self._rouletteChamber = random.randrange(0, 6)
if irc.nick in irc.state.channels[channel].ops: if irc.nick in irc.state.channels[channel].ops:
irc.queueMsg(ircmsgs.kick(channel, nick, 'BANG!')) irc.queueMsg(ircmsgs.kick(channel, nick, 'BANG!'))
else: else:
irc.reply('*BANG* Hey, who put a blank in here?!') irc.reply('*BANG* Hey, who put a blank in here?!',
prefixName=False)
irc.reply('reloads and spins the chambers.', action=True)
else: else:
irc.reply('*click*') irc.reply('*click*')
self._rouletteChamber += 1
self._rouletteChamber %= 6
def monologue(self, irc, msg, args): def monologue(self, irc, msg, args):
"""[<channel>] """[<channel>]