summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-04-11 21:00:06 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-04-11 21:00:06 +0200
commit972df692a219e9277a7c7f9cf28806f15efd6d68 (patch)
tree1f34bee64571655c77626d5e3b4a4965d880bab7 /data
parentd400e2711d003fafb15359c2f5479402260f6eb4 (diff)
uno plugin: a Reverse on a Reverse on a +X should be playable regardless of color
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/games/uno.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/data/rbot/plugins/games/uno.rb b/data/rbot/plugins/games/uno.rb
index f2935c6e..bda55dae 100644
--- a/data/rbot/plugins/games/uno.rb
+++ b/data/rbot/plugins/games/uno.rb
@@ -331,16 +331,14 @@ class UnoGame
# if play is forced, check against the only allowed cards
return false if @must_play and not @must_play.include?(card)
- # When a +something is online, you can only play
- # a +something of same or higher something, or a Reverse of
- # the correct color
+ # When a +something is online, you can only play a +something of same or
+ # higher something, or a Reverse of the correct color, or a Reverse on
+ # a Reverse
# TODO make optional
if @picker > 0
- if (card.value == 'Reverse' and card.color == @color) or card.picker >= @last_picker
- return true
- else
- return false
- end
+ return true if card.picker >= @last_picker
+ return true if card.value == 'Reverse' and (card.color == @color or @discard.value == card.value)
+ return false
else
# You can always play a Wild
return true if Wild === card