From fc24a86d3f1c95c3c35a5647334287ff34097720 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 2 Jul 2010 12:55:20 +0200 Subject: 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. --- data/rbot/plugins/games/uno.rb | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'data/rbot/plugins/games/uno.rb') 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 ", 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) -- cgit v1.2.3