/*****************************************************************************
 *  Practice System by Orion Elder.                                          *
 *                                                                           *
 *  Updates to this snippet can be found at the SSWRA:                       *
 *  http://www.geocities.com/knytehawk/smaug/index.html                      *
 *                                                                           *
 *  Please send all bug reports, suggestions, or ideas to:                   *
 *  orion_elder@charter.net                                                  *
 *                                                                           *
 *  NOTE: If you downloaded this snippet from the SSWRA disregard. I will    *
 *        under no circumstances support versions of this snippet gleaned    *
 *        from other sources. If you're having problems download a fresh     *
 *        copy from the SSWRA and re-install.                                *
 *                                                                           *
 * If you're having problems with your copy of this snippet, please check to *
 * ensure that no updates have been posted before seeking help.              *
 *                                                                           *
 * Copyright 2001-2009 by Orion Elder                                        *
 *****************************************************************************/

This snippet will update your current practice system to use more than one
practice point to initially learn the skill. Using OSC (online spell/skill
creation) you can set the number of practices each skill requires.

EG (old style):
command           : practice faerie fire
cost              : 1 practice point
percentage learned: 17%

EG (new style):
command           : practice faerie fire
cost              : 3 practice point
percentage learned: 17%

[mud.h]

Find:

/*
 * Skills include spells as a particular case.
 */
struct  skill_type
{

At the bottom of that, directly above:

    struct      timerset        userec; /* Usage record                 */

Add:

    int         practices;              /* # of practices required initially */


[act_info.c]

Find and comment out:

	if ( ch->practice <= 0 )
	{
	    act( AT_TELL, "$n tells you 'You must earn some more practice sessions.'",
		mob, NULL, ch, TO_VICT );
	    return;
	}

Find:

	sn = skill_lookup( argument );
	if ( can_prac 
          && ( ( sn == -1 )
       	       || ( !IS_NPC(ch)
	            &&  ch->level < skill_table[sn]->skill_level[ch->class] 
/* OUT FOR THIS PORT -SHADDAI
                    &&  ch->level < skill_table[sn]->race_level[ch->race]  
*/
                  ) 
             ) 
        )
	{
	    act( AT_TELL, "$n tells you 'You're not ready to learn that yet...'",
		mob, NULL, ch, TO_VICT );
	    return;
	}

Below that add:

        if ( ch->practice <= 0 || ch->practice < skill_table[sn]->practices )
        {
            act( AT_TELL, "$n tells you 'You must earn some more practice sessions.'",
                mob, NULL, ch, TO_VICT );
            return;
        }

Find:

            ch->pcdata->learned[sn] += int_app[get_curr_int(ch)].learn;
            act( AT_ACTION, "You practice $T.",
                    ch, NULL, skill_table[sn]->name, TO_CHAR );
            act( AT_ACTION, "$n practices $T.",
                    ch, NULL, skill_table[sn]->name, TO_ROOM );

Above that comment out:

	    ch->practice--;

And immediately below that add:

            ch->practice -= (skill_table[sn]->practices);


[skills.c]

Find within do_slookup:

        ch_printf( ch, "Sectors Allowed: %s\n",
                skill->spell_sector?flag_string(skill->spell_sector,sec_flags):
                        "All");

Above that add:

        ch_printf( ch, "Practices Required: %d\n", skill->practices);

Find within do_sset:

          send_to_char( "  sector\n\r", ch );

And change it to:

          send_to_char( "  sector practices\n\r", ch );

Find:

        if ( !str_cmp( arg2, "level" ) )
        {
            char arg3[MAX_INPUT_LENGTH];
            int class;

            argument = one_argument( argument, arg3 );
            class = atoi( arg3 );

Above that add:

        if ( !str_cmp( arg2, "practices" ) )
        {
            int practices = atoi(argument);

            skill->practices = URANGE(1, practices, 20);
            return;
        }


[tables.c]

Find within fwrite_skill:

    if ( skill->min_mana )
        fprintf( fpout, "Mana         %d\n",    skill->min_mana );

Below that add:

    if ( skill->practices )
        fprintf( fpout, "Practices    %d\n",    skill->practices );

Find within fread_skill:

	    if ( !str_cmp( word, "End" ) )
	    {
		if ( skill->saves != 0 && SPELL_SAVE(skill) == SE_NONE )
		{
		    bug( "fread_skill(%s):  Has saving throw (%d) with no saving effect.",
			skill->name, skill->saves );
		    SET_SSAV(skill, SE_NEGATE);
		}

Below the '}' add:

                 //Sets a skill to require at LEAST one practice
                if ( !skill->practices )
                    skill->practices = 1;
                //Sets a skill to require at LEAST one practice
                if ( skill->practices < 1 )
                    skill->practices = 1;
                //Sets a skill to require no more than twenty practices
                if ( skill->practices > 20 )
                    skill->practices = 20;

Find:

        case 'P':
            KEY( "Participants",skill->participants,    fread_number( fp ) );

Below that add:

            KEY( "Practices",   skill->practices,       fread_number( fp ) );


Now, make clean, make, reboot the mud, and save the skill table.

Once, you save the skill table, go back into the shell, and open up the
skills.dat file, which is in the system directory, and go through it, setting
the number of practices for each skill.

NOTE: You may set the practices within the game, the first time, however
      within the shell is much easier, for the major overhaul. Simply search
      for 'Practices' and change the number out beside it, save, then reboot
      the MUD again to bring in your changes.

To change the skills inside the MUD the syntax is:

     "sset <skill> practices <number of practices>"

That should about do it, this will install the system, however if you want a
way for your players to see how many practices a skill requires, you will need
to create one. This is so that some of you new coders can at least get a few
chances to make some custom code.