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
//
//
//

#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    update_all_qobjs(CHAR_DATA * ch);

void do_remort( CHAR_DATA *ch, char *argument )
{
  char buf[MAX_INPUT_LENGTH];
  int vhit, vmana, vmove, wear_loc, value, sn;
  OBJ_DATA *obj,*obj_next;
 
 
  if (IS_NPC(ch))
  {
    send_to_char("I'm sorry, mobs cannot remort!\n\r",ch);
    return;
  }

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

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

  if (ch->remorts >= 20)
  {
    send_to_char("This char has already been remorted too many times.\n\r",ch);
    return;
  }

  ch->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,ch);

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

  for (obj = ch->first_carrying; obj != NULL; obj = obj_next)
  {
    obj_next = obj->next_content;
    if (xIS_SET(obj->extra_flags, ITEM_QUEST))
      continue;
    else
    {
      obj_from_char( obj );
      extract_obj(obj);
    }
  }


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

  ch->max_hit = vhit;
  ch->max_mana = vmana;
  ch->max_move = vmove;
  ch->hit = vhit;
  ch->mana = vmana;
  ch->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
         && ( ch->level >= skill_table[sn]->skill_level[ch->class]
              || value == 0 ) )
    {

      ch->pcdata->learned[sn] = 0;
    }
  }
  ch->level = 10;
  ch->exp = 0;
  ch->perm_str = 13;
  ch->perm_con = 13;
  ch->perm_cha = 13;
  ch->perm_lck = 13;
  ch->perm_wis = 13;
  ch->perm_int = 13;
  ch->perm_dex = 13;
  ch->armor = 100;
  ch->hitroll = 0;
  ch->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
         && ( ch->level >= skill_table[sn]->skill_level[ch->class]
              || value == 0 ) )
    {

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

  send_to_char("For all your hard work, the immortals wish to bless you with the following skills.\n\r", ch);
  
  if(ch->remorts>4)
  {
    send_to_char("Eighth Cast\n\r",ch);
    ch->pcdata->learned[gsn_eighth_cast] = 1;
  }
  if(ch->remorts>3)
  {
    send_to_char("Eighth Attack and Seventh Cast\n\r",ch);
    ch->pcdata->learned[gsn_seventh_cast] = 1;
    ch->pcdata->learned[gsn_eighth_attack] = 1;
  }
  if(ch->remorts>2)
  {
    send_to_char("Sixth Cast\n\r",ch);
    ch->pcdata->learned[gsn_sixth_cast] = 1;
  }
  if(ch->remorts>1)
  {
    send_to_char("Seventh Attack and Fifth Cast\n\r",ch);
    ch->pcdata->learned[gsn_fifth_cast] = 1;
    ch->pcdata->learned[gsn_seventh_attack] = 1;
  }
  if(ch->remorts>0)
  {
    send_to_char("Combo, Enhanced Dammage and Fourth Cast\n\r",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");
  update_all_qobjs(ch);

  return;
}