]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
UNO plugin: give cards to correct player at endgame
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 27 Oct 2008 21:59:07 +0000 (22:59 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 27 Oct 2008 21:59:07 +0000 (22:59 +0100)
If the winner played a Reverse in response to a picker, the previous
player should pick the cards, and not the next one. This is not really
important at the moment because we score by giving points to the winner
instead of taking them from losers, but we fix it for correctness. It'll
be especially useful when we'll implement the other scoring too.

data/rbot/plugins/games/uno.rb

index ea7ed18bcda6bdc910d264f5d1f80da6babcc34a..bb6401257753695c39c5327eb9d2ae70140ded63 100644 (file)
@@ -761,7 +761,11 @@ class UnoGame
       }
     end
     if @picker > 0 and not halted
-      p = @players[1]
+      if @discard.value == 'Reverse'
+        p = @players.last
+      else
+        p = @players[1]
+      end
       announce _("%{p} has to pick %{b}%{n}%{b} cards!") % {
         :p => p, :n => @picker, :b => Bold
       }