diff --git a/brawl.rb b/brawl.rb index bce1f87..7a8f20f 100644 --- a/brawl.rb +++ b/brawl.rb @@ -1714,7 +1714,7 @@ def do_move(player, opponent, wait=true) def do_counter(player, opponent, c) unless c[0].type == :counter - say "Play a counter or pass." + notify player, "Play a counter or pass." return end case c[0].id @@ -1772,11 +1772,8 @@ def do_counter(player, opponent, c) end def elapsed_time - if started - Utils.secs_to_string(Time.now-started).gsub(/\[|\]|"/,'') - else - nil - end + return nil unless started + Utils.secs_to_string(Time.now-started).gsub(/\[|\]|"/,'') end def increment_turn @@ -2388,13 +2385,13 @@ def show_records(m, params) @bot.say m.replyto, "Most turns: #{records[:most_turns_user]} " + "with #{records[:most_turns]} turns." end - if records[:least_time] + if t = records[:least_time] @bot.say m.replyto, "Quickest winner: #{records[:least_time_user]} " + - "after #{records[:least_time]} seconds." + "after #{Utils.secs_to_string(t).gsub(/\[|\]|"/,'')}." end - if records[:most_time] + if t = records[:most_time] @bot.say m.replyto, "Slowest winner: #{records[:most_time_user]} " + - "after #{records[:most_time]} seconds." + "after #{Utils.secs_to_string(t).gsub(/\[|\]|"/,'')}." end end diff --git a/junkyard.rb b/junkyard.rb index 93e2ce8..0370501 100644 --- a/junkyard.rb +++ b/junkyard.rb @@ -1427,7 +1427,7 @@ def do_move(player, opponent, wait=true) def do_counter(player, opponent, c) unless c[0].type == :counter - say "Play a counter or pass." + notify player, "Play a counter or pass." return end case c[0].id @@ -1485,11 +1485,8 @@ def do_counter(player, opponent, c) end def elapsed_time - if started - Utils.secs_to_string(Time.now-started).gsub(/\[|\]|"/,'') - else - nil - end + return nil unless started + Utils.secs_to_string(Time.now-started).gsub(/\[|\]|"/,'') end def increment_turn @@ -2084,13 +2081,13 @@ def show_records(m, params) @bot.say m.replyto, "Most turns: #{records[:most_turns_user]} " + "with #{records[:most_turns]} turns." end - if records[:least_time] + if t = records[:least_time] @bot.say m.replyto, "Quickest winner: #{records[:least_time_user]} " + - "after #{records[:least_time]} seconds." + "after #{Utils.secs_to_string(t).gsub(/\[|\]|"/,'')}." end - if records[:most_time] + if t = records[:most_time] @bot.say m.replyto, "Slowest winner: #{records[:most_time_user]} " + - "after #{records[:most_time]} seconds." + "after #{Utils.secs_to_string(t).gsub(/\[|\]|"/,'')}." end end diff --git a/rumble.rb b/rumble.rb index 0b8eb07..012a4f1 100644 --- a/rumble.rb +++ b/rumble.rb @@ -1609,7 +1609,7 @@ def do_move(player, opponent, wait=true) def do_counter(player, opponent, c) unless c[0].type == :counter - say "Play a counter or pass." + notify player, "Play a counter or pass." return end case c[0].id @@ -1667,11 +1667,8 @@ def do_counter(player, opponent, c) end def elapsed_time - if started - Utils.secs_to_string(Time.now-started).gsub(/\[|\]|"/,'') - else - nil - end + return nil unless started + Utils.secs_to_string(Time.now-started).gsub(/\[|\]|"/,'') end def increment_turn @@ -2266,13 +2263,13 @@ def show_records(m, params) @bot.say m.replyto, "Most turns: #{records[:most_turns_user]} " + "with #{records[:most_turns]} turns." end - if records[:least_time] + if t = records[:least_time] @bot.say m.replyto, "Quickest winner: #{records[:least_time_user]} " + - "after #{records[:least_time]} seconds." + "after #{Utils.secs_to_string(t).gsub(/\[|\]|"/,'')}." end - if records[:most_time] + if t = records[:most_time] @bot.say m.replyto, "Slowest winner: #{records[:most_time_user]} " + - "after #{records[:most_time]} seconds." + "after #{Utils.secs_to_string(t).gsub(/\[|\]|"/,'')}." end end