]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
UNO!: prevent joins after a challengeable card
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Thu, 9 Dec 2010 10:32:49 +0000 (11:32 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Thu, 9 Dec 2010 10:32:49 +0000 (11:32 +0100)
If someone joins after a challengeable W+4, he would be inserted between
the last and first player, and if there is a challenge _his_ cards would
be exposed. So prevent joining in such a situation.

data/rbot/plugins/games/uno.rb

index 6b50d03e3b85799a9cc0314cdf40ebf4f6d5dcc2..c689c253224402233f203a7601f50e4d536b6503 100644 (file)
@@ -689,6 +689,13 @@ class UnoGame
         return
       end
     end
+    if @last_discard
+      announce _("you can't join now, %{p}, a %{card} was just played, wait until next turn") % {
+        :card => @discard,
+        :p => user
+      }
+      return
+    end
     cards = 7
     if @start_time
       cards = (@players.inject(0) do |s, pl|