]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/games/uno.rb
time: support POSIX time
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / games / uno.rb
index 6ea0063355c162710dae4007df26acb1a5207709..870526fc38e8a9636d14252d97dcdca535d06147 100644 (file)
@@ -244,6 +244,7 @@ class UnoGame
   end
 
   def start_game
+    @join_timer = nil
     debug "Starting game"
     @players.shuffle!
     show_order
@@ -543,6 +544,10 @@ class UnoGame
       }
       deal(p, @picker)
       @picker = 0
+      # make sure that if this is the "pick and pass" after a W+4,
+      # then the following player cannot do a challenge:
+      @last_discard = nil
+      @last_color = nil
     else
       if @player_has_picked
         announce _("%{p} passes turn") % { :p => p }
@@ -747,11 +752,17 @@ class UnoGame
   def replace_player(old, new)
     # The new user
     user = channel.get_user(new)
+    if not user
+      announce _("there is no '%{nick}' here") % {
+        :nick => new
+      }
+      return false
+    end
     if p = get_player(user)
       announce _("%{p} is already playing %{uno} here") % {
         :p => p, :uno => UNO
       }
-      return
+      return false
     end
     # We scan the player list of the player with the old nick, instead
     # of using get_player, in case of IRC drops etc
@@ -761,12 +772,13 @@ class UnoGame
         announce _("%{p} takes %{b}%{old}%{b}'s place at %{uno}") % {
           :p => p, :b => Bold, :old => old, :uno => UNO
         }
-        return
+        return true
       end
     end
     announce _("%{b}%{old}%{b} isn't playing %{uno} here") % {
       :uno => UNO, :b => Bold, :old => old
     }
+    return false
   end
 
   def end_game(halted = false)