summaryrefslogtreecommitdiff
path: root/data/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-04-07 09:05:38 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-04-07 09:05:38 +0000
commit7d549a69b2d7745e976838758c3573799f1d5dfa (patch)
tree96ce5fc230f9445411def93420070b9688e39c63 /data/rbot
parent93c89892b9603bda7665e0ae490ad0935da2ba84 (diff)
roulette plugin: disable 'twice in a row' shooting, with option to re-enable it
Diffstat (limited to 'data/rbot')
-rw-r--r--data/rbot/plugins/games/roulette.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/data/rbot/plugins/games/roulette.rb b/data/rbot/plugins/games/roulette.rb
index 9fce8d8a..5c9a86c6 100644
--- a/data/rbot/plugins/games/roulette.rb
+++ b/data/rbot/plugins/games/roulette.rb
@@ -7,6 +7,9 @@ class RoulettePlugin < Plugin
BotConfig.register BotConfigBooleanValue.new('roulette.kick',
:default => false,
:desc => "Kicks shot players from the channel")
+ BotConfig.register BotConfigBooleanValue.new('roulette.twice_in_a_row',
+ :default => false,
+ :desc => "Allow players to go twice in a row")
def initialize
super
@@ -43,13 +46,18 @@ class RoulettePlugin < Plugin
totals = RouletteHistory.new(0,0,0,0,0)
end
+ if @players.last == m.sourcenick and not @bot.config['roulette.twice_in_a_row']
+ m.reply "you can't go twice in a row!"
+ return
+ end
+
unless @players.include?(m.sourcenick)
@players << m.sourcenick
playerdata.games += 1
end
playerdata.shots += 1
totals.shots += 1
-
+
shot = @chambers.pop
if shot
m.reply "#{m.sourcenick}: chamber #{6 - @chambers.length} of 6 => *BANG*"
@@ -73,7 +81,7 @@ class RoulettePlugin < Plugin
@registry["player " + m.sourcenick] = playerdata
@registry["totals"] = totals
-
+
if shot || @chambers.empty?
reload(m)
elsif @chambers.length == 1 and @bot.config['roulette.autospin']