require "Command.rb" require "Commands.rb" module RubyMud class Cast < Command def words return ["cast"] end def initialize() super() end #login username password def execute(clientConnection,string) tokens = string.split(' ') if (tokens.length != 3) return end room = clientConnection.player.parent # Check that the target is in the room target = room.getObjectByName(tokens[2]) if (target == nil) clientConnection.send("Could not find that object in the room\r\n") return end # Get the effect effects = Effects.getEffects for effect in effects if (effect.name == tokens[1]) newEffect = effect.new(clientConnection.player,target) clientConnection.send("You casted "+tokens[1]+" on the " + tokens[2] +"\r\n") return end end clientConnection.send("You do not have that spell\r\n") end end # Create the instance, it adds itself to the commands list Cast.new() end #module