summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/games/uno.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-09-22 22:42:02 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-09-22 22:42:02 +0200
commitedde7610c9010b9cc0a8a20436c62652795d1b6f (patch)
treead9a02adfb0a6f3860d9a952d7b576105c30d2c9 /data/rbot/plugins/games/uno.rb
parentc96f6443b0cb282bebadbd3bc3bfb2f5139a6add (diff)
UNO: prevent player from replaying a misplayed card
Diffstat (limited to 'data/rbot/plugins/games/uno.rb')
-rw-r--r--data/rbot/plugins/games/uno.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/data/rbot/plugins/games/uno.rb b/data/rbot/plugins/games/uno.rb
index ab0ea161..df6a1eee 100644
--- a/data/rbot/plugins/games/uno.rb
+++ b/data/rbot/plugins/games/uno.rb
@@ -515,7 +515,7 @@ class UnoGame
announce _("%{lp}'s move was %{b}not%{b} legal, %{lp} must pick %{b}%{n}%{b} cards and play again!") % {
:cp => cp, :lp => lp, :b => Bold, :n => @picker
}
- lp.cards << @discard # put the W+4 back in place
+ played = @discard # store the misplayed W+4
# reset the discard
@color = @last_color.dup
@@ -527,7 +527,10 @@ class UnoGame
# force the player to play the current cards
@must_play = lp.cards.dup
+ # but not the same (type of) card he misplayed, though
+ @must_play.delete(played)
+ lp.cards << played # reinstate the W+4 in the list of player cards
# give him the penalty cards
deal(lp, @picker)
@picker = 0