low/
low/area/
low/notes/
low/player/
low/player/backup/
low/player/store/
/***************************************************************************
 *  God Wars Mud originally written by KaVir aka Richard Woolcock.         *
 *  Changes done to the code done by Sage aka Walter Howard, this mud is   *
 *  for the public, however if you run this code it means you agree        *
 *  to the license.low, license.gw, and license.merc have fun. :)          *
***************************************************************************/
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "dragon.h"


const char * dcolor [10] =
{
    "",		"Red",
    "Green",	"Blue",
    "Yellow",	"Silver",
    "White",    "Black",
    "Gold",	"Shadow"
};


const char * dcolor2 [10] =
{
    "",		"{RRed{x",
    "{GGreen{x","{BBlue{x",
    "{YYellow{x","Silver",
    "White",    "Black",
    "Gold",	"Shadow"
};


const char * transformation_message[7] =
{
 "You resume your human form.\n\r",
 "You become a Hatchling..\n\r",
 "You become a Juvenile..\n\r",
 "You become a Young Adult..\n\r",
 "You become an Adult..\n\r",
 "You become a Wyrm..\n\r",
 "You become the Supreme Dragon..\n\r"
};

const struct form_type form_data [MAX_FORMS] =
{
 //  Short Long  Claws? Fangs? Tail?  Wings? +hit +dam
    {  "",  "",  FALSE, FALSE, FALSE, FALSE,   0,  0 },
 
 //  Hatchling
    { "A small %s dragon hatchling is here.", 
	"the %s hatchling", FALSE, FALSE, FALSE, FALSE, 5, 5 },
 //  Juvenile
    { "A juvenile %s dragon stands here.",
	"the %s dragon", TRUE, FALSE, FALSE, FALSE, 25, 25 },
 //  Young Adult
    { "A medium sized %s dragon stands here.",
	"the %s dragon", TRUE,  TRUE, FALSE, FALSE, 50, 50 },
 //  Adult
    { "A large, adult %s dragon stands here.",
	"the adult %s dragon", TRUE, TRUE, FALSE, TRUE, 100, 100 },
 //  Wyrm
    { "A giant %s wyrm is here, towering over you.",
	"the %s wyrm", TRUE, TRUE, TRUE, TRUE, 200, 200 },
 //  Supreme Dragon
    { "A colossal Supreme %s Dragon towers over you.",
	"the Supreme %s Dragon", TRUE, TRUE, TRUE, TRUE, 350, 350 }
};


void add_dragon_bonuses( CHAR_DATA *ch )
{
    ch->max_hit += ( ch->pcdata->disc_a[DRAGON_FORM] * 400 );
    ch->hit += ( ch->pcdata->disc_a[DRAGON_FORM] * 400 );
    return;
}

void remove_dragon_bonuses( CHAR_DATA *ch )
{
    ch->max_hit -= ( ch->pcdata->disc_a[DRAGON_FORM] * 400 );
    if ( ch->hit > 2500 )
      ch->hit -= ( ch->pcdata->disc_a[DRAGON_FORM] * 400 );
    return;
}

void set_dragon_form( CHAR_DATA *ch )
{

    char buf[MSL];
    char buf2[MSL];
    int gen, chcolor;

    gen = ch->pcdata->disc_a[DRAGON_AGE];
    chcolor = ch->pcdata->disc_a[DRAGON_COLOR];
    if ( chcolor == 0 )
      chcolor = 3;

     
    sprintf(buf,"%s ",ch->name);
    sprintf(buf2, form_data[gen].name, dcolor2[chcolor]);
    strcat( buf, buf2 );
    ch->morph = str_dup(buf);
    SET_BIT(ch->affected_by, AFF_POLYMORPH);
    sprintf(buf,transformation_message[gen]);
    stc(buf,ch);
    ch->pcdata->disc_a[DRAGON_FORM] = gen;
    add_dragon_bonuses(ch);

    return;
}


void remove_dragon_form( CHAR_DATA *ch )
{
    char buf[MSL];

    free_string(ch->morph);
    REMOVE_BIT(ch->affected_by, AFF_POLYMORPH);
    ch->morph = str_dup("");
    sprintf(buf, transformation_message[0]);
    stc(buf,ch);
    remove_dragon_bonuses(ch);
    ch->pcdata->disc_a[DRAGON_FORM] = 0;
    return;
}

void do_testdragon( CHAR_DATA *ch, char *argument )
{
   if ( IS_NPC(ch) ) return;

	if (!IS_CLASS(ch,CLASS_DRAGON))
    {
      send_to_char("Huh?\n\r",ch);
      return;
    }

/*   if  (!str_cmp(ch->name,"Sage") || !str_cmp(ch->name,"Dunkirk"))
   {
     stc("Huh?\n\r",ch);
     return;
   }
*/
   
   if ( ch->pcdata->disc_a[DRAGON_FORM] > 0 )
   {
     remove_dragon_form(ch);
     return;
   }
   else
   {
     set_dragon_form(ch);
     return;
   }

   return;
}