From a306b2c68eb58c1c88057ff7ee78895401adb6a9 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 19 Oct 2010 00:39:13 +0200 Subject: uno plugin: don't allow g9r9 card specification The regexp should make sure that the second card is equal to the first specified card, instead of matching the card expression one or two times. Otherwise, a play like 'pl g9r9' would be accepted when the player had two r9 cards and could play them. This is only a aesthetical change because the plays would still be valid, albeit (1) surprising and (2) mismatching what the user actually wrote. --- data/rbot/plugins/games/uno.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'data/rbot') diff --git a/data/rbot/plugins/games/uno.rb b/data/rbot/plugins/games/uno.rb index 870526fc..adaa127f 100644 --- a/data/rbot/plugins/games/uno.rb +++ b/data/rbot/plugins/games/uno.rb @@ -382,7 +382,7 @@ class UnoGame def play_card(source, cards) debug "Playing card #{cards}" p = get_player(source) - shorts = cards.gsub(/\s+/,'').match(/^(?:([rbgy]\+?\d){1,2}|([rbgy][rs])|(w(?:\+4)?)([rbgy])?)$/).to_a + shorts = cards.gsub(/\s+/,'').match(/^(?:([rbgy]\+?\d)\1|([rbgy][rs])|(w(?:\+4)?)([rbgy])?)$/).to_a debug shorts.inspect if shorts.empty? announce _("what cards were that again?") -- cgit v1.2.3