class ClasslessMud::Commands::Whisper
Public Class Methods
perform(game, player, message)
click to toggle source
# File lib/classless_mud/commands/whisper.rb, line 5 def self.perform game, player, message _, target, *target_message = message.split(' ').reject { |word| CONNECTORS.include?(word.downcase) } target_char = player.room.find_character target if target_char.nil? player.puts "You can't seem to find them here." else target_char.puts %[#{player.name} whispers, "#{target_message.join(' ')}"] player.puts %[You whisper to #{target_char.name}, "#{target_message.join(' ')}"] end end