this is the second part of my multi-part message talking about modifying the spell/skill setup to allow more information to be customizable per skill as well as involving races in the assigning of spells/skills.. ok..the previous message takes care of assigning all of the data to the spells..now we just need to figure out how to use the data with the practice command, and list_skills.. first of all, i would make some utility functions to calculate all of the information that's going to be necessary, in case you want to assign a spell or skill to both a race and a class...i handled this by averaging things like learned, min, max, gain per prac..urm..start with a macro #define CL_LEARNED(ch, spell) \ spell_info[spell].class_params[(int)GET_CLASS(ch)].learned #define R_LEARNED(ch, spell) \ spell_info[spell].race_params[(int)GET_RACE(ch)].learned int LEARNED(struct char_data *ch, int spell) { int tmp = 0; if (GET_LEVEL(ch) > CL_LEVEL(ch, spell) && GET_LEVE(ch) > R_LEVEL(ch, spell)) tmp = (CL_LEARNED(ch, spell) + R_LEARNED(ch, spell))/2; else if (GET_LEVEL(ch) > CL_LEVEL(ch, spell)) tmp = CL_LEARNED(ch, spell); else tmp = R_LEARNED(ch, spell); return tmp; } there are other times when you will want to take the highest or the lowest rather than the average..for instance the level at which the character can practice would probably be which ever one was assigned to be lower.. now that we have all of the setup done, we'll see what the new list_skills and guild spec_proc look like (these are both located in spec_procs.c).. first, let me note that i made a note of which skills were skills, and which were spells so that i could differentiate in the list_skills..mine looks something like: Spells: Fireball (superb) ... Skills: kick (poor) ... void list_skills(struct char_data * ch) { int i, sortpos; if (!GET_PRACTICES(ch)) strcpy(buf, "You have no practice sessions remaining.\r\n"); else sprintf(buf, "You have %d practice session%s remaining.\r\n", GET_PRACTICES(ch), (GET_PRACTICES(ch) == 1 ? "" : "s")); sprintf(buf + strlen(buf), "You know of the following skills:\r\n"); strcpy(buf2, buf); for (sortpos = 1; sortpos < MAX_SKILLS; sortpos++) { i = spell_sort_info[sortpos]; if (strlen(buf2) >= MAX_STRING_LENGTH - 32) { strcat(buf2, "**OVERFLOW**\r\n"); break; } if (GET_LEVEL(ch) >= MIN_LEVEL(ch, spell) && SPLSKL(ch, spell) == SKILL) { sprintf(buf, "%-20s %s\r\n", spells[i], how_good(GET_SKILL(ch, i))); strcat(buf2, buf); } } sprintf(buf + strlen(buf), "You know of the following spells:\r\n"); strcat(buf2, buf); for (sortpos = 1; sortpos < MAX_SKILLS; sortpos++) { i = spell_sort_info[sortpos]; if (strlen(buf2) >= MAX_STRING_LENGTH - 32) { strcat(buf2, "**OVERFLOW**\r\n"); break; } if (GET_LEVEL(ch) >= MIN_LEVEL(ch, spell) && SPLSKL(ch, spell) == SPELL) { sprintf(buf, "%-20s %s\r\n", spells[i], how_good(GET_SKILL(ch, i))); strcat(buf2, buf); } } page_string(ch->desc, buf2, 1); } note that you'll have to make macros or functions for MIN_LEVEL(ch, spell) and SPLSKL(ch, spell)..just follow the example that i gave for LEARNED(ch, spell).. and here's the guild proc.. SPECIAL(guild) { int skill_num, percent; if (IS_NPC(ch) || !CMD_IS("practice")) return 0; skip_spaces(&argument); if (!*argument) { list_skills(ch); return 1; } if (GET_PRACTICES(ch) <= 0) { send_to_char("You do not seem to be able to practice now.\r\n", ch); return 1; } skill_num = find_skill_num(argument); if (skill_num < 1 || GET_LEVEL(ch) < MIN_LEVEL(ch, skill_num)) { sprintf(buf, "You do not know of that %s.\r\n", SPLSKL(ch, skill_num)); send_to_char(buf, ch); return 1; } if (GET_SKILL(ch, skill_num) >= LEARNED(ch, skill_num)) { send_to_char("You are already learned in that area.\r\n", ch); return 1; } send_to_char("You practice for a while...\r\n", ch); GET_PRACTICES(ch)--; percent = GET_SKILL(ch, skill_num); percent += MIN(MAXGAIN(ch, skill_num), MAX(MINGAIN(ch, skill_num), int_app[GET_INT(ch)].learn)); SET_SKILL(ch, skill_num, MIN(LEARNED(ch, skill_num), percent)); if (GET_SKILL(ch, skill_num) >= LEARNED(ch, skill_num)) send_to_char("You are now learned in that area.\r\n", ch); return 1; } you could also make it so that you can only practice class skills at the guild and make another spec_proc for the race skills.. another thing that i know will need to be changed is the unused_spells func.. there's probably a LOT more that needs to be modified, but this is pretty much the bulk of the changes.. siv +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST