#include <lib.h>
#include <message_class.h>

inherit "/verbs/players/cast.c";

inherit LIB_DAEMON;

mixed cmd(string args)
{
  mixed spell = this_player()->GetProperty("readied spell");
  
  if (!args || args == "")
  {
    if (spell == 0)
      this_player()->eventPrint("You have no spell readied.", MSG_SYSTEM);
    else
    {
      this_player()->eventPrint("You currently have the " +spell+ " spell readied.", MSG_SYSTEM);
    }
  }
  else if (args == "none")
  {
    this_player()->SetProperty("readied spell", 0);
    this_player()->eventPrint("You now have no spell readied.", MSG_SYSTEM);
  }
  else 
  {
    if (can_cast_str(args) != 0)
    {
      this_player()->SetProperty("readied spell", args);
      this_player()->eventPrint("You now have the " +this_player()->GetProperty("readied spell")+ " spell readied.", MSG_SYSTEM);
    }
    else
    {
      this_player()->eventPrint("For some reason, you can't cast that spell.", MSG_SYSTEM);
      return 0;
    }
  }
  return 1;
}

string GetHelp()
{
  return ("Syntax: ready\n"
	  "        ready none\n"
	  "        ready <SPELL>\n\n"
	  "The ready command allows you to ready a spell for future casting,"
	  "so that you don't have to type its name as an argument to cast."
	  "Ready with no arguments prints which spell, if any, you have ready."
	  "Ready with an argumentt of none clears the readied spell."
	  "Ready with any other argument readies the spell, if you can cast it.\n");
}