eldhamud/boards/
eldhamud/clans/
eldhamud/classes/
eldhamud/councils/
eldhamud/deity/
eldhamud/doc/
eldhamud/doc/DIKU/
eldhamud/doc/MERC/
eldhamud/doc/mudprogs/
eldhamud/houses/
//
// C Implementation: remort
//
// Description:
//
//
// Author: robo <robo@localhost>, (C) 2005
//
// Copyright: See COPYING file that comes with this distribution
//
//

#if defined(macintosh)
#include <types.h>
#include <time.h>
#else
#include <sys/types.h>
#include <sys/time.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mud.h"




void do_remort( CHAR_DATA *ch, char *argument )
{
  char arg[MAX_INPUT_LENGTH];
  CHAR_DATA *victim;
  char buf[MAX_INPUT_LENGTH];
  int vhit, vmana, vmove;
  ;
  int wear_loc;
  OBJ_DATA *obj,*obj_next;
  int value;
  int sn;

  one_argument( argument, arg );

  if ( arg[0] == '\0' )
    {
      send_to_char( "Syntax: Remort <Your Name>\n\r", ch );
      return;
    }

  if ( ( victim = get_char_world( ch, arg ) ) == NULL )
    {
      send_to_char( "They aren't here.\n\r", ch );
      return;
    }

  if (IS_NPC(victim))
    {
      send_to_char("You are going to remort a mob?!?!\n\r",ch);
      return;
    }

  if (victim->level == LEVEL_IMMORTAL)
    {
      send_to_char("Heros cannot be remorted, sorry!\n\r",ch);
      return;
    }

  if (victim->level > LEVEL_HERO)
    {
      send_to_char("Immortals cannot be remorted, sorry!\n\r",ch);
      return;
    }

  if (victim->level < LEVEL_HERO - 10)
    {
      sprintf(buf, "You can only remort players from level %d to %d.\n\r",
              LEVEL_HERO - 10, LEVEL_HERO  );
      send_to_char(buf,ch);
      return;
    }

  if (victim->remorts >= 20)
    {
      send_to_char("This char has already been remorted too many times.\n\r",ch);
      return;
    }
  
  victim->remorts += 1;
  sprintf(buf,
          "Having conquered that which has been set before you, you demand that\n\r"
          "the immortals buff you up a little more, maybe with eq or a nifty set of\n\r"
          "commands. Well it seems your ego has gotten you into some trouble, as\n\r"
          "your mind becomes instantly filled with a loud thunder and images of death.\n\r"
          "Maybe today was the wrong time to annoy the immortals...\n\r");
  send_to_char(buf,victim);


  for (wear_loc = WEAR_LIGHT; wear_loc <= MAX_WEAR; wear_loc++)
    {
      if ((obj = get_eq_char(victim,wear_loc)) == NULL)
        continue;
      unequip_char(victim,obj);
    }

  for (obj = victim->first_carrying; obj != NULL; obj = obj_next)
    {
      obj_next = obj->next_content;
      obj_from_char( obj );
      extract_obj(obj);
    }


  do_restore(ch, victim->name);
  vhit = victim->hit /= 3;
  vmana = victim->mana /= 3;
  vmove = victim->move /= 3;

  victim->max_hit = vhit;
  victim->max_mana = vmana;
  victim->max_move = vmove;
  victim->hit = vhit;
  victim->mana = vmana;
  victim->move = vmove;
  for ( sn = 0; sn < top_sn; sn++ )
    {
      /* Fix by Narn to prevent ssetting skills the player shouldn't have. */
      if ( skill_table[sn]->name
           && ( victim->level >= skill_table[sn]->skill_level[victim->class]
                || value == 0 ) )
        {

          victim->pcdata->learned[sn] = 0;
        }
    }
  victim->level = 10;
  victim->exp = 0;
  victim->perm_str = 13;
  victim->perm_con = 13;
  victim->perm_cha = 13;
  victim->perm_lck = 13;
  victim->perm_wis = 13;
  victim->perm_int = 13;
  victim->perm_dex = 13;
  victim->armor = 100;
  victim->hitroll = 0;
  victim->damroll = 0;
  for ( sn = 0; sn < top_sn; sn++ )
    {
      /* Fix by Narn to prevent ssetting skills the player shouldn't have. */
      if ( skill_table[sn]->name
           && ( victim->level >= skill_table[sn]->skill_level[victim->class]
                || value == 0 ) )
        {

          victim->pcdata->learned[sn] = 0;
        }
    }

  if(victim->remorts>4)
  {
  send_to_char("For all your hard work, the immortals wish to bless you with the following skills.\n\r", ch);
  send_to_char("Eighth Cast",ch);
  ch->pcdata->learned[gsn_eighth_cast] = 1;
  }
  if(victim->remorts>3)
  {
  send_to_char("For all your hard work, the immortals wish to bless you with the following skills.\n\r", ch);
  send_to_char("Eighth Attack and Seventh Cast",ch);
  ch->pcdata->learned[gsn_seventh_cast] = 1;
  ch->pcdata->learned[gsn_eighth_attack] = 1;
  }
  if(victim->remorts>2)
  {
  send_to_char("For all your hard work, the immortals wish to bless you with the following skills.\n\r", ch);
  send_to_char("Sixth Cast",ch);
  ch->pcdata->learned[gsn_sixth_cast] = 1;
  }
  if(victim->remorts>1)
  {
  send_to_char("For all your hard work, the immortals wish to bless you with the following skills.\n\r", ch);
  send_to_char("Seventh Attack and Fifth Cast",ch);
  ch->pcdata->learned[gsn_fifth_cast] = 1;
  ch->pcdata->learned[gsn_seventh_attack] = 1;
  }
  if(victim->remorts>0)
  {
  send_to_char("For all your hard work, the immortals wish to bless you with the following skills.\n\r", ch);
  send_to_char("Combo, Enhanced Dammage and Fourth Cast",ch);
  ch->pcdata->learned[gsn_combo] = 1;
  ch->pcdata->learned[gsn_enhanced_damage] = 1;
  ch->pcdata->learned[gsn_fourth_cast] = 1;
  }
  sprintf( buf, "&R[&CANNOUNCEMENT&R]&c:{xAll congratulate {R%s{x, who has just remorted. {x\n\r", ch->name);
  talk_info(AT_PURPLE, buf);
  do_double(ch, "exp on 60");

  return;
}