summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2010-07-02 12:31:32 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2010-07-02 12:31:32 +0200
commit94d72bb656a6d0877e2d87cb0218a2fb150d446b (patch)
tree10e202f5892a2d641af42a245b9ad6162e2c8e1c
parent11fe3ea3c6848fc1838a4d284ddcfaeb30ac17bc (diff)
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.
-rw-r--r--data/rbot/plugins/games/uno.rb13
1 files changed, 10 insertions, 3 deletions
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