summaryrefslogtreecommitdiff
path: root/data/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-04-21 23:43:23 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-04-21 23:43:23 +0200
commitb2af728968fcb8c1e109164332a1094cc17c9102 (patch)
treecc697b22acb89f06e376126394909b435cfb4131 /data/rbot
parent2092b0b165822b09a2fa83aad18bc9d12af753b5 (diff)
uno plugin: most commands should only trigger after the game has started
Diffstat (limited to 'data/rbot')
-rw-r--r--data/rbot/plugins/games/uno.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/data/rbot/plugins/games/uno.rb b/data/rbot/plugins/games/uno.rb
index f77d1c42..12b77f6e 100644
--- a/data/rbot/plugins/games/uno.rb
+++ b/data/rbot/plugins/games/uno.rb
@@ -160,6 +160,9 @@ class UnoGame
# number of cards to be picked if the player can't play an appropriate card
attr_reader :picker
+ # game start time
+ attr :start_time
+
# the IRC user that created the game
attr_accessor :manager
@@ -569,7 +572,7 @@ class UnoGame
end
def has_turn?(source)
- @players.first.user == source
+ @start_time && (@players.first.user == source)
end
def show_picker
@@ -869,7 +872,7 @@ class UnoPlugin < Plugin
m.reply _("It's not your turn")
end
when :pa # pass turn
- return if m.params
+ return if m.params or not g.start_time
if g.has_turn?(m.source)
g.pass(m.source)
else
@@ -891,7 +894,7 @@ class UnoPlugin < Plugin
return if m.params
g.show_all_cards(m.source)
when :cd # show current discard
- return if m.params
+ return if m.params or not g.start_time
g.show_discard
when :ch
if g.has_turn?(m.source)