From 8d29abf8ec962602559ff26af56021551992c09d Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 10 Apr 2008 13:23:49 +0200 Subject: uno plugin: when players join mid-game, give them an average number of gards --- data/rbot/plugins/games/uno.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'data/rbot') diff --git a/data/rbot/plugins/games/uno.rb b/data/rbot/plugins/games/uno.rb index 4ea0ec35..92bf2b48 100644 --- a/data/rbot/plugins/games/uno.rb +++ b/data/rbot/plugins/games/uno.rb @@ -509,12 +509,19 @@ class UnoGame } return end + cards = 7 + if @start_time + cards = @players.inject(0) do |s, pl| + s +=pl.cards.length + end/@players.length + end p = Player.new(user) @players << p announce _("%{p} joins this game of %{uno}") % { :p => p, :uno => UNO } - deal(p, 7) + deal(p, cards) + return if @start_time if @join_timer @bot.timer.reschedule(@join_timer, 10) elsif @players.length > 1 -- cgit v1.2.3