From 94d72bb656a6d0877e2d87cb0218a2fb150d446b Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 2 Jul 2010 12:31:32 +0200 Subject: UNO! plugin: be more discreet about user failures The public announcement is now a generic "can't do that", with the specific message being notified to the user. This reduces the chance of other players guessing what the current player has from the error messages. --- data/rbot/plugins/games/uno.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 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 4ae05f6e..ecf322d5 100644 --- a/data/rbot/plugins/games/uno.rb +++ b/data/rbot/plugins/games/uno.rb @@ -211,6 +211,13 @@ class UnoGame @bot.notice player.user, msg, opts end + def notify_error(player, msg, opts={}) + announce _("you can't do that, %{p}") % { + :p => player.user + } + notify player, msg, opts + end + def make_base_stock @base_stock = COLORS.inject([]) do |list, clr| VALUES.each do |n| @@ -397,7 +404,7 @@ class UnoGame if cards = p.has_card?(short) debug cards unless can_play(cards.first) - announce _("you can't play that card") + notify_error p, _("you can't play that card") return end if cards.length >= toplay @@ -451,10 +458,10 @@ class UnoGame announce _("%{p}, choose a color with: co r|b|g|y") % { :p => p } end else - announce _("you don't have two cards of that kind") + notify_error p, _("you don't have two cards of that kind") end else - announce _("you don't have that card") + notify_error p, _("you don't have that card") end end -- cgit v1.2.3