diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-04-10 13:23:49 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-04-10 13:23:49 +0200 |
commit | 8d29abf8ec962602559ff26af56021551992c09d (patch) | |
tree | bddcc8efaa437ae37d05d72ffc0066625093b8b2 /data/rbot/plugins/games/uno.rb | |
parent | 10e1b4c600adfe49b62679762f7f76481dbf1f23 (diff) |
uno plugin: when players join mid-game, give them an average number of gards
Diffstat (limited to 'data/rbot/plugins/games/uno.rb')
-rw-r--r-- | data/rbot/plugins/games/uno.rb | 9 |
1 files changed, 8 insertions, 1 deletions
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 |