X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fgames%2Funo.rb;h=1d49642ceae554c748798986c5b983e120bb1207;hb=fb33606c5a7e2aa75c11bb5282987138920c8bde;hp=e4ee2ae2b72c373567979b5ddc0de6e7c32f044f;hpb=aa0da8b4c3d4fda7ccb8a3c864d07a54fdf1c3aa;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/games/uno.rb b/data/rbot/plugins/games/uno.rb index e4ee2ae2..1d49642c 100644 --- a/data/rbot/plugins/games/uno.rb +++ b/data/rbot/plugins/games/uno.rb @@ -86,6 +86,16 @@ class UnoGame def special? SPECIALS.include?(@value) end + + def <=>(other) + cc = self.color <=> other.color + if cc == 0 + return self.value.to_s <=> other.value.to_s + else + return cc + end + end + include Comparable end # Wild, Wild +4 cards @@ -467,6 +477,7 @@ class UnoGame end notify player, _("You picked %{picked}") % { :picked => picked.join(' ') } player.cards += picked + player.cards.sort! end def add_player(user) @@ -565,7 +576,7 @@ class UnoPlugin < Plugin end when :pl # play card if g.has_turn?(m.source) - g.play_card(m.source, m.params) + g.play_card(m.source, m.params.downcase) else m.reply _("It's not your turn") end