]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/games/uno.rb
dict.rb plugin: fixes the oxford parser so it doesn't spit out a bunch of extra crap
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / games / uno.rb
index 131f0673c09f56219df19a4d25b86508eca3cf52..12b77f6e9bfc6ff42add969fd4980f5a60cc8372 100644 (file)
@@ -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
 
@@ -517,6 +520,13 @@ class UnoGame
   end
 
   def choose_color(user, color)
+    # you can only pick a color if the current color is unset
+    if @color
+      announce _("you can't pick a color now, %{p}") % {
+        :p => get_player(user)
+      }
+      return
+    end
     case color
     when 'r'
       @color = 'Red'
@@ -562,7 +572,7 @@ class UnoGame
   end
 
   def has_turn?(source)
-    @players.first.user == source
+    @start_time && (@players.first.user == source)
   end
 
   def show_picker
@@ -862,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
@@ -884,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)