From 7d549a69b2d7745e976838758c3573799f1d5dfa Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 7 Apr 2007 09:05:38 +0000 Subject: roulette plugin: disable 'twice in a row' shooting, with option to re-enable it --- data/rbot/plugins/games/roulette.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'data/rbot/plugins') 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'] -- cgit v1.2.3