]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
UNO! plugin: cope with pre-game drops
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Fri, 2 Jul 2010 10:04:42 +0000 (12:04 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Fri, 2 Jul 2010 10:04:42 +0000 (12:04 +0200)
The drop is still counted, to prevent people from leaving and then
rejoining until they have nice cards.

data/rbot/plugins/games/uno.rb

index a86c33dba8d03216fa37cc9814baa885a470a318..3d874bf9beae5f3d133774a5714d46c2be224fbb 100644 (file)
@@ -329,7 +329,7 @@ class UnoGame
   def next_turn(opts={})
     @players << @players.shift
     @player_has_picked = false
-    show_turn
+    show_turn unless opts[:silent]
   end
 
   def can_play(card)
@@ -699,11 +699,18 @@ class UnoGame
     }
     case @players.length
     when 2
+      if @join_timer
+        @bot.timer.remove(@join_timer)
+        announce _("game start countdown stopped")
+        @join_timer = nil
+      end
       if p == @players.first
-        next_turn
+        next_turn :silent => @start_time.nil?
+      end
+      if @start_time
+        end_game
+        return
       end
-      end_game
-      return
     when 1
       end_game(true)
       return