diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2010-07-02 12:55:20 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2010-07-02 12:55:20 +0200 |
commit | fc24a86d3f1c95c3c35a5647334287ff34097720 (patch) | |
tree | 939b49f60aa0093e06a3bf010e29687d23ea18ba /data | |
parent | 94d72bb656a6d0877e2d87cb0218a2fb150d446b (diff) |
UNO! plugin: prevent double wild play
This allows lazy players to specify the color after playing the wild by
pressing up-arrow and adding the color to the previous line, without
running the risk of playing their precious second wild.
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/games/uno.rb | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/data/rbot/plugins/games/uno.rb b/data/rbot/plugins/games/uno.rb index ecf322d5..6ea00633 100644 --- a/data/rbot/plugins/games/uno.rb +++ b/data/rbot/plugins/games/uno.rb @@ -397,10 +397,24 @@ class UnoGame toplay = (full == short) ? 1 : 2 end debug [full, short, jolly, jcolor, toplay].inspect - # r7r7 -> r7r7, r7, nil, nil - # r7 -> r7, r7, nil, nil - # w -> w, nil, w, nil - # wg -> wg, nil, w, g + # r7r7 -> r7r7, r7, nil, nil, 2 + # r7 -> r7, r7, nil, nil, 1 + # w -> w, nil, w, nil, 1 + # wg -> wg, nil, w, g, 1 + + # if @color is nil, the player just played a wild without specifying + # a color. (s)he should now use "co <colorname>", but we allow him to + # replay the wild _and_ specify the color, without actually replaying + # the card (which would otherwise happen if the player has another wild) + if @color.nil? + if jcolor + choose_color(p.user, jcolor) + else + announce _("you already played your card, ") + _("%{p}, choose a color with: co r|b|g|y") % { :p => p } + end + return + end + if cards = p.has_card?(short) debug cards unless can_play(cards.first) |